@@ -12,13 +12,17 @@ import java.io.File
12
12
import java.io.FileOutputStream
13
13
import javax.inject.Inject
14
14
import org.gradle.api.file.ConfigurableFileCollection
15
+ import org.gradle.api.file.ProjectLayout
15
16
16
17
@CacheableTask
17
18
abstract class StoneTask : DefaultTask () {
18
19
19
20
@get:Inject
20
21
abstract val exec: ExecOperations
21
22
23
+ @get:Inject
24
+ abstract val layout: ProjectLayout
25
+
22
26
@get:Input
23
27
abstract val stoneConfigs: ListProperty <StoneConfig >
24
28
@@ -90,6 +94,13 @@ abstract class StoneTask : DefaultTask() {
90
94
}
91
95
}
92
96
97
+ // Order of inputs can affect the output of stone
98
+ // Sorting spec files by relative path makes order stable across machines
99
+ val projectDirectory = layout.projectDirectory.asFile
100
+ val sortedSpecFiles = specFiles.sortedBy {
101
+ it.toRelativeString(projectDirectory)
102
+ }.map { it.absolutePath }.toTypedArray()
103
+
93
104
stoneConfigs.get().forEachIndexed { index, stoneConfig ->
94
105
val isFirst = index == 0
95
106
val append: Boolean = ! isFirst
@@ -100,7 +111,7 @@ abstract class StoneTask : DefaultTask() {
100
111
101
112
generatorFile.get().asFile,
102
113
outputDirectory.absolutePath,
103
- * specFiles.map { it.absolutePath }.toTypedArray() ,
114
+ * sortedSpecFiles ,
104
115
" --" , " --package" , stoneConfig.packageName,
105
116
)
106
117
0 commit comments