@@ -44,6 +44,7 @@ ext.legacyForgeAsmVersion = project.hasProperty("legacyForgeAsmVersion") ? asmVe
4444ext. doSignJar = project. hasProperty(" keyStorePath" )
4545
4646java {
47+ modularity. inferModulePath = false
4748 toolchain. languageVersion = JavaLanguageVersion . of(ciSystem == ' unknown' ? 16 : 8 )
4849}
4950
@@ -97,6 +98,7 @@ sourceSets {
9798 compileClasspath + = main. output
9899 ext. languageVersion = 8
99100 ext. compatibility = ' 1.6'
101+ ext. modularityExcluded = true
100102 }
101103 agent {
102104 compileClasspath + = main. output
@@ -107,10 +109,15 @@ sourceSets {
107109 compileClasspath + = main. output
108110 ext. languageVersion = 8
109111 ext. compatibility = ' 1.8'
112+ ext. modularityExcluded = true
110113 }
111114 example {
112115 compileClasspath + = main. output
113116 compileClasspath + = ap. output
117+ ext. modularityExcluded = true
118+ }
119+ test {
120+ ext. modularityExcluded = true
114121 }
115122 launchwrapper {
116123 compileClasspath + = main. output
@@ -135,14 +142,7 @@ sourceSets {
135142 }
136143 modularity {
137144 ext. languageVersion = 16
138- java. srcDirs + = [
139- sourceSets. legacy. java. srcDirs,
140- sourceSets. main. java. srcDirs,
141- sourceSets. ap. java. srcDirs,
142- sourceSets. agent. java. srcDirs,
143- sourceSets. modlauncher. java. srcDirs,
144- sourceSets. modlauncher9. java. srcDirs
145- ]
145+ ext. modularityExcluded = true // don't add ourselves
146146 }
147147}
148148
@@ -205,14 +205,6 @@ dependencies {
205205 modularityCompileOnly ' org.apache.logging.log4j:log4j-core:2.11.2'
206206}
207207
208- compileModularityJava {
209- doFirst {
210- options. compilerArgs = [
211- ' --module-path' , classpath. asPath
212- ]
213- }
214- }
215-
216208javadoc {
217209 exclude ' **/throwables'
218210 classpath + = sourceSets. legacy. output
@@ -285,7 +277,6 @@ checkstyle {
285277 ]
286278 configFile = file(" checkstyle.xml" )
287279 toolVersion = ' 8.43'
288- sourceSets - = project. sourceSets[' modularity' ]
289280}
290281
291282// Source compiler configuration
@@ -295,6 +286,8 @@ tasks.withType(JavaCompile) {
295286 options. encoding = ' utf8'
296287}
297288
289+ def modularityInputs = objects. fileCollection()
290+
298291project. sourceSets. each { set -> {
299292 if (set. ext. has(" languageVersion" )) {
300293 project. tasks[set. compileJavaTaskName]. javaCompiler = javaToolchains. compilerFor {
@@ -305,8 +298,25 @@ project.sourceSets.each { set -> {
305298 project. tasks[set. compileJavaTaskName]. sourceCompatibility = set. ext. compatibility
306299 project. tasks[set. compileJavaTaskName]. targetCompatibility = set. ext. compatibility
307300 }
301+ def modularityExcluded = set. ext. has(" modularityExcluded" ) && set. ext. modularityExcluded
302+ if (! modularityExcluded) {
303+ project. sourceSets. modularity {
304+ compileClasspath + = set. output
305+ }
306+ modularityInputs. from set. output
307+ }
308308}}
309309
310+ compileModularityJava {
311+ inputs. files(modularityInputs)
312+ doFirst {
313+ options. compilerArgs = [
314+ ' --module-path' , classpath. asPath,
315+ ' --patch-module' , " org.spongepowered.mixin=${ modularityInputs.collect { it.absolutePath }.join(File.pathSeparator)} "
316+ ]
317+ }
318+ }
319+
310320if (JavaVersion . current(). isJava8Compatible()) {
311321 tasks. withType(Javadoc ) {
312322 // disable the crazy super-strict doclint tool in Java 8
@@ -318,8 +328,6 @@ task stagingJar(type: ShadowJar) {
318328 sourceSets. findAll { ! (it. name =~ / example|test/ ) }. each {
319329 from it. output
320330 }
321- duplicatesStrategy = DuplicatesStrategy . EXCLUDE
322-
323331 configurations = [project. configurations. stagingJar]
324332
325333 // JAR manifest configuration
0 commit comments