Merge pull request #3843 from wagyourtail/1.19/fix/1.19.3-fixdistnames

fix dist names to match previous versions
This commit is contained in:
leijurv 2023-02-18 16:08:45 -08:00 committed by GitHub
commit 7a5c4f1f03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 44 additions and 24 deletions

View File

@ -19,6 +19,8 @@ package baritone.gradle.task;
import org.gradle.api.DefaultTask;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.TaskAction;
import java.io.File;
import java.io.IOException;
@ -49,14 +51,35 @@ class BaritoneGradleTask extends DefaultTask {
ARTIFACT_STANDALONE = "%s-standalone-%s.jar";
protected String artifactName, artifactVersion;
protected final Path
protected Path
artifactPath,
artifactUnoptimizedPath, artifactApiPath, artifactStandalonePath, // these are different for forge builds
proguardOut;
@Input
@Optional
protected String compType = null;
public String getCompType() {
return compType;
}
public void setCompType(String compType) {
this.compType = compType;
}
public BaritoneGradleTask() {
this.artifactName = getProject().getProperties().get("archivesBaseName").toString();
this.artifactVersion = getProject().getVersion().toString();
this.artifactName = getProject().getRootProject().getProperties().get("archives_base_name").toString();
}
public void doFirst() {
if (compType != null) {
this.artifactVersion = compType + "-" + getProject().getVersion();
} else {
this.artifactVersion = getProject().getVersion().toString();
}
this.artifactPath = this.getBuildFile(formatVersion(ARTIFACT_STANDARD));
@ -99,4 +122,8 @@ class BaritoneGradleTask extends DefaultTask {
protected Path getBuildFile(String file) {
return getRelativeFile("libs/" + file);
}
protected String addCompTypeFirst(String string) {
return compType == null ? string : compType + "-" + string;
}
}

View File

@ -41,6 +41,7 @@ public class CreateDistTask extends BaritoneGradleTask {
@TaskAction
protected void exec() throws Exception {
super.doFirst();
super.verifyArtifacts();
// Define the distribution file paths

View File

@ -63,15 +63,9 @@ public class ProguardTask extends BaritoneGradleTask {
return extract;
}
@Input
private String compType;
public String getCompType() {
return compType;
}
@TaskAction
protected void exec() throws Exception {
super.doFirst();
super.verifyArtifacts();
// "Haha brady why don't you make separate tasks"
@ -253,7 +247,7 @@ public class ProguardTask extends BaritoneGradleTask {
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.add(2, "-printmapping " + new File(this.getRootRelativeFile(PROGUARD_MAPPING_DIR).toFile(), "mappings-" + addCompTypeFirst("api.txt")));
// API config doesn't require any changes from the changes that we made to the template
Files.write(getTemporaryFile(compType+PROGUARD_API_CONFIG), api);
@ -261,7 +255,7 @@ public class ProguardTask extends BaritoneGradleTask {
// 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"));
standalone.add(2, "-printmapping " + new File(this.getRootRelativeFile(PROGUARD_MAPPING_DIR).toFile(), "mappings-" + compType + "-standalone.txt"));
standalone.add(2, "-printmapping " + new File(this.getRootRelativeFile(PROGUARD_MAPPING_DIR).toFile(), "mappings-" + addCompTypeFirst("standalone.txt")));
Files.write(getTemporaryFile(compType+PROGUARD_STANDALONE_CONFIG), standalone);
}
@ -294,11 +288,6 @@ public class ProguardTask extends BaritoneGradleTask {
public void setExtract(String extract) {
this.extract = extract;
}
public void setCompType(String compType) {
this.compType = compType;
}
private void runProguard(Path config) throws Exception {
// Delete the existing proguard output file. Proguard probably handles this already, but why not do it ourselves
if (Files.exists(this.proguardOut)) {

View File

@ -22,7 +22,7 @@ plugins {
id "com.github.johnrengelman.shadow" version "7.0.0"
}
archivesBaseName = archivesBaseName + "-" + project.name
archivesBaseName = archivesBaseName + "-fabric"
minecraft {
fabric()
@ -79,10 +79,12 @@ components.java {
task proguard(type: ProguardTask) {
url 'https://github.com/Guardsquare/proguard/releases/download/v7.2.1/proguard-7.2.1.zip'
extract 'proguard-7.2.1/lib/proguard.jar'
compType "FABRIC"
compType "fabric"
}
task createDist(type: CreateDistTask, dependsOn: proguard)
task createDist(type: CreateDistTask, dependsOn: proguard) {
compType "fabric"
}
build.finalizedBy(createDist)

View File

@ -22,7 +22,7 @@ plugins {
id "com.github.johnrengelman.shadow" version "7.0.0"
}
archivesBaseName = archivesBaseName + "-" + project.name
archivesBaseName = archivesBaseName + "-forge"
minecraft {
forge {
@ -98,10 +98,12 @@ components.java {
task proguard(type: ProguardTask) {
url 'https://github.com/Guardsquare/proguard/releases/download/v7.2.1/proguard-7.2.1.zip'
extract 'proguard-7.2.1/lib/proguard.jar'
compType "FORGE"
compType "forge"
}
task createDist(type: CreateDistTask, dependsOn: proguard)
task createDist(type: CreateDistTask, dependsOn: proguard) {
compType "forge"
}
build.finalizedBy(createDist)

View File

@ -97,7 +97,6 @@ jar {
task proguard(type: ProguardTask) {
url 'https://github.com/Guardsquare/proguard/releases/download/v7.2.1/proguard-7.2.1.zip'
extract 'proguard-7.2.1/lib/proguard.jar'
compType "OFFICIAL"
}
task createDist(type: CreateDistTask, dependsOn: proguard)