File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import com.replaymod.gradle.preprocess.ProjectGraphNode
2+ import com.replaymod.gradle.preprocess.RootPreprocessExtension
13import dev.deftu.gradle.utils.ModData
24import dev.deftu.gradle.utils.ProjectData
35
@@ -8,6 +10,22 @@ plugins {
810subprojects {
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
1331preprocess {
You can’t perform that action at this time.
0 commit comments