mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 13:37:45 -05:00
Add "loom.forge.include" for include configuration on forge
This commit is contained in:
@@ -72,6 +72,7 @@ import net.fabricmc.loom.util.function.LazyBool;
|
||||
|
||||
public class LoomGradleExtension {
|
||||
private static final String FORGE_PROPERTY = "loom.forge";
|
||||
private static final String INCLUDE_PROPERTY = "loom.forge.include";
|
||||
|
||||
public String refmapName;
|
||||
public String loaderLaunchMethod;
|
||||
@@ -102,6 +103,7 @@ public class LoomGradleExtension {
|
||||
private MappingSet[] srcMappingCache = new MappingSet[2];
|
||||
private Mercury[] srcMercuryCache = new Mercury[2];
|
||||
private final LazyBool forge;
|
||||
private final LazyBool supportsInclude;
|
||||
private Set<File> mixinMappings = Collections.synchronizedSet(new HashSet<>());
|
||||
private final List<String> tasksBeforeRun = Collections.synchronizedList(new ArrayList<>());
|
||||
public final List<Supplier<SourceSet>> forgeLocalMods = Collections.synchronizedList(new ArrayList<>(Arrays.asList(new Supplier<SourceSet>() {
|
||||
@@ -219,6 +221,7 @@ public class LoomGradleExtension {
|
||||
this.project = project;
|
||||
this.unmappedMods = project.files();
|
||||
this.forge = new LazyBool(() -> Boolean.parseBoolean(Objects.toString(project.findProperty(FORGE_PROPERTY))));
|
||||
this.supportsInclude = new LazyBool(() -> Boolean.parseBoolean(Objects.toString(project.findProperty(INCLUDE_PROPERTY))));
|
||||
this.runConfigs = project.container(RunConfigSettings.class,
|
||||
baseName -> new RunConfigSettings(project, baseName));
|
||||
this.launchConfigs = project.container(LaunchProviderSettings.class,
|
||||
@@ -474,6 +477,10 @@ public class LoomGradleExtension {
|
||||
return forge.getAsBoolean();
|
||||
}
|
||||
|
||||
public boolean supportsInclude() {
|
||||
return !isForge() || supportsInclude.getAsBoolean();
|
||||
}
|
||||
|
||||
public boolean shouldGenerateSrgTiny() {
|
||||
if (generateSrgTiny != null) {
|
||||
return generateSrgTiny;
|
||||
|
||||
@@ -99,7 +99,7 @@ public class NestedJars {
|
||||
private static List<File> getContainedJars(Project project) {
|
||||
List<File> fileList = new ArrayList<>();
|
||||
|
||||
if (project.getExtensions().getByType(LoomGradleExtension.class).isForge()) {
|
||||
if (!project.getExtensions().getByType(LoomGradleExtension.class).supportsInclude()) {
|
||||
return fileList;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public final class CompileConfiguration {
|
||||
extendsFrom(Constants.Configurations.MINECRAFT_DEPENDENCIES, Constants.Configurations.FORGE_DEPENDENCIES, project);
|
||||
}
|
||||
|
||||
if (!project.getExtensions().getByType(LoomGradleExtension.class).isForge()) {
|
||||
if (project.getExtensions().getByType(LoomGradleExtension.class).supportsInclude()) {
|
||||
Configuration includeConfig = project.getConfigurations().maybeCreate(Constants.Configurations.INCLUDE);
|
||||
includeConfig.setTransitive(false); // Dont get transitive deps
|
||||
}
|
||||
@@ -294,7 +294,7 @@ public final class CompileConfiguration {
|
||||
project1.getTasks().getByName("build").dependsOn(remapJarTask);
|
||||
|
||||
project.getTasks().withType(RemapJarTask.class).forEach(task -> {
|
||||
if (!extension.isForge() && task.getAddNestedDependencies().getOrElse(false)) {
|
||||
if (extension.supportsInclude() && task.getAddNestedDependencies().getOrElse(false)) {
|
||||
NestedJars.getRequiredTasks(project1).forEach(task::dependsOn);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user