@@ -7,6 +7,7 @@ buildscript {
7
7
dependencies {
8
8
classpath ' net.minecraftforge.gradle:ForgeGradle:4.+'
9
9
classpath ' org.spongepowered:mixingradle:0.7-SNAPSHOT'
10
+ classpath ' com.github.jengelman.gradle.plugins:shadow:6.1.0'
10
11
}
11
12
}
12
13
@@ -16,6 +17,7 @@ plugins {
16
17
17
18
apply plugin : ' net.minecraftforge.gradle'
18
19
apply plugin : ' org.spongepowered.mixin'
20
+ apply plugin : ' com.github.johnrengelman.shadow'
19
21
20
22
version project. modVersion
21
23
group project. modGroup
@@ -132,24 +134,33 @@ processResources {
132
134
}
133
135
}
134
136
135
- task sourceJar (type : Jar ) { // Generate sources
137
+ task buildApiSource (type : Jar ) { // Generate sources
136
138
group ' build'
137
139
description ' Assemble API library source archive'
138
140
139
141
archiveClassifier. set ' api-source'
140
142
from sourceSets. main. allSource
141
143
}
142
144
143
- task apiJar (type : Jar ) {
145
+ task buildApi (type : Jar ) {
144
146
group ' build'
145
147
description ' Assemble API library archive'
146
148
147
149
archiveClassifier. set ' api'
148
150
from sourceSets. main. output
149
151
}
150
152
151
- // Don't put baritone mixin here please c:
152
- jar {
153
+ task buildAll {
154
+ group ' build'
155
+ description ' Assemble all jars'
156
+
157
+ dependsOn ' buildApi'
158
+ dependsOn ' buildApiSource'
159
+ dependsOn ' build'
160
+ }
161
+
162
+ shadowJar {
163
+ // Don't put baritone mixin here please c:
153
164
manifest. attributes(
154
165
' Manifest-Version' : 1.0 ,
155
166
' MixinConfigs' : ' mixins.lambda.json' ,
@@ -159,27 +170,31 @@ jar {
159
170
' ForceLoadAsMod' : ' true'
160
171
)
161
172
162
- // Copy needed libs to jar
163
- from {
164
- exclude ' **/module-info.class' ,
165
- ' DebugProbesKt.bin' ,
166
- ' META-INF/proguard/**' ,
167
- ' META-INF/versions/**' ,
168
- ' META-INF/**.RSA' ,
169
- ' META-INF/com.android.tools/**' ,
170
- ' META-INF/*.kotlin_module' ,
171
- ' kotlin/**/*.kotlin_metadata' ,
172
- ' kotlin/**/*.kotlin_builtins' ,
173
- ' META-INF/*.version'
174
- configurations. jarLibs. collect {
175
- it. isDirectory() ? it : zipTree(it)
176
- }
173
+ archiveClassifier. set(' ' )
174
+ exclude ' **/module-info.class' ,
175
+ ' DebugProbesKt.bin' ,
176
+ ' META-INF/proguard/**' ,
177
+ ' META-INF/versions/**' ,
178
+ ' META-INF/**.RSA' ,
179
+ ' META-INF/com.android.tools/**' ,
180
+ ' META-INF/*.kotlin_module' ,
181
+ ' kotlin/**/*.kotlin_metadata' ,
182
+ ' kotlin/**/*.kotlin_builtins' ,
183
+ ' META-INF/*.version'
184
+ configurations = [project. configurations. jarLibs]
185
+ relocate ' kotlin' , ' com.lambda.shadow.kotlin'
186
+ relocate ' kotlinx' , ' com.lambda.shadow.kotlinx'
187
+ finalizedBy ' reobfShadowJar'
188
+ }
189
+
190
+ reobf {
191
+ shadowJar {}
192
+ jar {
193
+ enabled = false
177
194
}
178
195
}
179
196
180
- task buildApi {
181
- group ' build'
182
- dependsOn sourceJar
183
- dependsOn apiJar
184
- description ' Assemble API library archives'
197
+ artifacts {
198
+ shadowJar
185
199
}
200
+
0 commit comments