Skip to content

Commit 6627e9e

Browse files
committed
Merge branch 'twoconfig' of https://github.com/Polyfrost/PolyPatcher into twoconfig
2 parents a49c5e3 + 8c4f342 commit 6627e9e

File tree

9 files changed

+60
-57
lines changed

9 files changed

+60
-57
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,47 @@
1-
name: build
1+
# Build Workflow
2+
3+
name: Build with Gradle
24

35
on:
4-
push:
56
pull_request:
7+
workflow_dispatch:
8+
push:
9+
10+
concurrency:
11+
group: ${{ github.head_ref || format('{0}-{1}', github.ref, github.run_number) }}
12+
cancel-in-progress: true
613

714
jobs:
815
build:
9-
name: "Build"
10-
runs-on: "ubuntu-latest"
16+
name: Build
1117

12-
steps:
13-
- uses: actions/checkout@v4
18+
runs-on: ubuntu-latest
1419

15-
- uses: gradle/wrapper-validation-action@v3
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 10
1625

17-
- uses: actions/setup-java@v4
26+
- name: Set up JDK 17
27+
uses: actions/setup-java@v4
1828
with:
19-
distribution: "temurin"
20-
java-version: "21"
29+
java-version: 21
30+
distribution: temurin
2131

2232
- uses: actions/cache@v4
2333
with:
2434
path: |
2535
~/.gradle/caches
2636
~/.gradle/wrapper
2737
**/loom-cache
28-
key: ${{ runner.os }}-gradle-v2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
38+
**/prebundled-jars
39+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
2940
restore-keys: |
30-
${{ runner.os }}-gradle-v2-
41+
${{ runner.os }}-gradle-
42+
43+
- name: Chmod Gradle
44+
run: chmod +x ./gradlew
3145

32-
- run: ./gradlew --no-daemon build
46+
- name: Build
47+
run: ./gradlew build --no-daemon

build.gradle.kts

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@file:Suppress("UnstableApiUsage", "PropertyName")
22

33
import dev.deftu.gradle.utils.GameSide
4-
import dev.deftu.gradle.utils.includeOrShade
4+
import dev.deftu.gradle.utils.MinecraftVersion
55

66
plugins {
77
java
@@ -11,12 +11,11 @@ plugins {
1111
id("dev.deftu.gradle.tools.resources") // Applies resource processing so that we can replace tokens, such as our mod name/version, in our resources.
1212
id("dev.deftu.gradle.tools.bloom") // Applies the Bloom plugin, which allows us to replace tokens in our source files, such as being able to use `@MOD_VERSION` in our source files.
1313
id("dev.deftu.gradle.tools.shadow") // Applies the Shadow plugin, which allows us to shade our dependencies into our mod JAR. This is NOT recommended for Fabric mods, but we have an *additional* configuration for those!
14+
id("dev.deftu.gradle.tools.ducks") // Creates a ducks source set, which allows us to use theoretical classes which may not exist at runtime (such as things which are in other mods).
1415
id("dev.deftu.gradle.tools.minecraft.loom") // Applies the Loom plugin, which automagically configures Essential's Architectury Loom plugin for you.
1516
id("dev.deftu.gradle.tools.minecraft.releases") // Applies the Minecraft auto-releasing plugin, which allows you to automatically release your mod to CurseForge and Modrinth.
1617
}
1718

18-
val accessTransformerName = "patcher1${mcData.version.minor}_at.cfg"
19-
2019
toolkitLoomHelper {
2120
useOneConfig {
2221
version = "1.0.0-alpha.49"
@@ -31,8 +30,6 @@ toolkitLoomHelper {
3130
+module
3231
}
3332
}
34-
useDevAuth("1.2.1")
35-
useMixinExtras("0.4.1")
3633

3734
// Turns off the server-side run configs, as we're building a client-sided mod.
3835
disableRunConfigs(GameSide.SERVER)
@@ -45,73 +42,66 @@ toolkitLoomHelper {
4542
if (mcData.isForge) {
4643
// Configures the Mixin tweaker if we are building for Forge.
4744
useForgeMixin(modData.id)
48-
49-
useProperty("patcher.debugBytecode", "true", GameSide.CLIENT)
50-
useProperty("fml.coreMods.load", "club.sk1er.patcher.tweaker.PatcherTweaker", GameSide.CLIENT)
5145
}
5246
}
5347

48+
val accessTransformerName = "patcher1${mcData.version.minor}_at.cfg"
49+
5450
if (mcData.isForge) {
5551
loom {
5652
forge {
57-
accessTransformer(rootProject.file("src/main/resources/META-INF/$accessTransformerName"))
53+
accessTransformer(rootProject.file("src/main/resources/$accessTransformerName"))
5854
}
5955
}
6056
}
6157

62-
// Configures the output directory for when building from the `src/resources` directory.
63-
sourceSets {
64-
val dummy by creating
65-
main {
66-
dummy.compileClasspath += compileClasspath
67-
compileClasspath += dummy.output
68-
output.setResourcesDir(java.classesDirectory)
69-
}
70-
}
71-
7258
// Configures the libraries/dependencies for your mod.
7359
dependencies {
74-
modImplementation(includeOrShade("org.polyfrost:elementa-$mcData:562") {
60+
modImplementation(shade("org.polyfrost:elementa-$mcData:562") {
7561
isTransitive = false
7662
})
7763

78-
implementation(includeOrShade("com.github.ben-manes.caffeine:caffeine:2.9.3")!!)
64+
implementation(shade("com.github.ben-manes.caffeine:caffeine:2.9.3")!!)
7965

80-
implementation(includeOrShade("com.github.char:Koffee:88ba1b0") {
66+
implementation(shade("com.github.videogame-hacker:Koffee:88ba1b0") {
8167
isTransitive = false
8268
})
8369

8470
if (mcData.version.minor < 12) {
85-
implementation(includeOrShade("it.unimi.dsi:fastutil:8.5.13")!!)
71+
implementation(shade("it.unimi.dsi:fastutil:8.5.13")!!)
8672
}
73+
74+
// Add Fabric Language Kotlin and (Legacy) Fabric API as dependencies (these are both optional but are particularly useful).
8775
if (mcData.isFabric) {
88-
runtimeOnly("include"(rootProject.project(":fake-mod"))!!)
89-
implementation(includeOrShade("com.github.Chocohead:Fabric-ASM:2.3")!!)
76+
if (mcData.isLegacyFabric) {
77+
// 1.8.9 - 1.13
78+
modImplementation("net.legacyfabric.legacy-fabric-api:legacy-fabric-api:${mcData.dependencies.legacyFabric.legacyFabricApiVersion}")
79+
} else {
80+
// 1.16.5+
81+
modImplementation("net.fabricmc.fabric-api:fabric-api:${mcData.dependencies.fabric.fabricApiVersion}")
82+
}
9083
}
9184
}
9285

9386
tasks {
9487
compileKotlin {
95-
compilerOptions {
96-
optIn.add("kotlin.RequiresOptIn")
97-
freeCompilerArgs.add("-Xno-param-assertions")
98-
freeCompilerArgs.add("-Xjvm-default=all-compatibility")
88+
kotlinOptions {
89+
freeCompilerArgs += listOf("-Xopt-in=kotlin.RequiresOptIn", "-Xno-param-assertions", "-Xjvm-default=all-compatibility")
9990
}
10091
}
10192

10293
jar {
10394
// Sets the jar manifest attributes.
10495
if (mcData.isLegacyForge) {
10596
manifest.attributes += mapOf(
106-
"FMLCorePlugin" to "club.sk1er.patcher.tweaker.PatcherTweaker",
107-
"FMLCorePluginContainsFMLMod" to "Yes, yes it does",
10897
"FMLAT" to accessTransformerName,
10998
"Main-Class" to "club.sk1er.container.ContainerMessage"
11099
)
111100
}
112101
}
113102

114103
processResources {
115-
exclude("**/*.at.cfg")
104+
exclude("patcher18_at.cfg")
105+
exclude("patcher112_at.cfg")
116106
}
117107
}

root.gradle.kts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ preprocess {
1010
// "1.8.9-forge"(10809, "srg")
1111
// }
1212

13-
"1.12.2-forge"(11202, "srg") {
14-
"1.12.2-fabric"(11202, "yarn") {
15-
"1.8.9-fabric"(10809, "yarn", file("versions/1.12.2-1.8.9.txt")) {
16-
"1.8.9-forge"(10809, "srg")
13+
"1.12.2-fabric"(11202, "yarn") {
14+
"1.12.2-forge"(11202, "srg") {
15+
"1.8.9-forge"(10809, "srg", file("versions/1.12.2-1.8.9.txt")) {
16+
"1.8.9-fabric"(10809, "yarn")
1717
}
1818
}
1919
}
20-
20+
2121
strictExtraMappings.set(true)
22-
}
22+
}

settings.gradle.kts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pluginManagement {
2424

2525
plugins {
2626
kotlin("jvm") version("2.0.0")
27-
id("dev.deftu.gradle.multiversion-root") version("2.17.0")
27+
id("dev.deftu.gradle.multiversion-root") version("2.18.2")
2828
}
2929
}
3030

@@ -35,21 +35,19 @@ val projectName: String = extra["mod.name"]?.toString()
3535
rootProject.name = projectName
3636
rootProject.buildFileName = "root.gradle.kts"
3737

38-
include(":fake-mod")
39-
4038
// Adds all of our build target versions to the classpath if we need to add version-specific code.
4139
// Update this list if you want to remove/add a version and/or mod loader.
4240
// The format is: version-modloader (f.ex: 1.8.9-forge, 1.17.1-fabric, etc)
43-
// **REMEMBER TO ALSO UPDATE THE `root.gradle.kts` FILE WITH THE NEW VERSION(S).
41+
// **REMEMBER TO ALSO UPDATE THE `root.gradle.kts` AND `build.gradle.kts` FILES WITH THE NEW VERSION(S).
4442
listOf(
4543
"1.8.9-forge",
4644
"1.8.9-fabric",
45+
"1.12.2-fabric",
4746
"1.12.2-forge",
48-
"1.12.2-fabric"
4947
).forEach { version ->
5048
include(":$version")
5149
project(":$version").apply {
5250
projectDir = file("versions/$version")
5351
buildFileName = "../../build.gradle.kts"
5452
}
55-
}
53+
}
File renamed without changes.
File renamed without changes.

src/dummy/java/gg/essential/api/config/EssentialConfig.java renamed to src/ducks/java/gg/essential/api/config/EssentialConfig.java

File renamed without changes.

src/dummy/java/gg/essential/api/data/OnboardingData.java renamed to src/ducks/java/gg/essential/api/data/OnboardingData.java

File renamed without changes.

src/dummy/java/gg/essential/api/utils/TrustedHostsUtil.java renamed to src/ducks/java/gg/essential/api/utils/TrustedHostsUtil.java

File renamed without changes.

0 commit comments

Comments
 (0)