mirror of https://github.com/cabaletta/baritone
rework this again and fix dist
This commit is contained in:
parent
a475f522ef
commit
fd43dace70
|
@ -46,13 +46,7 @@ class BaritoneGradleTask extends DefaultTask {
|
|||
ARTIFACT_STANDARD = "%s-%s.jar",
|
||||
ARTIFACT_UNOPTIMIZED = "%s-unoptimized-%s.jar",
|
||||
ARTIFACT_API = "%s-api-%s.jar",
|
||||
ARTIFACT_STANDALONE = "%s-standalone-%s.jar",
|
||||
ARTIFACT_FORGE_UNOPTIMIZED = "%s-forge-unoptimized-%s.jar",
|
||||
ARTIFACT_FORGE_API = "%s-forge-api-%s.jar",
|
||||
ARTIFACT_FORGE_STANDALONE = "%s-forge-standalone-%s.jar",
|
||||
ARTIFACT_FABRIC_UNOPTIMIZED = "%s-fabric-standalone-%s.jar",
|
||||
ARTIFACT_FABRIC_API = "%s-fabric-api-%s.jar",
|
||||
ARTIFACT_FABRIC_STANDALONE = "%s-fabric-standalone-%s.jar";
|
||||
ARTIFACT_STANDALONE = "%s-standalone-%s.jar";
|
||||
|
||||
protected String artifactName, artifactVersion;
|
||||
protected final Path
|
||||
|
@ -61,25 +55,14 @@ class BaritoneGradleTask extends DefaultTask {
|
|||
proguardOut;
|
||||
|
||||
public BaritoneGradleTask() {
|
||||
this.artifactName = getProject().getProperties().get("archives_base_name").toString();
|
||||
this.artifactName = getProject().getProperties().get("archivesBaseName").toString();
|
||||
this.artifactVersion = getProject().getVersion().toString();
|
||||
|
||||
String subprojectArtifactName = getProject().getProperties().get("archivesBaseName").toString();
|
||||
this.artifactPath = this.getBuildFile(String.format(ARTIFACT_STANDARD, subprojectArtifactName, artifactVersion));
|
||||
this.artifactPath = this.getBuildFile(formatVersion(ARTIFACT_STANDARD));
|
||||
|
||||
if (getProject().hasProperty("baritone.forge_build")) {
|
||||
this.artifactUnoptimizedPath = this.getBuildFile(formatVersion(ARTIFACT_FORGE_UNOPTIMIZED));
|
||||
this.artifactApiPath = this.getBuildFile(formatVersion(ARTIFACT_FORGE_API));
|
||||
this.artifactStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_FORGE_STANDALONE));
|
||||
} else if (getProject().hasProperty("baritone.fabric_build")) {
|
||||
this.artifactUnoptimizedPath = this.getBuildFile(formatVersion(ARTIFACT_FABRIC_UNOPTIMIZED));
|
||||
this.artifactApiPath = this.getBuildFile(formatVersion(ARTIFACT_FABRIC_API));
|
||||
this.artifactStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_FABRIC_STANDALONE));
|
||||
} else {
|
||||
this.artifactUnoptimizedPath = this.getBuildFile(formatVersion(ARTIFACT_UNOPTIMIZED));
|
||||
this.artifactApiPath = this.getBuildFile(formatVersion(ARTIFACT_API));
|
||||
this.artifactStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_STANDALONE));
|
||||
}
|
||||
this.artifactUnoptimizedPath = this.getBuildFile(formatVersion(ARTIFACT_UNOPTIMIZED));
|
||||
this.artifactApiPath = this.getBuildFile(formatVersion(ARTIFACT_API));
|
||||
this.artifactStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_STANDALONE));
|
||||
|
||||
this.proguardOut = this.getTemporaryFile(PROGUARD_EXPORT_PATH);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,9 @@ import org.gradle.api.tasks.TaskAction;
|
|||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.OpenOption;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -59,8 +61,8 @@ public class CreateDistTask extends BaritoneGradleTask {
|
|||
Files.copy(this.artifactUnoptimizedPath, unoptimized, REPLACE_EXISTING);
|
||||
|
||||
// Calculate all checksums and format them like "shasum"
|
||||
List<String> shasum = getAllDistJars().stream()
|
||||
.filter(Files::exists)
|
||||
List<String> shasum = Files.list(getRootRelativeFile("dist/"))
|
||||
.filter(e -> e.getFileName().toString().endsWith(".jar"))
|
||||
.map(path -> sha1(path) + " " + path.getFileName().toString())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
@ -74,20 +76,6 @@ public class CreateDistTask extends BaritoneGradleTask {
|
|||
return p.getFileName().toString();
|
||||
}
|
||||
|
||||
private List<Path> getAllDistJars() {
|
||||
return Arrays.asList(
|
||||
getRootRelativeFile("dist/" + formatVersion(ARTIFACT_API)),
|
||||
getRootRelativeFile("dist/" + formatVersion(ARTIFACT_FABRIC_API)),
|
||||
getRootRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE_API)),
|
||||
getRootRelativeFile("dist/" + formatVersion(ARTIFACT_STANDALONE)),
|
||||
getRootRelativeFile("dist/" + formatVersion(ARTIFACT_FABRIC_STANDALONE)),
|
||||
getRootRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE_STANDALONE)),
|
||||
getRootRelativeFile("dist/" + formatVersion(ARTIFACT_UNOPTIMIZED)),
|
||||
getRootRelativeFile("dist/" + formatVersion(ARTIFACT_FABRIC_UNOPTIMIZED)),
|
||||
getRootRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE_UNOPTIMIZED))
|
||||
);
|
||||
}
|
||||
|
||||
private static synchronized String sha1(Path path) {
|
||||
try {
|
||||
if (SHA1_DIGEST == null) {
|
||||
|
|
Loading…
Reference in New Issue