General cleanup
parent
6083146127
commit
1955bcb2ea
|
@ -1,5 +1,2 @@
|
||||||
[*.kt]
|
[*.{gradle,java}]
|
||||||
indent_style = tab
|
|
||||||
|
|
||||||
[*.gradle]
|
|
||||||
indent_style = tab
|
indent_style = tab
|
58
build.gradle
58
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,48 +123,48 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
//Also publish a snapshot so people can use the latest version if they wish
|
// Also publish a snapshot so people can use the latest version if they wish
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
//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,33 +374,31 @@ 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<>();
|
|
||||||
|
|
||||||
GroovyXmlUtil.childrenNodesStream(dependencies).filter((n) -> "dependency".equals(n.name())).forEach((n) -> {
|
GroovyXmlUtil.childrenNodesStream(dependencies).filter((n) -> "dependency".equals(n.name())).forEach((n) -> {
|
||||||
Optional<Node> groupId = GroovyXmlUtil.getNode(n, "groupId");
|
Optional<Node> groupId = GroovyXmlUtil.getNode(n, "groupId");
|
||||||
Optional<Node> artifactId = GroovyXmlUtil.getNode(n, "artifactId");
|
Optional<Node> artifactId = GroovyXmlUtil.getNode(n, "artifactId");
|
||||||
|
|
||||||
if (groupId.isPresent() && artifactId.isPresent()) {
|
if (groupId.isPresent() && artifactId.isPresent()) {
|
||||||
foundArtifacts.add(groupId.get().text() + ":" + artifactId.get().text());
|
foundArtifacts.add(groupId.get().text() + ":" + artifactId.get().text());
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
for (Dependency dependency : compileModsConfig.getAllDependencies()) {
|
|
||||||
if (foundArtifacts.contains(dependency.getGroup() + ":" + dependency.getName())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Node depNode = dependencies.appendNode("dependency");
|
|
||||||
depNode.appendNode("groupId", dependency.getGroup());
|
|
||||||
depNode.appendNode("artifactId", dependency.getName());
|
|
||||||
depNode.appendNode("version", dependency.getVersion());
|
|
||||||
depNode.appendNode("scope", entry.getMavenScope());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
for (Dependency dependency : compileModsConfig.getAllDependencies()) {
|
||||||
|
if (foundArtifacts.contains(dependency.getGroup() + ":" + dependency.getName())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Node depNode = dependencies.appendNode("dependency");
|
||||||
|
depNode.appendNode("groupId", dependency.getGroup());
|
||||||
|
depNode.appendNode("artifactId", dependency.getName());
|
||||||
|
depNode.appendNode("version", dependency.getVersion());
|
||||||
|
depNode.appendNode("scope", entry.getMavenScope());
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class LoomGradleExtension {
|
||||||
|
|
||||||
final List<LoomDecompiler> decompilers = new ArrayList<>();
|
final List<LoomDecompiler> decompilers = new ArrayList<>();
|
||||||
|
|
||||||
//Not to be set in the build.gradle
|
// Not to be set in the build.gradle
|
||||||
private final Project project;
|
private final Project project;
|
||||||
private LoomDependencyManager dependencyManager;
|
private LoomDependencyManager dependencyManager;
|
||||||
private JarProcessorManager jarProcessorManager;
|
private JarProcessorManager jarProcessorManager;
|
||||||
|
@ -354,7 +354,7 @@ public class LoomGradleExtension {
|
||||||
|
|
||||||
// Ideally this should use maven, but this is a lot easier
|
// Ideally this should use maven, but this is a lot easier
|
||||||
public Function<String, String> getIntermediaryUrl() {
|
public Function<String, String> getIntermediaryUrl() {
|
||||||
//Done like this to work around this possibly not being a java string...
|
// Done like this to work around this possibly not being a java string...
|
||||||
return s -> intermediaryUrl.apply(s).toString();
|
return s -> intermediaryUrl.apply(s).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ public abstract class AbstractFernFlowerDecompiler implements LoomDecompiler {
|
||||||
args.add("-l=" + absolutePathOf(linemapDestination));
|
args.add("-l=" + absolutePathOf(linemapDestination));
|
||||||
args.add("-m=" + absolutePathOf(metaData.javaDocs));
|
args.add("-m=" + absolutePathOf(metaData.javaDocs));
|
||||||
|
|
||||||
//TODO, Decompiler breaks on jemalloc, J9 module-info.class?
|
// TODO, Decompiler breaks on jemalloc, J9 module-info.class?
|
||||||
for (Path library : metaData.libraries) {
|
for (Path library : metaData.libraries) {
|
||||||
args.add("-e=" + absolutePathOf(library));
|
args.add("-e=" + absolutePathOf(library));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
@ -92,7 +92,7 @@ public class ThreadIDFFLogger extends IFernflowerLogger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startMethod(String methodName) {
|
public void startMethod(String methodName) {
|
||||||
//No need to print out methods
|
// No need to print out methods
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -41,7 +41,7 @@ public final class MappingsCache {
|
||||||
|
|
||||||
private final Map<Path, SoftReference<TinyTree>> mappingsCache = new HashMap<>();
|
private final Map<Path, SoftReference<TinyTree>> mappingsCache = new HashMap<>();
|
||||||
|
|
||||||
//TODO: loom doesn't actually use new mappings when the mappings change until the gradle daemons are stopped
|
// TODO: loom doesn't actually use new mappings when the mappings change until the gradle daemons are stopped
|
||||||
public TinyTree get(Path mappingsPath) throws IOException {
|
public TinyTree get(Path mappingsPath) throws IOException {
|
||||||
mappingsPath = mappingsPath.toAbsolutePath();
|
mappingsPath = mappingsPath.toAbsolutePath();
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class MinecraftMappedProvider extends DependencyProvider {
|
||||||
try {
|
try {
|
||||||
mapMinecraftJar();
|
mapMinecraftJar();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
//Cleanup some some things that may be in a bad state now
|
// Cleanup some some things that may be in a bad state now
|
||||||
minecraftMappedJar.delete();
|
minecraftMappedJar.delete();
|
||||||
minecraftIntermediaryJar.delete();
|
minecraftIntermediaryJar.delete();
|
||||||
getExtension().getMappingsProvider().cleanFiles();
|
getExtension().getMappingsProvider().cleanFiles();
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class MinecraftNativesProvider {
|
||||||
throw new GradleException("Native jar not found at " + libJarFile.getAbsolutePath());
|
throw new GradleException("Native jar not found at " + libJarFile.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO possibly find a way to prevent needing to re-extract after each run, doesnt seem too slow
|
// TODO possibly find a way to prevent needing to re-extract after each run, doesnt seem too slow
|
||||||
ZipUtil.unpack(libJarFile, nativesDir);
|
ZipUtil.unpack(libJarFile, nativesDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,10 +127,10 @@ public class MinecraftProvider extends DependencyProvider {
|
||||||
|
|
||||||
if (offline) {
|
if (offline) {
|
||||||
if (manifests.exists()) {
|
if (manifests.exists()) {
|
||||||
//If there is the manifests already we'll presume that's good enough
|
// If there is the manifests already we'll presume that's good enough
|
||||||
getProject().getLogger().debug("Found version manifests, presuming up-to-date");
|
getProject().getLogger().debug("Found version manifests, presuming up-to-date");
|
||||||
} else {
|
} else {
|
||||||
//If we don't have the manifests then there's nothing more we can do
|
// If we don't have the manifests then there's nothing more we can do
|
||||||
throw new GradleException("Version manifests not found at " + manifests.getAbsolutePath());
|
throw new GradleException("Version manifests not found at " + manifests.getAbsolutePath());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class GenIdeaProjectTask extends AbstractLoomTask {
|
||||||
public void genIdeaRuns() throws IOException, ParserConfigurationException, SAXException, TransformerException {
|
public void genIdeaRuns() throws IOException, ParserConfigurationException, SAXException, TransformerException {
|
||||||
Project project = this.getProject();
|
Project project = this.getProject();
|
||||||
|
|
||||||
//Only generate the idea runs on the root project
|
// Only generate the idea runs on the root project
|
||||||
if (!AbstractPlugin.isRootProject(project)) {
|
if (!AbstractPlugin.isRootProject(project)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
|
|
|
@ -39,7 +39,7 @@ import org.gradle.api.tasks.TaskAction;
|
||||||
import net.fabricmc.loom.LoomGradleExtension;
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
import net.fabricmc.loom.util.RunConfig;
|
import net.fabricmc.loom.util.RunConfig;
|
||||||
|
|
||||||
//Recommended vscode plugins:
|
// Recommended vscode plugins:
|
||||||
// https://marketplace.visualstudio.com/items?itemName=redhat.java
|
// https://marketplace.visualstudio.com/items?itemName=redhat.java
|
||||||
// https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug
|
// https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug
|
||||||
// https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack
|
// https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class DownloadUtil {
|
||||||
to.delete();
|
to.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
//If the output already exists we'll use it's last modified time
|
// If the output already exists we'll use it's last modified time
|
||||||
if (to.exists()) {
|
if (to.exists()) {
|
||||||
connection.setIfModifiedSince(to.lastModified());
|
connection.setIfModifiedSince(to.lastModified());
|
||||||
}
|
}
|
||||||
|
@ -79,13 +79,10 @@ public class DownloadUtil {
|
||||||
connection.setRequestProperty("If-None-Match", etag);
|
connection.setRequestProperty("If-None-Match", etag);
|
||||||
}
|
}
|
||||||
|
|
||||||
//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
|
// Try make the connection, it will hang here if the connection is bad
|
||||||
//connection.setRequestProperty("User-Agent", null);
|
|
||||||
|
|
||||||
//Try make the connection, it will hang here if the connection is bad
|
|
||||||
connection.connect();
|
connection.connect();
|
||||||
|
|
||||||
int code = connection.getResponseCode();
|
int code = connection.getResponseCode();
|
||||||
|
@ -111,10 +108,10 @@ public class DownloadUtil {
|
||||||
logger.info("'{}' Changed, downloading {}", to, toNiceSize(contentLength));
|
logger.info("'{}' Changed, downloading {}", to, toNiceSize(contentLength));
|
||||||
}
|
}
|
||||||
|
|
||||||
try { //Try download to the output
|
try { // Try download to the output
|
||||||
FileUtils.copyInputStreamToFile(connection.getInputStream(), to);
|
FileUtils.copyInputStreamToFile(connection.getInputStream(), to);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
to.delete(); //Probably isn't good if it fails to copy/save
|
to.delete(); // Probably isn't good if it fails to copy/save
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -29,14 +29,14 @@ import java.lang.reflect.Method;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.file.RegularFileProperty;
|
import org.gradle.api.file.RegularFileProperty;
|
||||||
|
|
||||||
//This is used to bridge the gap over large gradle api changes.
|
// This is used to bridge the gap over large gradle api changes.
|
||||||
public class GradleSupport {
|
public class GradleSupport {
|
||||||
public static RegularFileProperty getfileProperty(Project project) {
|
public static RegularFileProperty getfileProperty(Project project) {
|
||||||
try {
|
try {
|
||||||
//First try the new method, if that fails fall back.
|
// First try the new method, if that fails fall back.
|
||||||
return getfilePropertyModern(project);
|
return getfilePropertyModern(project);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//Nope
|
// Nope
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -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();
|
||||||
|
|
||||||
|
@ -174,7 +175,7 @@ public class ModCompileRemapper {
|
||||||
try {
|
try {
|
||||||
sourceRemapper.scheduleRemapSources(sources, remappedSources);
|
sourceRemapper.scheduleRemapSources(sources, remappedSources);
|
||||||
|
|
||||||
//Set the remapped sources creation date to match the sources if we're likely succeeded in making it
|
// Set the remapped sources creation date to match the sources if we're likely succeeded in making it
|
||||||
remappedSources.setLastModified(sources.lastModified());
|
remappedSources.setLastModified(sources.lastModified());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -88,10 +88,10 @@ public class ModProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void stripNestedJars(File file) {
|
private static void stripNestedJars(File file) {
|
||||||
//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");
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ public class NestedJars {
|
||||||
ProjectDependency projectDependency = (ProjectDependency) dependency;
|
ProjectDependency projectDependency = (ProjectDependency) dependency;
|
||||||
Project dependencyProject = projectDependency.getDependencyProject();
|
Project dependencyProject = projectDependency.getDependencyProject();
|
||||||
|
|
||||||
//TODO change this to allow just normal jar tasks, so a project can have a none loom sub project
|
// TODO change this to allow just normal jar tasks, so a project can have a none loom sub project
|
||||||
Collection<Task> remapJarTasks = dependencyProject.getTasksByName("remapJar", false);
|
Collection<Task> remapJarTasks = dependencyProject.getTasksByName("remapJar", false);
|
||||||
Collection<Task> jarTasks = dependencyProject.getTasksByName("jar", false);
|
Collection<Task> jarTasks = dependencyProject.getTasksByName("jar", false);
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ public class NestedJars {
|
||||||
return fileList;
|
return fileList;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Looks for any deps that require a sub project to be built first
|
// Looks for any deps that require a sub project to be built first
|
||||||
public static List<RemapJarTask> getRequiredTasks(Project project) {
|
public static List<RemapJarTask> getRequiredTasks(Project project) {
|
||||||
List<RemapJarTask> remapTasks = new ArrayList<>();
|
List<RemapJarTask> remapTasks = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ public class NestedJars {
|
||||||
ZipUtil.addEntry(tempFile, "fabric.mod.json", getMod(dependency).getBytes());
|
ZipUtil.addEntry(tempFile, "fabric.mod.json", getMod(dependency).getBytes());
|
||||||
fileList.add(tempFile);
|
fileList.add(tempFile);
|
||||||
} else {
|
} else {
|
||||||
//Default copy the jar right in
|
// Default copy the jar right in
|
||||||
fileList.add(file);
|
fileList.add(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ public class NestedJars {
|
||||||
return fileList;
|
return fileList;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Generates a barebones mod for a dependency
|
// Generates a barebones mod for a dependency
|
||||||
private static String getMod(ResolvedDependency dependency) {
|
private static String getMod(ResolvedDependency dependency) {
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
jsonObject.addProperty("schemaVersion", 1);
|
jsonObject.addProperty("schemaVersion", 1);
|
||||||
|
|
|
@ -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";
|
||||||
|
@ -182,7 +173,7 @@ public class RunConfig {
|
||||||
return ideaServer;
|
return ideaServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
//This can be removed at somepoint, its not ideal but its the best solution I could thing of
|
// This can be removed at somepoint, its not ideal but its the best solution I could thing of
|
||||||
public static boolean needsUpgrade(File file) throws IOException {
|
public static boolean needsUpgrade(File file) throws IOException {
|
||||||
String contents = FileUtils.readFileToString(file, StandardCharsets.UTF_8);
|
String contents = FileUtils.readFileToString(file, StandardCharsets.UTF_8);
|
||||||
return !(contents.contains("net.fabricmc.devlaunchinjector.Main"));
|
return !(contents.contains("net.fabricmc.devlaunchinjector.Main"));
|
||||||
|
|
|
@ -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();
|
||||||
|
@ -76,7 +76,7 @@ public class AccessWidener {
|
||||||
Set<String> targets = new LinkedHashSet<>();
|
Set<String> targets = new LinkedHashSet<>();
|
||||||
|
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
//Comment handling
|
// Comment handling
|
||||||
int commentPos = line.indexOf('#');
|
int commentPos = line.indexOf('#');
|
||||||
|
|
||||||
if (commentPos >= 0) {
|
if (commentPos >= 0) {
|
||||||
|
@ -136,7 +136,7 @@ public class AccessWidener {
|
||||||
classes.addAll(parentClasses);
|
classes.addAll(parentClasses);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Could possibly be cleaner but should do its job for now
|
// Could possibly be cleaner but should do its job for now
|
||||||
public void write(StringWriter writer) {
|
public void write(StringWriter writer) {
|
||||||
writer.write("accessWidener\tv1\t");
|
writer.write("accessWidener\tv1\t");
|
||||||
writer.write(namespace);
|
writer.write(namespace);
|
||||||
|
@ -310,7 +310,7 @@ public class AccessWidener {
|
||||||
|
|
||||||
private static int makeProtected(int i) {
|
private static int makeProtected(int i) {
|
||||||
if ((i & Opcodes.ACC_PUBLIC) != 0) {
|
if ((i & Opcodes.ACC_PUBLIC) != 0) {
|
||||||
//Return i if public
|
// Return i if public
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ public class AccessWidenerJarProcessor implements JarProcessor {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return !Arrays.equals(inputHash, hash); //TODO how do we know if the current jar as the correct access applied? save the hash of the input?
|
return !Arrays.equals(inputHash, hash); // TODO how do we know if the current jar as the correct access applied? save the hash of the input?
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AccessTransformer extends ClassVisitor {
|
private class AccessTransformer extends ClassVisitor {
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class AccessWidenerRemapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccessWidener remap() {
|
public AccessWidener remap() {
|
||||||
//Dont remap if we dont need to
|
// Dont remap if we dont need to
|
||||||
if (input.namespace.equals(to)) {
|
if (input.namespace.equals(to)) {
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -56,13 +56,13 @@ public class ProgressLogger {
|
||||||
Class<?> progressLoggerFactoryClass = null;
|
Class<?> progressLoggerFactoryClass = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//Gradle 2.14 and higher
|
// Gradle 2.14 and higher
|
||||||
progressLoggerFactoryClass = Class.forName("org.gradle.internal.logging.progress.ProgressLoggerFactory");
|
progressLoggerFactoryClass = Class.forName("org.gradle.internal.logging.progress.ProgressLoggerFactory");
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
//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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ public class ProgressLogger {
|
||||||
try {
|
try {
|
||||||
return logger.getClass().getMethod(methodName, args);
|
return logger.getClass().getMethod(methodName, args);
|
||||||
} catch (NoSuchMethodException ignored) {
|
} catch (NoSuchMethodException ignored) {
|
||||||
//Nope
|
// Nope
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ public class ProgressLogger {
|
||||||
method.setAccessible(true);
|
method.setAccessible(true);
|
||||||
return method.invoke(logger, args);
|
return method.invoke(logger, args);
|
||||||
} catch (IllegalAccessException | InvocationTargetException ignored) {
|
} catch (IllegalAccessException | InvocationTargetException ignored) {
|
||||||
//Nope
|
// Nope
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue