-
Notifications
You must be signed in to change notification settings - Fork 155
/
build.gradle
251 lines (205 loc) · 7.1 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
import net.minecraftforge.gradle.common.task.SignJar
buildscript {
repositories {
maven {
url = 'https://files.minecraftforge.net/maven'
}
maven {
url "https://repo.spongepowered.org/repository/maven-public/"
content { includeGroup "org.spongepowered" }
}
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true
classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'org.spongepowered.mixin'
mixin {
add sourceSets.main, "astralsorcery.refmap.json"
}
version = '1.16.4-1.14.1'
group = 'hellfirepvp.astralsorcery'
archivesBaseName = 'astralsorcery'
String build_version = ""
// Most likely inside Jenkins. Or homebrew environment.
// I hope you know what you do if it's the latter.
if (System.getenv("BUILD_NUMBER") != null) {
build_version = version + ".v" + System.getenv("BUILD_NUMBER")
}
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
minecraft {
mappings channel: 'snapshot', version: '20201028-1.16.3'
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'info'
mods {
astralsorcery {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'info'
mods {
astralsorcery {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'info'
args '--mod', 'astralsorcery', '--all', '--output', file('src/generated/resources/'), '--validate',
'--existing', sourceSets.main.resources.srcDirs[0]
mods {
astralsorcery {
source sourceSets.main
}
}
}
}
}
repositories {
maven {
name 'hellfirepvp maven'
url 'https://maven.hellfiredev.net/'
}
maven {
name 'curios maven'
url "https://maven.theillusivec4.top/"
}
maven {
name 'JEI maven'
url "https://dvs1.progwml6.com/files/maven"
}
maven {
name 'Botania maven'
url "https://maven.blamejared.com"
}
maven {
name 'CF maven dankstorage'
url "https://www.cursemaven.com"
}
}
dependencies {
minecraft 'net.minecraftforge:forge:1.16.5-36.2.22'
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
compileOnly 'hellfirepvp.observerlib:observerlib:1.16.5-1.5.2.v77'
runtimeOnly 'hellfirepvp.observerlib:observerlib:1.16.5-1.5.2.v77:deobf'
compileOnly 'top.theillusivec4.curios:curios-forge:1.16.5-4.0.5.1:api'
runtimeOnly fg.deobf('top.theillusivec4.curios:curios-forge:1.16.5-4.0.5.1')
compileOnly fg.deobf('mezz.jei:jei-1.16.5:7.7.0.99')
runtimeOnly fg.deobf('mezz.jei:jei-1.16.5:7.7.0.99')
compileOnly fg.deobf('vazkii.patchouli:Patchouli:1.16.4-51:api')
runtimeOnly fg.deobf('vazkii.patchouli:Patchouli:1.16.4-51')
compileOnly fg.deobf('vazkii.botania:Botania:1.16.5-416:api')
runtimeOnly fg.deobf('vazkii.botania:Botania:1.16.5-416')
compileOnly fg.deobf('com.blamejared.crafttweaker:CraftTweaker-1.16.5:7.1.0.294')
runtimeOnly fg.deobf('com.blamejared.crafttweaker:CraftTweaker-1.16.5:7.1.0.294')
compileOnly fg.deobf("curse.maven:corail-tombstone-243707:3800673")
runtimeOnly fg.deobf("curse.maven:corail-tombstone-243707:3800673")
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
java {
withSourcesJar()
}
//Sign jar from flatfile if present
task signJar(type: SignJar, dependsOn: jar) {
onlyIf {
project.hasProperty('keyStore')
}
if (project.hasProperty('keyStore')) {
keyStore = project.keyStore
alias = project.alias
storePass = project.storePass
keyPass = project.keyPass
inputFile = jar.archivePath
outputFile = jar.archivePath
} else {
logger.warn("No key store found, not signing the output jar\n")
}
}
build.dependsOn signJar
// Example for how to get properties into the manifest for reading by the runtime..
jar {
manifest {
attributes([
"Specification-Title": "astralsorcery",
"Specification-Vendor": "hellfirepvp",
"Specification-Version": "1",
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" : "hellfirepvp",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConnector": "hellfirepvp.astralsorcery.MixinConnector"
])
}
}
task srcJar(type: Jar) {
from(sourceSets.main.java)
classifier = 'sources'
}
artifacts {
archives srcJar
}
publishing {
tasks.publish.dependsOn build
publications {
mavenJava(MavenPublication) {
groupId project.group
artifactId project.archivesBaseName
version build_version
from components.java
}
}
repositories {
maven {
url "file://" + System.getenv("LOCAL_MAVEN")
}
}
}
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
// Minimize/optimize all png files, requires optipng on the PATH
// Credits: ImmersiveEngineering / and from there: BrainStone
void minimizePNGFile(File file) {
long size = file.length()
exec {
executable "optipng"
args "-q", "-o7", "-zm1-9", "-strip", "all", file
}
long newSize = file.length()
if (newSize < size) {
System.out.format("Reduced File size of %s from %d bytes to %d bytes (reduced by %.2f%%)\n",
file, size, newSize, ((double) (size - newSize)) / ((double) size) * 100.0)
} else {
System.out.format("File size of %s couldn't be reduced.\n", file)
}
}
task optimizePng {
def pngPatterns = ["**/*.png"]
doLast {
//Ensure the logo is minimized (we add this file to each jar)
//Minimize any PNGs in the source sets
for (dir in sourceSets.main.resources.srcDirs) {
fileTree(dir: dir, includes: pngPatterns).each { minimizePNGFile(it) }
}
}
}