Skip to content

Commit 9b3b481

Browse files
committed
Merge remote-tracking branch 'origin/pr/520'
2 parents 4c7beea + 87b36f6 commit 9b3b481

File tree

3 files changed

+31
-20
lines changed

3 files changed

+31
-20
lines changed

build.gradle

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ ext.legacyForgeAsmVersion = project.hasProperty("legacyForgeAsmVersion") ? asmVe
4444
ext.doSignJar = project.hasProperty("keyStorePath")
4545

4646
java {
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-
216208
javadoc {
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+
298291
project.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+
310320
if (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

checkstyle.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<module name="Checker">
1212
<property name="severity" value="warning"/>
1313
<property name="charset" value="UTF-8"/>
14+
<module name="BeforeExecutionExclusionFileFilter">
15+
<property name="fileNamePattern" value="module\-info\.java$"/>
16+
</module>
1417
<module name="TreeWalker">
1518
<module name="OuterTypeFilename"/>
1619
<module name="IllegalTokenText">

src/main/java/org/spongepowered/asm/util/PrettyPrinter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ private void logSpecial(ILogger logger, Level level, ISpecialEntry line) {
11471147

11481148
private void logString(ILogger logger, Level level, String line) {
11491149
if (line != null) {
1150-
logger.log(level, "/* {} */", String.format("%-" + this.width, line));
1150+
logger.log(level, "/* {} */", String.format("%-" + this.width + "s", line));
11511151
}
11521152
}
11531153

0 commit comments

Comments
 (0)