Update MCE - Remove auto population of minVersion in mixins - Drop some log levels.
This commit is contained in:
		
							parent
							
								
									b8058c693d
								
							
						
					
					
						commit
						409f5f8e93
					
				
					 10 changed files with 13 additions and 97 deletions
				
			
		|  | @ -27,13 +27,10 @@ package net.fabricmc.loom; | |||
| import java.io.File; | ||||
| import java.nio.file.Path; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Collection; | ||||
| import java.util.Collections; | ||||
| import java.util.HashSet; | ||||
| import java.util.List; | ||||
| import java.util.Objects; | ||||
| import java.util.Set; | ||||
| import java.util.function.BiPredicate; | ||||
| import java.util.function.Function; | ||||
| import java.util.function.Supplier; | ||||
| import java.util.stream.Collectors; | ||||
|  | @ -44,12 +41,10 @@ import org.cadixdev.mercury.Mercury; | |||
| import org.gradle.api.Action; | ||||
| import org.gradle.api.NamedDomainObjectContainer; | ||||
| import org.gradle.api.Project; | ||||
| import org.gradle.api.artifacts.Configuration; | ||||
| import org.gradle.api.artifacts.Dependency; | ||||
| import org.gradle.api.file.ConfigurableFileCollection; | ||||
| import org.gradle.api.plugins.BasePluginConvention; | ||||
| import org.jetbrains.annotations.ApiStatus; | ||||
| import org.jetbrains.annotations.Nullable; | ||||
| 
 | ||||
| import net.fabricmc.loom.api.decompilers.LoomDecompiler; | ||||
| import net.fabricmc.loom.configuration.LoomDependencyManager; | ||||
|  | @ -263,81 +258,6 @@ public class LoomGradleExtension { | |||
| 		return new File(getProjectPersistentCache(), "launch.cfg"); | ||||
| 	} | ||||
| 
 | ||||
| 	@Nullable | ||||
| 	private static Dependency findDependency(Project p, Collection<Configuration> configs, BiPredicate<String, String> groupNameFilter) { | ||||
| 		for (Configuration config : configs) { | ||||
| 			for (Dependency dependency : config.getDependencies()) { | ||||
| 				String group = dependency.getGroup(); | ||||
| 				String name = dependency.getName(); | ||||
| 
 | ||||
| 				if (groupNameFilter.test(group, name)) { | ||||
| 					p.getLogger().debug("Loom findDependency found: " + group + ":" + name + ":" + dependency.getVersion()); | ||||
| 					return dependency; | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		return null; | ||||
| 	} | ||||
| 
 | ||||
| 	@Nullable | ||||
| 	private <T> T recurseProjects(Function<Project, T> projectTFunction) { | ||||
| 		Project p = this.project; | ||||
| 		T result; | ||||
| 
 | ||||
| 		while (p.getRootProject() != p) { | ||||
| 			if ((result = projectTFunction.apply(p)) != null) { | ||||
| 				return result; | ||||
| 			} | ||||
| 
 | ||||
| 			p = p.getRootProject(); | ||||
| 		} | ||||
| 
 | ||||
| 		result = projectTFunction.apply(p); | ||||
| 		return result; | ||||
| 	} | ||||
| 
 | ||||
| 	@Nullable | ||||
| 	private Dependency getMixinDependency() { | ||||
| 		return recurseProjects(p -> { | ||||
| 			List<Configuration> configs = new ArrayList<>(); | ||||
| 			// check compile classpath first | ||||
| 			Configuration possibleCompileClasspath = p.getConfigurations().findByName("compileClasspath"); | ||||
| 
 | ||||
| 			if (possibleCompileClasspath != null) { | ||||
| 				configs.add(possibleCompileClasspath); | ||||
| 			} | ||||
| 
 | ||||
| 			// failing that, buildscript | ||||
| 			configs.addAll(p.getBuildscript().getConfigurations()); | ||||
| 
 | ||||
| 			return findDependency(p, configs, (group, name) -> { | ||||
| 				if (name.equalsIgnoreCase("mixin") && group.equalsIgnoreCase("org.spongepowered")) { | ||||
| 					return true; | ||||
| 				} | ||||
| 
 | ||||
| 				return name.equalsIgnoreCase("sponge-mixin") && group.equalsIgnoreCase("net.fabricmc"); | ||||
| 			}); | ||||
| 		}); | ||||
| 	} | ||||
| 
 | ||||
| 	@Nullable | ||||
| 	public String getMixinJsonVersion() { | ||||
| 		Dependency dependency = getMixinDependency(); | ||||
| 
 | ||||
| 		if (dependency != null) { | ||||
| 			if (dependency.getGroup().equalsIgnoreCase("net.fabricmc")) { | ||||
| 				if (Objects.requireNonNull(dependency.getVersion()).split("\\.").length >= 4) { | ||||
| 					return dependency.getVersion().substring(0, dependency.getVersion().lastIndexOf('.')) + "-SNAPSHOT"; | ||||
| 				} | ||||
| 			} | ||||
| 
 | ||||
| 			return dependency.getVersion(); | ||||
| 		} | ||||
| 
 | ||||
| 		return null; | ||||
| 	} | ||||
| 
 | ||||
| 	public String getLoaderLaunchMethod() { | ||||
| 		return loaderLaunchMethod != null ? loaderLaunchMethod : ""; | ||||
| 	} | ||||
|  |  | |||
|  | @ -42,7 +42,7 @@ import net.fabricmc.loom.LoomGradlePlugin; | |||
| public final class MixinRefmapHelper { | ||||
| 	private MixinRefmapHelper() { } | ||||
| 
 | ||||
| 	public static boolean addRefmapName(String filename, String mixinVersion, Path outputPath) { | ||||
| 	public static boolean addRefmapName(String filename, Path outputPath) { | ||||
| 		File output = outputPath.toFile(); | ||||
| 		Set<String> mixinFilenames = findMixins(output, true); | ||||
| 
 | ||||
|  | @ -56,10 +56,6 @@ public final class MixinRefmapHelper { | |||
| 						json.addProperty("refmap", filename); | ||||
| 					} | ||||
| 
 | ||||
| 					if (!json.has("minVersion") && mixinVersion != null) { | ||||
| 						json.addProperty("minVersion", mixinVersion); | ||||
| 					} | ||||
| 
 | ||||
| 					return LoomGradlePlugin.GSON.toJson(json); | ||||
| 				} | ||||
| 			})).toArray(ZipEntryTransformerEntry[]::new)); | ||||
|  |  | |||
|  | @ -51,7 +51,7 @@ public class MinecraftProcessedProvider extends MinecraftMappedProvider { | |||
| 	@Override | ||||
| 	protected void addDependencies(DependencyInfo dependency, Consumer<Runnable> postPopulationScheduler) { | ||||
| 		if (jarProcessorManager.isInvalid(projectMappedJar) || isRefreshDeps()) { | ||||
| 			getProject().getLogger().lifecycle(":processing mapped jar"); | ||||
| 			getProject().getLogger().info(":processing mapped jar"); | ||||
| 			invalidateJars(); | ||||
| 
 | ||||
| 			try { | ||||
|  |  | |||
|  | @ -217,7 +217,7 @@ public class MinecraftProvider extends DependencyProvider { | |||
| 	} | ||||
| 
 | ||||
| 	private void mergeJars(Logger logger) throws IOException { | ||||
| 		logger.lifecycle(":merging jars"); | ||||
| 		logger.info(":merging jars"); | ||||
| 
 | ||||
| 		try (JarMerger jarMerger = new JarMerger(minecraftClientJar, minecraftServerJar, minecraftMergedJar)) { | ||||
| 			jarMerger.enableSyntheticParamsOffset(); | ||||
|  |  | |||
|  | @ -176,7 +176,7 @@ public class MappingsProvider extends DependencyProvider { | |||
| 	} | ||||
| 
 | ||||
| 	private void storeMappings(Project project, MinecraftProvider minecraftProvider, Path yarnJar) throws IOException { | ||||
| 		project.getLogger().lifecycle(":extracting " + yarnJar.getFileName()); | ||||
| 		project.getLogger().info(":extracting " + yarnJar.getFileName()); | ||||
| 
 | ||||
| 		try (FileSystem fileSystem = FileSystems.newFileSystem(yarnJar, (ClassLoader) null)) { | ||||
| 			extractMappings(fileSystem, baseTinyMappings); | ||||
|  |  | |||
|  | @ -73,7 +73,7 @@ public class MinecraftAssetsProvider { | |||
| 		File checksumInfo = new File(assets, "checksum" + File.separator + minecraftProvider.getMinecraftVersion() + ".json"); | ||||
| 
 | ||||
| 		if (!assetsInfo.exists() || !Checksum.equals(assetsInfo, assetIndex.sha1)) { | ||||
| 			project.getLogger().lifecycle(":downloading asset index"); | ||||
| 			project.getLogger().info(":downloading asset index"); | ||||
| 
 | ||||
| 			if (offline) { | ||||
| 				if (assetsInfo.exists()) { | ||||
|  |  | |||
|  | @ -87,7 +87,7 @@ public class MigrateMappingsTask extends AbstractLoomTask { | |||
| 		Project project = getProject(); | ||||
| 		LoomGradleExtension extension = getExtension(); | ||||
| 
 | ||||
| 		project.getLogger().lifecycle(":loading mappings"); | ||||
| 		project.getLogger().info(":loading mappings"); | ||||
| 
 | ||||
| 		if (!Files.exists(inputDir) || !Files.isDirectory(inputDir)) { | ||||
| 			throw new IllegalArgumentException("Could not find input directory: " + inputDir.toAbsolutePath()); | ||||
|  | @ -161,7 +161,7 @@ public class MigrateMappingsTask extends AbstractLoomTask { | |||
| 	private static void migrateMappings(Project project, MinecraftMappedProvider minecraftMappedProvider, | ||||
| 										Path inputDir, Path outputDir, TinyTree currentMappings, TinyTree targetMappings | ||||
| 	) throws IOException { | ||||
| 		project.getLogger().lifecycle(":joining mappings"); | ||||
| 		project.getLogger().info(":joining mappings"); | ||||
| 
 | ||||
| 		MappingSet mappingSet = new TinyMappingsJoiner( | ||||
| 				currentMappings, "named", | ||||
|  | @ -191,7 +191,7 @@ public class MigrateMappingsTask extends AbstractLoomTask { | |||
| 			project.getLogger().warn("Could not remap fully!", e); | ||||
| 		} | ||||
| 
 | ||||
| 		project.getLogger().lifecycle(":cleaning file descriptors"); | ||||
| 		project.getLogger().info(":cleaning file descriptors"); | ||||
| 		System.gc(); | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -116,7 +116,7 @@ public class RemapJarTask extends Jar { | |||
| 			remapOption.execute(remapperBuilder); | ||||
| 		} | ||||
| 
 | ||||
| 		project.getLogger().lifecycle(":remapping " + input.getFileName()); | ||||
| 		project.getLogger().info(":remapping " + input.getFileName()); | ||||
| 
 | ||||
| 		StringBuilder rc = new StringBuilder("Remap classpath: "); | ||||
| 
 | ||||
|  | @ -148,7 +148,7 @@ public class RemapJarTask extends Jar { | |||
| 			throw new RuntimeException("Failed to remap " + input + " to " + output + " - file missing!"); | ||||
| 		} | ||||
| 
 | ||||
| 		if (MixinRefmapHelper.addRefmapName(extension.getRefmapName(), extension.getMixinJsonVersion(), output)) { | ||||
| 		if (MixinRefmapHelper.addRefmapName(extension.getRefmapName(), output)) { | ||||
| 			project.getLogger().debug("Transformed mixin reference maps in output JAR!"); | ||||
| 		} | ||||
| 
 | ||||
|  | @ -218,7 +218,7 @@ public class RemapJarTask extends Jar { | |||
| 						throw new RuntimeException("Failed to remap " + input + " to " + output + " - file missing!"); | ||||
| 					} | ||||
| 
 | ||||
| 					if (MixinRefmapHelper.addRefmapName(extension.getRefmapName(), extension.getMixinJsonVersion(), output)) { | ||||
| 					if (MixinRefmapHelper.addRefmapName(extension.getRefmapName(), output)) { | ||||
| 						project.getLogger().debug("Transformed mixin reference maps in output JAR!"); | ||||
| 					} | ||||
| 
 | ||||
|  |  | |||
|  | @ -99,7 +99,7 @@ public class Constants { | |||
| 		 * Constants for versions of dependencies. | ||||
| 		 */ | ||||
| 		public static final class Versions { | ||||
| 			public static final String MIXIN_COMPILE_EXTENSIONS = "0.3.2.6"; | ||||
| 			public static final String MIXIN_COMPILE_EXTENSIONS = "0.4.0"; | ||||
| 			public static final String DEV_LAUNCH_INJECTOR = "0.2.1+build.8"; | ||||
| 			public static final String TERMINAL_CONSOLE_APPENDER = "1.2.0"; | ||||
| 			public static final String JETBRAINS_ANNOTATIONS = "19.0.0"; | ||||
|  |  | |||
|  | @ -173,7 +173,7 @@ public class SourceRemapper { | |||
| 		MappingSet mappings = extension.getOrCreateSrcMappingCache(toNamed ? 1 : 0, () -> { | ||||
| 			try { | ||||
| 				TinyTree m = mappingsProvider.getMappings(); | ||||
| 				project.getLogger().lifecycle(":loading " + (toNamed ? "intermediary -> named" : "named -> intermediary") + " source mappings"); | ||||
| 				project.getLogger().info(":loading " + (toNamed ? "intermediary -> named" : "named -> intermediary") + " source mappings"); | ||||
| 				return new TinyMappingsReader(m, toNamed ? "intermediary" : "named", toNamed ? "named" : "intermediary").read(); | ||||
| 			} catch (Exception e) { | ||||
| 				throw new RuntimeException(e); | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue