mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-11 14:57:28 +00:00
197 lines
6.7 KiB
Groovy
197 lines
6.7 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.CurseForgeUtil
|
|
import customskinloader.gradle.util.ModrinthUtil
|
|
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'
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
name = "sponge"
|
|
url = "https://repo.spongepowered.org/repository/maven-public/"
|
|
}
|
|
}
|
|
|
|
// We need to change source dirs for inherited problems.
|
|
sourceSets.main {
|
|
java {
|
|
srcDir "source"
|
|
}
|
|
resources {
|
|
srcDir "resource"
|
|
}
|
|
}
|
|
|
|
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,
|
|
modShortFullVersion: shortVersion,
|
|
mcVersion : config.minecraft_version,
|
|
mcFullVersions : config.minecraft_full_versions,
|
|
forgeVersion : config.forge_version,
|
|
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")
|
|
])
|
|
}
|
|
}
|
|
|
|
// Mixin stuffs
|
|
if (!project.name.toLowerCase().contains("forge/legacy")) {
|
|
apply plugin: 'org.spongepowered.mixin'
|
|
|
|
apply from: rootProject.file("buildSrc/patch.gradle")
|
|
patchMixin()
|
|
|
|
task genSrgMap {
|
|
doLast {
|
|
if (config.srg_notch_map != null) {
|
|
// 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
|
|
|
|
mixin {
|
|
add sourceSets.main, "mixins.customskinloader.refmap.json"
|
|
reobfSrgFile = "build/mixin.srg"
|
|
reobfNotchSrgFile = "build/mixin.srg"
|
|
}
|
|
|
|
reobf {
|
|
jar {
|
|
if (config.srg_notch_map != null) {
|
|
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"
|
|
if (project.name.toLowerCase().contains("vanilla")) {
|
|
exclude "**/*-sources.jar"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
build.finalizedBy afterBuild
|
|
|
|
apply plugin: 'maven-publish'
|
|
publishing {
|
|
repositories {
|
|
maven {
|
|
name = "GitHubPackages"
|
|
url = uri("https://maven.pkg.github.com/xfl03/MCCustomSkinLoader")
|
|
credentials {
|
|
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
|
|
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
|
|
}
|
|
}
|
|
}
|
|
publications {
|
|
gpr(MavenPublication) {
|
|
groupId 'customskinloader'
|
|
artifactId project.archivesBaseName
|
|
from(components.java)
|
|
}
|
|
}
|
|
}
|
|
tasks.withType(PublishToMavenRepository) {
|
|
onlyIf { System.getenv("GITHUB_TOKEN") != null }
|
|
}
|
|
|
|
if (project.name.toLowerCase().contains("vanilla/1.")) {
|
|
apply from: rootProject.file('Vanilla/common.gradle')
|
|
} else {
|
|
// Only Fabric and Forge edition should be uploaded to CurseForge and Modrinth
|
|
CurseForgeUtil.provideCurseForge project
|
|
ModrinthUtil.provideModrinth project
|
|
}
|
|
}
|
|
}
|