Skip to content

Commit e33337c

Browse files
committed
Switch back to NG7
1 parent aa823ba commit e33337c

File tree

3 files changed

+161
-145
lines changed

3 files changed

+161
-145
lines changed

core-api/build.gradle.kts

Lines changed: 81 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,82 @@
1-
import java.text.SimpleDateFormat
2-
import java.util.*
3-
4-
val versionMain: String = System.getenv("VERSION") ?: "9.9.9"
5-
6-
plugins {
7-
id("java-library")
8-
id("maven-publish")
9-
alias(neoforged.plugins.moddev)
10-
}
11-
12-
sourceSets {
13-
named("test") {
14-
resources {
15-
//The test module has no resources
16-
setSrcDirs(emptyList<String>())
17-
}
18-
}
19-
}
20-
21-
base {
22-
group = "dev.compactmods.compactmachines"
23-
version = versionMain
24-
}
25-
26-
java {
27-
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
28-
withJavadocJar()
29-
}
30-
31-
neoForge {
32-
version = neoforged.versions.neoforge
33-
}
34-
35-
tasks.withType<JavaCompile> {
36-
options.encoding = "UTF-8"
37-
options.compilerArgs.add("-proc:none")
38-
options.compilerArgs.addAll(arrayOf("-Xmaxerrs", "9000"))
39-
}
40-
41-
tasks.withType<Jar> {
42-
val gitVersion = providers.exec {
43-
commandLine("git", "rev-parse", "HEAD")
44-
}.standardOutput.asText.get()
45-
46-
manifest {
47-
val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date())
48-
attributes(
49-
mapOf(
50-
"Specification-Title" to "Compact Machines - Core API",
51-
"Specification-Version" to "1", // We are version 1 of ourselves
52-
"Implementation-Title" to "Compact Machines - Core API",
53-
"Implementation-Timestamp" to now,
54-
"FMLModType" to "GAMELIBRARY",
55-
"Minecraft-Version" to mojang.versions.minecraft.get(),
56-
"NeoForge-Version" to neoforged.versions.neoforge.get(),
57-
"Main-Commit" to gitVersion
58-
)
59-
)
60-
}
61-
}
62-
63-
val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/compactmachines"
64-
publishing {
65-
publications.register<MavenPublication>("api") {
66-
artifactId = "core-api"
67-
from(components.getByName("java"))
68-
}
69-
70-
repositories {
71-
// GitHub Packages
72-
maven(PACKAGES_URL) {
73-
name = "GitHubPackages"
74-
credentials {
75-
username = System.getenv("GITHUB_ACTOR")
76-
password = System.getenv("GITHUB_TOKEN")
77-
}
78-
}
79-
}
1+
import java.text.SimpleDateFormat
2+
import java.util.*
3+
4+
val versionMain: String = System.getenv("VERSION") ?: "9.9.9"
5+
6+
plugins {
7+
id("java-library")
8+
id("maven-publish")
9+
alias(neoforged.plugins.moddev)
10+
}
11+
12+
sourceSets {
13+
named("test") {
14+
resources {
15+
//The test module has no resources
16+
setSrcDirs(emptyList<String>())
17+
}
18+
}
19+
}
20+
21+
base {
22+
group = "dev.compactmods.compactmachines"
23+
version = versionMain
24+
}
25+
26+
java {
27+
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
28+
withJavadocJar()
29+
}
30+
31+
minecraft {}
32+
33+
dependencies {
34+
api(neoforged.neoforge)
35+
}
36+
37+
tasks.withType<JavaCompile> {
38+
options.encoding = "UTF-8"
39+
options.compilerArgs.add("-proc:none")
40+
options.compilerArgs.addAll(arrayOf("-Xmaxerrs", "9000"))
41+
}
42+
43+
tasks.withType<Jar> {
44+
val gitVersion = providers.exec {
45+
commandLine("git", "rev-parse", "HEAD")
46+
}.standardOutput.asText.get()
47+
48+
manifest {
49+
val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date())
50+
attributes(
51+
mapOf(
52+
"Specification-Title" to "Compact Machines - Core API",
53+
"Specification-Version" to "1", // We are version 1 of ourselves
54+
"Implementation-Title" to "Compact Machines - Core API",
55+
"Implementation-Timestamp" to now,
56+
"FMLModType" to "GAMELIBRARY",
57+
"Minecraft-Version" to mojang.versions.minecraft.get(),
58+
"NeoForge-Version" to neoforged.versions.neoforge.get(),
59+
"Main-Commit" to gitVersion
60+
)
61+
)
62+
}
63+
}
64+
65+
val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/compactmachines"
66+
publishing {
67+
publications.register<MavenPublication>("api") {
68+
artifactId = "core-api"
69+
from(components.getByName("java"))
70+
}
71+
72+
repositories {
73+
// GitHub Packages
74+
maven(PACKAGES_URL) {
75+
name = "GitHubPackages"
76+
credentials {
77+
username = System.getenv("GITHUB_ACTOR")
78+
password = System.getenv("GITHUB_TOKEN")
79+
}
80+
}
81+
}
8082
}

neoforge-main/build.gradle.kts

Lines changed: 68 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@file:Suppress("SpellCheckingInspection")
22

3-
import org.slf4j.event.Level
43
import java.text.SimpleDateFormat
54
import java.util.*
65

@@ -55,71 +54,81 @@ sourceSets.test {
5554
}
5655
}
5756

58-
neoForge {
59-
version = neoforged.versions.neoforge
60-
61-
this.mods.create(modId) {
62-
modSourceSets.add(sourceSets.main)
63-
modSourceSets.add(sourceSets.test)
64-
this.dependency(coreApi)
65-
}
66-
67-
unitTest {
68-
enable()
69-
testedMod = mods.named(modId)
57+
minecraft {
58+
this.modIdentifier = modId
59+
this.accessTransformers {
60+
this.file(project.file("src/main/resources/META-INF/accesstransformer.cfg"))
7061
}
62+
}
7163

72-
runs {
73-
// applies to all the run configs below
74-
configureEach {
75-
76-
logLevel.set(Level.DEBUG)
77-
78-
sourceSet = project.sourceSets.main
79-
80-
if (!System.getenv().containsKey("CI")) {
81-
// JetBrains Runtime Hotswap
82-
// jvmArgument("-XX:+AllowEnhancedClassRedefinition")
83-
}
84-
}
85-
86-
create("client") {
87-
client()
88-
gameDirectory.set(file("runs/client"))
89-
90-
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
91-
systemProperty("forge.enabledGameTestNamespaces", modId)
64+
runs {
65+
configureEach {
66+
this.modSource(coreApi.sourceSets.main.get())
9267

93-
programArguments.addAll("--username", "Nano")
94-
programArguments.addAll("--width", "1920")
95-
programArguments.addAll("--height", "1080")
68+
dependencies {
69+
runtime(libraries.feather)
70+
runtime(libraries.jnanoid)
9671
}
9772

98-
create("server") {
99-
server()
100-
gameDirectory.set(file("runs/server"))
101-
102-
systemProperty("forge.enabledGameTestNamespaces", modId)
103-
programArgument("nogui")
73+
// if (!System.getenv().containsKey("CI")) {
74+
// // JetBrains Runtime Hotswap
75+
// // jvmArgument("-XX:+AllowEnhancedClassRedefinition")
76+
// }
77+
}
10478

105-
environment.put("CM_TEST_RESOURCES", file("src/test/resources").path)
79+
this.create("client") {
80+
client()
10681

107-
sourceSet = project.sourceSets.test
108-
// sourceSets.add(project.sourceSets.test.get())
109-
}
82+
this.workingDirectory.set(file("runs/client"))
11083

111-
create("gameTestServer") {
112-
type = "gameTestServer"
113-
gameDirectory.set(file("runs/gametest"))
84+
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
85+
systemProperty("forge.enabledGameTestNamespaces", modId)
11486

115-
systemProperty("forge.enabledGameTestNamespaces", modId)
116-
environment.put("CM_TEST_RESOURCES", file("src/test/resources").path)
117-
118-
sourceSet = project.sourceSets.test
119-
// sourceSets.add(project.sourceSets.test.get())
120-
}
87+
programArguments.addAll("--username", "Nano")
88+
programArguments.addAll("--width", "1920")
89+
programArguments.addAll("--height", "1080")
12190
}
12291
}
92+
//neoForge {
93+
// version = neoforged.versions.neoforge
94+
//
95+
// this.mods.create(modId) {
96+
// modSourceSets.add(sourceSets.main)
97+
// modSourceSets.add(sourceSets.test)
98+
// this.dependency(coreApi)
99+
// }
100+
//
101+
// unitTest {
102+
// enable()
103+
// testedMod = mods.named(modId)
104+
// }
105+
//
106+
107+
// create("server") {
108+
// server()
109+
// gameDirectory.set(file("runs/server"))
110+
//
111+
// systemProperty("forge.enabledGameTestNamespaces", modId)
112+
// programArgument("nogui")
113+
//
114+
// environment.put("CM_TEST_RESOURCES", file("src/test/resources").path)
115+
//
116+
// sourceSet = project.sourceSets.test
117+
// // sourceSets.add(project.sourceSets.test.get())
118+
// }
119+
//
120+
// create("gameTestServer") {
121+
// type = "gameTestServer"
122+
// gameDirectory.set(file("runs/gametest"))
123+
//
124+
// systemProperty("forge.enabledGameTestNamespaces", modId)
125+
// environment.put("CM_TEST_RESOURCES", file("src/test/resources").path)
126+
//
127+
// sourceSet = project.sourceSets.test
128+
// // sourceSets.add(project.sourceSets.test.get())
129+
// }
130+
// }
131+
//}
123132

124133
repositories {
125134
mavenLocal()
@@ -163,18 +172,20 @@ dependencies {
163172

164173
compileOnly(coreApi)
165174
testCompileOnly(coreApi)
175+
jarJar(coreApi)
166176

167177
compileOnly(libraries.feather)
168178
jarJar(libraries.feather) { isTransitive = false }
169179
}
170180

181+
implementation(neoforged.neoforge)
182+
171183
runtimeOnly(neoforged.testframework)
172184
testImplementation(neoforged.testframework)
173185
testImplementation("org.junit.jupiter:junit-jupiter:5.7.1")
174186
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
175187

176-
additionalRuntimeClasspath(libraries.feather)
177-
additionalRuntimeClasspath(libraries.jnanoid)
188+
178189

179190
// Mods
180191
// compileOnly(mods.bundles.jei)

settings.gradle.kts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,26 @@ rootProject.name = "Compact Machines 21.0"
22

33
dependencyResolutionManagement {
44
versionCatalogs.create("neoforged") {
5-
version("mdg", "1.0.14")
6-
version("neoforge", "21.0.114-beta")
5+
version("neoforge", "21.0.143")
6+
version("neogradle", "7.0.154")
77

88
version("neoforgeRange") {
99
require("[21.0,22)")
10-
prefer("21.0.2-beta")
10+
prefer("21.0.143")
1111
}
1212

13-
plugin("moddev", "net.neoforged.moddev")
14-
.versionRef("mdg")
13+
plugin("moddev", "net.neoforged.gradle.userdev")
14+
.versionRef("neogradle")
15+
16+
library("neoforge", "net.neoforged", "neoforge")
17+
.versionRef("neoforge")
1518

1619
library("testframework", "net.neoforged", "testframework")
1720
.versionRef("neoforge")
1821
}
1922

2023
versionCatalogs.create("mojang") {
21-
version("minecraft", "1.20.6")
24+
version("minecraft", "1.21.0")
2225
version("minecraftRange") {
2326
this.require("[1.21, 1.21.1)")
2427
this.prefer("1.21")
@@ -35,8 +38,8 @@ dependencyResolutionManagement {
3538
version("feather", "[0.1.8, 2.0)")
3639
version("jnanoid", "[2.0.0, 3)")
3740

38-
version("parchment-mc", "1.20.6")
39-
version("parchment", "2024.05.01")
41+
version("parchment-mc", "1.21")
42+
version("parchment", "2024.07.28")
4043
}
4144

4245
versionCatalogs.create("mods") {
@@ -79,5 +82,5 @@ plugins {
7982

8083
include(":core-api")
8184
include(":neoforge-main")
82-
include(":neoforge-datagen")
85+
// include(":neoforge-datagen")
8386

0 commit comments

Comments
 (0)