-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from gradle/przemek/upgrade_to_gradle_8.3
Upgrade Gradle wrapper to version 8.3 and adapt tests
- Loading branch information
Showing
11 changed files
with
103 additions
and
57 deletions.
There are no files selected for viewing
This file contains 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
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains 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
This file contains 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
This file contains 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
76 changes: 46 additions & 30 deletions
76
samples-check/src/test/samples/gradle/multi-step-sample/build.gradle
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,98 @@ | ||
import org.gradle.work.ChangeType | ||
import org.gradle.work.Incremental | ||
import org.gradle.work.InputChanges | ||
|
||
def inputsDir = layout.projectDirectory.dir("inputs") | ||
|
||
task originalInputs() { | ||
doLast { | ||
file('inputs').mkdir() | ||
file('inputs/1.txt').text = 'Content for file 1.' | ||
file('inputs/2.txt').text = 'Content for file 2.' | ||
file('inputs/3.txt').text = 'Content for file 3.' | ||
inputsDir.asFile.mkdir() | ||
inputsDir.file('1.txt').asFile.text = 'Content for file 1.' | ||
inputsDir.file('2.txt').asFile.text = 'Content for file 2.' | ||
inputsDir.file('3.txt').asFile.text = 'Content for file 3.' | ||
} | ||
} | ||
|
||
// START SNIPPET updated-inputs | ||
task updateInputs() { | ||
doLast { | ||
file('inputs/1.txt').text = 'Changed content for existing file 1.' | ||
file('inputs/4.txt').text = 'Content for new file 4.' | ||
inputsDir.file('1.txt').asFile.text = 'Changed content for existing file 1.' | ||
inputsDir.file('4.txt').asFile.text = 'Content for new file 4.' | ||
} | ||
} | ||
// END SNIPPET updated-inputs | ||
|
||
// START SNIPPET removed-input | ||
task removeInput() { | ||
doLast { | ||
file('inputs/3.txt').delete() | ||
inputsDir.file('3.txt').asFile.delete() | ||
} | ||
} | ||
// END SNIPPET removed-input | ||
|
||
// START SNIPPET removed-output | ||
task removeOutput() { | ||
doLast { | ||
file("$buildDir/outputs/1.txt").delete() | ||
layout.buildDirectory.file('outputs/1.txt').get().asFile.delete() | ||
} | ||
} | ||
// END SNIPPET removed-output | ||
|
||
// START SNIPPET reverse | ||
task incrementalReverse(type: IncrementalReverseTask) { | ||
inputDir = file('inputs') | ||
outputDir = file("$buildDir/outputs") | ||
inputDir = inputsDir.asFileTree | ||
outputDir = layout.buildDirectory.dir('outputs') | ||
inputProperty = project.properties['taskInputProperty'] ?: 'original' | ||
} | ||
// END SNIPPET reverse | ||
|
||
// START SNIPPET incremental-task | ||
class IncrementalReverseTask extends DefaultTask { | ||
@InputDirectory | ||
def File inputDir | ||
@InputFiles | ||
@SkipWhenEmpty | ||
FileCollection inputDir | ||
|
||
@OutputDirectory | ||
def File outputDir | ||
Provider<Directory> outputDir | ||
|
||
@Input | ||
def inputProperty | ||
|
||
@TaskAction | ||
void execute(IncrementalTaskInputs inputs) { | ||
void execute(InputChanges inputs) { | ||
println inputs.incremental ? 'CHANGED inputs considered out of date' | ||
: 'ALL inputs considered out of date' | ||
// START SNIPPET handle-non-incremental-inputs | ||
if (!inputs.incremental) | ||
project.delete(outputDir.listFiles()) | ||
project.delete(outputDir.get().asFile.listFiles()) | ||
// END SNIPPET handle-non-incremental-inputs | ||
|
||
// START SNIPPET out-of-date-inputs | ||
inputs.outOfDate { change -> | ||
if (change.file.file) { | ||
println "out of date: ${change.file.name}" | ||
def targetFile = new File(outputDir, change.file.name) | ||
targetFile.text = change.file.text.reverse() | ||
} | ||
} | ||
// END SNIPPET out-of-date-inputs | ||
if (inputs.incremental) { | ||
inputs.getFileChanges(inputDir).each { change -> | ||
// START SNIPPET out-of-date-inputs | ||
if (change.changeType == ChangeType.MODIFIED && change.file.file) { | ||
println "out of date: ${change.file.name}" | ||
def targetFile = new File(outputDir.get().asFile, change.file.name) | ||
targetFile.text = change.file.text.reverse() | ||
} | ||
// END SNIPPET out-of-date-inputs | ||
// START SNIPPET added-inputs | ||
if (change.changeType == ChangeType.ADDED && change.file.file) { | ||
println "added: ${change.file.name}" | ||
def targetFile = new File(outputDir.get().asFile, change.file.name) | ||
targetFile.text = change.file.text.reverse() | ||
} | ||
// END SNIPPET added-inputs | ||
|
||
// START SNIPPET removed-inputs | ||
inputs.removed { change -> | ||
println "removed: ${change.file.name}" | ||
def targetFile = new File(outputDir, change.file.name) | ||
targetFile.delete() | ||
// START SNIPPET removed-inputs | ||
if (change.changeType == ChangeType.REMOVED) { | ||
println "removed: ${change.file.name}" | ||
def targetFile = new File(outputDir.get().asFile, change.file.name) | ||
targetFile.delete() | ||
} | ||
// END SNIPPET removed-inputs | ||
} | ||
} | ||
// END SNIPPET removed-inputs | ||
} | ||
} | ||
// END SNIPPET incremental-task |
5 changes: 2 additions & 3 deletions
5
samples-check/src/test/samples/gradle/multi-step-sample/incrementalTaskRemovedOutput.out
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
ALL inputs considered out of date | ||
CHANGED inputs considered out of date | ||
out of date: 1.txt | ||
out of date: 2.txt | ||
out of date: 3.txt | ||
added: 4.txt |
12 changes: 9 additions & 3 deletions
12
...-check/src/test/samples/gradle/multi-step-sample/incrementalTaskRemovedOutput.sample.conf
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
commands: [{ | ||
executable: gradle | ||
args: originalInputs incrementalReverse | ||
args: originalInputs | ||
}, { | ||
executable: gradle | ||
args: incrementalReverse | ||
expected-output-file: originalInputs.out | ||
allow-additional-output: true | ||
}, { | ||
executable: gradle | ||
args: removeOutput updateInputs | ||
}, { | ||
executable: gradle | ||
args: removeOutput incrementalReverse | ||
args: incrementalReverse | ||
expected-output-file: incrementalTaskRemovedOutput.out | ||
allow-disordered-output: true | ||
allow-additional-output: true | ||
}] | ||
}] |
3 changes: 2 additions & 1 deletion
3
samples-check/src/test/samples/gradle/multi-step-sample/originalInputs.out
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
> Task :originalInputs | ||
> Task :incrementalReverse | ||
ALL inputs considered out of date |
This file contains 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