-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
202 lines (162 loc) · 5.95 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
plugins {
id 'eclipse'
id 'idea'
id 'net.minecraftforge.gradle' version '5.1.+'
id 'wtf.gofancy.fancygradle' version '1.1.+'
}
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
import org.apache.tools.ant.filters.ReplaceTokens
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
vendor = JvmVendorSpec.ADOPTOPENJDK
}
}
version = "${version_major}.${version_minor}.${version_revise}"
archivesBaseName = "ICBM-classic-cc-addon-${version_mc}"
fancyGradle {
patches {
//https://gitlab.com/gofancy/fancygradle/-/wikis/IDE-Specific-Runs
resources
coremods
asm
mergetool
}
}
idea {
module {
outputDir = compileJava.destinationDir
testOutputDir = compileTestJava.destinationDir
inheritOutputDirs = true
downloadJavadoc = true
downloadSources = true
}
}
dependencies {
minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2860'
// Computer craft
// https://squiddev.cc/maven/org/squiddev/cc-tweaked-1.12.2/1.89.2/
// https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v1.12.2-1.89.2
// https://github.com/cc-tweaked/CC-Tweaked/tree/v1.12.2-1.89.2
implementation "org.squiddev:cc-tweaked-1.12.2:1.89.2"
// Mods
implementation(fg.deobf('curse.maven:icbm-244451:5372969')) //6.0.1
// https://projectlombok.org/setup/gradle
compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
testCompileOnly 'org.projectlombok:lombok:1.18.24'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.24'
//Junit 5
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
//TODO example runtimeOnly(fg.deobf(group = "mezz.jei", name = "jei-1.16.5", version = "7.7.1.121"))
//Resource injector
// https://hosuaby.github.io/inject-resources/0.3.2/asciidoc/#inject-resources-junit-jupiter
// https://github.com/hosuaby/inject-resources
testImplementation 'io.hosuaby:inject-resources-junit-jupiter:0.3.2'
//Mockito
testImplementation 'org.mockito:mockito-inline:4.3.1'
testImplementation 'org.mockito:mockito-core:4.3.1'
}
minecraft {
mappings channel: 'snapshot', version: '20171003-1.12'
//accessTransformer = file('src/main/resources/META-INF/ICBMClassic_at.cfg')
runs {
client {
workingDirectory project.file('run/client')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
}
server {
workingDirectory project.file('run/server')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
}
}
}
task filterTokens(type: Sync) {
duplicatesStrategy = 'include'
// this will ensure that this task is redone when the versions change.
inputs.property 'version', version
from sourceSets.main.java
filter(ReplaceTokens, tokens: [VERSION: version.toString()])
into "$buildDir/sources"
}
/*compileJava {
source = filterTokens.outputs
}*/
test {
useJUnitPlatform()
maxHeapSize = '1G'
failFast = false
workingDir = './run/tests'
mkdir './run/tests'
forkEvery = 1
}
processResources {
// required to allow file expansion later
duplicatesStrategy = 'include'
// this will ensure that this task is redone when the versions change.
inputs.property 'version', version
inputs.property 'mcversion', version_mc
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version': version, 'mcversion': version_mc
}
// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
//Borrow from darkhax, thank you
doLast {
def jsonMinifyStart = System.currentTimeMillis()
def jsonMinified = 0
def jsonBytesSaved = 0
fileTree(dir: outputs.files.asPath, include: '**/*.json').each {
File file = it
jsonMinified++
def oldLength = file.length()
file.text = JsonOutput.toJson(new JsonSlurper().parse(file))
jsonBytesSaved += oldLength - file.length()
}
println('Minified ' + jsonMinified + ' json files. Saved ' + jsonBytesSaved + ' bytes. Took ' + (System.currentTimeMillis() - jsonMinifyStart) + 'ms.')
}
}
jar {
manifest.mainAttributes(
"Built-By": System.properties['user.name'],
"Created-By": "Gradle ${gradle.gradleVersion}",
'Build-Jdk': "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
'Build-OS': "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}",
'Specification-Title': "ICBM-Classic-cc-addon",
'Specification-Vendor': "Built Broken Modding",
'Specification-Version': "${project.version}",
"Implementation-Title": project.archivesBaseName,
"Implementation-Version": "${project.version}",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"FMLAT": "ICBMClassic_at.cfg")
}
repositories {
mavenCentral()
maven {
name 'SquidDev'
url 'https://squiddev.cc/maven/'
}
maven {
url "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
}
}
jar.finalizedBy('reobfJar')
task installLocalGitHook(type: Copy){
from new File(rootProject.rootDir, 'scripts/commit-msg')
into { new File(rootProject.rootDir, '.git/hooks')}
fileMode 0775
}
build.dependsOn installLocalGitHook