-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
205 lines (173 loc) · 6.35 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
buildscript {
repositories {
mavenCentral()
maven {
name 'JitPack'
url 'https://jitpack.io'
}
maven {
name 'forge'
url 'https://maven.minecraftforge.net'
}
}
dependencies {
classpath('com.anatawa12.forge:ForgeGradle:1.2-1.1.+') {
changing = true
}
classpath 'com.github.MJaroslav:Bon2Gradle:0.5.+'
}
}
apply plugin: 'java'
apply plugin: 'forge'
apply plugin: 'maven-publish'
apply from: 'https://raw.githubusercontent.com/MJaroslav/MCInGameTester/master/gradle/configurations/v1.gradle'
apply plugin: 'bon2gradle'
repositories {
mavenCentral()
maven {
name 'jitpack'
url 'https://jitpack.io'
}
maven {
name "Gregtech repo"
url 'https://gregtech.overminddl1.com'
}
maven {
name "CraftTweaker"
url "https://maven.blamejared.com/"
}
maven {
url 'https://cursemaven.com/'
content {
includeGroup 'curse.maven'
}
}
// FG adds forge maven before central and forge maven contains only poms of lombok, not jars.
exclusiveContent {
forRepository {
mavenCentral()
}
filter {
includeGroup "org.projectlombok"
}
}
}
def buildprop = new Properties()
file("build.properties").withInputStream { buildprop.load(it) }
version = buildprop.version
group = buildprop.group
archivesBaseName = project.name
task devJar(type: Jar) {
archiveClassifier = 'dev'
manifest { from project.tasks.jar.manifest }
from sourceSets.main.output
}
artifacts {
archives devJar
}
java {
withSourcesJar()
}
configure([tasks.compileJava, tasks.compileTestJava, tasks.compileApiJava]) {
sourceCompatibility = 16 // for the IDE support
options.release = 8
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(16)
}
}
configurations {
shade
implementation.extendsFrom(shade)
}
minecraft {
version = "${buildprop.game_version}-${buildprop.forge_version}-${buildprop.game_version}"
runDir = buildprop.run_dir
replace '@VERSION@', project.version
srgExtra "PK: blue/endless/jankson io/github/mjaroslav/mjutils/library/blue/endless/jankson"
// srgExtra "PK: io/github/mjaroslav/sharedjava io/github/mjaroslav/mjutils/library/io/github/mjaroslav/sharedjava"
}
dependencies {
shade "blue.endless:jankson:${buildprop.jankson_version}"
shade "com.github.MJaroslav:Shared-Java:${buildprop.sharedjava_version}"
// All mods versions hardcoded because it's 1.7.10, my dude
implementation "codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev"
implementation "codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev"
implementation "codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev"
implementation "mcp.mobius.waila:Waila:1.5.11-RC2-NONEI_1.7.10:dev"
implementation "com.azanor.baubles:Baubles:1.7.10-1.0.1.10:deobf"
implementation "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev"
implementation bon2.deobf("curse.maven:crafttweaker-239197:2838720")
implementation "com.github.LegacyModdingMC.UniMixins:unimixins-mixin-1.7.10:${buildprop.unimixins_version}"
annotationProcessor "com.github.LegacyModdingMC.UniMixins:unimixins-mixin-1.7.10:${buildprop.unimixins_version}"
implementation bon2.deobf("com.github.LegacyModdingMC.UniMixins:unimixins-mixinbooterlegacy-1.7.10:${buildprop.unimixins_version}")
compileOnly "org.jetbrains:annotations:${buildprop.jetbrains_annotations_version}"
testCompileOnly "org.jetbrains:annotations:${buildprop.jetbrains_annotations_version}"
compileOnly "org.projectlombok:lombok:${buildprop.lombok_version}"
annotationProcessor "org.projectlombok:lombok:${buildprop.lombok_version}"
testCompileOnly "org.projectlombok:lombok:${buildprop.lombok_version}"
testAnnotationProcessor "org.projectlombok:lombok:${buildprop.lombok_version}"
annotationProcessor "com.github.bsideup.jabel:jabel-javac-plugin:${buildprop.jabel_version}"
testAnnotationProcessor "com.github.bsideup.jabel:jabel-javac-plugin:${buildprop.jabel_version}"
testImplementation "junit:junit:${buildprop.junit_version}"
}
runClient {
args += ["--tweakClass", "org.spongepowered.asm.launch.MixinTweaker"]
}
runServer {
args += ["--tweakClass", "org.spongepowered.asm.launch.MixinTweaker"]
}
testClient {
logOnlyTests = false
args += ["--tweakClass", "org.spongepowered.asm.launch.MixinTweaker"]
}
testServer {
logOnlyTests = false
args += ["--tweakClass", "org.spongepowered.asm.launch.MixinTweaker"]
}
def outSrgFile = "${tasks.compileJava.temporaryDir}/outSrg.srg"
def outRefMapFile = "${tasks.compileJava.temporaryDir}/mixin.${project.name.replace(" ", "").toLowerCase()}.refmap.json"
test {
useJUnit()
}
processResources {
inputs.property 'version', project.version
inputs.property 'mcversion', project.minecraft.version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version': project.version, 'mcversion': project.minecraft.version
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}
jar {
if (buildprop.coremod.toBoolean())
manifest {
// TODO: Don't forged about -Dfml.coreMods.load
attributes "FMLCorePlugin": "${project.group}.${project.name.replace(" ", "").toLowerCase()}" +
".asm.${project.name.replace(" ", "")}Plugin"
attributes "FMLCorePluginContainsFMLMod": "true"
attributes "ForceLoadAsMod": "true"
}
configurations.shade.each { dep ->
from project.zipTree(dep)
}
from outRefMapFile
}
tasks.compileJava.options.compilerArgs += ["-AreobfSrgFile=${tasks.reobf.srg}", "-AoutSrgFile=${outSrgFile}", "-AoutRefMapFile=${outRefMapFile}"]
reobf {
addExtraSrgFile outSrgFile
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
// artifact(jar) { builtBy build }
// artifact(sourcesJar) { builtBy sourcesJar }
// artifact(devJar) { builtBy devJar }
pom {
name = "MJUtils"
description = "A set of tools to simplify writing mods. It contains a modular system for " +
"initialization of mods and a system of configurations by annotations."
}
}
}
}