Skip to content

Commit

Permalink
rework gradle script part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed Aug 5, 2024
1 parent 81e6fca commit e410140
Show file tree
Hide file tree
Showing 21 changed files with 93 additions and 39 deletions.
30 changes: 23 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ subprojects {
assemble.dependsOn spotlessApply

repositories {
maven { url "https://maven.neoforged.net/releases/" }

}

dependencies {
minecraft libs.minecraft
mappings loom.layered {
minecraft(libs.minecraft)
mappings(loom.layered {
mappings(variantOf(libs.yarn) { classifier("v2") })
mappings libs.yarn.patch
}
implementation 'com.google.auto.service:auto-service-annotations:1.1.1'
annotationProcessor 'com.google.auto.service:auto-service:1.1.1'
mappings(libs.yarn.patch)
})
implementation("com.google.auto.service:auto-service-annotations:1.1.1")
annotationProcessor("com.google.auto.service:auto-service:1.1.1")
}

java {
Expand Down Expand Up @@ -72,3 +72,19 @@ subprojects {
}
}
}

allprojects {
configurations {
moduleImplementation {
canBeResolved = true
canBeConsumed = false
}
compileClasspath.extendsFrom moduleImplementation
runtimeClasspath.extendsFrom moduleImplementation
moduleInclude {
canBeResolved = true
canBeConsumed = false
}
include.extendsFrom moduleInclude
}
}
4 changes: 2 additions & 2 deletions command-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ group = "band.kessoku.lib.command"
base.archivesName = rootProject.name + "-command"

dependencies {
implementation(project(":base-common"))
implementation(project(":event-base-common"))
moduleImplementation(project(":base-common"))
moduleImplementation(project(":event-base-common"))
}
2 changes: 1 addition & 1 deletion command-fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ group = "band.kessoku.lib.command"
base.archivesName = rootProject.name + "-command"

dependencies {
implementation(project(":event-base-common"))
moduleImplementation(project(":event-base-common"))

common(project(path: ':command-common', configuration: 'namedElements')) { transitive false }
shadowBundle project(path: ':command-common', configuration: 'transformProductionFabric')
Expand Down
4 changes: 2 additions & 2 deletions command-neo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ group = "band.kessoku.lib.command"
base.archivesName = rootProject.name + "-command"

dependencies {
implementation(project(":event-base-common"))
implementation(project(":event-base-neo"))
moduleImplementation(project(":event-base-common"))
moduleImplementation(project(":event-base-neo"))

common(project(path: ':command-common', configuration: 'namedElements')) { transitive false }
shadowBundle project(path: ':command-common', configuration: 'transformProductionNeoForge')
Expand Down
2 changes: 1 addition & 1 deletion event-base-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ group = "band.kessoku.lib.event"
base.archivesName = rootProject.name + "-event-base"

dependencies {
implementation(project(":base-common"))
moduleImplementation(project(":base-common"))
}
9 changes: 5 additions & 4 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ apply from: rootProject.file("gradle/scripts/kessokulib-fabric.gradle")
group = "band.kessoku.lib"
base.archivesName = rootProject.name

var modules = [":base-fabric", ":event-base-fabric", ":lifecycle-events-fabric", ":platform-fabric", ":registry-fabric"]

dependencies {
include(project(":base-fabric"))
include(project(":event-base-fabric"))
include(project(":platform-fabric"))
include(project(":registry-fabric"))
modules.each {
moduleInclude(project(it))
}
}
9 changes: 9 additions & 0 deletions gradle/example/common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apply from: rootProject.file("gradle/scripts/kessokulib-common.gradle")

group = "band.kessoku.lib.package"
base.archivesName = rootProject.name + "-package"

// You can delete this section if you need to
dependencies {

}
9 changes: 9 additions & 0 deletions gradle/example/fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apply from: rootProject.file("gradle/scripts/kessokulib-fabric.gradle")

group = "band.kessoku.lib.package"
base.archivesName = rootProject.name + "-package"

dependencies {
common(project(path: ':package-common', configuration: 'namedElements')) { transitive false }
shadowBundle(project(path: ':package-common', configuration: 'transformProductionFabric'))
}
9 changes: 9 additions & 0 deletions gradle/example/neo/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apply from: rootProject.file("gradle/scripts/kessokulib-neo.gradle")

group = "band.kessoku.lib.package"
base.archivesName = rootProject.name + "-package"

dependencies {
common(project(path: ':package-common', configuration: 'namedElements')) { transitive false }
shadowBundle(project(path: ':package-common', configuration: 'transformProductionNeoForge'))
}
1 change: 1 addition & 0 deletions gradle/example/neo/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
loom.platform=neoforge
20 changes: 14 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,35 @@
mod = "0.1.0"
minecraft = "1.21"
yarn = "1.21+build.9"
yarn-mappings-patch-neoforge = "1.21+build.4"
yarn-patch-neoforge = "1.21+build.4"

# Loaders
neo = "21.0.151"
fabric-loader = "0.16.0"

# Mods
fabric-api = "0.100.8+1.21"

# Plugin version
loom = "1.7-SNAPSHOT"
architectury = "3.4-SNAPSHOT"
shadow = "8.1.1"
spotless = "6.25.0"

[libraries]
minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraft" }
yarn = { group = "net.fabricmc", name = "yarn", version.ref = "yarn" }
yarn-patch = { group = "dev.architectury", name = "yarn-mappings-patch-neoforge", version.ref = "yarn-mappings-patch-neoforge" }
yarn-patch = { group = "dev.architectury", name = "yarn-mappings-patch-neoforge", version.ref = "yarn-patch-neoforge" }

# Loaders
neo = { group = "net.neoforged", name = "neoforge", version.ref = "neo" }
fabric-loader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabric-loader" }

# Mods
fabric-api = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fabric-api" }

[plugins]
loom = { id = "dev.architectury.loom", version = "1.7-SNAPSHOT" }
architectury = { id = "architectury-plugin", version = "3.4-SNAPSHOT" }
shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" }
spotless = { id = "com.diffplug.spotless", version = "6.25.0" }
loom = { id = "dev.architectury.loom", version.ref = "loom" }
architectury = { id = "architectury-plugin", version.ref = "architectury" }
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
4 changes: 2 additions & 2 deletions lifecycle-events-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ group = "band.kessoku.lib.events.lifecycle"
base.archivesName = rootProject.name + "-lifecycle-events"

dependencies {
implementation(project(":base-common"))
implementation(project(":event-base-common"))
moduleImplementation(project(":base-common"))
moduleImplementation(project(":event-base-common"))
}
2 changes: 1 addition & 1 deletion lifecycle-events-fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ group = "band.kessoku.lib.events.lifecycle"
base.archivesName = rootProject.name + "-lifecycle-events"

dependencies {
implementation(project(":event-base-common"))
moduleImplementation(project(":event-base-common"))

common(project(path: ':lifecycle-events-common', configuration: 'namedElements')) { transitive false }
shadowBundle project(path: ':lifecycle-events-common', configuration: 'transformProductionFabric')
Expand Down
4 changes: 2 additions & 2 deletions lifecycle-events-neo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ loom {
}

dependencies {
implementation(project(":event-base-common"))
implementation(project(":event-base-neo"))
moduleImplementation(project(":event-base-common"))
moduleImplementation(project(":event-base-neo"))

common(project(path: ':lifecycle-events-common', configuration: 'namedElements')) { transitive false }
shadowBundle project(path: ':lifecycle-events-common', configuration: 'transformProductionNeoForge')
Expand Down
9 changes: 5 additions & 4 deletions neo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ apply from: rootProject.file("gradle/scripts/kessokulib-neo.gradle")
group = "band.kessoku.lib"
base.archivesName = rootProject.name

var modules = [":base-neo", ":event-base-neo", ":lifecycle-events-neo", ":platform-neo", ":registry-neo"]

dependencies {
include(project(":base-neo"))
include(project(":event-base-neo"))
include(project(":platform-neo"))
include(project(":registry-neo"))
modules.each {
moduleInclude(project(it))
}
}
2 changes: 1 addition & 1 deletion platform-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ group = "band.kessoku.lib.platform"
base.archivesName = rootProject.name + "-platform"

dependencies {
implementation(project(":base-common"))
moduleImplementation(project(":base-common"))
}
2 changes: 1 addition & 1 deletion platform-fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ base.archivesName = rootProject.name + "-platform"

dependencies {
common(project(path: ':platform-common', configuration: 'namedElements')) { transitive false }
shadowBundle project(path: ':platform-common', configuration: 'transformProductionFabric')
shadowBundle(project(path: ':platform-common', configuration: 'transformProductionFabric'))
}
2 changes: 1 addition & 1 deletion platform-neo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ base.archivesName = rootProject.name + "-platform"

dependencies {
common(project(path: ':platform-common', configuration: 'namedElements')) { transitive false }
shadowBundle project(path: ':platform-common', configuration: 'transformProductionNeoForge')
shadowBundle(project(path: ':platform-common', configuration: 'transformProductionNeoForge'))
}
2 changes: 1 addition & 1 deletion registry-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ group = "band.kessoku.lib.registry"
base.archivesName = rootProject.name + "-registry"

dependencies {
implementation project(":base-common")
moduleImplementation(project(":base-common"))
}
2 changes: 1 addition & 1 deletion registry-fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ base.archivesName = rootProject.name + "-registry"

dependencies {
common(project(path: ':registry-common', configuration: 'namedElements')) { transitive false }
shadowBundle project(path: ':registry-common', configuration: 'transformProductionFabric')
shadowBundle(project(path: ':registry-common', configuration: 'transformProductionFabric'))
}
4 changes: 2 additions & 2 deletions registry-neo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ group = "band.kessoku.lib.registry"
base.archivesName = rootProject.name + "-registry"

dependencies {
implementation(project(":event-base-neo"))
moduleImplementation(project(":event-base-neo"))

common(project(path: ':registry-common', configuration: 'namedElements')) { transitive false }
shadowBundle project(path: ':registry-common', configuration: 'transformProductionNeoForge')
shadowBundle(project(path: ':registry-common', configuration: 'transformProductionNeoForge'))
}

0 comments on commit e410140

Please sign in to comment.