Files
MCCustomSkinLoader/build.gradle
T
2024-07-02 22:43:35 +08:00

133 lines
4.5 KiB
Groovy

apply plugin: 'base'
apply plugin: 'customskinloader'
ext.configFile = file "build.properties"
configFile.withReader {
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
gradleVersion = "4.9"
}
import customskinloader.gradle.util.RemapUtil
import customskinloader.gradle.util.VersionUtil
subprojects {
apply plugin: 'net.minecraftforge.gradle.forge'
ext.configFile = file "build.properties"
configFile.withReader {
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}
version = VersionUtil.getCSLVersion(rootProject)
group = "customskinloader"
ext.shortVersion = VersionUtil.getShortVersion(rootProject)
sourceCompatibility = targetCompatibility = 1.8
compileJava {
sourceCompatibility = targetCompatibility = 1.8
}
minecraft {
version = config.forge_mc_version + "-" + config.forge_version
runDir = "run"
mappings = config.mappings_version
replace '@MOD_VERSION@', rootProject.ext.config.version
replace '@MOD_FULL_VERSION@', project.version
replace '@MOD_BUILD_NUMBER@', VersionUtil.getBuildNum()
replaceIn 'CustomSkinLoader.java'
}
jar {
manifest {
attributes([
"Specification-Title" : "CustomSkinLoader",
"Specification-Vendor" : "xfl03",
"Specification-Version" : "1",
"Implementation-Title" : "CustomSkinLoader",
"Implementation-Version" : "${version}",
"Implementation-Vendor" : "xfl03",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
// For real subprojects
if (!config.is_real_project || Boolean.parseBoolean(config.is_real_project.toString())) {
archivesBaseName = "CustomSkinLoader_${-> VersionUtil.getEdition(project)}"
processResources {
filesNotMatching(["**/*.js", "mixins.*.json"]) {
expand([
modVersion : rootProject.ext.config.version,
modFullVersion : project.version,
dependencies : VersionUtil.getDependencies(project.ext.config.dependencies.toString()),
gitVersion : System.getenv("CIRCLE_SHA1") ?: System.getenv("GITHUB_SHA"),
buildUrl : System.getenv("CIRCLE_BUILD_URL") ?: "https://github.com/xfl03/MCCustomSkinLoader/actions/runs/" + System.getenv("GITHUB_RUN_ID"),
releaseTime : new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
jar {
exclude "com/**"
exclude "net/minecraft/client/renderer/RenderType.class"
exclude "net/minecraft/client/renderer/texture/**"
exclude "net/minecraft/resources/**"
}
task genSrgMap {
doLast {
if (!config.srg_notch_map.isEmpty()) {
// convert mappings
RemapUtil.tsrg2srg file(config.srg_notch_map), file("build/reobf.srg")
RemapUtil.tsrg2srg file("mixin.tsrg"), file("build/mixin.srg")
}
}
}
deobfCompileDummyTask.dependsOn genSrgMap
reobf {
jar {
if (!config.srg_notch_map.isEmpty()) {
mappings = file("build/reobf.srg")
}
}
}
task signJar(type: SignJar, dependsOn: reobfJar) {
onlyIf { System.getenv("KEY_PASS") != null && System.getenv("KEY_PASS") != "" }
doLast { System.out.println("Jar will be signed.") }
inputFile = jar.archivePath
outputFile = jar.archivePath
keyStore = "${rootDir}/Common/CustomSkinLoader.jks"
alias = 'CustomSkinLoader'
storePass = System.getenv("KEY_PASS")
keyPass = System.getenv("KEY_PASS")
}
build.dependsOn signJar
task afterBuild {
doLast {
//copyBuildFile
copy {
from "build/libs"
into "${rootDir}/build/libs"
include "**/*.jar"
}
}
}
build.finalizedBy afterBuild
}
}