Merge remote-tracking branch 'FabricMC/dev/0.9' into dev/0.9

Signed-off-by: shedaniel <daniel@shedaniel.me>

# Conflicts:
#	build.gradle
#	src/main/java/net/fabricmc/loom/util/SourceRemapper.java
This commit is contained in:
shedaniel
2021-07-11 00:21:59 +08:00
8 changed files with 26 additions and 27 deletions

View File

@@ -80,11 +80,11 @@ dependencies {
implementation ('com.google.code.gson:gson:2.8.6')
implementation ('com.fasterxml.jackson.core:jackson-databind:2.12.3')
implementation ('com.google.guava:guava:30.1-jre')
implementation ('org.ow2.asm:asm:9.1')
implementation ('org.ow2.asm:asm-analysis:9.1')
implementation ('org.ow2.asm:asm-commons:9.1')
implementation ('org.ow2.asm:asm-tree:9.1')
implementation ('org.ow2.asm:asm-util:9.1')
implementation ('org.ow2.asm:asm:9.2')
implementation ('org.ow2.asm:asm-analysis:9.2')
implementation ('org.ow2.asm:asm-commons:9.2')
implementation ('org.ow2.asm:asm-tree:9.2')
implementation ('org.ow2.asm:asm-util:9.2')
implementation ('me.tongfei:progressbar:0.9.0')
// game handling utils

View File

@@ -40,7 +40,6 @@ import java.util.stream.Collectors;
import org.apache.commons.io.FileUtils;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.plugins.JavaPlugin;
import net.fabricmc.loom.configuration.DependencyProvider;
@@ -49,8 +48,6 @@ import net.fabricmc.loom.configuration.launch.LaunchProviderSettings;
import net.fabricmc.loom.util.Constants;
public class LaunchProvider extends DependencyProvider {
public Dependency annotationDependency;
public LaunchProvider(Project project) {
super(project);
}
@@ -134,7 +131,7 @@ public class LaunchProvider extends DependencyProvider {
addDependency(Constants.Dependencies.DEV_LAUNCH_INJECTOR + Constants.Dependencies.Versions.DEV_LAUNCH_INJECTOR, Constants.Configurations.LOOM_DEVELOPMENT_DEPENDENCIES);
addDependency(Constants.Dependencies.TERMINAL_CONSOLE_APPENDER + Constants.Dependencies.Versions.TERMINAL_CONSOLE_APPENDER, Constants.Configurations.LOOM_DEVELOPMENT_DEPENDENCIES);
annotationDependency = addDependency(Constants.Dependencies.JETBRAINS_ANNOTATIONS + Constants.Dependencies.Versions.JETBRAINS_ANNOTATIONS, JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME);
addDependency(Constants.Dependencies.JETBRAINS_ANNOTATIONS + Constants.Dependencies.Versions.JETBRAINS_ANNOTATIONS, JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME);
if (getExtension().isForge()) {
addDependency(Constants.Dependencies.FORGE_RUNTIME + Constants.Dependencies.Versions.FORGE_RUNTIME, JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME);

View File

@@ -43,14 +43,11 @@ import org.cadixdev.lorenz.MappingSet;
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.artifacts.ResolvedArtifact;
import org.gradle.api.plugins.JavaPlugin;
import org.zeroturnaround.zip.ZipUtil;
import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.build.ModCompileRemapper;
import net.fabricmc.loom.configuration.providers.LaunchProvider;
import net.fabricmc.loom.configuration.providers.minecraft.MinecraftMappedProvider;
import net.fabricmc.loom.task.GenerateSourcesTask;
import net.fabricmc.loom.util.Constants;
@@ -178,9 +175,9 @@ public class ForgeSourcesRemapper {
mappings.getOrCreateClassMapping(entry.getKey()).setDeobfuscatedName(entry.getValue());
}
Dependency annotationDependency = extension.getDependencyManager().getProvider(LaunchProvider.class).annotationDependency;
Set<File> files = project.getConfigurations().getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME)
.files(annotationDependency);
Set<File> files = project.getConfigurations()
.detachedConfiguration(project.getDependencies().create(Constants.Dependencies.JETBRAINS_ANNOTATIONS + Constants.Dependencies.Versions.JETBRAINS_ANNOTATIONS))
.resolve();
for (File file : files) {
mercury.getClassPath().add(file.toPath());

View File

@@ -47,7 +47,7 @@ public class UnpickJarTask extends JavaExec {
public UnpickJarTask() {
getOutputs().upToDateWhen(e -> false);
classpath(getProject().getConfigurations().getByName(Constants.Configurations.UNPICK_CLASSPATH));
setMain("daomephsta.unpick.cli.Main");
getMainClass().set("daomephsta.unpick.cli.Main");
}
@Override

View File

@@ -38,13 +38,10 @@ import org.cadixdev.lorenz.MappingSet;
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;
import net.fabricmc.loom.configuration.RemappedConfigurationEntry;
import net.fabricmc.loom.configuration.providers.LaunchProvider;
import net.fabricmc.loom.configuration.providers.mappings.MappingsProviderImpl;
import net.fabricmc.loom.configuration.providers.minecraft.tr.MercuryUtils;
import net.fabricmc.lorenztiny.TinyMappingsReader;
@@ -214,9 +211,9 @@ public class SourceRemapper {
m.getClassPath().add(extension.getMinecraftMappedProvider().getSrgJar().toPath());
}
Dependency annotationDependency = extension.getDependencyManager().getProvider(LaunchProvider.class).annotationDependency;
Set<File> files = project.getConfigurations().getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME)
.files(annotationDependency);
Set<File> files = project.getConfigurations()
.detachedConfiguration(project.getDependencies().create(Constants.Dependencies.JETBRAINS_ANNOTATIONS + Constants.Dependencies.Versions.JETBRAINS_ANNOTATIONS))
.resolve();
for (File file : files) {
m.getClassPath().add(file.toPath());

View File

@@ -49,8 +49,8 @@ class ReproducibleBuildTest extends Specification implements ProjectTestTrait {
getOutputHash("fabric-example-mod-1.0.0-sources.jar") in sourceHash // Done for different line endings.
where:
gradle | modHash | sourceHash
DEFAULT_GRADLE | "6132ffb4117adb7e258f663110552952" | ["be31766e6cafbe4ae3bca9e35ba63169", "7348b0bd87d36d7ec6f3bca9c2b66062"]
PRE_RELEASE_GRADLE | "6132ffb4117adb7e258f663110552952" | ["be31766e6cafbe4ae3bca9e35ba63169", "7348b0bd87d36d7ec6f3bca9c2b66062"]
DEFAULT_GRADLE | "0f954aa060fd8fc005e834c7cd271303" | ["be31766e6cafbe4ae3bca9e35ba63169", "7348b0bd87d36d7ec6f3bca9c2b66062"]
PRE_RELEASE_GRADLE | "0f954aa060fd8fc005e834c7cd271303" | ["be31766e6cafbe4ae3bca9e35ba63169", "7348b0bd87d36d7ec6f3bca9c2b66062"]
}
String getOutputHash(String name) {

View File

@@ -42,17 +42,25 @@ class UnpickTest extends Specification implements ProjectTestTrait {
def "unpick decompile"() {
when:
def result = create("genSources")
def result = create("genSources", gradle)
then:
result.task(":genSources").outcome == SUCCESS
getClassSource("net/minecraft/block/CakeBlock.java").contains("Block.DEFAULT_SET_BLOCK_STATE_FLAG")
where:
gradle | _
DEFAULT_GRADLE | _
PRE_RELEASE_GRADLE | _
}
def "unpick build"() {
when:
def result = create("build")
def result = create("build", gradle)
then:
result.task(":build").outcome == SUCCESS
where:
gradle | _
DEFAULT_GRADLE | _
PRE_RELEASE_GRADLE | _
}
String getClassSource(String classname, String mappings = MAPPINGS) {

View File

@@ -29,7 +29,7 @@ import org.gradle.testkit.runner.GradleRunner
trait ProjectTestTrait {
final static String DEFAULT_GRADLE = "7.0.1"
final static String PRE_RELEASE_GRADLE = "7.2-20210612220215+0000"
final static String PRE_RELEASE_GRADLE = "7.2-20210704221017+0000"
static File gradleHome = File.createTempDir()
File testProjectDir = File.createTempDir()