mirror of
https://github.com/cabaletta/baritone
synced 2025-02-20 14:07:06 +00:00
fabric task like forge
This commit is contained in:
parent
f5d5457100
commit
5494c43290
36
build.gradle
36
build.gradle
@ -52,8 +52,7 @@ import net.minecraftforge.gradle.userdev.tasks.GenerateSRG
|
||||
import net.minecraftforge.gradle.userdev.tasks.RenameJarInPlace
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
|
||||
def isMCP = false
|
||||
|
||||
def isMCP = !getProject().hasProperty("baritone.fabric_build")
|
||||
|
||||
apply plugin: 'java'
|
||||
if (isMCP) {
|
||||
@ -150,7 +149,7 @@ if (isMCP) {
|
||||
|
||||
mixin {
|
||||
defaultObfuscationEnv searge
|
||||
add sourceSets.launch, 'mixins.baritone.refmap.json'
|
||||
add sourceSets.launch, 'baritone-refmap.json'
|
||||
}
|
||||
}
|
||||
|
||||
@ -192,7 +191,9 @@ dependencies {
|
||||
|
||||
// this makes it compile with the forge tweak stuff
|
||||
implementation 'com.github.ImpactDevelopment:SimpleTweaker:1.2'
|
||||
implementation 'net.minecraft:launchwrapper:1.12'
|
||||
implementation('net.minecraft:launchwrapper:1.12') {
|
||||
exclude module: 'lwjgl'
|
||||
}
|
||||
|
||||
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
||||
}
|
||||
@ -257,6 +258,15 @@ File getClientJar() {
|
||||
.get()
|
||||
}
|
||||
|
||||
File getClientJarFabric() {
|
||||
return project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().findByName("launch").getRuntimeClasspath().getFiles()
|
||||
.stream()
|
||||
.filter({f -> f.getName().endsWith("-v2.jar") && f.getName().startsWith("minecraft-")})
|
||||
.map({f -> new File(f.getParentFile().getParentFile(), f.getName().toString().replace("mapped", "intermediary"))})
|
||||
.findFirst()
|
||||
.get()
|
||||
}
|
||||
|
||||
if (isMCP) {
|
||||
task copyMcJar(type: Copy) {
|
||||
def mcJar = {getClientJar()}
|
||||
@ -288,5 +298,21 @@ if (isMCP) {
|
||||
|
||||
task createDist(type: CreateDistTask, dependsOn: proguard)
|
||||
|
||||
build.finalizedBy(createDist)
|
||||
} else {
|
||||
task copyMcJar(type: Copy) {
|
||||
def mcJar = {getClientJarFabric()}
|
||||
|
||||
from mcJar
|
||||
into 'build/createMcIntermediaryJar/'
|
||||
rename {'client.jar'}
|
||||
}
|
||||
|
||||
task proguard(type: ProguardTask, dependsOn: copyMcJar) {
|
||||
url 'https://downloads.sourceforge.net/project/proguard/proguard/6.0/proguard6.0.3.zip'
|
||||
extract 'proguard6.0.3/lib/proguard.jar'
|
||||
}
|
||||
|
||||
task createDist(type: CreateDistTask, dependsOn: proguard)
|
||||
|
||||
}
|
||||
build.finalizedBy(createDist)
|
||||
|
@ -41,13 +41,16 @@ class BaritoneGradleTask extends DefaultTask {
|
||||
PROGUARD_STANDALONE_CONFIG = "standalone.pro",
|
||||
PROGUARD_EXPORT_PATH = "proguard_out.jar",
|
||||
|
||||
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-unoptimized-forge-%s.jar",
|
||||
ARTIFACT_FORGE_API = "%s-api-forge-%s.jar",
|
||||
ARTIFACT_FORGE_STANDALONE = "%s-standalone-forge-%s.jar";
|
||||
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-unoptimized-forge-%s.jar",
|
||||
ARTIFACT_FORGE_API = "%s-api-forge-%s.jar",
|
||||
ARTIFACT_FORGE_STANDALONE = "%s-standalone-forge-%s.jar",
|
||||
ARTIFACT_FABRIC_UNOPTIMIZED = "%s-unoptimized-fabric-%s.jar",
|
||||
ARTIFACT_FABRIC_API = "%s-api-fabric-%s.jar",
|
||||
ARTIFACT_FABRIC_STANDALONE = "%s-standalone-fabric-%s.jar";
|
||||
|
||||
protected String artifactName, artifactVersion;
|
||||
protected final Path
|
||||
@ -65,6 +68,10 @@ class BaritoneGradleTask extends DefaultTask {
|
||||
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));
|
||||
|
@ -81,7 +81,10 @@ public class CreateDistTask extends BaritoneGradleTask {
|
||||
getRelativeFile("dist/" + formatVersion(ARTIFACT_STANDALONE)),
|
||||
getRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE_STANDALONE)),
|
||||
getRelativeFile("dist/" + formatVersion(ARTIFACT_UNOPTIMIZED)),
|
||||
getRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE_UNOPTIMIZED))
|
||||
getRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE_UNOPTIMIZED)),
|
||||
getRelativeFile("dist/" + formatVersion(ARTIFACT_FABRIC_API)),
|
||||
getRelativeFile("dist/" + formatVersion(ARTIFACT_FABRIC_STANDALONE)),
|
||||
getRelativeFile("dist/" + formatVersion(ARTIFACT_FABRIC_UNOPTIMIZED))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -112,6 +112,9 @@ public class ProguardTask extends BaritoneGradleTask {
|
||||
if (getProject().hasProperty("baritone.forge_build")) {
|
||||
libraries = dependencies
|
||||
.map(f -> f.toString().endsWith("client.jar") ? getSrgMcJar() : f);
|
||||
} else if (getProject().hasProperty("baritone.fabric_build")) {
|
||||
libraries = dependencies
|
||||
.map(f -> f.getName().endsWith("-v2.jar") && f.getName().startsWith("minecraft-") ? getSrgMcJar() : f);
|
||||
} else {
|
||||
libraries = dependencies;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user