forked from Zeitheron/AlchemicalEnergy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
194 lines (172 loc) · 5.02 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
plugins {
id 'com.matthewprenger.cursegradle' version '1.1.0'
id 'se.bjurr.gitchangelog.git-changelog-gradle-plugin' version '1.56'
}
apply plugin: 'net.minecraftforge.gradle.forge'
ext.configFile = file "build.txt"
configFile.withReader {
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}
version = "${config.mod_version}"
group = "tk.zeitheron.${config.mod_id}"
archivesBaseName = "${config.mod_id_fancy}-${config.minecraft_version}"
sourceCompatibility = targetCompatibility = "1.8"
compileJava {
sourceCompatibility = targetCompatibility = "1.8"
}
minecraft {
version = "${config.minecraft_version}-${config.forge_version}"
runDir = "run"
mappings = "${config.mcp}"
makeObfSourceJar = false
replace 'required-after:hammercore', "required-after:hammercore@[${config.hl_version},)"
replace '@VERSION@', "${config.mod_version}"
replace '@FINGERPRINT@', project.findProperty('signSHA1')
}
repositories {
maven {
name = "DragonForge"
url = "https://raw.github.com/dragon-forge/maven/master"
}
maven {
name = "jei"
url = "http://dvs1.progwml6.com/files/maven"
}
}
dependencies {
deobfCompile "tk.zeitheron.HammerLib:HammerLib-${config.minecraft_version}:${config.hl_version}:deobf"
deobfCompile "mezz.jei:jei_${config.minecraft_version}:${config.jei_version}:api"
runtime "mezz.jei:jei_${config.minecraft_version}:${config.jei_version}"
}
processResources
{
inputs.property "version", project.version
inputs.property "mcversion", config.minecraft_version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
include 'pack.mcmeta'
expand 'version':project.version, 'mcversion':project.minecraft.version
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
exclude 'pack.mcmeta'
}
rename "mod_id_at.cfg", "META-INF/${config.mod_id}_at.cfg"
}
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'deobf'
manifest {
attributes 'FMLAT': "${config.mod_id}_at.cfg"
}
}
task srcJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
classifier = 'sources'
manifest {
attributes 'FMLAT': "${config.mod_id}_at.cfg"
}
}
jar {
manifest {
attributes 'FMLAT': "${config.mod_id}_at.cfg"
}
}
artifacts {
archives deobfJar
archives srcJar
}
curseforge {
apiKey = System.env.CURSEFORGE_API_KEY_COMM != null ? System.env.CURSEFORGE_API_KEY_COMM : '0'
project {
id = "${config.cf_project}"
changelogType = 'html'
changelog = file('changelog.html')
releaseType = "${config.release_type}"
addGameVersion "${config.minecraft_version}"
mainArtifact(jar) {
displayName = "[${config.minecraft_version}] ${config.mod_name} - ${config.mod_version}"
}
relations {
requiredLibrary 'Hammer-Lib'
}
}
}
task signJar(type: SignJar, dependsOn: reobfJar) {
onlyIf {
System.env.MC_KS_PASS != null
}
keyStore = System.env.MC_KS_PATH
alias = System.env.MC_KS_ALIAS
storePass = System.env.MC_KS_PASS
keyPass = System.env.MC_KS_PASS
inputFile = jar.archivePath
outputFile = jar.archivePath
}
task signDeobfJar(type: SignJar, dependsOn: deobfJar) {
onlyIf {
System.env.MC_KS_PASS != null
}
keyStore = System.env.MC_KS_PATH
alias = System.env.MC_KS_ALIAS
storePass = System.env.MC_KS_PASS
keyPass = System.env.MC_KS_PASS
inputFile = deobfJar.archivePath
outputFile = deobfJar.archivePath
}
task signSrcJar(type: SignJar, dependsOn: srcJar) {
onlyIf {
System.env.MC_KS_PASS != null
}
keyStore = System.env.MC_KS_PATH
alias = System.env.MC_KS_ALIAS
storePass = System.env.MC_KS_PASS
keyPass = System.env.MC_KS_PASS
inputFile = srcJar.archivePath
outputFile = srcJar.archivePath
}
task makeChangelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
file = new File("changelog.html")
untaggedName = "Version ${project.version}"
fromCommit = "${config.start_git_commit}"
toRef = "HEAD"
gitHubIssuePattern = "nonada123";
templateContent = """
{{#tags}}
<h1>Changes:</h1>
<ul>
{{#commits}}
<li> {{{message}}}</li>
{{/commits}}
</ul>
{{/tags}}
"""
}
build.dependsOn signJar
build.dependsOn signDeobfJar
build.dependsOn signSrcJar
tasks.build.dependsOn makeChangelog
afterEvaluate {
tasks["curseforge${config.cf_project}"].dependsOn.add(signJar)
tasks["curseforge${config.cf_project}"].dependsOn.add(signDeobfJar)
tasks["curseforge${config.cf_project}"].dependsOn.add(signSrcJar)
tasks["curseforge${config.cf_project}"].dependsOn.add(makeChangelog)
}