Merge remote-tracking branch 'FabricMC/dev/0.6' into dev/0.6-forge

# Conflicts:
#	.github/workflows/test-push.yml
#	build.gradle
#	src/main/java/net/fabricmc/loom/util/Constants.java
This commit is contained in:
shedaniel
2021-01-18 09:08:38 +08:00
8 changed files with 53 additions and 32 deletions

View File

@@ -43,30 +43,34 @@ dependencies {
implementation gradleApi()
// libraries
implementation ('commons-io:commons-io:2.6')
implementation ('org.zeroturnaround:zt-zip:1.13')
implementation ('com.google.code.gson:gson:2.8.5')
implementation ('com.google.guava:guava:28.0-jre')
implementation ('commons-io:commons-io:2.8.0')
implementation ('org.zeroturnaround:zt-zip:1.14')
implementation ('com.google.code.gson:gson:2.8.6')
implementation ('com.google.guava:guava:30.1-jre')
implementation ('org.ow2.asm:asm:9.0')
implementation ('org.ow2.asm:asm-analysis:9.0')
implementation ('org.ow2.asm:asm-commons:9.0')
implementation ('org.ow2.asm:asm-tree:9.0')
implementation ('org.ow2.asm:asm-util:9.0')
// game handling utils
implementation ('net.fabricmc:stitch:0.4.6+build.74') {
implementation ('net.fabricmc:stitch:0.5.1+build.77') {
exclude module: 'mercury'
exclude module: 'enigma'
}
// tinyfile management
implementation ('net.fabricmc:tiny-remapper:0.3.0.70')
implementation ('net.fabricmc:tiny-mappings-parser:0.2.2.14')
implementation ('net.fabricmc:tiny-remapper:0.3.2')
implementation ('net.fabricmc:tiny-mappings-parser:0.3.0+build.17')
implementation 'net.fabricmc:access-widener:1.0.0'
implementation ('net.fabricmc:lorenz-tiny:2.0.0+build.2') {
implementation ('net.fabricmc:lorenz-tiny:3.0.0') {
transitive = false
}
implementation ('org.cadixdev:lorenz-io-proguard:0.5.5')
implementation ('org.cadixdev:lorenz-io-proguard:0.5.6')
// decompilers
implementation ('net.fabricmc:procyon-fabric-compilertools:0.5.35.13')
implementation ('net.fabricmc:fabric-fernflower:1.3.0')
implementation ('org.benf:cfr:0.150')
@@ -74,7 +78,7 @@ dependencies {
implementation ('org.cadixdev:mercury:0.2.8')
// Kapt integration
compileOnly('org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72')
compileOnly('org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21')
// Forge patches
implementation ('net.minecraftforge:binarypatcher:1.1.1')

View File

@@ -142,7 +142,7 @@ public final class CompileConfiguration {
extendsFrom(Constants.Configurations.LOADER_DEPENDENCIES, Constants.Configurations.MINECRAFT_DEPENDENCIES, project);
extendsFrom(Constants.Configurations.MINECRAFT_NAMED, Constants.Configurations.LOADER_DEPENDENCIES, project);
extendsFrom(JavaPlugin.COMPILE_CONFIGURATION_NAME, Constants.Configurations.MAPPINGS_FINAL, project);
extendsFrom(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, Constants.Configurations.MAPPINGS_FINAL, project);
}
/**

View File

@@ -63,10 +63,6 @@ public abstract class DependencyProvider {
public abstract String getTargetConfig();
public void addDependency(Object object) {
addDependency(object, "compile");
}
public Dependency addDependency(Object object, String target) {
if (object instanceof File) {
object = project.files(object);

View File

@@ -25,6 +25,10 @@
package net.fabricmc.loom.configuration;
import org.gradle.api.artifacts.ConfigurationContainer;
import org.gradle.api.plugins.JavaPlugin;
import net.fabricmc.loom.util.Constants;
import net.fabricmc.loom.util.gradle.GradleSupport;
public class RemappedConfigurationEntry {
private final String sourceConfiguration;
@@ -61,7 +65,7 @@ public class RemappedConfigurationEntry {
public String getTargetConfiguration(ConfigurationContainer container) {
if (container.findByName(targetConfiguration) == null) {
return "compile";
return GradleSupport.IS_GRADLE_7_OR_NEWER ? JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME : Constants.Configurations.COMPILE;
}
return targetConfiguration;

View File

@@ -27,9 +27,11 @@ package net.fabricmc.loom.util;
import java.util.List;
import com.google.common.collect.ImmutableList;
import org.gradle.api.plugins.JavaPlugin;
import org.objectweb.asm.Opcodes;
import net.fabricmc.loom.configuration.RemappedConfigurationEntry;
import net.fabricmc.loom.util.gradle.GradleSupport;
public class Constants {
public static final String LIBRARIES_BASE = "https://libraries.minecraft.net/";
@@ -40,14 +42,23 @@ public class Constants {
public static final int ASM_VERSION = Opcodes.ASM9;
public static final List<RemappedConfigurationEntry> MOD_COMPILE_ENTRIES = ImmutableList.of(
new RemappedConfigurationEntry("modCompile", "compile", true, "compile"),
new RemappedConfigurationEntry("modApi", "api", true, "compile"),
new RemappedConfigurationEntry("modImplementation", "implementation", true, "runtime"),
new RemappedConfigurationEntry("modRuntime", "runtimeOnly", false, ""),
new RemappedConfigurationEntry("modCompileOnly", "compileOnly", true, "")
private static final List<RemappedConfigurationEntry> LEGACY_MOD_COMPILE_ENTRIES = ImmutableList.of(
new RemappedConfigurationEntry("modCompile", Configurations.COMPILE, true, "compile"),
new RemappedConfigurationEntry("modApi", JavaPlugin.API_CONFIGURATION_NAME, true, "compile"),
new RemappedConfigurationEntry("modImplementation", JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, true, "runtime"),
new RemappedConfigurationEntry("modRuntime", JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME, false, ""),
new RemappedConfigurationEntry("modCompileOnly", JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, true, "")
);
private static final List<RemappedConfigurationEntry> MODERN_MOD_COMPILE_ENTRIES = ImmutableList.of(
new RemappedConfigurationEntry("modApi", JavaPlugin.API_CONFIGURATION_NAME, true, "compile"),
new RemappedConfigurationEntry("modImplementation", JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, true, "runtime"),
new RemappedConfigurationEntry("modRuntime", JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME, false, ""),
new RemappedConfigurationEntry("modCompileOnly", JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, true, "")
);
public static final List<RemappedConfigurationEntry> MOD_COMPILE_ENTRIES = GradleSupport.IS_GRADLE_7_OR_NEWER ? MODERN_MOD_COMPILE_ENTRIES : LEGACY_MOD_COMPILE_ENTRIES;
private Constants() {
}
@@ -72,6 +83,8 @@ public class Constants {
public static final String FORGE_INSTALLER = "forgeInstaller";
public static final String FORGE_UNIVERSAL = "forgeUniversal";
public static final String FORGE_DEPENDENCIES = "forgeDependencies";
@Deprecated // Not to be used in gradle 7+
public static final String COMPILE = "compile";
private Configurations() {
}

View File

@@ -38,6 +38,7 @@ import org.cadixdev.mercury.Mercury;
import org.cadixdev.mercury.remapper.MercuryRemapper;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.plugins.JavaPlugin;
import org.zeroturnaround.zip.ZipUtil;
import net.fabricmc.loom.LoomGradleExtension;
@@ -196,7 +197,7 @@ public class SourceRemapper {
}
Dependency annotationDependency = extension.getDependencyManager().getProvider(LaunchProvider.class).annotationDependency;
Set<File> files = project.getConfigurations().getByName("compileOnly")
Set<File> files = project.getConfigurations().getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME)
.files(annotationDependency);
for (File file : files) {

View File

@@ -28,9 +28,12 @@ import java.lang.reflect.Method;
import org.gradle.api.Project;
import org.gradle.api.file.RegularFileProperty;
import org.gradle.util.GradleVersion;
// This is used to bridge the gap over large gradle api changes.
public class GradleSupport {
public static final boolean IS_GRADLE_7_OR_NEWER = isIsGradle7OrNewer();
public static RegularFileProperty getfileProperty(Project project) {
try {
// First try the new method, if that fails fall back.
@@ -59,4 +62,9 @@ public class GradleSupport {
method.setAccessible(true);
return (RegularFileProperty) method.invoke(object);
}
public static boolean isIsGradle7OrNewer() {
String version = GradleVersion.current().getVersion();
return Integer.parseInt(version.substring(0, version.indexOf("."))) >= 7;
}
}

View File

@@ -24,10 +24,10 @@ dependencies {
//to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:\${project.minecraft_version}"
mappings ${mappingsDep}
modCompile "net.fabricmc:fabric-loader:\${project.loader_version}"
modImplementation "net.fabricmc:fabric-loader:\${project.loader_version}"
// Fabric API. This is technically optional, but you probably want it anyway.
modCompile "net.fabricmc.fabric-api:fabric-api:\${project.fabric_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:\${project.fabric_version}"
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them.
@@ -36,14 +36,9 @@ dependencies {
processResources {
inputs.property "version", project.version
from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
filesMatching("fabric.mod.json") {
expand "version": project.version
}
from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}
// ensure that the encoding is set to UTF-8, no matter what the system default is