diff --git a/build.gradle b/build.gradle index 6808ab4..9c46e7d 100644 --- a/build.gradle +++ b/build.gradle @@ -12,9 +12,6 @@ buildscript { url = "https://jitpack.io" } } - dependencies { - classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.11' - } } plugins { @@ -26,18 +23,6 @@ plugins { id("com.gtnewhorizons.retrofuturagradle") version "1.3.19" } -// Set the toolchain version to decouple the Java we run Gradle with from the Java used to compile and run the mod -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(8)) - // Azul covers the most platforms for Java 8 toolchains, crucially including MacOS arm64 - vendor.set(org.gradle.jvm.toolchain.JvmVendorSpec.AZUL) - } - // Generate sources and javadocs jars when building and publishing - withSourcesJar() - withJavadocJar() -} - allprojects { apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'maven-publish' @@ -77,6 +62,8 @@ allprojects { } if(project.name.startsWith("module-") && project.name != "module-mixin" && project.name != "module-common") { + // TODO rfg: figure out source and dev jars + /* if(project.name != "module-all") { task sourcesJar(type: Jar) { from sourceSets.main.allSource @@ -118,7 +105,7 @@ allprojects { it.dependsOn reobf } } - } + }*/ } // Put license, credits and readme in jar diff --git a/module-common/build.gradle b/module-common/build.gradle index aa30377..9ea7a44 100644 --- a/module-common/build.gradle +++ b/module-common/build.gradle @@ -1 +1,10 @@ +apply from: "${rootDir}/module-conventions.gradle" + archivesBaseName = archivesBaseName.replace("-1.7.10", "-common-1.7.10" ) + +// Shadow considers the shadow jar the output of this subproject when it gets +// shadowed elsewhere, so we have to set it up +shadowJar { + archiveClassifier = 'dev' + configurations = [] +} diff --git a/module-conventions.gradle b/module-conventions.gradle new file mode 100644 index 0000000..ac57a53 --- /dev/null +++ b/module-conventions.gradle @@ -0,0 +1,15 @@ +// Stuff that should get set in every module. Because putting it in allprojects +// doesn't work for some reason! + +// Set the toolchain version to decouple the Java we run Gradle with from the Java used to compile and run the mod +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(8)) + // Azul covers the most platforms for Java 8 toolchains, crucially including MacOS arm64 + vendor.set(org.gradle.jvm.toolchain.JvmVendorSpec.AZUL) + } + // TODO rfg: figure out source and dev jars + // Generate sources and javadocs jars when building and publishing + //withSourcesJar() + //withJavadocJar() +} diff --git a/module-mixin/build.gradle b/module-mixin/build.gradle index 7f1a5eb..49810d2 100644 --- a/module-mixin/build.gradle +++ b/module-mixin/build.gradle @@ -1,12 +1,11 @@ +apply from: "${rootDir}/module-conventions.gradle" + import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar buildscript { repositories { gradlePluginPortal() } - dependencies { - classpath 'com.github.jengelman.gradle.plugins:shadow:6.1.0' - } } def versionBase = version @@ -120,11 +119,11 @@ flavors.each { // We want to *not* relocate ASM in the bridge classes. So we use a multi-step // build procedure: - + // 1. Create relocated Mixin jar, without the bridge classes task("mixinJar$_flavor", type: ShadowJar) { destinationDirectory = file("build/tmp") - classifier = "tmpMixin$_flavor" + archiveClassifier = "tmpMixin$_flavor" configurations = [project.configurations."shadow$_flavor"] relocate 'org.objectweb.asm', 'org.spongepowered.asm.lib' @@ -161,7 +160,7 @@ flavors.each { // 2. Create Mixin jar without relocation, with *only* the bridge classes task("bridgeJar$_flavor", type: ShadowJar) { destinationDirectory = file("build/tmp") - classifier = "tmpBridge$_flavor" + archiveClassifier = "tmpBridge$_flavor" configurations = [project.configurations."shadowBridge$_flavor"] include '*.jar' @@ -170,7 +169,7 @@ flavors.each { // 3. Combine the two jars task("shadowJar$_flavor", type: ShadowJar) { - version = versionBase + "+" + mixinFlavorClassifier + archiveVersion = versionBase + "+" + mixinFlavorClassifier from(sourceSets.main.output) { exclude "mcmod.info" } @@ -216,8 +215,8 @@ flavors.each { exclude "mcmod.info" } - version = versionBase + "+" + mixinFlavorClassifier - classifier = '' + archiveVersion = versionBase + "+" + mixinFlavorClassifier + archiveClassifier = '' configurations = [project.configurations."shadow$_flavor"] relocate 'io.github.legacymoddingmc.unimixins.common', 'io.github.legacymoddingmc.unimixins.mixin.repackage.common' @@ -259,8 +258,8 @@ flavors.each { task("shadowSourcesJar$_flavor", type: ShadowJar) { from sourceSets.main.allSource - version = versionBase + "+" + mixinFlavorClassifier - classifier = "sources" + archiveVersion = versionBase + "+" + mixinFlavorClassifier + archiveClassifier = "sources" configurations = [project.configurations."shadowSources$_flavor"] } @@ -273,13 +272,13 @@ flavors.each { artifact tasks."shadowSourcesJar$_flavor" artifactId = archivesBaseName.substring(1) - version = tasks."shadowJar$_flavor".version + version = tasks."shadowJar$_flavor".archiveVersion } } } } // Obfuscation is useless because we're not compiling code referencing Minecraft classes -reobf.enabled = false +reobfJar.enabled = false jar.enabled = false diff --git a/project.gradle b/project.gradle deleted file mode 100644 index e69de29..0000000 diff --git a/settings.gradle b/settings.gradle index 53ad091..7b8b13b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -16,14 +16,14 @@ pluginManagement { } } -/*include 'module-mixin' -include 'module-compat' -include 'module-devcompat' -include 'module-mixingasm' -include 'module-spongemixins' -include 'module-mixinbooterlegacy' -include 'module-gasstation' -include 'module-gtnhmixins' -include 'module-mixinextras' -include 'module-all'*/ +include 'module-mixin' +// include 'module-compat' +// include 'module-devcompat' +// include 'module-mixingasm' +// include 'module-spongemixins' +// include 'module-mixinbooterlegacy' +// include 'module-gasstation' +// include 'module-gtnhmixins' +// include 'module-mixinextras' +// include 'module-all' include 'module-common'