Repository navigation
Expand file tree
/
Copy pathbuild.gradle
More file actions
95 lines (85 loc) · 3.62 KB
/
Copy pathbuild.gradle
File metadata and controls
95 lines (85 loc) · 3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
plugins {
id 'net.fabricmc.fabric-loom' version "${loom_version}" apply false
id 'net.neoforged.moddev' version "${moddev_version}" apply false
}
// LungoLua and StyxLua come from GitHub Packages, whose Maven registry wants a login even to read a
// public package: a GitHub user and a token with read:packages, as gpr.user and gpr.key in
// ~/.gradle/gradle.properties (or GITHUB_ACTOR and GITHUB_TOKEN, as Actions gives them). Without
// them the build says so here, not as "Username must not be null!" from deep in a resolve.
def packagesUser = providers.gradleProperty('gpr.user').orElse(providers.environmentVariable('GITHUB_ACTOR')).getOrNull()
def packagesKey = providers.gradleProperty('gpr.key').orElse(providers.environmentVariable('GITHUB_TOKEN')).getOrNull()
if (packagesUser == null || packagesKey == null) {
throw new GradleException("""No GitHub Packages login: LungoLua and StyxLua are on GitHub Packages, which needs one even to read.
Make a GitHub token (Settings, Developer settings, Personal access tokens, classic) with only the read:packages scope, and put
gpr.user=<your GitHub user>
gpr.key=<the token>
in ${gradle.gradleUserHomeDir}/gradle.properties (or set GITHUB_ACTOR and GITHUB_TOKEN). See the README's Building.""")
}
// Published versions carry the Minecraft version as SemVer build metadata: 0.1.0+26.3 (each loader's
// jar is named for its loader). See .agents/VERSIONING.md.
subprojects {
apply plugin: 'java-library'
version = "${project.mod_version}+${project.minecraft_version}"
group = project.maven_group
base {
archivesName = "${project.archives_base_name}-${project.name}"
}
repositories {
mavenCentral()
maven {
name = 'LungoLua'
url = 'https://maven.pkg.github.com/payonel/lua'
credentials {
username = packagesUser
password = packagesKey
}
content {
includeModule 'com.payonel', 'lungolua'
// LungoLua's C# port (lungolua.dll), only for the manual's C# example (DocsCsharpTest).
includeModule 'com.payonel', 'lungoluacsharp'
}
}
maven {
name = 'StyxLua'
url = 'https://maven.pkg.github.com/payonel/styxlua'
credentials {
username = packagesUser
password = packagesKey
}
content {
includeModule 'com.payonel', 'styxlua'
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_25
targetCompatibility = JavaVersion.VERSION_25
}
tasks.withType(JavaCompile).configureEach {
it.options.release = 25
it.options.encoding = "UTF-8"
}
def baseName = project.archives_base_name
def license = rootProject.file("LICENSE")
tasks.withType(Jar).configureEach {
from(license) {
rename { "${it}_${baseName}" }
}
}
}
// Everything: each project's `build` (unit tests in common), the server game tests on both loaders,
// and the headless client tests on Fabric only (NeoForge has no client test harness; user, 2026-10-20).
tasks.register("testAll") {
group = "verification"
description = "Runs unit tests, the server game tests on Fabric and NeoForge, and Fabric's headless client game tests."
dependsOn ":common:build", ":fabric:build", ":neoforge:build",
":fabric:runGameTest", ":neoforge:runGameTestServer", ":fabric:runProductionClientGameTest"
}
// What GitHub Actions runs: testAll but the client tests, which need a display with OpenGL that its
// runners don't give (Xvfb there finds no GLX visual); they stay testAll's, run before every commit.
tasks.register("testServer") {
group = "verification"
description = "Runs unit tests and the server game tests on Fabric and NeoForge (testAll without the client tests)."
dependsOn ":common:build", ":fabric:build", ":neoforge:build",
":fabric:runGameTest", ":neoforge:runGameTestServer"
}