User: rednesto Date: 05 Dec 24 15:36 Revision: c73d3e755fd290501e5477eb21ed1619c8b3cc30 Summary: Fix references to client code not being resolved in fabric.mod.json For some obscure reasons I couldn't figure out, it did not work in some cases before TeamCity URL: https://ci.mcdev.io/viewModification.html?tab=vcsModificationFiles&modId=9797&personal=false Index: changelog.md =================================================================== --- changelog.md (revision 55211813347e609851aada054dd9c186b40e9a1e) +++ changelog.md (revision c73d3e755fd290501e5477eb21ed1619c8b3cc30) @@ -16,6 +16,7 @@ - In this case, the creator will now select the latest version available for the latest Minecraft version supported by Parchment - [#2408](https://github.com/minecraft-dev/MinecraftDev/issues/2408) External translation annotations are not attached - This happens because IntelliJ IDEA disables external annotations by default in 2024.3, which we rely on for this feature, an opt-out setting has been added to force-enable external annotations in Minecraft projects. +- Cases where references to client sources in fabric.mod.json were not resolved ## [1.8.2] - 2024-10-05 Index: src/main/kotlin/platform/fabric/reference/FabricModJsonResolveScopeEnlarger.kt =================================================================== --- src/main/kotlin/platform/fabric/reference/FabricModJsonResolveScopeEnlarger.kt (revision 55211813347e609851aada054dd9c186b40e9a1e) +++ src/main/kotlin/platform/fabric/reference/FabricModJsonResolveScopeEnlarger.kt (revision c73d3e755fd290501e5477eb21ed1619c8b3cc30) @@ -21,16 +21,11 @@ package com.demonwav.mcdev.platform.fabric.reference import com.demonwav.mcdev.platform.fabric.util.FabricConstants -import com.demonwav.mcdev.platform.mcp.fabricloom.FabricLoomData -import com.intellij.openapi.module.ModuleManager import com.intellij.openapi.module.ModuleUtilCore import com.intellij.openapi.project.Project -import com.intellij.openapi.roots.ProjectRootManager import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.ResolveScopeEnlarger -import com.intellij.psi.search.GlobalSearchScope import com.intellij.psi.search.SearchScope -import org.jetbrains.plugins.gradle.util.GradleUtil class FabricModJsonResolveScopeEnlarger : ResolveScopeEnlarger() { @@ -41,30 +36,6 @@ val module = ModuleUtilCore.findModuleForFile(file, project) ?: return null - val loomData = GradleUtil.findGradleModuleData(module)?.children - ?.find { it.key == FabricLoomData.KEY }?.data as? FabricLoomData - ?: return null - val modSourceSets = loomData.modSourceSets - ?: return null - - val moduleScopes = mutableListOf() - val moduleManager = ModuleManager.getInstance(project) - val parentPath = module.name.substringBeforeLast('.') - val rootType = ProjectRootManager.getInstance(project).fileIndex.getContainingSourceRootType(file) - ?: return null - for ((_, sourceSets) in modSourceSets) { - for (sourceSet in sourceSets) { - val childModule = moduleManager.findModuleByName("$parentPath.$sourceSet") - if (childModule != null) { - moduleScopes.add(childModule.getModuleScope(rootType.isForTests)) + return module.moduleWithDependentsScope.union(module.moduleTestsWithDependentsScope) - } - } + } +} - } - - if (moduleScopes.isEmpty()) { - return null - } - - return GlobalSearchScope.union(moduleScopes) - } -}