This repository has been archived by the owner on Jan 3, 2021. It is now read-only.
forked from TheSilkMiner/Energy-s-Matter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
277 lines (233 loc) · 7.34 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
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
name 'Minecraft Forge'
url 'https://files.minecraftforge.net/maven'
}
maven {
name 'OpenMods Third Party'
url 'https://repo.openmods.info/artifactory/simple/thirdparty'
}
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '2.3-SNAPSHOT'
classpath group: 'net.thesilkminer.gradle.translationchecker', name: 'TranslationChecker', version: '1.1'
classpath group: 'org.jetbrains.kotlin', name: 'kotlin-gradle-plugin', version: "${kotlin_version}"
}
}
plugins {
id 'idea'
id 'java'
id 'eclipse'
id 'visual-studio'
id 'maven'
id 'org.jlleitschuh.gradle.ktlint' version '8.1.0'
id 'org.jetbrains.dokka' version '0.9.17'
id 'net.minecrell.licenser' version '0.4.1'
}
apply plugin: 'kotlin'
apply plugin: 'net.minecraftforge.gradle.forge'
static def getGitCommit() {
def proc = "git rev-parse --short HEAD".execute()
proc.waitFor()
return proc.exitValue() ? "EINVAL(NO_GIT)" : proc.text.trim()
}
static def getBuildNumber() {
return System.env.BUILD_NUMBER? System.env.BUILD_NUMBER : System.env.TRAVIS_BUILD_NUMBER
}
static def getBuildString() {
return getBuildNumber()? "+build.${getBuildNumber()}" : ""
}
idea {
module {
inheritOutputDirs = true
}
}
license {
header = project.file('NOTICE')
include '**/*.java'
include '**/*.kt'
ext {
year = Calendar.getInstance().get(Calendar.YEAR)
name = 'TheSilkMiner'
email = 'thesilkminer <at> outlook <dot> com'
app = "Energy's Matter"
}
ignoreFailures = false
}
dokka {
outputFormat = 'gfm'
outputDirectory = "$buildDir/kdoc/md"
jdkVersion = 8
skipEmptyPackages = false
}
ktlint {
version = "0.33.0"
debug = true
verbose = true
android = false
outputToConsole = true
reporters = [org.jlleitschuh.gradle.ktlint.reporter.ReporterType.PLAIN, org.jlleitschuh.gradle.ktlint.reporter.ReporterType.CHECKSTYLE]
//ignoreFailures = false
ignoreFailures = true // <-- temporary
enableExperimentalRules = false
}
compileKotlin {
kotlinOptions.jvmTarget = '1.8'
}
compileTestKotlin {
kotlinOptions.jvmTarget = '1.8'
}
version = "0.1.0" + getBuildString()
group = "net.thesilkminer.mc.ematter" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "energysmatter"
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
minecraft {
version = "1.12.2-14.23.5.2847"
runDir = "run"
mappings = "snapshot_20180814"
replace '@ENERGY_IS_MATTER_VERSION@', project.version
replace '@FINGERPRINT@', project.findProperty('signSHA1')
}
repositories {
mavenCentral()
jcenter()
maven {
name 'BlameJared'
url 'https://maven.blamejared.com/'
}
maven {
name 'Progwml6 maven'
url 'https://dvs1.progwml6.com/files/maven/'
}
maven {
name 'ShadowFacts'
url 'http://maven.shadowfacts.net/'
}
maven {
name 'TehNut'
url 'https://maven.tehnut.info/'
}
maven {
name 'Tterrag'
url 'http://maven.tterrag.com/'
}
flatDir {
dirs 'libs'
}
flatDir {
dirs 'Boson/libs' // TODO: Remove this once I get a Maven
}
// Moved to the bottom to ensure that this is the last place we look into
maven {
name 'ModMaven'
url 'https://modmaven.k-4u.nl/'
}
}
configurations {
shade
compile.extendsFrom shade
}
// compile, provided, deobfCompile, deobfProvided
dependencies {
/* ======================= COMPILE TIME ONLY ======================= */
// Boson
compile(group: 'net.thesilkminer.mc', name: 'boson')
// CraftTweaker API
deobfProvided(group: 'CraftTweaker2', name: 'CraftTweaker2-API', version: '4.1.20.555') {
exclude group: 'org.ow2.asm'
exclude group: 'com.google.code.gson'
}
// Hwyla API
deobfProvided group: 'mcp.mobius.waila', name: 'Hwyla', version: '1.8.26-B41_1.12.2', classifier: 'api'
// JustEnoughItems API
deobfProvided group: 'mezz.jei', name: 'jei_1.12.2', version: '4.15.0.293', classifier: 'api'
// TheOneProbe API
deobfProvided group: 'mcjty.theoneprobe', name: 'TheOneProbe-1.12', version: '1.12-1.4.28-17', classifier: 'api'
/* ======================= SHADED LIBRARIES ======================= */
/* ======================= RUNTIME LIBRARIES ======================= */
// CraftTweaker 2
runtime(group: 'CraftTweaker2', name: 'CraftTweaker2-MC1120-Main', version: '1.12-4.1.20.555') {
exclude group: 'org.ow2.asm'
exclude group: 'com.google.code.gson'
}
// CraftTweaker 2 JEI Plugin
runtime(group: 'CraftTweaker2', name: 'CraftTweaker2-MC1120-Mod-JEI', version: '1.12-4.1.20.555') {
exclude group: 'deobf.mezz.jei'
}
// Hwyla
runtime group: 'mcp.mobius.waila', name: 'Hwyla', version: '1.8.26-B41_1.12.2'
// JustEnoughItems
runtime group: 'mezz.jei', name: 'jei_1.12.2', version: '4.15.0.293'
// TheOneProbe
runtime group: 'mcjty.theoneprobe', name: 'TheOneProbe-1.12', version: '1.12-1.4.28-17'
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mc_version", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mc_version':project.minecraft.version
}
// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
task deobfJar(type: Jar, dependsOn: 'jar') {
configurations.shade.each {
from (project.zipTree(it)) {
exclude 'META-INF/MANIFEST.MF'
}
}
from "build/classes/java/main"
from "build/resources/main/"
classifier "deobf"
}
task signJar(type: SignJar, dependsOn: 'reobfJar') {
onlyIf {
project.hasProperty('keystore')
}
keyStore = project.findProperty('keystore')
alias = project.findProperty('keystoreAlias')
storePass = project.findProperty('keystorePass')
keyPass = project.findProperty('keyPass')
inputFile = jar.archivePath
outputFile = jar.archivePath
}
build.dependsOn signJar
artifacts {
archives deobfJar
}
jar {
configurations.shade.each {
from (project.zipTree(it)) {
exclude 'META-INF/MANIFEST.MF'
}
}
manifest {
attributes([
"Specification-Title": "Energy's Matter",
"Specification-Vendor": "TheSilkMiner",
"Specification-Version": "1.0.0", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"TheSilkMiner",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"GitCommit": "" + getGitCommit(),
"BuildNumber": "" + getBuildNumber()
])
}
}
wrapper {
gradleVersion = "${gradle_version}"
distributionType = Wrapper.DistributionType.ALL
}