diff --git a/build.gradle b/build.gradle index 867549e0..a689a2a2 100644 --- a/build.gradle +++ b/build.gradle @@ -49,6 +49,10 @@ ext.legacyForgeAsmVersion = project.hasProperty("legacyForgeAsmVersion") ? asmVe sourceCompatibility = '1.8' targetCompatibility = '1.8' +java { + modularity.inferModulePath = false +} + // Project repositories repositories { mavenCentral() @@ -105,6 +109,7 @@ sourceSets { compileClasspath += main.output ext.languageVersion = 8 ext.compatibility = '1.6' + ext.modularityExcluded = true } agent { compileClasspath += main.output @@ -115,10 +120,15 @@ sourceSets { compileClasspath += main.output ext.languageVersion = 8 ext.compatibility = '1.8' + ext.modularityExcluded = true } example { compileClasspath += main.output compileClasspath += ap.output + ext.modularityExcluded = true + } + test { + ext.modularityExcluded = true } launchwrapper { compileClasspath += main.output @@ -143,14 +153,7 @@ sourceSets { } modularity { ext.languageVersion = 16 - java.srcDirs += [ - sourceSets.legacy.java.srcDirs, - sourceSets.main.java.srcDirs, - sourceSets.ap.java.srcDirs, - sourceSets.agent.java.srcDirs, - sourceSets.modlauncher.java.srcDirs, - sourceSets.modlauncher9.java.srcDirs - ] + ext.modularityExcluded = true // don't add ourselves } } @@ -217,14 +220,6 @@ dependencies { modularityCompileOnly 'org.apache.logging.log4j:log4j-core:2.11.2' } -compileModularityJava { - doFirst { - options.compilerArgs = [ - '--module-path', classpath.asPath - ] - } -} - javadoc { exclude '**/throwables' classpath += sourceSets.legacy.output @@ -298,7 +293,6 @@ checkstyle { ] configFile = file("checkstyle.xml") toolVersion = '8.43' - sourceSets -= project.sourceSets['modularity'] } // Source compiler configuration @@ -308,6 +302,8 @@ tasks.withType(JavaCompile) { options.encoding = 'utf8' } +def modularityInputs = objects.fileCollection() + project.sourceSets.each { set -> { if (set.ext.has("languageVersion")) { project.tasks[set.compileJavaTaskName].javaCompiler = javaToolchains.compilerFor { @@ -318,8 +314,25 @@ project.sourceSets.each { set -> { project.tasks[set.compileJavaTaskName].sourceCompatibility = set.ext.compatibility project.tasks[set.compileJavaTaskName].targetCompatibility = set.ext.compatibility } + def modularityExcluded = set.ext.has("modularityExcluded") && set.ext.modularityExcluded + if (!modularityExcluded) { + project.sourceSets.modularity { + compileClasspath += set.output + } + modularityInputs.from set.output + } }} +compileModularityJava { + inputs.files(modularityInputs) + doFirst { + options.compilerArgs = [ + '--module-path', classpath.asPath, + '--patch-module', "org.spongepowered.mixin=${modularityInputs.collect { it.absolutePath }.join(File.pathSeparator)}" + ] + } +} + if (JavaVersion.current().isJava8Compatible()) { tasks.withType(Javadoc) { // disable the crazy super-strict doclint tool in Java 8 @@ -331,8 +344,6 @@ task stagingJar(type: ShadowJar) { sourceSets.findAll { !(it.name =~ /example|test/) }.each { from it.output } - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - configurations = [project.configurations.stagingJar] // JAR manifest configuration diff --git a/checkstyle.xml b/checkstyle.xml index 62145c03..1109c4ac 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -11,6 +11,9 @@ + + + diff --git a/gradle.properties b/gradle.properties index fb0dd434..2b3307ed 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,10 +5,10 @@ description=Mixin (Fabric fork) url=https://fabricmc.net organization=FabricMC buildVersion=0.10.0 -upstreamMixinVersion=0.8.4.snapshot +upstreamMixinVersion=0.8.4 buildType=RELEASE asmVersion=9.2 legacyForgeAsmVersion=5.0.3 modlauncherAsmVersion=9.1 modlauncherVersion=9.0.7 -legacyModlauncherVersion=7.0.0 +legacyModlauncherVersion=7.0.0 \ No newline at end of file diff --git a/src/ap/java/org/spongepowered/tools/obfuscation/fg3/ObfuscationServiceFG3.java b/src/ap/java/org/spongepowered/tools/obfuscation/fg3/ObfuscationServiceFG3.java index 87f5e526..c645e551 100644 --- a/src/ap/java/org/spongepowered/tools/obfuscation/fg3/ObfuscationServiceFG3.java +++ b/src/ap/java/org/spongepowered/tools/obfuscation/fg3/ObfuscationServiceFG3.java @@ -52,6 +52,7 @@ public class ObfuscationServiceFG3 implements IObfuscationService { public Set getSupportedOptions() { return ImmutableSet.of( ObfuscationServiceFG3.REOBF_TSRG_FILE, + ObfuscationServiceFG3.REOBF_EXTRA_TSRG_FILES, ObfuscationServiceFG3.OUT_TSRG_SRG_FILE, ObfuscationServiceFG3.TSRG_OUTPUT_BEHAVIOUR ); diff --git a/src/main/java/org/spongepowered/asm/mixin/MixinEnvironment.java b/src/main/java/org/spongepowered/asm/mixin/MixinEnvironment.java index 2dc938ce..0eb13c9c 100644 --- a/src/main/java/org/spongepowered/asm/mixin/MixinEnvironment.java +++ b/src/main/java/org/spongepowered/asm/mixin/MixinEnvironment.java @@ -626,7 +626,7 @@ public final class MixinEnvironment implements ITokenProvider { @Override boolean isSupported() { - return JavaVersion.current() >= JavaVersion.JAVA_8 && ASM.isAtLeastVersion(6); + return JavaVersion.current() >= JavaVersion.JAVA_9 && ASM.isAtLeastVersion(6); } }, diff --git a/src/main/java/org/spongepowered/asm/util/PrettyPrinter.java b/src/main/java/org/spongepowered/asm/util/PrettyPrinter.java index db52660b..14592d23 100644 --- a/src/main/java/org/spongepowered/asm/util/PrettyPrinter.java +++ b/src/main/java/org/spongepowered/asm/util/PrettyPrinter.java @@ -1147,7 +1147,7 @@ public class PrettyPrinter { private void logString(ILogger logger, Level level, String line) { if (line != null) { - logger.log(level, "/* {} */", String.format("%-" + this.width, line)); + logger.log(level, "/* {} */", String.format("%-" + this.width + "s", line)); } } diff --git a/src/modularity/java/module-info.java b/src/modularity/java/module-info.java index b638dd2a..72755f95 100644 --- a/src/modularity/java/module-info.java +++ b/src/modularity/java/module-info.java @@ -26,18 +26,14 @@ /** * Mixin module declaration */ -@SuppressWarnings("module") // Suppress the warnings about gson and gson below +@SuppressWarnings("module") // Suppress the warnings about gson and gson below. Damn gsons, you ruined gson! module org.spongepowered.mixin { // // Actual modules we depend on // - requires transitive cpw.mods.modlauncher; - requires cpw.mods.securejarhandler; requires transitive java.compiler; requires transitive java.instrument; - requires transitive org.apache.logging.log4j; - requires org.apache.logging.log4j.core; requires transitive org.objectweb.asm; requires transitive org.objectweb.asm.commons; requires transitive org.objectweb.asm.tree; @@ -46,11 +42,19 @@ module org.spongepowered.mixin { requires java.logging; // - // Automatic modules we depend on + // Modules we require for compilation but don't necessarily need at runtime // - requires jopt.simple; - requires guava; - requires gson; + requires static org.apache.logging.log4j.core; + requires static transitive cpw.mods.modlauncher; + requires static cpw.mods.securejarhandler; + requires static transitive org.apache.logging.log4j; + + // + // Automatic modules we depend on, using static to avoid the forward compatibility mess + // + requires static jopt.simple; + requires static guava; + requires static gson; // // Exports