forked from FabricMC/fabric-loom
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial plumbing for NeoForge support * Fix checkstyle * Add ModPlatform.id * Use NeoForge-specific cache * Use NeoForge-specific dependency configuration This is only for the "(neo)forge" configuration exposed as API. The other configurations remain the same. * Add test for basic NeoForge 1.20.2 projects * Implement hacky fast track for NeoForge field migration In other works, we skip field migrating for now. * Disable patched decompilation task on Neo * Disable mixin AP for building on NeoForge * Many changes related to NeoForge mappings and remapping * Code style and related fixes * McpExecutor: Add support for downloading deps via Gradle Also adds support for downloading a file without a repo for NeoForm functions. * Fix wrong configurations being used on NeoForge * Fix mixin version detection on NeoForge * Rename MinecraftPatchedProvider jar paths on NeoForge * Test NeoForge against a client-only MC jar * Add DFU for codecs, support NeoForge run config templates * Centralise userdev config reading, support missing SAS * Set up Shadow for bundling DFU * Use correct name for NeoForm in cache files * RemapJarTask: Fix check using isForgeLike for Forge * MojangMappingsMerger: Complete and reorder mappings * Fix SRG being used on NeoForge * Fix SRG being used on NeoForge for ATs * Use client pipeline for merged to avoid patch issues on Neo * Update to architectury-loom-runtime 2.0 * Fix Minecraft jar name on Neo * Fix MojangMappingsMerger having incomplete names * Fix NeoForge mod dependency remapping using wrong mappings * Quiet down MojangMappingsMerger * Fix (Neo)Forge builtin coremods not being remapped Fixes #146. * Disable deprecated data generation API on NeoForge * Use release version of the forge runtime * Revert "Set up Shadow for bundling DFU" This reverts commit 2bb8166. * Make NeoForge Field Migration work * NeoForge shouldn't try to get datagen mods * Fix checkstyle * Remove mojang maven * Split Forge and NeoForge extensions * SimpleNeoForgeTest: Bump Neo version and fix Yarn version * Remove resolved TODOs * Re-enable joined NeoForm pipeline * MPP: Rename srg -> intermediate jars * Reintroduce namespace filtering for mapping trees Should be a simple optimisation to avoid reading an additional ns. * ForgeRunTemplateTest: Fix code format * Adapt SrgMerger into ForgeMappingsMerger (#169) * Fix crash with NeoForge ext creation * Adapt SrgMerger into ForgeMappingsMerger * Update tiny-remapper * Fix spotless * Resolve reviews * Fix checkstyle * Remap ASMAPI.redirectFieldToMethod (#171) * Remap ASMAPI.redirectFieldToMethod * Move lastClassName outside the if * Fix missing template variables in tests using forge/simple * Add Java version to forge/simple test variables * Disable naming service dependency on Neo * Fix changing patch version not affecting mapped game jars Fixes #167. * Rename configuration: neoforge -> neoForge --------- Co-authored-by: shedaniel <[email protected]>
- Loading branch information
Showing
78 changed files
with
1,389 additions
and
471 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/java/dev/architectury/loom/forge/UserdevConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package dev.architectury.loom.forge; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
|
||
import net.fabricmc.loom.configuration.providers.forge.ForgeRunTemplate; | ||
|
||
public record UserdevConfig( | ||
String mcp, | ||
String universal, | ||
String sources, | ||
String patches, | ||
Optional<String> patchesOriginalPrefix, | ||
Optional<String> patchesModifiedPrefix, | ||
String binpatches, | ||
BinaryPatcherConfig binpatcher, | ||
List<String> libraries, | ||
Map<String, ForgeRunTemplate> runs, | ||
List<String> sass | ||
) { | ||
public static final Codec<UserdevConfig> CODEC = RecordCodecBuilder.create(instance -> instance.group( | ||
Codec.STRING.fieldOf("mcp").forGetter(UserdevConfig::mcp), | ||
Codec.STRING.fieldOf("universal").forGetter(UserdevConfig::universal), | ||
Codec.STRING.fieldOf("sources").forGetter(UserdevConfig::sources), | ||
Codec.STRING.fieldOf("patches").forGetter(UserdevConfig::patches), | ||
Codec.STRING.optionalFieldOf("patchesOriginalPrefix").forGetter(UserdevConfig::patchesOriginalPrefix), | ||
Codec.STRING.optionalFieldOf("patchesModifiedPrefix").forGetter(UserdevConfig::patchesModifiedPrefix), | ||
Codec.STRING.fieldOf("binpatches").forGetter(UserdevConfig::binpatches), | ||
BinaryPatcherConfig.CODEC.fieldOf("binpatcher").forGetter(UserdevConfig::binpatcher), | ||
Codec.STRING.listOf().fieldOf("libraries").forGetter(UserdevConfig::libraries), | ||
ForgeRunTemplate.MAP_CODEC.fieldOf("runs").forGetter(UserdevConfig::runs), | ||
Codec.STRING.listOf().optionalFieldOf("sass", List.of()).forGetter(UserdevConfig::sass) | ||
).apply(instance, UserdevConfig::new)); | ||
|
||
public record BinaryPatcherConfig(String dependency, List<String> args) { | ||
public static final Codec<BinaryPatcherConfig> CODEC = RecordCodecBuilder.create(instance -> instance.group( | ||
Codec.STRING.fieldOf("version").forGetter(BinaryPatcherConfig::dependency), | ||
Codec.STRING.listOf().fieldOf("args").forGetter(BinaryPatcherConfig::args) | ||
).apply(instance, BinaryPatcherConfig::new)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/dev/architectury/loom/util/MappingOption.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package dev.architectury.loom.util; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
|
||
import net.fabricmc.loom.api.LoomGradleExtensionAPI; | ||
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace; | ||
|
||
public enum MappingOption { | ||
DEFAULT(null), | ||
WITH_SRG(MappingsNamespace.SRG.toString()), | ||
WITH_MOJANG(MappingsNamespace.MOJANG.toString()); | ||
|
||
private final String extraNamespace; | ||
|
||
MappingOption(@Nullable String extraNamespace) { | ||
this.extraNamespace = extraNamespace; | ||
} | ||
|
||
public MappingOption forNamespaces(String... namespaces) { | ||
if (extraNamespace == null) return this; | ||
|
||
for (String namespace : namespaces) { | ||
if (extraNamespace.equals(namespace)) { | ||
return this; | ||
} | ||
} | ||
|
||
return DEFAULT; | ||
} | ||
|
||
public static MappingOption forPlatform(LoomGradleExtensionAPI extension) { | ||
return switch (extension.getPlatform().get()) { | ||
case FORGE -> WITH_SRG; | ||
case NEOFORGE -> WITH_MOJANG; | ||
default -> DEFAULT; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/main/java/net/fabricmc/loom/api/NeoForgeExtensionAPI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* This file is part of fabric-loom, licensed under the MIT License (MIT). | ||
* | ||
* Copyright (c) 2023 FabricMC | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package net.fabricmc.loom.api; | ||
|
||
import org.gradle.api.file.ConfigurableFileCollection; | ||
|
||
/** | ||
* This is the NeoForge extension API available to build scripts. | ||
*/ | ||
public interface NeoForgeExtensionAPI { | ||
/** | ||
* A collection of all project access transformers. | ||
* The collection should only contain AT files, and not directories or other files. | ||
* | ||
* <p>If this collection is empty, Loom tries to resolve the AT from the default path | ||
* ({@code META-INF/accesstransformer.cfg} in the {@code main} source set). | ||
* | ||
* @return the collection of AT files | ||
*/ | ||
ConfigurableFileCollection getAccessTransformers(); | ||
|
||
/** | ||
* Adds a {@linkplain #getAccessTransformers() project access transformer}. | ||
* | ||
* @param file the file, evaluated as per {@link org.gradle.api.Project#file(Object)} | ||
*/ | ||
void accessTransformer(Object file); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.