Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid snapshotting sourceLink.localDirectory input #2807

Merged
merged 5 commits into from Jan 13, 2023

Conversation

ilya-g
Copy link
Member

@ilya-g ilya-g commented Jan 10, 2023

A typical use case in a project with complex source root setup is to set sourceLink.localDirectory to the root of the project checkout dir and remoteUrl to the root of the project VCS url respectively.
However, since this property was marked as InputDirectory, in that case Gradle snapshotted hashes of all files in this entire project directory before running the Dokka task (including for example .git and .gradle directories). This could be very slow in big projects and also result in various Gradle warnings.

Now localDirectory is not an input property, but its relativized path is stored in another read-only input string property. Therefore, it invalidates task outputs when its value changes, but not when any content inside it.

A typical use case in a project with complex source root setup is to set sourceLink.localDirectory to the root of the project checkout dir and remoteUrl to the root of the project VCS url respectively.
However, since this property was marked as InputDirectory, in that case Gradle snapshotted hashes of all files in this entire project directory before running the Dokka task (including for example .git and .gradle directories). This could be very slow in big projects and also result in various Gradle warnings.

Now localDirectory is not an input property, but its relativized path is stored in another read-only input string property. Therefore, it invalidates task outputs when its value changes, but not when any content inside it.
@ilya-g ilya-g self-assigned this Jan 10, 2023
Copy link
Member

@IgnatBeresnev IgnatBeresnev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the initiative!

@IgnatBeresnev IgnatBeresnev linked an issue Jan 13, 2023 that may be closed by this pull request
Copy link
Member

@IgnatBeresnev IgnatBeresnev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@IgnatBeresnev IgnatBeresnev merged commit ac932d4 into master Jan 13, 2023
@IgnatBeresnev IgnatBeresnev deleted the ig/local-directory-cache-issue branch January 13, 2023 22:19
@ilya-g
Copy link
Member Author

ilya-g commented Jan 14, 2023

Note: I assigned this PR to me because I would have liked to hit merge myself in order to correct the message of the squashed commit.

@IgnatBeresnev
Copy link
Member

Note: I assigned this PR to me because I would have liked to hit merge myself in order to correct the message of the squashed commit.

Oh, sorry, will bear this in mind for next time 👍 Never seen assigns used in that way and we don't use the field ourselves, so it didn't trigger anything in my brain, I just assumed you assigned it to yourself automatically.

I thought about leaving the more detailed comment in the commit description, but I felt like in-code comments captured it well, if that's what you wanted to add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot access input property sourceLinks.localDirectory
3 participants