Skip to content

Cannot access input property sourceLinks.localDirectory #2786

@IgnatBeresnev

Description

@IgnatBeresnev

Supposedly, because GradleSourceLinkBuilder#localDirectory is marked as InputDirectory, it keeps track of all the files within this directory so that it can mark the task as out-of-date if anything changes.

However, when localDirectory is targeting a directory with a lot of files (like the whole of the standard library), it can cause the following exceptions:

Cannot access input property 'unsuppressedSourceSets.$0.sourceLinks.$0.localDirectory' of task ':stdlib_1.0'
java.io.UncheckedIOException: Failed to create MD5 hash for file content.
        at org.gradle.internal.hash.DefaultStreamHasher.hash(DefaultStreamHasher.java:37)
        at org.gradle.internal.hash.DefaultFileHasher.hash(DefaultFileHasher.java:41)
        at org.gradle.api.internal.changedetection.state.CachingFileHasher.snapshot(CachingFileHasher.java:94)
        at org.gradle.api.internal.changedetection.state.CachingFileHasher.hash(CachingFileHasher.java:76)
        at org.gradle.api.internal.changedetection.state.SplitFileHasher.hash(SplitFileHasher.java:54)
        at org.gradle.internal.snapshot.impl.DirectorySnapshotter$PathVisitor.snapshotFile(DirectorySnapshotter.java:347)
        .....
Caused by: java.io.IOException: The process cannot access the file because another process has locked a portion of the file
        at java.io.FileInputStream.readBytes(Native Method)
        at java.io.FileInputStream.read(FileInputStream.java:233)
        at org.gradle.internal.hash.DefaultStreamHasher.doHash(DefaultStreamHasher.java:52)
        at org.gradle.internal.hash.DefaultStreamHasher.hash(DefaultStreamHasher.java:35)
        ... 120 more 

These exceptions do not stop the build, but they slow it down considerably.

Should be reproducible on https://github.com/vmishenev/kotlin/tree/update-dokka/libraries/tools/kotlin-stdlib-docs


This property is only used for getting the absolute path of the source files in order to add source links to signatures. I can see no reason for why it should be responsible for making Dokka tasks out of date.

That being said, maybe @InputDirectory could be dropped in favor of something simpler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions