From 1efab74e67e07277523c9667c225b72c2eb785d1 Mon Sep 17 00:00:00 2001 From: Picono435 Date: Sat, 19 Mar 2022 10:35:59 +0000 Subject: [PATCH] Updated gradle, arch plugin & arch loom --- build.gradle | 13 ++----- common/build.gradle | 16 ++++----- fabric/build.gradle | 43 +++++++++++------------- forge/build.gradle | 40 +++++++++------------- gradle/wrapper/gradle-wrapper.properties | 2 +- 5 files changed, 48 insertions(+), 66 deletions(-) diff --git a/build.gradle b/build.gradle index 72d771f..ca417e7 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { - id "architectury-plugin" version "3.2-SNAPSHOT" - id "dev.architectury.loom" version "0.9.0-SNAPSHOT" apply false + id "architectury-plugin" version "3.4-SNAPSHOT" + id "dev.architectury.loom" version "0.11.0-SNAPSHOT" apply false } architectury { @@ -44,14 +44,7 @@ allprojects { tasks.withType(JavaCompile) { options.encoding = "UTF-8" - - // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too - // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used. - // We'll use that if it's available, but otherwise we'll use the older option. - def targetVersion = 8 - if (JavaVersion.current().isJava9Compatible()) { - options.release = targetVersion - } + options.release = 8 } java { diff --git a/common/build.gradle b/common/build.gradle index 24fe23e..cfacebb 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -3,26 +3,26 @@ dependencies { // Do NOT use other classes from fabric loader modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" - implementation 'org.spongepowered:configurate-yaml:4.1.1' + implementation 'org.spongepowered:configurate-yaml:4.1.2' } architectury { common() } -java { - withSourcesJar() +configurations { + dev +} + +artifacts { + dev(jar) } publishing { publications { mavenCommon(MavenPublication) { artifactId = rootProject.archives_base_name - // add all the jars that should be included when publishing to maven - artifact remapJar - artifact(sourcesJar) { - builtBy remapSourcesJar - } + from components.java } } diff --git a/fabric/build.gradle b/fabric/build.gradle index 8713a2a..d05023d 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -2,16 +2,19 @@ plugins { id "com.github.johnrengelman.shadow" version "7.0.0" } -configurations { - shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. - shadow -} - architectury { platformSetupLoomIde() fabric() } +configurations { + common + shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. + compileClasspath.extendsFrom common + runtimeClasspath.extendsFrom common + developmentFabric.extendsFrom common +} + repositories { maven { url 'https://jitpack.io' } } @@ -19,19 +22,17 @@ repositories { dependencies { modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" - modImplementation shadow("com.github.Picono435:fabric-permissions-api:-SNAPSHOT") { transitive = false } + modImplementation ("com.github.Picono435:fabric-permissions-api:-SNAPSHOT") { transitive = false } + include shadowCommon ("com.github.Picono435:fabric-permissions-api:-SNAPSHOT") { transitive = false } - implementation(project(path: ":common")) { - transitive = false - } - developmentFabric(project(path: ":common")) { + common(project(path: ":common", configuration: "dev")) { transitive = false } shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive = false } - implementation shadow('org.spongepowered:configurate-yaml:4.1.1') + implementation shadowCommon('org.spongepowered:configurate-yaml:4.1.2') } processResources { @@ -43,7 +44,7 @@ processResources { } shadowJar { - configurations = [project.configurations.shadowCommon, project.configurations.shadow] + configurations = [project.configurations.shadowCommon] classifier "dev-shadow" relocate 'org.yaml', 'com.gmail.picono435.dependencies.yaml' @@ -63,27 +64,23 @@ jar { classifier "dev" } -java { - withSourcesJar() -} - sourcesJar { def commonSources = project(":common").sourcesJar dependsOn commonSources from commonSources.archiveFile.map { zipTree(it) } } +components.java { + withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { + skip() + } +} + publishing { publications { mavenFabric(MavenPublication) { artifactId = rootProject.archives_base_name + "-" + project.name - // add all the jars that should be included when publishing to maven - artifact(remapJar) { - classifier null - } - artifact(sourcesJar) { - builtBy remapSourcesJar - } + from components.java } } diff --git a/forge/build.gradle b/forge/build.gradle index 5a11c7a..92cc610 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -2,34 +2,30 @@ plugins { id "com.github.johnrengelman.shadow" version "7.0.0" } -configurations { - shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. - shadow -} - architectury { platformSetupLoomIde() forge() } -loom { - useFabricMixin = true +configurations { + common + shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. + compileClasspath.extendsFrom common + runtimeClasspath.extendsFrom common + developmentForge.extendsFrom common } dependencies { forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}" - implementation(project(path: ":common")) { - transitive = false - } - developmentForge(project(path: ":common")) { + common(project(path: ":common", configuration: "dev")) { transitive = false } shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false } - implementation shadow('org.spongepowered:configurate-yaml:4.1.1') + forgeRuntimeLibrary(implementation(shadowCommon('org.spongepowered:configurate-yaml:4.1.2'))) } processResources { @@ -43,7 +39,7 @@ processResources { shadowJar { exclude "fabric.mod.json" - configurations = [project.configurations.shadowCommon, project.configurations.shadow] + configurations = [project.configurations.shadowCommon] classifier "dev-shadow" relocate 'org.yaml', 'com.gmail.picono435.dependencies.yaml' @@ -63,27 +59,23 @@ jar { classifier "dev" } -java { - withSourcesJar() -} - sourcesJar { def commonSources = project(":common").sourcesJar dependsOn commonSources from commonSources.archiveFile.map { zipTree(it) } } +components.java { + withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { + skip() + } +} + publishing { publications { mavenForge(MavenPublication) { artifactId = rootProject.archives_base_name + "-" + project.name - // add all the jars that should be included when publishing to maven - artifact(remapJar) { - classifier null - } - artifact(sourcesJar) { - builtBy remapSourcesJar - } + from components.java } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0f80bbf..00e33ed 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists