@@ -10,7 +10,7 @@ plugins {
10
10
id " eclipse"
11
11
id " idea"
12
12
id " maven-publish"
13
- id " fabric-loom" version " 0.6 .local" apply false
13
+ id " fabric-loom" version " 0.7 .local" apply false
14
14
id " org.cadixdev.licenser" version " 0.5.0"
15
15
id " org.ajoberstar.grgit" version " 4.1.0"
16
16
id " com.matthewprenger.cursegradle" version " 1.4.0"
@@ -33,6 +33,7 @@ logger.lifecycle("Building Fabric: " + version)
33
33
34
34
import org.apache.commons.codec.digest.DigestUtils
35
35
import net.fabricmc.loom.task.RemapJarTask
36
+ import net.fabricmc.loom.task.RemapSourcesJarTask
36
37
37
38
def getSubprojectVersion (project , version ) {
38
39
if (grgit == null ) {
@@ -150,13 +151,33 @@ allprojects {
150
151
}
151
152
152
153
jar {
153
- archiveClassifier. set " dev"
154
+ archiveClassifier = " dev"
154
155
}
155
156
157
+ task testmodJar(type : Jar ) {
158
+ from sourceSets. testmod. output
159
+ archiveClassifier = " testmod-dev"
160
+ }
161
+
162
+ task remapTestmodJar(type : RemapJarTask , dependsOn : testmodJar) {
163
+ input= testmodJar. getArchiveFile()
164
+ archiveClassifier = " testmod"
165
+ classpath sourceSets. testmod. compileClasspath
166
+ addNestedDependencies = false
167
+ }
168
+
169
+ task testmodSourceJar(type : Jar , dependsOn : classes) {
170
+ classifier = ' testmodSources'
171
+ from sourceSets. testmod. allSource
172
+ }
173
+
174
+ // Gets setup fully in loom
175
+ task remapTestmodSourcesJar(type : RemapSourcesJarTask )
176
+
156
177
afterEvaluate {
157
178
remapJar {
158
179
input = file(" ${ project.buildDir} /libs/$archivesBaseName -${ archiveVersion.get()} -dev.jar" )
159
- archiveFileName. set " ${ archivesBaseName} -${ archiveVersion.get()} .jar"
180
+ archiveFileName = " ${ archivesBaseName} -${ archiveVersion.get()} .jar"
160
181
}
161
182
162
183
artifacts {
@@ -175,6 +196,17 @@ allprojects {
175
196
header rootProject. file(" HEADER" )
176
197
include " **/*.java"
177
198
}
199
+
200
+ // Setup batched remap for testmod jars. Not really a supported api in loom so copy this at your own risk.
201
+ net.fabricmc.loom.configuration.RemapConfiguration . setupRemap(
202
+ project,
203
+ " testmodJar" ,
204
+ " testmodSourceJar" ,
205
+ " remapTestmodJar" ,
206
+ " remapTestmodSourcesJar" ,
207
+ " remapAllTestmodJars" ,
208
+ " remapAllTestmodSources"
209
+ )
178
210
}
179
211
180
212
task sourcesJar(type : Jar , dependsOn : classes) {
@@ -281,27 +313,27 @@ subprojects {
281
313
282
314
javadoc. enabled = false
283
315
284
- task testmodJar(type : Jar ) {
285
- from sourceSets. testmod. output
286
- archiveClassifier. set " testmod-dev"
287
- }
288
-
289
- task remapTestmodJar(type : RemapJarTask , dependsOn : testmodJar) {
290
- input. set testmodJar. getArchiveFile()
291
- archiveClassifier. set " testmod"
292
- classpath sourceSets. testmod. compileClasspath
293
- addNestedDependencies = false
316
+ if (file(" src/testmod" ). exists()) {
317
+ afterEvaluate {
318
+ project. rootProject. remapTestmodJar {
319
+ include remapTestmodJar. archivePath
320
+ }
321
+ }
294
322
}
295
323
}
296
324
297
325
task remapMavenJar (type : RemapJarTask , dependsOn : jar) {
298
326
afterEvaluate {
299
327
input = file(" ${ project.buildDir} /libs/${ archivesBaseName} -${ archiveVersion.get()} -dev.jar" )
300
- archiveFileName. set " ${ archivesBaseName} -${ archiveVersion.get()} -maven.jar"
328
+ archiveFileName = " ${ archivesBaseName} -${ archiveVersion.get()} -maven.jar"
301
329
addNestedDependencies = false
302
330
}
303
331
}
304
332
333
+ remapTestmodJar {
334
+ addDefaultNestedDependencies = false
335
+ }
336
+
305
337
publishing {
306
338
publications {
307
339
mavenJava(MavenPublication ) {
0 commit comments