-
Notifications
You must be signed in to change notification settings - Fork 37
/
build.gradle
211 lines (170 loc) · 6.15 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
import org.jetbrains.dokka.gradle.DokkaTask
import proguard.gradle.ProGuardTask
buildscript {
def f = file("gradle/mcversion.txt")
project.ext.mcVersion = f.exists() ? f.readLines().first() as int : 10809
ext.kotlin_version = "1.6.0"
ext.dokka_version = "1.6.10"
repositories {
mavenCentral()
gradlePluginPortal()
maven { url "https://maven.minecraftforge.net/" }
maven { url "https://repo.spongepowered.org/repository/maven-public/" }
maven { url "https://jitpack.io" }
flatDir dirs: 'libs'
}
dependencies {
classpath(
mcVersion >= 11200
? "com.github.ReplayMod.ForgeGradle:541e1485-all"
: "com.github.Debuggingss:ForgeGradle:1d22621a6b"
)
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
classpath ':proguard:'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'kotlin'
apply plugin: 'org.jetbrains.dokka'
version = "2.2.1-" + (
mcVersion.toString().substring(0, 1) + "." +
mcVersion.toString().substring(1, 3).replace("0", "") + "." +
mcVersion.toString().substring(3, 5).replace("0", "")
)
group = "com.chattriggers.ctjs" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "ctjs"
apply plugin: "java"
sourceCompatibility = targetCompatibility = 1.8
configurations {
provided
// Make compile extend from our provided configuration so that things added to bundled end up on the compile classpath
compile.extendsFrom(provided)
}
minecraft {
version = [
11202: '1.12.2-14.23.0.2486',
11201: '1.12.1-14.22.0.2444',
11200: '1.12-14.21.1.2387',
10809: '1.8.9-11.15.1.2318-1.8.9'
][mcVersion]
mappings = [
11202: "snapshot_20170615",
11201: "snapshot_20170615",
11200: "snapshot_20170615",
10809: "stable_22"
][mcVersion]
runDir = "run"
makeObfSourceJar = true
}
afterEvaluate {
tasks.sourceMainJava.replace '@MOD_VERSION@', project.version
tasks.sourceMainJava.replace '@MC_VERSION@', "[ ${project.minecraft.version} ]"
}
repositories {
mavenCentral()
maven { url 'https://repo.spongepowered.org/repository/maven-public/' }
maven { url 'https://jitpack.io' }
maven { url "https://repo.essential.gg/repository/maven-public" }
}
dependencies {
provided "gg.essential:loader-launchwrapper:1.1.3"
implementation "gg.essential:essential-1.8.9-forge:11092+gecb85a783"
provided("dev.falsehonesty.asmhelper:AsmHelper:1.5.3-$mcVersion") {
exclude group: "org.jetbrains.kotlin"
}
provided 'com.fasterxml.jackson.core:jackson-core:2.13.0'
provided 'com.chattriggers:rhino:1.8.6'
provided 'com.fifesoft:rsyntaxtextarea:3.1.3'
}
jar {
// Include all of the jars from the bundled configuration in our jar
from configurations.provided.collect {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE.txt'
exclude "**/module-info.class"
exclude 'META-INF/versions/9/**'
it.isDirectory() ? it : zipTree(it)
}
manifest.attributes(
"FMLCorePlugin": "dev.falsehonesty.asmhelper.core.AsmHelperLoadingPlugin",
"FMLCorePluginContainsFMLMod": "true",
"TweakClass": "gg.essential.loader.stage0.EssentialSetupTweaker",
"FMLAT": "ctjs_at.cfg"
)
}
processResources {
inputs.property "version", project.version
inputs.property "mcversion", 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, "mcversion": project.minecraft.version
}
from(sourceSets.main.resources.srcDirs) {
exclude "mcmod.info"
}
rename '(.+_at.cfg)', 'META-INF/$1'
}
task userdocs(type: DokkaTask) {
description = "Generate the docs to be used by scripters, excludes internal classes"
group = "documentation"
dependencies {
userdocsPlugin(project(":dokka-plugin"))
}
outputDirectory.set(file("$buildDir/javadoc"))
suppressInheritedMembers.set(true)
configure {
dokkaSourceSets {
main {
jdkVersion.set(8)
for (def pkg : ["engine.langs", "engine.loader", "engine.module", "utils", "listeners", "loader", "launch", "commands", "minecraft.wrappers.objects.threading"]) {
perPackageOption {
matchingRegex.set("${"com.chattriggers.ctjs.$pkg".replace(".", "\\.")}(\$|\\.).*")
suppress.set(true)
}
}
sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl.set(new URL(
"https://github.com/ChatTriggers/ChatTriggers/tree/master/src/main/kotlin"))
remoteLineSuffix.set("#L")
}
}
}
}
}
apply from: 'preprocessor.gradle'
task changeMcVersion() {
doLast {
def version
if (project.hasProperty("minecraftVersion")) {
version = project.minecraftVersion
} else {
version = 10809
println "Defaulting to version 1.8.9..."
}
project.ext.mcVersion = version
def f = file("gradle/mcversion.txt")
f.delete()
f.createNewFile()
f.write(version.toString())
println "MC target version is $version"
def vars = [MC: version as int]
project.convertTree(vars, 'src/main/java')
project.convertTree(vars, 'src/main/kotlin')
project.convertTree(vars, 'src/main/resources')
}
}
task proguard(type: ProGuardTask) {
configuration 'configuration.pro'
// dontobfuscate()
libraryjars files(configurations.runtimeClasspath.collect())
injars "build/libs/ctjs-${version}.jar"
outjars "build/libs/ctjs-${version}-RELEASE.jar"
}
proguard.dependsOn build