forked from VazkiiMods/Botania
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
296 lines (260 loc) · 8 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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
buildscript {
repositories {
mavenCentral()
maven {
name "forge"
url "https://files.minecraftforge.net/maven"
}
maven { url = 'https://dist.creeper.host/Sponge/maven' }
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.0.+'
classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT'
}
}
plugins {
id 'org.hidetake.ssh' version '2.10.1'
id "com.diffplug.spotless" version "5.1.0"
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'pmd'
apply plugin: 'org.spongepowered.mixin'
mixin {
add sourceSets.main, "botania.refmap.json"
}
ext.configFile = file('build.properties')
ext.config = parseConfig(configFile)
ext.priv = parseConfig(file('private.properties'))
def mc_version = "1.16.1"
version = "${config.version}-${config.build_number}"
if (System.getenv().RELEASE_MODE == null) {
version += '-SNAPSHOT'
}
group = "vazkii.botania" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = config.mod_name
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
minecraft {
mappings channel: 'snapshot', version: "20200723-1.16.1"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
properties 'forge.logging.console.level': 'debug'
properties 'fml.earlyprogresswindow': 'false'
workingDirectory project.file('run')
mods {
botania {
source sourceSets.main
}
}
}
server {
properties 'forge.logging.console.level': 'debug'
workingDirectory project.file('run')
mods {
botania {
source sourceSets.main
}
}
}
data {
properties 'fml.earlyprogresswindow': 'false'
workingDirectory project.file('run')
forceExit false
mods {
botania {
source sourceSets.main
}
}
args '--mod', 'botania', '--all',
'--existing', '"' + file('src/main/resources/') + '"',
'--existing', '"' + file('src/generated/resources/') + '"',
'--output', '"' + file('src/generated/resources/') + '"'
}
}
}
sourceSets.main.resources {
srcDir 'src/generated/resources'
}
repositories {
mavenCentral()
maven {
url "https://maven.blamejared.com"
}
maven {
url "https://dvs1.progwml6.com/files/maven"
}
maven {
url "https://minecraft.curseforge.com/api/maven/"
}
maven {
name "curios"
url "https://maven.theillusivec4.top/"
}
maven {
name "storagedrawers"
url = "https://dl.bintray.com/jaquadro/dev/"
}
}
test {
useJUnitPlatform()
}
dependencies {
minecraft "net.minecraftforge:forge:${mc_version}-32.0.75"
annotationProcessor 'org.spongepowered:mixin:0.8'
annotationProcessor 'com.google.code.gson:gson:2.8.0'
annotationProcessor 'com.google.guava:guava:21.0'
annotationProcessor 'org.ow2.asm:asm-tree:7.2'
annotationProcessor 'org.ow2.asm:asm-commons:7.2'
annotationProcessor 'org.ow2.asm:asm-util:7.2'
compileOnly fg.deobf("vazkii.patchouli:Patchouli:1.16-39:api")
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.16-39")
compileOnly fg.deobf("mezz.jei:jei-1.16.1:7.0.0.2:api")
runtimeOnly fg.deobf("mezz.jei:jei-1.16.1:7.0.0.2")
compileOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.16.1-3.0:api")
runtimeOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.16.1-3.0")
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.1'
}
spotless {
enforceCheck = false // workaround around jenkins having wrong line endings in some files
// we explicitly check in github actions builds
java {
indentWithTabs()
licenseHeaderFile('spotless/license_template.txt')
eclipse().configFile 'spotless/eclipseformat.xml'
removeUnusedImports()
importOrderFile 'spotless/eclipse.importorder'
}
}
pmd {
toolVersion '6.22.0'
incrementalAnalysis.set(true)
ruleSets.clear()
ruleSetFiles = files("spotless/pmd-ruleset.xml")
}
task checkSyntax {
dependsOn spotlessJavaCheck, pmdMain
}
jar {
manifest {
attributes(["Specification-Title": "botania",
"Specification-Vendor": "botania",
"Specification-Version": "1",
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor": "botania",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConnector": "vazkii.botania.common.MixinConnector"
])
}
exclude "**/*.bat"
exclude "**/*.psd"
exclude "**/*.exe"
}
processResources {
// Exclude datagenerator .cache directory
exclude '.cache'
filesMatching('data/botania/patchouli_books/lexicon/book.json') {
filter {
it.replaceAll("buildNumber", config.build_number)
}
}
}
task srcJar(type: Jar) {
from(sourceSets.main.java)
classifier = 'sources'
}
task apiJar(type: Jar) {
// Remove sources from the api jar when MinecraftForge/ForgeGradle#369 is fixed
from(sourceSets.main.allJava)
from(sourceSets.main.output)
include 'vazkii/botania/api/**'
classifier = 'api'
}
artifacts {
archives srcJar, apiJar
}
/**
* Increments the buildnumber in your config file, and saves it
* Note: The doFirst is important, without it the build number
* will be incremented every time tasks are configured, i.e every
* time gradle is run on this project.
*/
task incrementBuildNumber {
doFirst {
config.build_number = (config.build_number.toString().toInteger()) + 1
configFile.withWriter {
config.toProperties().store(it, "")
}
}
}
// SCP servers
remotes {
if (priv != null)
web {
host = 'botaniamod.net'
user = priv.scp_user
password = priv.scp_pass
knownHosts = allowAnyHosts
}
}
task uploadChangelog {
doLast {
ssh.run {
session(remotes.web) {
put from: 'web/changelog.txt', into: priv.scp_dir + "/changelog.txt"
}
}
}
}
task deployWeb {
doLast {
ssh.run {
session(remotes.web) {
def parent = file('web').toPath()
for (f in fileTree(dir: 'web')) {
def rel = parent.relativize(f.toPath()).toString().replace(File.separator, '/')
def dest = priv.scp_dir + rel
put from: f, into: dest
}
}
}
}
}
def parseConfig(File config) {
if(config.exists()){
config.withReader {
def prop = new Properties()
prop.load(it)
return (new ConfigSlurper().parse(prop))
}
} else {
return null
}
}
publishing {
tasks.publish.dependsOn build
publications {
mavenJava(MavenPublication) {
groupId project.group
artifactId project.archivesBaseName
version project.version
from components.java
artifact srcJar
artifact apiJar
pom.withXml {
def node = asNode()
if(node.dependencies.size() > 0)
node.remove(node.dependencies) // Remove deps, as they are all mappings-dependent and/or forge
}
}
}
repositories {
maven {
url "file://" + System.getenv("local_maven")
}
}
}
defaultTasks 'clean', 'checkSyntax', 'build'