General cleanup
This commit is contained in:
		
							parent
							
								
									6083146127
								
							
						
					
					
						commit
						1955bcb2ea
					
				
					 34 changed files with 124 additions and 168 deletions
				
			
		|  | @ -1,5 +1,2 @@ | ||||||
| [*.kt] | [*.{gradle,java}] | ||||||
| indent_style = tab |  | ||||||
| 
 |  | ||||||
| [*.gradle] |  | ||||||
| indent_style = tab | indent_style = tab | ||||||
							
								
								
									
										54
									
								
								build.gradle
									
									
									
									
									
								
							
							
						
						
									
										54
									
								
								build.gradle
									
									
									
									
									
								
							|  | @ -15,18 +15,18 @@ group = 'net.fabricmc' | ||||||
| archivesBaseName = project.name | archivesBaseName = project.name | ||||||
| def baseVersion = '0.5' | def baseVersion = '0.5' | ||||||
| 
 | 
 | ||||||
| def build = "local" | def build = 'local' | ||||||
| def ENV = System.getenv() | def ENV = System.getenv() | ||||||
| if (ENV.BUILD_NUMBER) { | if (ENV.BUILD_NUMBER) { | ||||||
| 	build = "jenkins #${ENV.BUILD_NUMBER}" | 	build = 'jenkins #${ENV.BUILD_NUMBER}' | ||||||
| 	version = baseVersion + "." + ENV.BUILD_NUMBER | 	version = baseVersion + '.' + ENV.BUILD_NUMBER | ||||||
| } else { | } else { | ||||||
| 	version = baseVersion + ".local" | 	version = baseVersion + '.local' | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| repositories { | repositories { | ||||||
| 	maven { | 	maven { | ||||||
| 		name = "Fabric" | 		name = 'Fabric' | ||||||
| 		url = 'https://maven.fabricmc.net/' | 		url = 'https://maven.fabricmc.net/' | ||||||
| 	} | 	} | ||||||
| 	mavenCentral() | 	mavenCentral() | ||||||
|  | @ -63,18 +63,18 @@ dependencies { | ||||||
| 	implementation ('org.cadixdev:mercury:0.1.0.fabric-SNAPSHOT') | 	implementation ('org.cadixdev:mercury:0.1.0.fabric-SNAPSHOT') | ||||||
| 
 | 
 | ||||||
| 	// Kapt integration | 	// Kapt integration | ||||||
| 	compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72") | 	compileOnly('org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72') | ||||||
| 
 | 
 | ||||||
| 	// Testing | 	// Testing | ||||||
| 	testImplementation(gradleTestKit()) | 	testImplementation(gradleTestKit()) | ||||||
| 	testImplementation("org.spockframework:spock-core:1.3-groovy-2.4") { | 	testImplementation('org.spockframework:spock-core:1.3-groovy-2.4') { | ||||||
| 		exclude module: 'groovy-all' | 		exclude module: 'groovy-all' | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| jar { | jar { | ||||||
| 	manifest { | 	manifest { | ||||||
| 		attributes 'Implementation-Version': version + " Build(" + build + ")" | 		attributes 'Implementation-Version': version + ' Build(' + build + ')' | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -95,7 +95,7 @@ license { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| checkstyle { | checkstyle { | ||||||
| 	configFile = file("checkstyle.xml") | 	configFile = file('checkstyle.xml') | ||||||
| 	toolVersion = '8.25' | 	toolVersion = '8.25' | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -106,8 +106,8 @@ checkstyleMain { | ||||||
| gradlePlugin { | gradlePlugin { | ||||||
| 	plugins { | 	plugins { | ||||||
| 		fabricLoom { | 		fabricLoom { | ||||||
| 			id = "fabric-loom" | 			id = 'fabric-loom' | ||||||
| 			implementationClass = "net.fabricmc.loom.LoomGradlePlugin" | 			implementationClass = 'net.fabricmc.loom.LoomGradlePlugin' | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | @ -123,7 +123,7 @@ publishing { | ||||||
| 			artifactId project.archivesBaseName | 			artifactId project.archivesBaseName | ||||||
| 			version project.version | 			version project.version | ||||||
| 
 | 
 | ||||||
| 			from components["java"] | 			from components['java'] | ||||||
| 
 | 
 | ||||||
| 			artifact sourcesJar | 			artifact sourcesJar | ||||||
| 			artifact javadocJar | 			artifact javadocJar | ||||||
|  | @ -133,9 +133,9 @@ publishing { | ||||||
| 		snapshot(MavenPublication) { publication -> | 		snapshot(MavenPublication) { publication -> | ||||||
| 			groupId project.group | 			groupId project.group | ||||||
| 			artifactId project.archivesBaseName | 			artifactId project.archivesBaseName | ||||||
| 			version baseVersion + "-SNAPSHOT" | 			version baseVersion + '-SNAPSHOT' | ||||||
| 
 | 
 | ||||||
| 			from components["java"] | 			from components['java'] | ||||||
| 
 | 
 | ||||||
| 			artifact sourcesJar | 			artifact sourcesJar | ||||||
| 			artifact javadocJar | 			artifact javadocJar | ||||||
|  | @ -143,28 +143,28 @@ publishing { | ||||||
| 
 | 
 | ||||||
| 		// Manually crate the plugin marker for snapshot versions | 		// Manually crate the plugin marker for snapshot versions | ||||||
| 		snapshotPlugin(MavenPublication) { publication -> | 		snapshotPlugin(MavenPublication) { publication -> | ||||||
| 			groupId "fabric-loom" | 			groupId 'fabric-loom' | ||||||
| 			artifactId "fabric-loom.gradle.plugin" | 			artifactId 'fabric-loom.gradle.plugin' | ||||||
| 			version baseVersion + "-SNAPSHOT" | 			version baseVersion + '-SNAPSHOT' | ||||||
| 
 | 
 | ||||||
| 			pom.withXml({ | 			pom.withXml({ | ||||||
| 				//Based of org.gradle.plugin.devel.plugins.MavenPluginPublishPlugin | 				// Based off org.gradle.plugin.devel.plugins.MavenPluginPublishPlugin | ||||||
| 				Element root = asElement() | 				Element root = asElement() | ||||||
| 				Document document = root.getOwnerDocument() | 				Document document = root.getOwnerDocument() | ||||||
| 				Node dependencies = root.appendChild(document.createElement("dependencies")) | 				Node dependencies = root.appendChild(document.createElement('dependencies')) | ||||||
| 				Node dependency = dependencies.appendChild(document.createElement("dependency")) | 				Node dependency = dependencies.appendChild(document.createElement('dependency')) | ||||||
| 				Node groupId = dependency.appendChild(document.createElement("groupId")) | 				Node groupId = dependency.appendChild(document.createElement('groupId')) | ||||||
| 				groupId.setTextContent("net.fabricmc") | 				groupId.setTextContent('net.fabricmc') | ||||||
| 				Node artifactId = dependency.appendChild(document.createElement("artifactId")) | 				Node artifactId = dependency.appendChild(document.createElement('artifactId')) | ||||||
| 				artifactId.setTextContent("fabric-loom") | 				artifactId.setTextContent('fabric-loom') | ||||||
| 				Node version = dependency.appendChild(document.createElement("version")) | 				Node version = dependency.appendChild(document.createElement('version')) | ||||||
| 				version.setTextContent(baseVersion + "-SNAPSHOT") | 				version.setTextContent(baseVersion + '-SNAPSHOT') | ||||||
| 			}) | 			}) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	repositories { | 	repositories { | ||||||
| 		maven { | 		maven { | ||||||
| 			url "http://mavenupload.modmuss50.me/" | 			url 'http://mavenupload.modmuss50.me/' | ||||||
| 			if (project.hasProperty('mavenPass')) { | 			if (project.hasProperty('mavenPass')) { | ||||||
| 				credentials { | 				credentials { | ||||||
| 					username 'buildslave' | 					username 'buildslave' | ||||||
|  |  | ||||||
|  | @ -161,7 +161,7 @@ public class AbstractPlugin implements Plugin<Project> { | ||||||
| 	/** | 	/** | ||||||
| 	 * Permit to add a Maven repository to a target project. | 	 * Permit to add a Maven repository to a target project. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param target The garget project | 	 * @param target The target project | ||||||
| 	 * @param name   The name of the repository | 	 * @param name   The name of the repository | ||||||
| 	 * @param url    The URL of the repository | 	 * @param url    The URL of the repository | ||||||
| 	 * @return An object containing the name and the URL of the repository that can be modified later | 	 * @return An object containing the name and the URL of the repository that can be modified later | ||||||
|  | @ -330,7 +330,7 @@ public class AbstractPlugin implements Plugin<Project> { | ||||||
| 					} | 					} | ||||||
| 
 | 
 | ||||||
| 					parentTask.dependsOn(remapSourcesJarTask); | 					parentTask.dependsOn(remapSourcesJarTask); | ||||||
| 				} catch (UnknownTaskException e) { | 				} catch (UnknownTaskException ignored) { | ||||||
| 					// pass | 					// pass | ||||||
| 				} | 				} | ||||||
| 			} else { | 			} else { | ||||||
|  | @ -374,8 +374,7 @@ public class AbstractPlugin implements Plugin<Project> { | ||||||
| 					mavenPublish.publications((publications) -> { | 					mavenPublish.publications((publications) -> { | ||||||
| 						for (Publication publication : publications) { | 						for (Publication publication : publications) { | ||||||
| 							if (publication instanceof MavenPublication) { | 							if (publication instanceof MavenPublication) { | ||||||
| 								((MavenPublication) publication).pom((pom) -> { | 								((MavenPublication) publication).pom((pom) -> pom.withXml((xml) -> { | ||||||
| 									pom.withXml((xml) -> { |  | ||||||
| 									Node dependencies = GroovyXmlUtil.getOrCreateNode(xml.asNode(), "dependencies"); | 									Node dependencies = GroovyXmlUtil.getOrCreateNode(xml.asNode(), "dependencies"); | ||||||
| 									Set<String> foundArtifacts = new HashSet<>(); | 									Set<String> foundArtifacts = new HashSet<>(); | ||||||
| 
 | 
 | ||||||
|  | @ -399,8 +398,7 @@ public class AbstractPlugin implements Plugin<Project> { | ||||||
| 										depNode.appendNode("version", dependency.getVersion()); | 										depNode.appendNode("version", dependency.getVersion()); | ||||||
| 										depNode.appendNode("scope", entry.getMavenScope()); | 										depNode.appendNode("scope", entry.getMavenScope()); | ||||||
| 									} | 									} | ||||||
| 									}); | 								})); | ||||||
| 								}); |  | ||||||
| 							} | 							} | ||||||
| 						} | 						} | ||||||
| 					}); | 					}); | ||||||
|  |  | ||||||
|  | @ -40,8 +40,8 @@ public class ThreadIDFFLogger extends IFernflowerLogger { | ||||||
| 	public final PrintStream stdOut; | 	public final PrintStream stdOut; | ||||||
| 	public final PrintStream stdErr; | 	public final PrintStream stdErr; | ||||||
| 
 | 
 | ||||||
| 	private ThreadLocal<Stack<String>> workingClass = ThreadLocal.withInitial(Stack::new); | 	private final ThreadLocal<Stack<String>> workingClass = ThreadLocal.withInitial(Stack::new); | ||||||
| 	private ThreadLocal<Stack<String>> line = ThreadLocal.withInitial(Stack::new); | 	private final ThreadLocal<Stack<String>> line = ThreadLocal.withInitial(Stack::new); | ||||||
| 
 | 
 | ||||||
| 	public ThreadIDFFLogger() { | 	public ThreadIDFFLogger() { | ||||||
| 		this(System.err, System.out); | 		this(System.err, System.out); | ||||||
|  |  | ||||||
|  | @ -25,7 +25,6 @@ | ||||||
| package net.fabricmc.loom.providers; | package net.fabricmc.loom.providers; | ||||||
| 
 | 
 | ||||||
| import java.io.File; | import java.io.File; | ||||||
| import java.io.IOException; |  | ||||||
| import java.util.Collection; | import java.util.Collection; | ||||||
| import java.util.HashSet; | import java.util.HashSet; | ||||||
| 
 | 
 | ||||||
|  | @ -38,10 +37,9 @@ import net.fabricmc.loom.util.MinecraftVersionInfo; | ||||||
| public class MinecraftLibraryProvider { | public class MinecraftLibraryProvider { | ||||||
| 	public File MINECRAFT_LIBS; | 	public File MINECRAFT_LIBS; | ||||||
| 
 | 
 | ||||||
| 	private Collection<File> libs = new HashSet<>(); | 	private final Collection<File> libs = new HashSet<>(); | ||||||
| 
 | 
 | ||||||
| 	public void provide(MinecraftProvider minecraftProvider, Project project) throws IOException { | 	public void provide(MinecraftProvider minecraftProvider, Project project) { | ||||||
| 		LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class); |  | ||||||
| 		MinecraftVersionInfo versionInfo = minecraftProvider.getVersionInfo(); | 		MinecraftVersionInfo versionInfo = minecraftProvider.getVersionInfo(); | ||||||
| 
 | 
 | ||||||
| 		initFiles(project, minecraftProvider); | 		initFiles(project, minecraftProvider); | ||||||
|  |  | ||||||
|  | @ -79,7 +79,7 @@ public class GenIdeaProjectTask extends AbstractLoomTask { | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if (runManager == null) { | 		if (runManager == null) { | ||||||
| 			throw new RuntimeException("Failed to generate intellij run configurations (runManager was not found)"); | 			throw new RuntimeException("Failed to generate IntelliJ run configurations (runManager was not found)"); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		runManager.appendChild(RunConfig.clientRunConfig(project).genRuns(runManager)); | 		runManager.appendChild(RunConfig.clientRunConfig(project).genRuns(runManager)); | ||||||
|  |  | ||||||
|  | @ -89,6 +89,7 @@ public class GenVsCodeProjectTask extends AbstractLoomTask { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	@SuppressWarnings("unused") | ||||||
| 	private static class VsCodeConfiguration { | 	private static class VsCodeConfiguration { | ||||||
| 		public String type = "java"; | 		public String type = "java"; | ||||||
| 		public String name; | 		public String name; | ||||||
|  |  | ||||||
|  | @ -55,9 +55,9 @@ import net.fabricmc.tinyremapper.TinyRemapper; | ||||||
| import net.fabricmc.tinyremapper.TinyUtils; | import net.fabricmc.tinyremapper.TinyUtils; | ||||||
| 
 | 
 | ||||||
| public class RemapJarTask extends Jar { | public class RemapJarTask extends Jar { | ||||||
| 	private RegularFileProperty input; | 	private final RegularFileProperty input; | ||||||
| 	private Property<Boolean> addNestedDependencies; | 	private final Property<Boolean> addNestedDependencies; | ||||||
| 	private Property<Boolean> remapAccessWidener; | 	private final Property<Boolean> remapAccessWidener; | ||||||
| 	public JarRemapper jarRemapper; | 	public JarRemapper jarRemapper; | ||||||
| 
 | 
 | ||||||
| 	public RemapJarTask() { | 	public RemapJarTask() { | ||||||
|  |  | ||||||
|  | @ -24,7 +24,6 @@ | ||||||
| 
 | 
 | ||||||
| package net.fabricmc.loom.util; | package net.fabricmc.loom.util; | ||||||
| 
 | 
 | ||||||
| import java.io.IOException; |  | ||||||
| import java.io.OutputStream; | import java.io.OutputStream; | ||||||
| import java.util.function.Consumer; | import java.util.function.Consumer; | ||||||
| 
 | 
 | ||||||
|  | @ -41,7 +40,7 @@ public class ConsumingOutputStream extends OutputStream { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@Override | 	@Override | ||||||
| 	public void write(int b) throws IOException { | 	public void write(int b) { | ||||||
| 		char ch = (char) (b & 0xFF); | 		char ch = (char) (b & 0xFF); | ||||||
| 		buffer.append(ch); | 		buffer.append(ch); | ||||||
| 
 | 
 | ||||||
|  | @ -51,7 +50,7 @@ public class ConsumingOutputStream extends OutputStream { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@Override | 	@Override | ||||||
| 	public void flush() throws IOException { | 	public void flush() { | ||||||
| 		String str = buffer.toString(); | 		String str = buffer.toString(); | ||||||
| 
 | 
 | ||||||
| 		if (str.endsWith("\r") || str.endsWith("\n")) { | 		if (str.endsWith("\r") || str.endsWith("\n")) { | ||||||
|  |  | ||||||
|  | @ -132,8 +132,6 @@ public abstract class DependencyProvider { | ||||||
| 			return sourceConfiguration; | 			return sourceConfiguration; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		// TODO: Can this be done with stable APIs only? |  | ||||||
| 		@SuppressWarnings("UnstableApiUsage") |  | ||||||
| 		public Set<File> resolve() { | 		public Set<File> resolve() { | ||||||
| 			return sourceConfiguration.files(dependency); | 			return sourceConfiguration.files(dependency); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -82,9 +82,6 @@ public class DownloadUtil { | ||||||
| 		// We want to download gzip compressed stuff | 		// We want to download gzip compressed stuff | ||||||
| 		connection.setRequestProperty("Accept-Encoding", "gzip"); | 		connection.setRequestProperty("Accept-Encoding", "gzip"); | ||||||
| 
 | 
 | ||||||
| 		//We shouldn't need to set a user agent, but it's here just in case |  | ||||||
| 		//connection.setRequestProperty("User-Agent", null); |  | ||||||
| 
 |  | ||||||
| 		// Try make the connection, it will hang here if the connection is bad | 		// Try make the connection, it will hang here if the connection is bad | ||||||
| 		connection.connect(); | 		connection.connect(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -42,13 +42,13 @@ import org.w3c.dom.NodeList; | ||||||
| import net.fabricmc.loom.LoomGradleExtension; | import net.fabricmc.loom.LoomGradleExtension; | ||||||
| 
 | 
 | ||||||
| public class FabricApiExtension { | public class FabricApiExtension { | ||||||
| 	private Project project; | 	private final Project project; | ||||||
| 
 | 
 | ||||||
| 	public FabricApiExtension(Project project) { | 	public FabricApiExtension(Project project) { | ||||||
| 		this.project = project; | 		this.project = project; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	private static HashMap<String, Map<String, String>> moduleVersionCache = new HashMap<>(); | 	private static final HashMap<String, Map<String, String>> moduleVersionCache = new HashMap<>(); | ||||||
| 
 | 
 | ||||||
| 	public Dependency module(String moduleName, String fabricApiVersion) { | 	public Dependency module(String moduleName, String fabricApiVersion) { | ||||||
| 		return project.getDependencies() | 		return project.getDependencies() | ||||||
|  |  | ||||||
|  | @ -26,7 +26,6 @@ package net.fabricmc.loom.util; | ||||||
| 
 | 
 | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Optional; | import java.util.Optional; | ||||||
| import java.util.stream.Collectors; |  | ||||||
| import java.util.stream.Stream; | import java.util.stream.Stream; | ||||||
| 
 | 
 | ||||||
| import groovy.util.Node; | import groovy.util.Node; | ||||||
|  | @ -58,8 +57,4 @@ public final class GroovyXmlUtil { | ||||||
| 		//noinspection unchecked | 		//noinspection unchecked | ||||||
| 		return (Stream<Node>) (Stream) (((List<Object>) node.children()).stream().filter((i) -> i instanceof Node)); | 		return (Stream<Node>) (Stream) (((List<Object>) node.children()).stream().filter((i) -> i instanceof Node)); | ||||||
| 	} | 	} | ||||||
| 
 |  | ||||||
| 	public static Iterable<Node> childrenNodes(Node node) { |  | ||||||
| 		return childrenNodesStream(node).collect(Collectors.toList()); |  | ||||||
| 	} |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -174,7 +174,7 @@ public class LineNumberRemapper { | ||||||
| 		private final String name; | 		private final String name; | ||||||
| 		private int maxLine; | 		private int maxLine; | ||||||
| 		private int maxLineDest; | 		private int maxLineDest; | ||||||
| 		private Map<Integer, Integer> lineMap = new HashMap<>(); | 		private final Map<Integer, Integer> lineMap = new HashMap<>(); | ||||||
| 
 | 
 | ||||||
| 		private RClass(String name) { | 		private RClass(String name) { | ||||||
| 			this.name = name; | 			this.name = name; | ||||||
|  |  | ||||||
|  | @ -52,7 +52,7 @@ public class LoomDependencyManager { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	private List<DependencyProvider> dependencyProviderList = new ArrayList<>(); | 	private final List<DependencyProvider> dependencyProviderList = new ArrayList<>(); | ||||||
| 
 | 
 | ||||||
| 	public void addProvider(DependencyProvider provider) { | 	public void addProvider(DependencyProvider provider) { | ||||||
| 		if (dependencyProviderList.contains(provider)) { | 		if (dependencyProviderList.contains(provider)) { | ||||||
|  |  | ||||||
|  | @ -91,32 +91,11 @@ public final class MixinRefmapHelper { | ||||||
| 							} | 							} | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
| 				} catch (Exception e) { | 				} catch (Exception ignored) { | ||||||
| 					// ... | 					// ... | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		}); | 		}); | ||||||
| 		return mixinFilename; | 		return mixinFilename; | ||||||
| 	} | 	} | ||||||
| 
 |  | ||||||
| 	private static Set<String> findRefmaps(File output) { |  | ||||||
| 		// first, identify all of the mixin refmaps |  | ||||||
| 		Set<String> mixinRefmapFilenames = new HashSet<>(); |  | ||||||
| 		// TODO: this is also a lovely hack |  | ||||||
| 		ZipUtil.iterate(output, (stream, entry) -> { |  | ||||||
| 			if (!entry.isDirectory() && entry.getName().endsWith(".json") && !entry.getName().contains("/") && !entry.getName().contains("\\")) { |  | ||||||
| 				// JSON file in root directory |  | ||||||
| 				try (InputStreamReader inputStreamReader = new InputStreamReader(stream)) { |  | ||||||
| 					JsonObject json = GSON.fromJson(inputStreamReader, JsonObject.class); |  | ||||||
| 
 |  | ||||||
| 					if (json != null && json.has("refmap")) { |  | ||||||
| 						mixinRefmapFilenames.add(json.get("refmap").getAsString()); |  | ||||||
| 					} |  | ||||||
| 				} catch (Exception e) { |  | ||||||
| 					// ... |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 		}); |  | ||||||
| 		return mixinRefmapFilenames; |  | ||||||
| 	} |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -83,7 +83,7 @@ public class ModCompileRemapper { | ||||||
| 
 | 
 | ||||||
| 				final String notation = group + ":" + name + ":" + version + classifierSuffix; | 				final String notation = group + ":" + name + ":" + version + classifierSuffix; | ||||||
| 
 | 
 | ||||||
| 				if (!isFabricMod(project, logger, artifact, notation)) { | 				if (!isFabricMod(logger, artifact, notation)) { | ||||||
| 					addToRegularCompile(project, regularConfig, notation); | 					addToRegularCompile(project, regularConfig, notation); | ||||||
| 					continue; | 					continue; | ||||||
| 				} | 				} | ||||||
|  | @ -122,7 +122,7 @@ public class ModCompileRemapper { | ||||||
| 	/** | 	/** | ||||||
| 	 * Checks if an artifact is a fabric mod, according to the presence of a fabric.mod.json. | 	 * Checks if an artifact is a fabric mod, according to the presence of a fabric.mod.json. | ||||||
| 	 */ | 	 */ | ||||||
| 	private static boolean isFabricMod(Project project, Logger logger, ResolvedArtifact artifact, String notation) { | 	private static boolean isFabricMod(Logger logger, ResolvedArtifact artifact, String notation) { | ||||||
| 		File input = artifact.getFile(); | 		File input = artifact.getFile(); | ||||||
| 
 | 
 | ||||||
| 		try (ZipFile zipFile = new ZipFile(input)) { | 		try (ZipFile zipFile = new ZipFile(input)) { | ||||||
|  | @ -166,7 +166,8 @@ public class ModCompileRemapper { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	private static void scheduleSourcesRemapping(Project project, SourceRemapper sourceRemapper, File sources, String remappedLog, String remappedFilename, File modStore) { | 	private static void scheduleSourcesRemapping(Project project, SourceRemapper sourceRemapper, File sources, String remappedLog, String remappedFilename, File modStore) { | ||||||
| 		project.getLogger().info(":providing " + remappedLog + " sources"); | 		project.getLogger().debug(":providing " + remappedLog + " sources"); | ||||||
|  | 
 | ||||||
| 		File remappedSources = new File(modStore, remappedFilename + "-sources.jar"); | 		File remappedSources = new File(modStore, remappedFilename + "-sources.jar"); | ||||||
| 		boolean refreshDeps = project.getGradle().getStartParameter().isRefreshDependencies(); | 		boolean refreshDeps = project.getGradle().getStartParameter().isRefreshDependencies(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -91,7 +91,7 @@ public class ModProcessor { | ||||||
| 		// Strip out all contained jar info as we dont want loader to try and load the jars contained in dev. | 		// Strip out all contained jar info as we dont want loader to try and load the jars contained in dev. | ||||||
| 		ZipUtil.transformEntries(file, new ZipEntryTransformerEntry[] {(new ZipEntryTransformerEntry("fabric.mod.json", new StringZipEntryTransformer() { | 		ZipUtil.transformEntries(file, new ZipEntryTransformerEntry[] {(new ZipEntryTransformerEntry("fabric.mod.json", new StringZipEntryTransformer() { | ||||||
| 			@Override | 			@Override | ||||||
| 			protected String transform(ZipEntry zipEntry, String input) throws IOException { | 			protected String transform(ZipEntry zipEntry, String input) { | ||||||
| 				JsonObject json = GSON.fromJson(input, JsonObject.class); | 				JsonObject json = GSON.fromJson(input, JsonObject.class); | ||||||
| 				json.remove("jars"); | 				json.remove("jars"); | ||||||
| 				return GSON.toJson(json); | 				return GSON.toJson(json); | ||||||
|  | @ -146,7 +146,8 @@ public class ModProcessor { | ||||||
| 		for (RemappedConfigurationEntry entry : Constants.MOD_COMPILE_ENTRIES) { | 		for (RemappedConfigurationEntry entry : Constants.MOD_COMPILE_ENTRIES) { | ||||||
| 			for (File inputFile : project.getConfigurations().getByName(entry.getSourceConfiguration()).getFiles()) { | 			for (File inputFile : project.getConfigurations().getByName(entry.getSourceConfiguration()).getFiles()) { | ||||||
| 				if (remapList.stream().noneMatch(info -> info.getInputFile().equals(inputFile))) { | 				if (remapList.stream().noneMatch(info -> info.getInputFile().equals(inputFile))) { | ||||||
| 					project.getLogger().info("Adding " + inputFile + " onto the remap classpath"); | 					project.getLogger().debug("Adding " + inputFile + " onto the remap classpath"); | ||||||
|  | 
 | ||||||
| 					remapper.readClassPathAsync(inputFile.toPath()); | 					remapper.readClassPathAsync(inputFile.toPath()); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  | @ -154,7 +155,9 @@ public class ModProcessor { | ||||||
| 
 | 
 | ||||||
| 		for (ModDependencyInfo info : remapList) { | 		for (ModDependencyInfo info : remapList) { | ||||||
| 			InputTag tag = remapper.createInputTag(); | 			InputTag tag = remapper.createInputTag(); | ||||||
| 			project.getLogger().info("Adding " + info.getInputFile() + " as a remap input"); | 
 | ||||||
|  | 			project.getLogger().debug("Adding " + info.getInputFile() + " as a remap input"); | ||||||
|  | 
 | ||||||
| 			remapper.readInputsAsync(tag, info.getInputFile().toPath()); | 			remapper.readInputsAsync(tag, info.getInputFile().toPath()); | ||||||
| 			tagMap.put(info, tag); | 			tagMap.put(info, tag); | ||||||
| 		} | 		} | ||||||
|  | @ -191,7 +194,6 @@ public class ModProcessor { | ||||||
| 			String launchMethod = extension.getLoaderLaunchMethod(); | 			String launchMethod = extension.getLoaderLaunchMethod(); | ||||||
| 
 | 
 | ||||||
| 			String jsonStr; | 			String jsonStr; | ||||||
| 			int priority = 0; |  | ||||||
| 
 | 
 | ||||||
| 			try (JarFile jarFile = new JarFile(file)) { | 			try (JarFile jarFile = new JarFile(file)) { | ||||||
| 				ZipEntry entry = null; | 				ZipEntry entry = null; | ||||||
|  | @ -206,7 +208,6 @@ public class ModProcessor { | ||||||
| 
 | 
 | ||||||
| 				if (entry == null) { | 				if (entry == null) { | ||||||
| 					entry = jarFile.getEntry("fabric-installer.json"); | 					entry = jarFile.getEntry("fabric-installer.json"); | ||||||
| 					priority++; |  | ||||||
| 
 | 
 | ||||||
| 					if (entry == null) { | 					if (entry == null) { | ||||||
| 						return null; | 						return null; | ||||||
|  | @ -218,8 +219,7 @@ public class ModProcessor { | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			JsonObject jsonObject = GSON.fromJson(jsonStr, JsonObject.class); | 			return GSON.fromJson(jsonStr, JsonObject.class); | ||||||
| 			return jsonObject; |  | ||||||
| 		} catch (IOException e) { | 		} catch (IOException e) { | ||||||
| 			e.printStackTrace(); | 			e.printStackTrace(); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -75,7 +75,7 @@ public class NestedJars { | ||||||
| 
 | 
 | ||||||
| 		return ZipUtil.transformEntries(modJar, single(new ZipEntryTransformerEntry("fabric.mod.json", new StringZipEntryTransformer() { | 		return ZipUtil.transformEntries(modJar, single(new ZipEntryTransformerEntry("fabric.mod.json", new StringZipEntryTransformer() { | ||||||
| 			@Override | 			@Override | ||||||
| 			protected String transform(ZipEntry zipEntry, String input) throws IOException { | 			protected String transform(ZipEntry zipEntry, String input) { | ||||||
| 				JsonObject json = GSON.fromJson(input, JsonObject.class); | 				JsonObject json = GSON.fromJson(input, JsonObject.class); | ||||||
| 				JsonArray nestedJars = json.getAsJsonArray("jars"); | 				JsonArray nestedJars = json.getAsJsonArray("jars"); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -34,9 +34,6 @@ import java.util.List; | ||||||
| import java.util.Locale; | import java.util.Locale; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| 
 | 
 | ||||||
| import javax.xml.parsers.ParserConfigurationException; |  | ||||||
| import javax.xml.transform.TransformerException; |  | ||||||
| 
 |  | ||||||
| import com.google.common.base.Strings; | import com.google.common.base.Strings; | ||||||
| import com.google.common.collect.ImmutableList; | import com.google.common.collect.ImmutableList; | ||||||
| import com.google.common.collect.ImmutableMap; | import com.google.common.collect.ImmutableMap; | ||||||
|  | @ -51,7 +48,6 @@ import org.gradle.api.Project; | ||||||
| import org.gradle.plugins.ide.eclipse.model.EclipseModel; | import org.gradle.plugins.ide.eclipse.model.EclipseModel; | ||||||
| 
 | 
 | ||||||
| import net.fabricmc.loom.LoomGradleExtension; | import net.fabricmc.loom.LoomGradleExtension; | ||||||
| import net.fabricmc.loom.providers.MinecraftProvider; |  | ||||||
| 
 | 
 | ||||||
| public class RunConfig { | public class RunConfig { | ||||||
| 	public String configName; | 	public String configName; | ||||||
|  | @ -62,7 +58,7 @@ public class RunConfig { | ||||||
| 	public String vmArgs; | 	public String vmArgs; | ||||||
| 	public String programArgs; | 	public String programArgs; | ||||||
| 
 | 
 | ||||||
| 	public Element genRuns(Element doc) throws IOException, ParserConfigurationException, TransformerException { | 	public Element genRuns(Element doc) { | ||||||
| 		Element root = this.addXml(doc, "component", ImmutableMap.of("name", "ProjectRunConfigurationManager")); | 		Element root = this.addXml(doc, "component", ImmutableMap.of("name", "ProjectRunConfigurationManager")); | ||||||
| 		root = addXml(root, "configuration", ImmutableMap.of("default", "false", "name", configName, "type", "Application", "factoryName", "Application")); | 		root = addXml(root, "configuration", ImmutableMap.of("default", "false", "name", configName, "type", "Application", "factoryName", "Application")); | ||||||
| 
 | 
 | ||||||
|  | @ -115,16 +111,13 @@ public class RunConfig { | ||||||
| 		runConfig.runDir = "file://$PROJECT_DIR$/" + extension.runDir; | 		runConfig.runDir = "file://$PROJECT_DIR$/" + extension.runDir; | ||||||
| 		runConfig.vmArgs = ""; | 		runConfig.vmArgs = ""; | ||||||
| 
 | 
 | ||||||
| 		switch (extension.getLoaderLaunchMethod()) { | 		if ("launchwrapper".equals(extension.getLoaderLaunchMethod())) { | ||||||
| 		case "launchwrapper": |  | ||||||
| 			runConfig.mainClass = "net.minecraft.launchwrapper.Launch"; | 			runConfig.mainClass = "net.minecraft.launchwrapper.Launch"; | ||||||
| 			runConfig.programArgs = "--tweakClass " + ("client".equals(mode) ? Constants.DEFAULT_FABRIC_CLIENT_TWEAKER : Constants.DEFAULT_FABRIC_SERVER_TWEAKER); | 			runConfig.programArgs = "--tweakClass " + ("client".equals(mode) ? Constants.DEFAULT_FABRIC_CLIENT_TWEAKER : Constants.DEFAULT_FABRIC_SERVER_TWEAKER); | ||||||
| 			break; | 		} else { | ||||||
| 		default: |  | ||||||
| 			runConfig.mainClass = "net.fabricmc.devlaunchinjector.Main"; | 			runConfig.mainClass = "net.fabricmc.devlaunchinjector.Main"; | ||||||
| 			runConfig.programArgs = ""; | 			runConfig.programArgs = ""; | ||||||
| 			runConfig.vmArgs = "-Dfabric.dli.config=" + encodeEscaped(extension.getDevLauncherConfig().getAbsolutePath()) + " -Dfabric.dli.env=" + mode.toLowerCase(); | 			runConfig.vmArgs = "-Dfabric.dli.config=" + encodeEscaped(extension.getDevLauncherConfig().getAbsolutePath()) + " -Dfabric.dli.env=" + mode.toLowerCase(); | ||||||
| 			break; |  | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if (extension.getLoaderLaunchMethod().equals("launchwrapper")) { | 		if (extension.getLoaderLaunchMethod().equals("launchwrapper")) { | ||||||
|  | @ -159,8 +152,6 @@ public class RunConfig { | ||||||
| 
 | 
 | ||||||
| 	public static RunConfig clientRunConfig(Project project) { | 	public static RunConfig clientRunConfig(Project project) { | ||||||
| 		LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class); | 		LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class); | ||||||
| 		MinecraftProvider minecraftProvider = extension.getMinecraftProvider(); |  | ||||||
| 		MinecraftVersionInfo minecraftVersionInfo = minecraftProvider.getVersionInfo(); |  | ||||||
| 
 | 
 | ||||||
| 		RunConfig ideaClient = new RunConfig(); | 		RunConfig ideaClient = new RunConfig(); | ||||||
| 		ideaClient.configName = "Minecraft Client"; | 		ideaClient.configName = "Minecraft Client"; | ||||||
|  |  | ||||||
|  | @ -44,7 +44,7 @@ public class AccessWidener { | ||||||
| 	public Map<String, Access> classAccess = new HashMap<>(); | 	public Map<String, Access> classAccess = new HashMap<>(); | ||||||
| 	public Map<EntryTriple, Access> methodAccess = new HashMap<>(); | 	public Map<EntryTriple, Access> methodAccess = new HashMap<>(); | ||||||
| 	public Map<EntryTriple, Access> fieldAccess = new HashMap<>(); | 	public Map<EntryTriple, Access> fieldAccess = new HashMap<>(); | ||||||
| 	private Set<String> classes = new LinkedHashSet<>(); | 	private final Set<String> classes = new LinkedHashSet<>(); | ||||||
| 
 | 
 | ||||||
| 	public void read(BufferedReader reader) throws IOException { | 	public void read(BufferedReader reader) throws IOException { | ||||||
| 		String headerStr = reader.readLine(); | 		String headerStr = reader.readLine(); | ||||||
|  |  | ||||||
|  | @ -29,6 +29,7 @@ import java.util.LinkedHashMap; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| import java.util.Set; | import java.util.Set; | ||||||
| 
 | 
 | ||||||
|  | @SuppressWarnings("unused") | ||||||
| public class AssetIndex { | public class AssetIndex { | ||||||
| 	private final Map<String, AssetObject> objects; | 	private final Map<String, AssetObject> objects; | ||||||
| 	private boolean virtual; | 	private boolean virtual; | ||||||
|  |  | ||||||
|  | @ -24,6 +24,7 @@ | ||||||
| 
 | 
 | ||||||
| package net.fabricmc.loom.util.assets; | package net.fabricmc.loom.util.assets; | ||||||
| 
 | 
 | ||||||
|  | @SuppressWarnings("unused") | ||||||
| public class AssetObject { | public class AssetObject { | ||||||
| 	private String hash; | 	private String hash; | ||||||
| 	private long size; | 	private long size; | ||||||
|  |  | ||||||
|  | @ -78,7 +78,7 @@ public abstract class AnnotationProcessorInvoker<T extends Task> { | ||||||
| 					put("defaultObfuscationEnv", "named:intermediary"); | 					put("defaultObfuscationEnv", "named:intermediary"); | ||||||
| 				}}; | 				}}; | ||||||
| 
 | 
 | ||||||
| 			project.getLogger().info("Outputting refmap to dir: " + getDestinationDir(task) + " for compile task: " + task); | 			project.getLogger().debug("Outputting refmap to dir: " + getDestinationDir(task) + " for compile task: " + task); | ||||||
| 			args.forEach((k, v) -> passArgument(task, k, v)); | 			args.forEach((k, v) -> passArgument(task, k, v)); | ||||||
| 		} catch (IOException e) { | 		} catch (IOException e) { | ||||||
| 			project.getLogger().error("Could not configure mixin annotation processors", e); | 			project.getLogger().error("Could not configure mixin annotation processors", e); | ||||||
|  |  | ||||||
|  | @ -62,7 +62,7 @@ public class ProgressLogger { | ||||||
| 			// prior to Gradle 2.14 | 			// prior to Gradle 2.14 | ||||||
| 			try { | 			try { | ||||||
| 				progressLoggerFactoryClass = Class.forName("org.gradle.logging.ProgressLoggerFactory"); | 				progressLoggerFactoryClass = Class.forName("org.gradle.logging.ProgressLoggerFactory"); | ||||||
| 			} catch (ClassNotFoundException e1) { | 			} catch (ClassNotFoundException ignored) { | ||||||
| 				// Unsupported Gradle version | 				// Unsupported Gradle version | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue