Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Commit

Permalink
Add classpath features + update repo
Browse files Browse the repository at this point in the history
  • Loading branch information
YoungerMax committed Mar 19, 2022
1 parent de05d10 commit 19cdb27
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group 'com.pocolifo.jarremapper'
version '1.2.0'
version '1.2.1'

repositories {
mavenCentral()
Expand All @@ -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'
Expand Down Expand Up @@ -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()'
]
}
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
pluginManagement {
repositories {
mavenLocal()
maven {
url 'https://maven.services.pocolifo.com'
url 'https://maven.services.pocolifo.com/releases'
name 'pocolifo'
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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
}
}
};
Expand Down

0 comments on commit 19cdb27

Please sign in to comment.