From 19cdb278c86e11893478189b518d6d6ad4822581 Mon Sep 17 00:00:00 2001 From: youngermax <60242131+YoungerMax@users.noreply.github.com> Date: Sat, 19 Mar 2022 10:18:04 -0400 Subject: [PATCH] Add classpath features + update repo --- build.gradle | 12 ++++++------ gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 3 ++- .../extensions/ExtensionUtility.java | 1 + .../extensions/TinyRemapperEngine.java | 17 +++++++++-------- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index ddb78b7..e1f634c 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { } group 'com.pocolifo.jarremapper' -version '1.2.0' +version '1.2.1' repositories { mavenCentral() @@ -15,13 +15,13 @@ repositories { } maven { - url 'https://maven.services.pocolifo.com' + url 'https://maven.services.pocolifo.com/releases' } } dependencies { - implementation 'com.pocolifo:jarremapper:2.0.0' - implementation 'net.fabricmc:tiny-remapper:0.7.0' + implementation 'com.pocolifo:jarremapper:2.0.2' + implementation 'net.fabricmc:tiny-remapper:0.8.1' implementation 'net.md-5:SpecialSource:1.11.0' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' @@ -52,7 +52,7 @@ jarremapper { 'com.pocolifo.jarremapper.extensions.TinyRemapperEngine/new TinyRemapperEngine().setOptions(net.fabricmc.tinyremapper.TinyRemapper.newRemapper().ignoreConflicts(true)).excludeMetaInf()', // Special source - //'com.pocolifo.jarremapper.extensions.SpecialSourceEngine/new SpecialSourceEngine()', + 'com.pocolifo.jarremapper.extensions.SpecialSourceEngine/new SpecialSourceEngine()', 'com.pocolifo.jarremapper.extensions.SpecialSourceEngine/new SpecialSourceEngine().excludeMetaInf()' ] } @@ -64,7 +64,7 @@ publishing { name = 'JAR Remapper Extensions' description = 'Extra features for JAR Remapper' artifactId = 'extensions' - version = System.getenv("RELEASE_VERSION") + version = System.getenv("RELEASE_VERSION") == null ? project.version : System.getenv("RELEASE_VERSION") licenses { license { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 69a9715..2e6e589 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index d45c658..06ccd48 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1,8 @@ pluginManagement { repositories { + mavenLocal() maven { - url 'https://maven.services.pocolifo.com' + url 'https://maven.services.pocolifo.com/releases' name 'pocolifo' } } diff --git a/src/main/java/com/pocolifo/jarremapper/extensions/ExtensionUtility.java b/src/main/java/com/pocolifo/jarremapper/extensions/ExtensionUtility.java index 681464a..689dee1 100644 --- a/src/main/java/com/pocolifo/jarremapper/extensions/ExtensionUtility.java +++ b/src/main/java/com/pocolifo/jarremapper/extensions/ExtensionUtility.java @@ -29,6 +29,7 @@ public static void copyResources(File inputFile, File outputFile) throws IOExcep try (FileSystem fileSystem = getFileSystem(outputFile)) { try (ZipInputStream stream = new ZipInputStream(new FileInputStream(inputFile))) { for (ZipEntry entry; (entry = stream.getNextEntry()) != null;) { + if (entry.isDirectory()) continue; if (entry.getName().endsWith(".class")) continue; Path path = fileSystem.getPath(entry.getName()); diff --git a/src/main/java/com/pocolifo/jarremapper/extensions/TinyRemapperEngine.java b/src/main/java/com/pocolifo/jarremapper/extensions/TinyRemapperEngine.java index 01880e7..8aacb79 100644 --- a/src/main/java/com/pocolifo/jarremapper/extensions/TinyRemapperEngine.java +++ b/src/main/java/com/pocolifo/jarremapper/extensions/TinyRemapperEngine.java @@ -1,6 +1,7 @@ package com.pocolifo.jarremapper.extensions; import java.io.IOException; +import java.nio.file.Path; import com.pocolifo.jarremapper.engine.AbstractRemappingEngine; import com.pocolifo.jarremapper.mapping.ClassMapping; @@ -14,6 +15,7 @@ public class TinyRemapperEngine extends AbstractRemappingEngine { private TinyRemapper.Builder options = TinyRemapper.newRemapper(); private boolean excludeMetaInf; + private Path[] classpath; public TinyRemapperEngine setOptions(TinyRemapper.Builder options) { this.options = options; @@ -25,15 +27,20 @@ public TinyRemapperEngine excludeMetaInf() { return this; } + public TinyRemapperEngine setClasspath(Path... classpath) { + this.classpath = classpath; + return this; + } + @Override public void remap() throws IOException { - TinyRemapper remapper = this.options .withMappings(createProvider(this.mapping)) .ignoreFieldDesc(true) .build(); remapper.readInputs(this.inputFile.toPath()); + if (this.classpath != null) remapper.readClassPath(this.classpath); try (OutputConsumerPath path = new OutputConsumerPath.Builder(this.outputFile.toPath()).build()) { remapper.apply(path); @@ -60,13 +67,7 @@ public static IMappingProvider createProvider(JarMapping mapping) { acceptor.acceptMethod(mtdMember, mtd.toMethodName); - /* - TODO: does this work?? - - for (int i = 0; mtd.parameterNames.size() > i; i++) { - acceptor.acceptMethodArg(mtdMember, i, mtd.parameterNames.get(i)); - } - */ + // TODO: Method parameters } } };