Skip to content

Commit

Permalink
Updated gradle, arch plugin & arch loom
Browse files Browse the repository at this point in the history
  • Loading branch information
Picono435 committed Mar 19, 2022
1 parent a6f2ea5 commit 1efab74
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 66 deletions.
13 changes: 3 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
16 changes: 8 additions & 8 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
43 changes: 20 additions & 23 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,37 @@ 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' }
}

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 {
Expand All @@ -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'
Expand All @@ -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
}
}

Expand Down
40 changes: 16 additions & 24 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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'
Expand All @@ -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
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1efab74

Please sign in to comment.