-
Notifications
You must be signed in to change notification settings - Fork 34
/
build.gradle
132 lines (113 loc) · 4.46 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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
}
}