Merge remote-tracking branch 'FabricMC/dev/0.12' into dev/0.12.0

# Conflicts:
#	src/test/kotlin/net/fabricmc/loom/test/kotlin/KotlinClassMetadataRemappingAnnotationVisitorTest.kt
This commit is contained in:
shedaniel
2022-06-04 16:51:14 +08:00
4 changed files with 23 additions and 11 deletions

View File

@@ -5,6 +5,7 @@ import java.util.List;
import org.gradle.api.JavaVersion;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.plugins.PluginAware;
import org.gradle.util.GradleVersion;
@@ -21,7 +22,21 @@ public class LoomGradlePluginBootstrap implements Plugin<PluginAware> {
private static final String IDEA_VERSION_PROP_KEY = "idea.version";
@Override
public void apply(PluginAware project) {
public void apply(PluginAware pluginAware) {
if (pluginAware instanceof Project) {
Project project = (Project) pluginAware;
if (project.findProperty("fabric.loom.skip-env-validation") == null) {
validateEnvironment();
} else {
project.getLogger().lifecycle("Loom environment validation disabled. Please re-enable before reporting any issues.");
}
}
getActivePlugin().apply(pluginAware);
}
private void validateEnvironment() {
List<String> errors = new ArrayList<>();
if (!isValidGradleRuntime()) {
@@ -50,8 +65,6 @@ public class LoomGradlePluginBootstrap implements Plugin<PluginAware> {
if (!errors.isEmpty()) {
throw new UnsupportedOperationException(String.join("\n", errors));
}
getActivePlugin().apply(project);
}
private static boolean isValidJavaRuntime() {

View File

@@ -312,9 +312,12 @@ task writeActionsTestMatrix() {
}
}
// Run all the unit tests togeather
// Run all the unit tests together
testMatrix.add("net.fabricmc.loom.test.unit.*")
// Kotlin tests
testMatrix.add("net.fabricmc.loom.test.kotlin.*")
def json = groovy.json.JsonOutput.toJson(testMatrix)
def output = file("build/test_matrix.json")
output.parentFile.mkdir()

View File

@@ -46,14 +46,15 @@ public class MinecraftLibraryProvider {
final BundleMetadata serverBundleMetadata = minecraftProvider.getServerBundleMetadata();
final boolean runtimeOnlyLog4j = extension.getRuntimeOnlyLog4j().get();
final boolean overrideLWJGL = LWJGLVersionOverride.overrideByDefault(versionInfo) || LWJGLVersionOverride.forceOverride(project) || Boolean.getBoolean("loom.test.lwjgloverride");
final boolean hasNativesToExtract = versionInfo.hasNativesToExtract();
final boolean overrideLWJGL = hasNativesToExtract && (LWJGLVersionOverride.overrideByDefault(versionInfo) || LWJGLVersionOverride.forceOverride(project) || Boolean.getBoolean("loom.test.lwjgloverride"));
final boolean isMacOS = OperatingSystem.CURRENT_OS.equals(OperatingSystem.MAC_OS);
if (overrideLWJGL) {
project.getLogger().warn("Loom is upgrading Minecraft's LWJGL version to {}", LWJGLVersionOverride.LWJGL_VERSION);
}
if (versionInfo.hasNativesToExtract()) {
if (hasNativesToExtract) {
extension.createLazyConfiguration(Constants.Configurations.MINECRAFT_NATIVES, configuration -> configuration.setTransitive(false));
}

View File

@@ -30,7 +30,6 @@ import net.fabricmc.loom.kotlin.remapping.KotlinMetadataRemappingClassVisitor
import net.fabricmc.loom.util.TinyRemapperHelper
import net.fabricmc.mappingio.MappingReader
import net.fabricmc.mappingio.tree.MemoryMappingTree
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import org.objectweb.asm.ClassReader
import org.objectweb.asm.ClassVisitor
@@ -71,8 +70,6 @@ class KotlinClassMetadataRemappingAnnotationVisitorTest {
println(d2In)
println(d2Out)
assertEquals(d2In.size, d2Out.size)
}
@Test
@@ -95,8 +92,6 @@ class KotlinClassMetadataRemappingAnnotationVisitorTest {
println(d2In)
println(d2Out)
assertEquals(d2In.size, d2Out.size)
}
private fun getClassBytes(name: String): ByteArray {