forked from henkelmax/advanced-mining-dimension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
224 lines (198 loc) · 6.6 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
maven { url = 'https://dist.creeper.host/Sponge/maven' }
maven { url = 'https://maven.maxhenkel.de/repository/public' }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath group: 'de.maxhenkel.forge-update', name: 'forge-update', version: '1.0.2'
classpath group: 'com.github.jengelman.gradle.plugins', name: 'shadow', version: '4.0.4'
classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT'
}
}
plugins {
// https://github.com/matthewprenger/CurseGradle
id "com.matthewprenger.cursegradle" version "1.4.0"
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'forge-update'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'idea'
apply plugin: 'org.spongepowered.mixin'
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
version = mod_version
group = mod_packagename
archivesBaseName = mod_id
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
minecraft {
mappings channel: 'snapshot', version: "${mappings_version}"
runs {
client {
workingDirectory project.file('run').canonicalPath
property 'forge.logging.console.level', 'debug'
args = ['--username', 'henkelmax']
source sourceSets.main
mods {
mod_id {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run/server').canonicalPath
property 'forge.logging.console.level', 'debug'
source sourceSets.main
mods {
mod_id {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/')
mods {
mod_id {
source sourceSets.main
}
}
}
}
}
dependencies {
minecraft "net.minecraftforge:forge:${mod_minecraft_version}-${forge_version}"
shadow fg.deobf("de.maxhenkel.corelib:corelib:${mod_minecraft_version}-${corelib_version}:api")
runtimeOnly fg.deobf("de.maxhenkel.corelib:corelib:${mod_minecraft_version}-${corelib_version}")
runtimeOnly fg.deobf("de.maxhenkel.corelib:corelib:${mod_minecraft_version}-${corelib_version}:javadoc")
}
mixin {
add sourceSets.main, "mining_dimension.refmap.json"
}
jar {
manifest {
attributes(["Specification-Title" : mod_name,
"Specification-Vendor" : mod_vendor,
"Specification-Version" : "1",
"Implementation-Title" : mod_name,
"Implementation-Version" : mod_version,
"Implementation-Vendor" : mod_vendor,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConnector" : "de.maxhenkel.miningdimension.mixin.MixinConnector"])
}
}
processResources {
inputs.property "version", project.version
from(sourceSets.main.resources.srcDirs) {
include '**/*.toml'
expand 'mod_id': mod_id,
'mod_version': mod_version,
'mod_vendor': mod_vendor,
'mod_name': mod_name,
'mod_forge_version': mod_forge_version,
'mod_loader_version': mod_loader_version,
'mod_minecraft_version': mod_minecraft_version
}
from(sourceSets.main.resources.srcDirs) {
exclude '**/*.toml'
}
}
curseforge {
def apiKeyFile = file('curseforge_api_key.txt')
if (System.env.CURSEFORGE_API_KEY != null) {
apiKey = System.env.CURSEFORGE_API_KEY;
} else if (apiKeyFile.exists()) {
apiKey = apiKeyFile.text
} else {
apiKey = ""
}
project {
id = curse_id
changelogType = 'markdown'
changelog = file('changelog.md')
releaseType = curse_release_type
addGameVersion mod_minecraft_version
mainArtifact(jar) {
displayName = "[${mod_minecraft_version}] ${mod_name} ${mod_version}"
}
}
}
forgeUpdate {
def messages = []
file('changelog.md').eachLine { String line ->
if (line.trim().startsWith('-')) {
messages.add(line.replaceFirst('-', '').trim())
}
}
def apiKeyFile = file('forge_update_api_key.txt')
if (System.env.FORGE_UPDATE_API_KEY != null) {
apiKey = System.env.FORGE_UPDATE_API_KEY;
} else if (apiKeyFile.exists()) {
apiKey = apiKeyFile.text
} else {
apiKey = ""
}
serverURL = 'https://update.maxhenkel.de/'
modID = mod_id
gameVersion = mod_minecraft_version
modVersion = mod_version
updateMessages = messages
releaseType = curse_release_type
tags = recommended == 'true' ? ['recommended'] : []
}
repositories {
maven {
name = "henkelmax.public"
url = 'https://maven.maxhenkel.de/repository/public'
}
mavenLocal()
}
javadoc {
failOnError = false
}
task deobfJar(type: Jar) {
classifier = 'deobf'
from sourceSets.main.output
manifest {
attributes(["Specification-Title" : mod_name,
"Specification-Vendor" : mod_vendor,
"Specification-Version" : "1",
"Implementation-Title" : mod_name,
"Implementation-Version" : mod_version,
"Implementation-Vendor" : mod_vendor,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConnector" : "de.maxhenkel.miningdimension.mixin.MixinConnector"])
}
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allJava
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.getDestinationDir()
}
artifacts {
archives deobfJar
archives sourcesJar
archives javadocJar
archives shadowJar
}
jar.finalizedBy('reobfJar')
shadowJar {
project.configurations.shadow.setTransitive(true);
configurations = [project.configurations.shadow]
classifier = ""
relocate 'de.maxhenkel.corelib', "de.maxhenkel.${mod_id}.corelib"
}
reobf {
shadowJar {}
}