Refactor: Build scripts · lambda-client/lambda@c912d92 · GitHub
Skip to content

Commit c912d92

Browse files
committed
Refactor: Build scripts
1 parent 11a6c5a commit c912d92

4 files changed

Lines changed: 60 additions & 57 deletions

File tree

build.gradle.kts

Lines changed: 6 additions & 34 deletions

fabric/build.gradle.kts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
val modVersion: String by project
12
val minecraftVersion: String by project
23
val fabricLoaderVersion: String by project
34
val fabricApiVersion: String by project
45
val kotlinFabricVersion: String by project
56

67
base.archivesName = "${base.archivesName.get()}-fabric"
78

9+
plugins {
10+
id("com.github.johnrengelman.shadow") version "8.1.1"
11+
}
12+
813
architectury {
914
platformSetupLoomIde()
1015
fabric()
@@ -40,11 +45,6 @@ fun DependencyHandlerScope.setupConfigurations() {
4045
modImplementation(it)
4146
include(it)
4247
}
43-
44-
shadowBundle.dependencies.forEach {
45-
shadowCommon(it)
46-
shadow(it)
47-
}
4848
}
4949

5050
dependencies {
@@ -73,10 +73,19 @@ dependencies {
7373
}
7474

7575
tasks {
76-
// Access wideners are the successor of the mixins accessor
77-
// that were used in the past to access private fields and methods.
78-
// They allow you to make field, method, and class access public.
76+
shadowJar {
77+
archiveVersion = "$modVersion+$minecraftVersion"
78+
configurations = listOf(shadowBundle)
79+
archiveClassifier = "dev-shadow"
80+
}
81+
7982
remapJar {
83+
dependsOn(shadowJar)
84+
inputFile = shadowJar.get().archiveFile
85+
86+
// Access wideners are the successor of the mixins accessor
87+
// that were used in the past to access private fields and methods.
88+
// They allow you to make field, method, and class access public.
8089
injectAccessWidener = true
8190
}
8291
}

forge/build.gradle.kts

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
val modVersion: String by project
12
val minecraftVersion: String by project
23
val forgeVersion: String by project
34
val mixinExtrasVersion: String by project
45
val kotlinForgeVersion: String by project
56

67
base.archivesName = "${base.archivesName.get()}-forge"
78

9+
plugins {
10+
id("com.github.johnrengelman.shadow") version "8.1.1"
11+
}
12+
813
architectury {
914
platformSetupLoomIde()
1015
forge()
@@ -62,11 +67,6 @@ fun DependencyHandlerScope.setupConfigurations() {
6267
forgeRuntimeLibrary(it)
6368
include(it)
6469
}
65-
66-
shadowBundle.dependencies.forEach {
67-
shadowCommon(it)
68-
shadow(it)
69-
}
7070
}
7171

7272
dependencies {
@@ -81,13 +81,13 @@ dependencies {
8181
includeMod("thedarkcolour:kotlinforforge:$kotlinForgeVersion")
8282
includeMod("baritone-api:baritone-unoptimized-forge:1.10.2")
8383

84+
// Fix KFF
85+
compileOnly(kotlin("stdlib"))
86+
8487
// MixinExtras
8588
implementation("io.github.llamalad7:mixinextras-forge:$mixinExtrasVersion")
8689
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:$mixinExtrasVersion")!!)
8790

88-
// Fix KFF
89-
compileOnly(kotlin("stdlib"))
90-
9191
// Disable reflections logging
9292
include("org.slf4j:slf4j-nop:2.0.13")
9393

@@ -100,9 +100,24 @@ dependencies {
100100
}
101101

102102
tasks {
103+
// Merge the resources and classes into the same directory.
104+
// This is done because java expects modules to be in a single directory.
105+
// And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem
106+
// This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later.
103107
sourceSets.forEach {
104108
val dir = layout.buildDirectory.dir("sourcesSets/${it.name}")
105109
it.output.setResourcesDir(dir)
106110
it.java.destinationDirectory.set(dir)
107111
}
112+
113+
shadowJar {
114+
archiveVersion = "$modVersion+$minecraftVersion"
115+
configurations = listOf(shadowBundle)
116+
archiveClassifier = "dev-shadow"
117+
}
118+
119+
remapJar {
120+
dependsOn(processResources, shadowJar)
121+
inputFile = shadowJar.get().archiveFile
122+
}
108123
}

neoforge/build.gradle.kts

Lines changed: 14 additions & 7 deletions

0 commit comments

Comments
 (0)