Skip to content

Commit

Permalink
Update to architectury-loom-runtime 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Juuxel committed Nov 2, 2023
1 parent c101463 commit 6b0ebe1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
6 changes: 4 additions & 2 deletions gradle/runtime.libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ native-support = "1.0.1"

# Forge Runtime depedencies
javax-annotations = "3.0.2"
forge-runtime = "1.1.8"
forge-runtime = "2.0.9999"
access-transformers = "3.0.1"
access-transformers-new = "8.0.5"
unprotect = "1.2.0"
Expand All @@ -34,7 +34,9 @@ native-support = { module = "net.fabricmc:fabric-loom-native-support", version.r

# Forge Runtime depedencies
javax-annotations = { module = "com.google.code.findbugs:jsr305", version.ref = "javax-annotations" }
forge-runtime = { module = "dev.architectury:architectury-loom-runtime", version.ref = "forge-runtime" }
mixin-remapper-service = { module = "dev.architectury:architectury-mixin-remapper-service", version.ref = "forge-runtime" }
naming-service = { module = "dev.architectury:architectury-naming-service", version.ref = "forge-runtime" }
mcp-annotations = { module = "dev.architectury:mcp-annotations", version.ref = "forge-runtime" }
access-transformers = { module = "net.minecraftforge:accesstransformers", version.ref = "access-transformers" }
access-transformers-new = { module = "net.minecraftforge:accesstransformers", version.ref = "access-transformers-new" }
unprotect = { module = "io.github.juuxel:unprotect", version.ref = "unprotect" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,16 @@ public void run() {
extendsFrom(JavaPlugin.TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME, Constants.Configurations.FORGE_EXTRA);
extendsFrom(JavaPlugin.TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME, Constants.Configurations.FORGE_EXTRA);

// Add Forge dev-time dependencies
getDependencies().add(Constants.Configurations.FORGE_EXTRA, LoomVersions.FORGE_RUNTIME.mavenNotation());
// Add Forge/NeoForge shared dev-time dependencies
getDependencies().add(Constants.Configurations.FORGE_EXTRA, LoomVersions.NAMING_SERVICE.mavenNotation());
getDependencies().add(Constants.Configurations.FORGE_EXTRA, LoomVersions.UNPROTECT.mavenNotation());
getDependencies().add(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, LoomVersions.JAVAX_ANNOTATIONS.mavenNotation());

// Add Forge-only dev-time dependencies
if (extension.isForge()) {
getDependencies().add(Constants.Configurations.FORGE_EXTRA, LoomVersions.MIXIN_REMAPPER_SERVICE.mavenNotation());
getDependencies().add(Constants.Configurations.FORGE_EXTRA, LoomVersions.MCP_ANNOTATIONS.mavenNotation());
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,14 @@ public void run() throws IOException {
.map(File::getAbsolutePath)
.collect(Collectors.joining(File.pathSeparator));

final String intermediateNs = IntermediaryNamespaces.intermediary(getProject());
final String mappingsPath = getExtension().getPlatformMappingFile().toAbsolutePath().toString();

launchConfig
// Should match YarnNamingService.PATH_TO_MAPPINGS in forge-runtime
// TODO (Neo): Can we rename this property for Neo? It's not at all accurate.
.property("fabric.yarnWithSrg.path", getExtension().getPlatformMappingFile().toAbsolutePath().toString())
.property("unprotect.mappings", unprotectMappings)

.property("mixin.env.remapRefMap", "true");
// See ArchitecturyNamingService in forge-runtime
.property("architectury.naming.sourceNamespace", intermediateNs)
.property("architectury.naming.mappingsPath", mappingsPath);

final List<String> dataGenMods = getExtension().getForge().getDataGenMods();

Expand All @@ -129,11 +130,17 @@ public void run() throws IOException {
.argument("data", getProject().file("src/generated/resources").getAbsolutePath());
}

if (PropertyUtil.getAndFinalize(getExtension().getForge().getUseCustomMixin())) {
final String intermediaryNs = IntermediaryNamespaces.intermediary(getProject());
launchConfig.property("mixin.forgeloom.inject.mappings.srg-named", getExtension().getMappingConfiguration().getReplacedTarget(getExtension(), intermediaryNs).toAbsolutePath().toString());
} else {
launchConfig.property("net.minecraftforge.gradle.GradleStart.srg.srg-mcp", getExtension().getMappingConfiguration().srgToNamedSrg.toAbsolutePath().toString());
if (getExtension().isForge()) {
launchConfig.property("mixin.env.remapRefMap", "true");

if (PropertyUtil.getAndFinalize(getExtension().getForge().getUseCustomMixin())) {
// See mixin remapper service in forge-runtime
launchConfig
.property("architectury.mixinRemapper.sourceNamespace", intermediateNs)
.property("architectury.mixinRemapper.mappingsPath", mappingsPath);
} else {
launchConfig.property("net.minecraftforge.gradle.GradleStart.srg.srg-mcp", getExtension().getMappingConfiguration().srgToNamedSrg.toAbsolutePath().toString());
}
}

Set<String> mixinConfigs = PropertyUtil.getAndFinalize(getExtension().getForge().getMixinConfigs());
Expand Down

0 comments on commit 6b0ebe1

Please sign in to comment.