Skip to content

Commit ef03f1d

Browse files
committed
Fix order-dependent assertion in CrossBuildScriptCachingIntegrationSpec
scriptsAreReused() compared scripts by list index, but isolated projects mode does not guarantee a stable project configuration order across builds. Match by path instead so the assertion is order-independent. Signed-off-by: Reinhold Degenfellner <[email protected]>
1 parent fd26fd3 commit ef03f1d

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

subprojects/core/src/integTest/groovy/org/gradle/api/CrossBuildScriptCachingIntegrationSpec.groovy

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -674,10 +674,13 @@ class CrossBuildScriptCachingIntegrationSpec extends AbstractIntegrationSpec {
674674
}
675675

676676
void scriptsAreReused(List<ClassDetails> before, List<ClassDetails> after) {
677-
assert before.size() == after.size()
678-
for (int i = 0; i < before.size(); i++) {
679-
def script1 = before[i]
680-
def script2 = after[i]
677+
def sort = { List<ClassDetails> list -> list.sort(false) { a, b -> a.path <=> b.path ?: a.className <=> b.className } }
678+
def sortedBefore = sort(before)
679+
def sortedAfter = sort(after)
680+
assert sortedBefore.size() == sortedAfter.size()
681+
for (int i = 0; i < sortedBefore.size(); i++) {
682+
def script1 = sortedBefore[i]
683+
def script2 = sortedAfter[i]
681684
assert script1.path == script2.path
682685
assert script1.className == script2.className
683686
assert script1.classpath == script2.classpath

0 commit comments

Comments
 (0)