Skip to content

Commit f1d629b

Browse files
committed
lets see if this works
1 parent d063a6b commit f1d629b

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

bootstrap/root.gradle.kts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import com.replaymod.gradle.preprocess.ProjectGraphNode
2+
import com.replaymod.gradle.preprocess.RootPreprocessExtension
13
import dev.deftu.gradle.utils.ModData
24
import dev.deftu.gradle.utils.ProjectData
35

@@ -8,6 +10,22 @@ plugins {
810
subprojects {
911
val projectData = ProjectData.from(rootProject)
1012
ModData.populateFrom(project, projectData)
13+
14+
// Force evaluation of the previous project in the preprocess chain before this project configures.
15+
// Prevents "Resolution was attempted without an exclusive lock" when using configure-on-demand + parallel,
16+
// since preprocessCode needs to resolve the linked project's compileClasspath.
17+
(parent?.extensions?.findByType(RootPreprocessExtension::class.java))?.rootNode?.let { rootNode ->
18+
val nodes = mutableListOf<ProjectGraphNode>()
19+
fun recurse(node: ProjectGraphNode) {
20+
nodes.add(node)
21+
for ((child) in node.links) recurse(child)
22+
}
23+
recurse(rootNode)
24+
val prevByProject = (1 until nodes.size).associate { nodes[it].project to nodes[it - 1].project }
25+
prevByProject[project.name]?.let { prevProject ->
26+
evaluationDependsOn(":bootstrap:$prevProject")
27+
}
28+
}
1129
}
1230

1331
preprocess {

0 commit comments

Comments
 (0)