forked from lambda-client/lambda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
214 lines (178 loc) · 6.07 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
buildscript {
repositories {
mavenCentral()
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://repo.spongepowered.org/maven/' }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:5.+'
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
classpath 'com.github.jengelman.gradle.plugins:shadow:6.1.0'
}
}
plugins {
id 'org.jetbrains.kotlin.jvm' version "$kotlinVersion"
id 'maven-publish'
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'com.github.johnrengelman.shadow'
version project.modVersion
group project.modGroup
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
options.encoding = 'UTF-8'
// Disables Gradle build caching for this task
// If build caching is enabled this can cause the refmap to not be built and included
outputs.upToDateWhen { false }
}
compileKotlin.kotlinOptions {
freeCompilerArgs += '-Xlambdas=indy'
freeCompilerArgs += '-opt-in=kotlin.RequiresOptIn'
freeCompilerArgs += '-opt-in=kotlin.contracts.ExperimentalContracts'
}
repositories {
mavenCentral()
maven { url = 'https://repo.spongepowered.org/maven/' }
maven { url = 'https://impactdevelopment.github.io/maven/' }
maven { url = 'https://jitpack.io' }
}
minecraft {
mappings channel: "$mappingsChannel", version: "$mappingsVersion"
runs {
client {
workingDirectory project.file('run')
property 'fml.coreMods.load', 'com.lambda.client.LambdaCoreMod'
property 'mixin.env.disableRefMap', 'true' // Disable refmap so we don't get trolled by Baritone
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
}
}
}
configurations {
jarLibs
onlyJarLibs
// Force choosing the correct nightly build because Mac OS chooses an invalid one
configureEach {
resolutionStrategy {
force 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209'
}
}
}
dependencies {
// Forge
minecraft "net.minecraftforge:forge:$minecraftVersion-$forgeVersion"
jarLibs('org.spongepowered:mixin:0.8.5') {
exclude module: 'commons-io'
exclude module: 'gson'
exclude module: 'guava'
}
// Hacky way to get mixin work
annotationProcessor('org.spongepowered:mixin:0.8.5:processor') {
exclude module: 'gson'
}
// Not the latest Reflections because it breaks Future compatibility :/
//noinspection GradlePackageUpdate
jarLibs 'org.reflections:reflections:0.9.12'
jarLibs("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion") {
exclude module: 'kotlin-stdlib-common'
exclude module: 'annotations'
}
jarLibs("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion") {
exclude module: 'kotlin-stdlib'
}
jarLibs("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") {
exclude module: 'kotlin-stdlib-jdk8'
exclude module: 'kotlin-stdlib-common'
}
jarLibs 'com.github.cbyrneee:DiscordIPC:e18542f600'
// Add them back to compileOnly (provided)
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion"
compileOnly 'org.jetbrains:annotations:23.0.0'
// This Baritone will NOT be included in the jar
implementation('cabaletta:baritone-deobf-unoptimized-mcp-dev:1.2').setChanging(true)
// This Baritone WILL be included in the jar
onlyJarLibs('cabaletta:baritone-api:1.2').setChanging(true)
// Add everything in jarLibs to implementation (compile)
implementation configurations.jarLibs
}
mixin {
defaultObfuscationEnv 'searge'
sourceSets {
main {
ext.refMap = 'mixins.lambda.refmap.json'
}
}
}
processResources {
exclude '**/rawimagefiles'
from(sourceSets.main.resources.srcDirs) {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
include 'mcmod.info'
expand version: version, 'mcversion': minecraftVersion
}
}
tasks.register('buildApiSource', Jar) { // Generate sources
group 'build'
description 'Assemble API library source archive'
archiveClassifier.set 'api-source'
from sourceSets.main.allSource
}
tasks.register('buildApi', Jar) {
group 'build'
description 'Assemble API library archive'
archiveClassifier.set 'api'
from sourceSets.main.output
}
tasks.register('buildAll') {
group 'build'
description 'Assemble all jars'
dependsOn 'buildApi'
dependsOn 'buildApiSource'
dependsOn 'build'
}
shadowJar {
// Don't put baritone mixin here please c:
manifest.attributes(
'Manifest-Version': 1.0,
'MixinConfigs': 'mixins.lambda.json',
'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
'FMLCorePluginContainsFMLMod': 'true',
'FMLCorePlugin': 'com.lambda.client.LambdaCoreMod',
'ForceLoadAsMod': 'true'
)
archiveClassifier.set('')
exclude '**/module-info.class',
'DebugProbesKt.bin',
'META-INF/proguard/**',
'META-INF/versions/**',
'META-INF/**.RSA',
'META-INF/com.android.tools/**',
'META-INF/*.kotlin_module',
'kotlin/**/*.kotlin_metadata',
'kotlin/**/*.kotlin_builtins',
'META-INF/*.version'
minimize {
exclude(dependency('cabaletta:baritone-api:.*'))
exclude(dependency('org.spongepowered:mixin:.*'))
}
configurations = [project.configurations.jarLibs, project.configurations.onlyJarLibs]
relocate 'kotlin', 'com.lambda.shadow.kotlin'
relocate 'kotlinx', 'com.lambda.shadow.kotlinx'
finalizedBy 'configureReobfTaskForReobfShadowJar', 'reobfShadowJar'
mustRunAfter 'jar'
}
reobf {
shadowJar {}
jar {
enabled = false
}
}
publishing {
publications {
api(MavenPublication) {
artifact source: buildApi, classifier: null
artifact source: buildApiSource, classifier: 'sources'
}
}
}