mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 21:47:42 -05:00
Configure compile task mixin options lazily (#1256)
* Try to configure compile task mixin options lazily * Fix CompileJava being realised too soon, and other misc lazy task fixes.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020-2022 FabricMC
|
||||
* Copyright (c) 2020-2025 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
|
||||
@@ -40,6 +40,7 @@ import org.gradle.api.Task;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.artifacts.ConfigurationContainer;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
import org.gradle.api.tasks.TaskProvider;
|
||||
|
||||
import net.fabricmc.loom.LoomGradleExtension;
|
||||
import net.fabricmc.loom.configuration.ide.idea.IdeaUtils;
|
||||
@@ -64,13 +65,13 @@ public abstract class AnnotationProcessorInvoker<T extends Task> {
|
||||
protected final Project project;
|
||||
private final LoomGradleExtension loomExtension;
|
||||
protected final MixinExtension mixinExtension;
|
||||
protected final Map<SourceSet, T> invokerTasks;
|
||||
protected final Map<SourceSet, TaskProvider<T>> invokerTasks;
|
||||
private final String name;
|
||||
private final Collection<Configuration> apConfigurations;
|
||||
|
||||
protected AnnotationProcessorInvoker(Project project,
|
||||
Collection<Configuration> apConfigurations,
|
||||
Map<SourceSet, T> invokerTasks, String name) {
|
||||
Map<SourceSet, TaskProvider<T>> invokerTasks, String name) {
|
||||
this.project = project;
|
||||
this.loomExtension = LoomGradleExtension.get(project);
|
||||
this.mixinExtension = loomExtension.getMixin();
|
||||
@@ -146,8 +147,8 @@ public abstract class AnnotationProcessorInvoker<T extends Task> {
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<SourceSet, T> entry : invokerTasks.entrySet()) {
|
||||
passMixinArguments(entry.getValue(), entry.getKey());
|
||||
for (Map.Entry<SourceSet, TaskProvider<T>> entry : invokerTasks.entrySet()) {
|
||||
entry.getValue().configure(t -> passMixinArguments(t, entry.getKey()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2022 FabricMC
|
||||
* Copyright (c) 2022-2025 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
|
||||
@@ -26,12 +26,12 @@ package net.fabricmc.loom.build.mixin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
import org.gradle.api.tasks.TaskProvider;
|
||||
import org.gradle.api.tasks.compile.GroovyCompile;
|
||||
|
||||
import net.fabricmc.loom.LoomGradleExtension;
|
||||
@@ -46,11 +46,10 @@ public class GroovyApInvoker extends AnnotationProcessorInvoker<GroovyCompile> {
|
||||
AnnotationProcessorInvoker.GROOVY);
|
||||
}
|
||||
|
||||
private static Map<SourceSet, GroovyCompile> getInvokerTasks(Project project) {
|
||||
private static Map<SourceSet, TaskProvider<GroovyCompile>> getInvokerTasks(Project project) {
|
||||
MixinExtension mixin = LoomGradleExtension.get(project).getMixin();
|
||||
return mixin.getInvokerTasksStream(AnnotationProcessorInvoker.GROOVY).collect(
|
||||
Collectors.toMap(Map.Entry::getKey,
|
||||
entry -> Objects.requireNonNull((GroovyCompile) entry.getValue())));
|
||||
return mixin.getInvokerTasksStream(AnnotationProcessorInvoker.GROOVY, GroovyCompile.class).collect(
|
||||
Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2016-2022 FabricMC
|
||||
* Copyright (c) 2016-2025 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
|
||||
@@ -26,11 +26,11 @@ package net.fabricmc.loom.build.mixin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
import org.gradle.api.tasks.TaskProvider;
|
||||
import org.gradle.api.tasks.compile.JavaCompile;
|
||||
|
||||
import net.fabricmc.loom.LoomGradleExtension;
|
||||
@@ -45,10 +45,10 @@ public class JavaApInvoker extends AnnotationProcessorInvoker<JavaCompile> {
|
||||
AnnotationProcessorInvoker.JAVA);
|
||||
}
|
||||
|
||||
private static Map<SourceSet, JavaCompile> getInvokerTasks(Project project) {
|
||||
private static Map<SourceSet, TaskProvider<JavaCompile>> getInvokerTasks(Project project) {
|
||||
MixinExtension mixin = LoomGradleExtension.get(project).getMixin();
|
||||
return mixin.getInvokerTasksStream(AnnotationProcessorInvoker.JAVA)
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, entry -> Objects.requireNonNull((JavaCompile) entry.getValue())));
|
||||
return mixin.getInvokerTasksStream(AnnotationProcessorInvoker.JAVA, JavaCompile.class)
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020-2022 FabricMC
|
||||
* Copyright (c) 2020-2025 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
|
||||
@@ -36,6 +36,7 @@ import java.util.stream.Collectors;
|
||||
import kotlin.Unit;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
import org.gradle.api.tasks.TaskProvider;
|
||||
import org.gradle.api.tasks.compile.JavaCompile;
|
||||
import org.jetbrains.kotlin.gradle.plugin.KaptExtension;
|
||||
|
||||
@@ -66,35 +67,36 @@ public class KaptApInvoker extends AnnotationProcessorInvoker<JavaCompile> {
|
||||
kaptExtension.setIncludeCompileClasspath(false);
|
||||
}
|
||||
|
||||
private static Map<SourceSet, JavaCompile> getInvokerTasks(Project project) {
|
||||
private static Map<SourceSet, TaskProvider<JavaCompile>> getInvokerTasks(Project project) {
|
||||
MixinExtension mixin = LoomGradleExtension.get(project).getMixin();
|
||||
return mixin.getInvokerTasksStream(AnnotationProcessorInvoker.JAVA)
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, entry -> Objects.requireNonNull((JavaCompile) entry.getValue())));
|
||||
return mixin.getInvokerTasksStream(AnnotationProcessorInvoker.JAVA, JavaCompile.class)
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureMixin() {
|
||||
super.configureMixin();
|
||||
|
||||
for (Map.Entry<SourceSet, JavaCompile> entry : invokerTasks.entrySet()) {
|
||||
for (Map.Entry<SourceSet, TaskProvider<JavaCompile>> entry : invokerTasks.entrySet()) {
|
||||
// Kapt only allows specifying javac args to all annotation processors at once. So we need to specify some dummy
|
||||
// target location for the refmap and then move it to the correct place for each sourceset
|
||||
JavaCompile task = entry.getValue();
|
||||
SourceSet sourceSet = entry.getKey();
|
||||
task.doLast(t -> {
|
||||
try {
|
||||
String refmapName = Objects.requireNonNull(MixinExtension.getMixinInformationContainer(sourceSet)).refmapNameProvider().get();
|
||||
Path src = Paths.get(getRefmapDestination(task, refmapName));
|
||||
Path dest = Paths.get(task.getDestinationDirectory().get().getAsFile().toString(), refmapName);
|
||||
entry.getValue().configure(task -> {
|
||||
SourceSet sourceSet = entry.getKey();
|
||||
task.doLast(t -> {
|
||||
try {
|
||||
String refmapName = Objects.requireNonNull(MixinExtension.getMixinInformationContainer(sourceSet)).refmapNameProvider().get();
|
||||
Path src = Paths.get(getRefmapDestination(task, refmapName));
|
||||
Path dest = Paths.get(task.getDestinationDirectory().get().getAsFile().toString(), refmapName);
|
||||
|
||||
// Possible that no mixin annotations exist
|
||||
if (Files.exists(src)) {
|
||||
project.getLogger().info("Copying refmap from " + src + " to " + dest);
|
||||
Files.move(src, dest);
|
||||
// Possible that no mixin annotations exist
|
||||
if (Files.exists(src)) {
|
||||
project.getLogger().info("Copying refmap from " + src + " to " + dest);
|
||||
Files.move(src, dest);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
project.getLogger().warn("Could not move refmap generated by kapt for task " + task, e);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
project.getLogger().warn("Could not move refmap generated by kapt for task " + task, e);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2016-2020 FabricMC
|
||||
* Copyright (c) 2016-2025 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
|
||||
@@ -26,12 +26,12 @@ package net.fabricmc.loom.build.mixin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
import org.gradle.api.tasks.TaskProvider;
|
||||
import org.gradle.api.tasks.scala.ScalaCompile;
|
||||
|
||||
import net.fabricmc.loom.LoomGradleExtension;
|
||||
@@ -47,10 +47,10 @@ public class ScalaApInvoker extends AnnotationProcessorInvoker<ScalaCompile> {
|
||||
AnnotationProcessorInvoker.SCALA);
|
||||
}
|
||||
|
||||
private static Map<SourceSet, ScalaCompile> getInvokerTasks(Project project) {
|
||||
private static Map<SourceSet, TaskProvider<ScalaCompile>> getInvokerTasks(Project project) {
|
||||
MixinExtension mixin = LoomGradleExtension.get(project).getMixin();
|
||||
return mixin.getInvokerTasksStream(AnnotationProcessorInvoker.SCALA)
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, entry -> Objects.requireNonNull((ScalaCompile) entry.getValue())));
|
||||
return mixin.getInvokerTasksStream(AnnotationProcessorInvoker.SCALA, ScalaCompile.class)
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2016-2012 FabricMC
|
||||
* Copyright (c) 2016-2025 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
|
||||
@@ -36,6 +36,7 @@ import org.gradle.api.plugins.ExtraPropertiesExtension;
|
||||
import org.gradle.api.provider.Provider;
|
||||
import org.gradle.api.tasks.Input;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
import org.gradle.api.tasks.TaskProvider;
|
||||
import org.gradle.api.tasks.util.PatternSet;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -81,7 +82,7 @@ public interface MixinExtension extends MixinExtensionAPI {
|
||||
Stream<Configuration> getApConfigurationsStream(Function<SourceSet, String> getApConfigNameFunc);
|
||||
|
||||
@NotNull
|
||||
Stream<Map.Entry<SourceSet, Task>> getInvokerTasksStream(String compileTaskLanguage);
|
||||
<T extends Task> Stream<Map.Entry<SourceSet, TaskProvider<T>>> getInvokerTasksStream(String compileTaskLanguage, Class<T> taskType);
|
||||
|
||||
@NotNull
|
||||
@Input
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2021-2022 FabricMC
|
||||
* Copyright (c) 2021-2025 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
|
||||
@@ -44,6 +44,7 @@ import org.gradle.api.provider.Property;
|
||||
import org.gradle.api.provider.Provider;
|
||||
import org.gradle.api.tasks.Input;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
import org.gradle.api.tasks.TaskProvider;
|
||||
import org.gradle.api.tasks.util.PatternSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -57,6 +58,7 @@ public class MixinExtensionImpl extends MixinExtensionApiImpl implements MixinEx
|
||||
this.isDefault = true;
|
||||
this.defaultRefmapName = project.getObjects().property(String.class)
|
||||
.convention(project.provider(this::getDefaultMixinRefmapName));
|
||||
this.defaultRefmapName.finalizeValueOnRead();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,11 +102,11 @@ public class MixinExtensionImpl extends MixinExtensionApiImpl implements MixinEx
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Stream<Map.Entry<SourceSet, Task>> getInvokerTasksStream(String compileTaskLanguage) {
|
||||
public <T extends Task> Stream<Map.Entry<SourceSet, TaskProvider<T>>> getInvokerTasksStream(String compileTaskLanguage, Class<T> taskType) {
|
||||
return getMixinSourceSetsStream()
|
||||
.flatMap(sourceSet -> {
|
||||
try {
|
||||
Task task = project.getTasks().getByName(sourceSet.getCompileTaskName(compileTaskLanguage));
|
||||
TaskProvider<T> task = project.getTasks().named(sourceSet.getCompileTaskName(compileTaskLanguage), taskType);
|
||||
return Stream.of(new AbstractMap.SimpleEntry<>(sourceSet, task));
|
||||
} catch (UnknownTaskException ignored) {
|
||||
return Stream.empty();
|
||||
@@ -133,7 +135,7 @@ public class MixinExtensionImpl extends MixinExtensionApiImpl implements MixinEx
|
||||
if (sourceSet.getName().equals("main")) {
|
||||
add(sourceSet);
|
||||
} else {
|
||||
add(sourceSet, sourceSet.getName() + "-" + getDefaultRefmapName().get());
|
||||
add(sourceSet, getDefaultRefmapName().map(defaultRefmapName -> "%s-%s".formatted(sourceSet.getName(), defaultRefmapName)), x -> { });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public abstract class RemapJarTask extends AbstractRemapJarTask {
|
||||
getOptimizeFabricModJson().convention(false).finalizeValueOnRead();
|
||||
|
||||
TaskProvider<NestableJarGenerationTask> processIncludeJars = getProject().getTasks().named(Constants.Task.PROCESS_INCLUDE_JARS, NestableJarGenerationTask.class);
|
||||
getNestedJars().from(getProject().fileTree(processIncludeJars.get().getOutputDirectory()));
|
||||
getNestedJars().from(processIncludeJars.map(task -> getProject().fileTree(task.getOutputDirectory())));
|
||||
getNestedJars().builtBy(processIncludeJars);
|
||||
|
||||
getUseMixinAP().set(LoomGradleExtension.get(getProject()).getMixin().getUseLegacyMixinAp());
|
||||
|
||||
@@ -79,7 +79,7 @@ public abstract class RemapTaskConfiguration implements Runnable {
|
||||
});
|
||||
|
||||
Action<RemapJarTask> remapJarTaskAction = task -> {
|
||||
final AbstractArchiveTask jarTask = getTasks().named(JavaPlugin.JAR_TASK_NAME, AbstractArchiveTask.class).get();
|
||||
final TaskProvider<AbstractArchiveTask> jarTask = getTasks().named(JavaPlugin.JAR_TASK_NAME, AbstractArchiveTask.class);
|
||||
|
||||
// Basic task setup
|
||||
task.dependsOn(jarTask);
|
||||
@@ -89,7 +89,7 @@ public abstract class RemapTaskConfiguration implements Runnable {
|
||||
getArtifacts().add(JavaPlugin.RUNTIME_ELEMENTS_CONFIGURATION_NAME, task);
|
||||
|
||||
// Setup the input file and the nested deps
|
||||
task.getInputFile().convention(jarTask.getArchiveFile());
|
||||
task.getInputFile().convention(jarTask.flatMap(AbstractArchiveTask::getArchiveFile));
|
||||
task.dependsOn(getTasks().named(JavaPlugin.JAR_TASK_NAME));
|
||||
task.getIncludesClientOnlyClasses().set(getProject().provider(extension::areEnvironmentSourceSetsSplit));
|
||||
};
|
||||
|
||||
@@ -28,15 +28,19 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.cadixdev.mercury.Mercury;
|
||||
import org.cadixdev.mercury.remapper.MercuryRemapper;
|
||||
import org.gradle.api.JavaVersion;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.file.ConfigurableFileCollection;
|
||||
import org.gradle.api.provider.Property;
|
||||
import org.gradle.api.provider.Provider;
|
||||
import org.gradle.api.tasks.Input;
|
||||
import org.gradle.api.tasks.InputFiles;
|
||||
import org.gradle.api.tasks.Nested;
|
||||
import org.gradle.api.tasks.compile.JavaCompile;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -69,7 +73,7 @@ public final class SourceRemapperService extends Service<SourceRemapperService.O
|
||||
task.getSourceNamespace(),
|
||||
task.getTargetNamespace()
|
||||
));
|
||||
o.getJavaCompileRelease().set(SourceRemapper.getJavaCompileRelease(task.getProject()));
|
||||
o.getJavaCompileRelease().set(getJavaCompileRelease(task.getProject()));
|
||||
o.getClasspath().from(task.getClasspath());
|
||||
});
|
||||
}
|
||||
@@ -135,4 +139,28 @@ public final class SourceRemapperService extends Service<SourceRemapperService.O
|
||||
|
||||
return mercury;
|
||||
}
|
||||
|
||||
public static int getJavaCompileRelease(Project project) {
|
||||
AtomicInteger release = new AtomicInteger(-1);
|
||||
|
||||
project.getTasks().withType(JavaCompile.class, javaCompile -> {
|
||||
Property<Integer> releaseProperty = javaCompile.getOptions().getRelease();
|
||||
|
||||
if (!releaseProperty.isPresent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int compileRelease = releaseProperty.get();
|
||||
release.set(Math.max(release.get(), compileRelease));
|
||||
});
|
||||
|
||||
final int i = release.get();
|
||||
|
||||
if (i < 0) {
|
||||
// Unable to find the release used to compile with, default to the current version
|
||||
return Integer.parseInt(JavaVersion.current().getMajorVersion());
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,17 +31,13 @@ import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.cadixdev.lorenz.MappingSet;
|
||||
import org.cadixdev.mercury.Mercury;
|
||||
import org.cadixdev.mercury.remapper.MercuryRemapper;
|
||||
import org.gradle.api.JavaVersion;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.internal.project.ProjectInternal;
|
||||
import org.gradle.api.provider.Property;
|
||||
import org.gradle.api.tasks.compile.JavaCompile;
|
||||
import org.gradle.internal.logging.progress.ProgressLogger;
|
||||
import org.gradle.internal.logging.progress.ProgressLoggerFactory;
|
||||
import org.slf4j.Logger;
|
||||
@@ -174,7 +170,8 @@ public class SourceRemapper {
|
||||
MappingSet mappings = lorenzMappingService.getMappings();
|
||||
|
||||
Mercury mercury = createMercuryWithClassPath(project, toNamed);
|
||||
mercury.setSourceCompatibilityFromRelease(getJavaCompileRelease(project));
|
||||
// Always use the latest version
|
||||
mercury.setSourceCompatibilityFromRelease(Integer.MAX_VALUE);
|
||||
|
||||
for (File file : extension.getUnmappedModCollection()) {
|
||||
Path path = file.toPath();
|
||||
@@ -206,30 +203,6 @@ public class SourceRemapper {
|
||||
return this.mercury;
|
||||
}
|
||||
|
||||
public static int getJavaCompileRelease(Project project) {
|
||||
AtomicInteger release = new AtomicInteger(-1);
|
||||
|
||||
project.getTasks().withType(JavaCompile.class, javaCompile -> {
|
||||
Property<Integer> releaseProperty = javaCompile.getOptions().getRelease();
|
||||
|
||||
if (!releaseProperty.isPresent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int compileRelease = releaseProperty.get();
|
||||
release.set(Math.max(release.get(), compileRelease));
|
||||
});
|
||||
|
||||
final int i = release.get();
|
||||
|
||||
if (i < 0) {
|
||||
// Unable to find the release used to compile with, default to the current version
|
||||
return Integer.parseInt(JavaVersion.current().getMajorVersion());
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public static void copyNonJavaFiles(Path from, Path to, Logger logger, Path source) throws IOException {
|
||||
Files.walk(from).forEach(path -> {
|
||||
Path targetPath = to.resolve(from.relativize(path).toString());
|
||||
|
||||
@@ -73,7 +73,10 @@ loom {
|
||||
mixin {
|
||||
useLegacyMixinAp = true
|
||||
|
||||
defaultRefmapName = "default-refmap0000.json"
|
||||
// After evaluate block only to test for https://github.com/FabricMC/fabric-loom/issues/1249
|
||||
afterEvaluate {
|
||||
defaultRefmapName = "default-refmap0000.json"
|
||||
}
|
||||
add(sourceSets["main"], "main-refmap0000.json")
|
||||
add(sourceSets["mixin"])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user