Rengenerate and download all files with --refresh-dependencies (#227)

* Re generate all files with --refresh-dependencies

* Always re-process jar processors

* Update mixin compile extensions
This commit is contained in:
modmuss50
2020-06-23 19:22:36 +01:00
committed by GitHub
parent 2f6071991c
commit 2d7421d4ed
10 changed files with 84 additions and 36 deletions

View File

@@ -51,6 +51,7 @@ import org.gradle.plugins.ide.idea.model.IdeaModel;
import net.fabricmc.loom.providers.LaunchProvider;
import net.fabricmc.loom.providers.MappingsProvider;
import net.fabricmc.loom.providers.MinecraftProvider;
import net.fabricmc.loom.providers.MappingsCache;
import net.fabricmc.loom.task.RemapJarTask;
import net.fabricmc.loom.task.RemapSourcesJarTask;
import net.fabricmc.loom.util.Constants;
@@ -63,6 +64,7 @@ import net.fabricmc.loom.util.mixin.JavaApInvoker;
import net.fabricmc.loom.util.mixin.KaptApInvoker;
import net.fabricmc.loom.util.mixin.ScalaApInvoker;
import net.fabricmc.loom.util.FabricApiExtension;
import net.fabricmc.loom.util.DownloadUtil;
public class AbstractPlugin implements Plugin<Project> {
protected Project project;
@@ -81,6 +83,14 @@ public class AbstractPlugin implements Plugin<Project> {
project.getLogger().lifecycle("Fabric Loom: " + AbstractPlugin.class.getPackage().getImplementationVersion());
boolean refreshDeps = project.getGradle().getStartParameter().isRefreshDependencies();
DownloadUtil.refreshDeps = refreshDeps;
if (refreshDeps) {
MappingsCache.INSTANCE.invalidate();
project.getLogger().lifecycle("Refresh dependencies is in use, loom will be significantly slower.");
}
// Apply default plugins
project.apply(ImmutableMap.of("plugin", "java"));
project.apply(ImmutableMap.of("plugin", "eclipse"));
@@ -135,33 +145,9 @@ public class AbstractPlugin implements Plugin<Project> {
configureIDEs();
configureCompile();
configureMixin();
configureMaven();
}
private void configureMixin() {
if (project.getPluginManager().hasPlugin("org.jetbrains.kotlin.kapt")) {
// If loom is applied after kapt, then kapt will use the AP arguments too early for loom to pass the arguments we need for mixin.
throw new IllegalArgumentException("fabric-loom must be applied BEFORE kapt in the plugins { } block.");
}
// Full plugin and mappings information is only available after evaluation
project.afterEvaluate((project) -> {
project.getLogger().lifecycle("Configuring compiler arguments for Java");
new JavaApInvoker(project).configureMixin();
if (project.getPluginManager().hasPlugin("scala")) {
project.getLogger().lifecycle("Configuring compiler arguments for Scala");
new ScalaApInvoker(project).configureMixin();
}
if (project.getPluginManager().hasPlugin("org.jetbrains.kotlin.kapt")) {
project.getLogger().lifecycle("Configuring compiler arguments for Kapt plugin");
new KaptApInvoker(project).configureMixin();
}
});
}
public Project getProject() {
return project;
}
@@ -298,7 +284,25 @@ public class AbstractPlugin implements Plugin<Project> {
AbstractArchiveTask jarTask = (AbstractArchiveTask) project1.getTasks().getByName("jar");
extension.addUnmappedMod(jarTask.getArchivePath().toPath());
}
project.getLogger().lifecycle("Configuring compiler arguments for Java");
new JavaApInvoker(project).configureMixin();
if (project.getPluginManager().hasPlugin("scala")) {
project.getLogger().lifecycle("Configuring compiler arguments for Scala");
new ScalaApInvoker(project).configureMixin();
}
if (project.getPluginManager().hasPlugin("org.jetbrains.kotlin.kapt")) {
project.getLogger().lifecycle("Configuring compiler arguments for Kapt plugin");
new KaptApInvoker(project).configureMixin();
}
});
if (project.getPluginManager().hasPlugin("org.jetbrains.kotlin.kapt")) {
// If loom is applied after kapt, then kapt will use the AP arguments too early for loom to pass the arguments we need for mixin.
throw new IllegalArgumentException("fabric-loom must be applied BEFORE kapt in the plugins { } block.");
}
}
protected void configureMaven() {