[2.x] fix: inputFileChanges with nested task scopes#8516
Merged
eed3si9n merged 11 commits intosbt:developfrom Jan 14, 2026
Merged
[2.x] fix: inputFileChanges with nested task scopes#8516eed3si9n merged 11 commits intosbt:developfrom
eed3si9n merged 11 commits intosbt:developfrom
Conversation
Fixes sbt#7489 When using nested task scopes like otherTask / testTask, the inputFileChanges macro was returning the wrong scope. It checked if the scope already had a task axis and returned it as-is, but this meant it would use otherTask's scope instead of testTask's. The fix always sets the task axis to the key being queried, ensuring fileInputs settings are found at the correct scope.
Member
Adds a scripted test to verify that inputFileChanges works correctly when using nested task scopes like otherTask / testTask.
The inputFileChanges macro doesn't work inside Def.uncached due to macro expansion scope issues. Use Def.taskDyn pattern instead, which is the same approach used in the file-hashes scripted test.
The inputFileChanges macro doesn't work with inline nested task scope expressions like (otherTask / testTask).inputFiles. Using a val to hold the scoped task key allows the macro to work properly.
Contributor
Author
|
@eed3si9n all checks passed! could you please review the changes again and approve it? |
eed3si9n
reviewed
Jan 14, 2026
sbt-app/src/sbt-test/nio/nested-task-scope/project/build.properties
Outdated
Show resolved
Hide resolved
eed3si9n
approved these changes
Jan 14, 2026
Member
eed3si9n
left a comment
There was a problem hiding this comment.
Minor comment, but overall lgtm.
Per reviewer feedback - this file will break in the future.
Contributor
Author
|
@eed3si9n can you merge the PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix inputFileChanges with nested task scopes
Fixes #7489
The Problem
When you define a task scoped to another task and try to use
inputFileChanges, it doesn't track file changes correctly:Running
otherTask / testTaskalways prints "NOT CHANGED", even after modifying files insrc.What was happening
The
getTaskScopefunction was checking if the scope already had a task axis set. If it did, it would return that scope as-is. But withotherTask / testTask, the scope hasotherTaskin the task axis, whilefileInputsis actually set at thetestTaskscope.The Fix
Always use the key being queried (
testTask) as the task axis, regardless of what's already in the scope. This ensures we look upfileInputsat the correct scope.Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=94194147