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

patch: Fix no such file or directory during commit #100

Merged
merged 2 commits into from
Aug 14, 2022
Merged

patch: Fix no such file or directory during commit #100

merged 2 commits into from
Aug 14, 2022

Conversation

ajoberstar
Copy link
Owner

Gradle fairly aggressively tries to cleanup stale output files, with the goal of reliable build caching to avoid the need to run "./gradlew clean". However, this is problematic for tasks that have overlapping output directories, as it makes it difficult for Gradle to track what's stale.

In a prior version we added the @UntrackedTask annotation to all of the publish tasks to avoid Gradle's state tracking. However, we use the built-in Gradle Copy task for one part of our chain, which does not have that annotation.

In cases where the .gradle directory was not present, we would see the repository directory get deleted after the gitPublishCopy task ran, because Gradle thought it was stale. In other cases it seemed to be fine.

While I don't understand the details of how Gradle makes those stale/fresh decisions, particularly in the absence of the .gradle directory, it seems the key is using the runtime method equivalent of the @UntrackedTask annotation (Task.doNotTrackState) to tell Gradle not to do its state tracking for this one task.

We could still have issues in the future, but this seems to get us over the immediate hurdle.

Fixes #99

Gradle fairly aggressively tries to cleanup stale output files, with
the goal of reliable build caching to avoid the need to run "./gradlew
clean". However, this is problematic for tasks that have overlapping
output directories, as it makes it difficult for Gradle to track
what's stale.

In a prior version we added the @UntrackedTask annotation to all of
the publish tasks to avoid Gradle's state tracking. However, we use
the built-in Gradle Copy task for one part of our chain, which does
not have that annotation.

In cases where the .gradle directory was not present, we would see the
repository directory get deleted after the gitPublishCopy task ran,
because Gradle thought it was stale. In other cases it seemed to be
fine.

While I don't understand the details of how Gradle makes those
stale/fresh decisions, particularly in the absence of the .gradle
directory, it seems the key is using the runtime method equivalent of
the @UntrackedTask annotation (Task.doNotTrackState) to tell Gradle
not to do its state tracking for this one task.

We could still have issues in the future, but this seems to get us
over the immediate hurdle.

Fixes #99
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.

No such file or directory after upgrading to 4.0.0
1 participant