mirror of https://github.com/cabaletta/baritone
proper mappings per proguard run
This commit is contained in:
parent
88c00f2fec
commit
3cee66229a
|
@ -36,4 +36,4 @@ jobs:
|
|||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Mappings
|
||||
path: build/tmp/proguard/mapping.txt
|
||||
path: mapping/
|
||||
|
|
|
@ -23,4 +23,4 @@ jobs:
|
|||
|
||||
- name: Executing tests
|
||||
run: ./gradlew test
|
||||
|
||||
|
||||
|
|
|
@ -32,4 +32,6 @@ baritone_Client.launch
|
|||
!/.idea/copyright/profiles_settings.xml
|
||||
|
||||
.vscode/launch.json
|
||||
.architectury-transformer
|
||||
.architectury-transformer
|
||||
|
||||
mapping
|
|
@ -42,6 +42,7 @@ class BaritoneGradleTask extends DefaultTask {
|
|||
PROGUARD_API_CONFIG = "api.pro",
|
||||
PROGUARD_STANDALONE_CONFIG = "standalone.pro",
|
||||
PROGUARD_EXPORT_PATH = "proguard_out.jar",
|
||||
PROGUARD_MAPPING_DIR = "mapping",
|
||||
|
||||
ARTIFACT_STANDARD = "%s-%s.jar",
|
||||
ARTIFACT_UNOPTIMIZED = "%s-unoptimized-%s.jar",
|
||||
|
@ -101,11 +102,11 @@ class BaritoneGradleTask extends DefaultTask {
|
|||
}
|
||||
|
||||
protected Path getRelativeFile(String file) {
|
||||
return Paths.get(new File(new File(getProject().getBuildDir(), "../"), file).getAbsolutePath());
|
||||
return Paths.get(new File(getProject().getBuildDir(), file).getAbsolutePath());
|
||||
}
|
||||
|
||||
protected Path getRootRelativeFile(String file) {
|
||||
return Paths.get(new File(new File(getProject().getRootProject().getBuildDir(), "../"), file).getAbsolutePath());
|
||||
return Paths.get(new File(getProject().getRootDir(), file).getAbsolutePath());
|
||||
}
|
||||
|
||||
protected Path getTemporaryFile(String file) {
|
||||
|
@ -113,6 +114,6 @@ class BaritoneGradleTask extends DefaultTask {
|
|||
}
|
||||
|
||||
protected Path getBuildFile(String file) {
|
||||
return getRelativeFile("build/libs/" + file);
|
||||
return getRelativeFile("libs/" + file);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -278,13 +278,19 @@ public class ProguardTask extends BaritoneGradleTask {
|
|||
template.add(2, "-libraryjars '" + this.getTemporaryFile(MIXIN_JAR) + "'");
|
||||
}
|
||||
|
||||
Files.createDirectories(this.getRootRelativeFile(PROGUARD_MAPPING_DIR));
|
||||
|
||||
List<String> api = new ArrayList<>(template);
|
||||
api.add(2, "-printmapping " + new File(this.getRootRelativeFile(PROGUARD_MAPPING_DIR).toFile(), "mappings-" + compType + "-api.txt"));
|
||||
|
||||
// API config doesn't require any changes from the changes that we made to the template
|
||||
Files.write(getTemporaryFile(PROGUARD_API_CONFIG), template);
|
||||
Files.write(getTemporaryFile(compType+PROGUARD_API_CONFIG), api);
|
||||
|
||||
// For the Standalone config, don't keep the API package
|
||||
List<String> standalone = new ArrayList<>(template);
|
||||
standalone.removeIf(s -> s.contains("# this is the keep api"));
|
||||
Files.write(getTemporaryFile(PROGUARD_STANDALONE_CONFIG), standalone);
|
||||
standalone.add(2, "-printmapping " + new File(this.getRootRelativeFile(PROGUARD_MAPPING_DIR).toFile(), "mappings-" + compType + "-standalone.txt"));
|
||||
Files.write(getTemporaryFile(compType+PROGUARD_STANDALONE_CONFIG), standalone);
|
||||
}
|
||||
|
||||
private Stream<File> acquireDependencies() {
|
||||
|
@ -294,12 +300,12 @@ public class ProguardTask extends BaritoneGradleTask {
|
|||
}
|
||||
|
||||
private void proguardApi() throws Exception {
|
||||
runProguard(getTemporaryFile(PROGUARD_API_CONFIG));
|
||||
runProguard(getTemporaryFile(compType+PROGUARD_API_CONFIG));
|
||||
Determinizer.determinize(this.proguardOut.toString(), this.artifactApiPath.toString());
|
||||
}
|
||||
|
||||
private void proguardStandalone() throws Exception {
|
||||
runProguard(getTemporaryFile(PROGUARD_STANDALONE_CONFIG));
|
||||
runProguard(getTemporaryFile(compType+PROGUARD_STANDALONE_CONFIG));
|
||||
Determinizer.determinize(this.proguardOut.toString(), this.artifactStandalonePath.toString());
|
||||
}
|
||||
|
||||
|
|
|
@ -337,5 +337,3 @@
|
|||
public java.lang.String substring(int);
|
||||
public java.lang.String substring(int,int);
|
||||
}
|
||||
|
||||
-printmapping mapping.txt
|
||||
|
|
Loading…
Reference in New Issue