mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-17 07:35:09 +00:00
160 lines
4.7 KiB
Groovy
160 lines
4.7 KiB
Groovy
apply plugin: 'net.minecraftforge.gradle.forge'
|
|
apply plugin: 'org.spongepowered.mixin'
|
|
|
|
ext.configFile = file "build.properties"
|
|
configFile.withReader {
|
|
def prop = new Properties()
|
|
prop.load(it)
|
|
project.ext.config = new ConfigSlurper().parse prop
|
|
}
|
|
apply from: rootProject.file("BuildScripts/version.gradle")
|
|
|
|
version = getCSLVersion()
|
|
group = config.group
|
|
archivesBaseName = rootProject.ext.config.name + "_" + config.minecraft_version
|
|
ext.shortVersion = getShortVersion()
|
|
|
|
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
|
|
replaceIn 'CustomSkinLoader.java'
|
|
}
|
|
|
|
jar {
|
|
manifest {
|
|
attributes 'TweakClass' : 'customskinloader.tweaker.ModSystemTweaker'
|
|
attributes 'TweakName' : rootProject.ext.config.name
|
|
attributes 'TweakAuthor' : 'xfl03,JLChnToZ'
|
|
attributes 'TweakVersion': version
|
|
attributes 'TweakOrder' : '-10'
|
|
}
|
|
exclude 'net/minecraft/client/renderer/texture/**'
|
|
exclude 'Profile.json'
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
name = "sponge"
|
|
url = "https://repo.spongepowered.org/maven"
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'org.spongepowered:mixin:0.8'
|
|
}
|
|
|
|
mixin {
|
|
add sourceSets.main, "mixins.customskinloader.refmap.json"
|
|
reobfSrgFile = "mixin.srg"
|
|
reobfNotchSrgFile = "mixin.srg"
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
//Common
|
|
srcDir "${rootDir}/Common/source"
|
|
//Vanilla
|
|
srcDir "${rootDir}/Vanilla/source"
|
|
//Special
|
|
srcDir "source"
|
|
}
|
|
resources {
|
|
//Common
|
|
srcDir "${rootDir}/Common/resource"
|
|
//Vanilla
|
|
srcDir "${rootDir}/Vanilla/resource"
|
|
//Special
|
|
srcDir "resource"
|
|
}
|
|
}
|
|
}
|
|
|
|
processResources {
|
|
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"),
|
|
buildUrl : System.getenv("CIRCLE_BUILD_URL"),
|
|
releaseTime : new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
|
])
|
|
}
|
|
|
|
import java.security.MessageDigest
|
|
|
|
apply from: rootProject.file("BuildScripts/remap.gradle")
|
|
task afterBuild {
|
|
doLast {
|
|
//renameSrgJar
|
|
def file0 = file("build/libs/${archivesBaseName}-${version}.jar")
|
|
def file1 = file("build/libs/${archivesBaseName}-${version}-srg.jar")
|
|
file0.renameTo(file1)
|
|
|
|
//reobfSrgToNotch
|
|
reobfSrgToNotch()
|
|
|
|
//copyBuildFile
|
|
copy {
|
|
from "build/libs"
|
|
into "${rootDir}/build/libs"
|
|
include "**/*.jar"
|
|
exclude "**/*-srg.jar"
|
|
exclude "**/*-dev.jar"
|
|
exclude "**/*-sources.jar"
|
|
}
|
|
|
|
//copyProfileJson
|
|
File f = project.file("build/resources/main/Profile.json")
|
|
String of = String.format("build/libs/%s-CSL-%s.json", config.minecraft_version, shortVersion)
|
|
File off = rootProject.file(of)
|
|
off.parentFile.mkdirs()
|
|
|
|
def digest = MessageDigest.getInstance "SHA1"
|
|
digest.update file0.getBytes()
|
|
def sha1 = new BigInteger(1, digest.digest()).toString 16 padLeft 40, "0"
|
|
off.withWriter "UTF-8", { w ->
|
|
f.eachLine "UTF-8", { str ->
|
|
w << "${-> str.contains("{SHA1}") ? str.replace("{SHA1}", sha1) : (!(str =~ $/"size":\s*-1/$) ? str : str.replace("-1", file0.size().toString()))}\n"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
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 }
|
|
}
|