User: rednesto Date: 05 Oct 24 12:35 Revision: 8bd000fc18693b7b19da226aa92afec746c858b2 Summary: Fix #1886 Sync error in ForgeGradle composite builds Also remove duplicate tasks before executing them TeamCity URL: https://ci.mcdev.io/viewModification.html?tab=vcsModificationFiles&modId=9767&personal=false Index: src/main/kotlin/platform/mcp/gradle/McpProjectResolverExtension.kt =================================================================== --- src/main/kotlin/platform/mcp/gradle/McpProjectResolverExtension.kt (revision f5ea374e402abb6524e196d3c18d4ab368599c98) +++ src/main/kotlin/platform/mcp/gradle/McpProjectResolverExtension.kt (revision 8bd000fc18693b7b19da226aa92afec746c858b2) @@ -59,7 +59,7 @@ val projectDirPath = Paths.get(projectDataNode.data.linkedExternalProjectPath) runGradleTask(project, projectDirPath) { settings -> - settings.taskNames = allTaskNames + settings.taskNames = allTaskNames.distinct() } super.resolveFinished(projectDataNode) Index: src/main/kotlin/platform/mcp/gradle/datahandler/McpModelFG3Handler.kt =================================================================== --- src/main/kotlin/platform/mcp/gradle/datahandler/McpModelFG3Handler.kt (revision f5ea374e402abb6524e196d3c18d4ab368599c98) +++ src/main/kotlin/platform/mcp/gradle/datahandler/McpModelFG3Handler.kt (revision 8bd000fc18693b7b19da226aa92afec746c858b2) @@ -34,6 +34,7 @@ import org.gradle.tooling.model.idea.IdeaModule import org.jetbrains.plugins.gradle.model.data.GradleSourceSetData import org.jetbrains.plugins.gradle.service.project.ProjectResolverContext +import org.jetbrains.plugins.gradle.util.gradleIdentityPath object McpModelFG3Handler : McpModelDataHandler { @@ -68,9 +69,10 @@ forgeVersion, ) - val gradleProjectPath = gradleModule.gradleProject.projectIdentifier.projectPath - val suffix = if (gradleProjectPath.endsWith(':')) "" else ":" - val taskName = gradleProjectPath + suffix + data.taskName + // gradleIdentityPath makes it work with composite builds + val identityPath = node.data.gradleIdentityPath + // But ignore it if it is the root project, as taskName already starts with a colon + val taskName = if (identityPath == ":") data.taskName else identityPath + ':' + data.taskName val ats = data.accessTransformers if (ats != null && ats.isNotEmpty()) {