Skip to content

Commit 183aa79

Browse files
committed
Use shared buildscript
1 parent 9773f0d commit 183aa79

File tree

14 files changed

+86
-207
lines changed

14 files changed

+86
-207
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

build.gradle

Lines changed: 9 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,144 +1,19 @@
11
plugins {
2-
id 'fabric-loom' version '1.2-SNAPSHOT'
3-
id 'com.matthewprenger.cursegradle' version '1.4.0'
4-
id 'com.github.johnrengelman.shadow' version '8.1.1'
5-
id 'com.modrinth.minotaur' version '2.+'
6-
id 'mod-update' version '2.0.0'
2+
id 'com.github.johnrengelman.shadow' version "${shadow_version}"
3+
id 'fabric-loom' version "${fabric_loom_version}"
4+
id 'mod-update' version "${mod_update_version}"
5+
id 'com.matthewprenger.cursegradle' version "${cursegradle_version}"
6+
id 'com.modrinth.minotaur' version "${minotaur_version}"
77
}
88

9-
sourceCompatibility = JavaVersion.VERSION_17
10-
targetCompatibility = JavaVersion.VERSION_17
11-
12-
archivesBaseName = archives_base_name
13-
version = mod_version
14-
group = maven_group
15-
16-
repositories {
17-
mavenLocal()
18-
mavenCentral()
19-
maven { url = 'https://maven.fabricmc.net/' }
20-
maven { url = 'https://maven.maxhenkel.de/repository/public'}
21-
}
22-
23-
runClient.doFirst {
24-
args = ['--username', "henkelmax${new Random().nextInt(1000)}"]
25-
}
26-
27-
dependencies {
28-
minecraft "com.mojang:minecraft:${minecraft_version}"
29-
mappings loom.officialMojangMappings()
30-
modImplementation "net.fabricmc:fabric-loader:${loader_version}"
31-
32-
Set<String> apiModules = [
33-
'fabric-api-base',
34-
'fabric-lifecycle-events-v1',
35-
'fabric-networking-api-v1',
36-
'fabric-resource-loader-v0',
37-
'fabric-key-binding-api-v1'
38-
]
39-
40-
apiModules.forEach {
41-
include(modImplementation(fabricApi.module(it, fabric_version)))
42-
}
43-
44-
implementation "de.maxhenkel.configbuilder:configbuilder:${configbuilder_version}"
45-
shadow "de.maxhenkel.configbuilder:configbuilder:${configbuilder_version}"
46-
47-
implementation 'com.google.code.findbugs:jsr305:3.0.2'
48-
}
9+
apply from: "https://raw.githubusercontent.com/henkelmax/mod-gradle-scripts/${mod_gradle_script_version}/mod.gradle"
4910

5011
processResources {
5112
filesMatching('fabric.mod.json') {
52-
expand 'version': version,
13+
expand 'mod_version': mod_version,
5314
'minecraft_dependency': minecraft_dependency,
54-
'loader_version': loader_version,
55-
'min_fabric_version': fabric_version,
15+
'fabric_loader_dependency': fabric_loader_dependency,
16+
'fabric_api_dependency_breaks': fabric_api_dependency_breaks,
5617
'compatibility_version': mod_compatibility_version
5718
}
5819
}
59-
60-
tasks.withType(JavaCompile).configureEach {
61-
it.options.encoding = 'UTF-8'
62-
it.options.release = 17
63-
}
64-
65-
java {
66-
withSourcesJar()
67-
}
68-
69-
jar {
70-
from('LICENSE') {
71-
rename { "${it}_${archivesBaseName}" }
72-
}
73-
}
74-
75-
curseforge {
76-
apiKey = file('curseforge_api_key.txt').exists() ? file('curseforge_api_key.txt').text : ''
77-
project {
78-
id = curse_id
79-
changelogType = 'markdown'
80-
changelog = file('changelog.md')
81-
releaseType = release_type
82-
addGameVersion curseforge_minecraft_version
83-
addGameVersion 'Fabric'
84-
addGameVersion 'Java 17'
85-
mainArtifact(file("${buildDir}/libs/${archivesBaseName}-${version}.jar")) {
86-
displayName = "[FABRIC][${minecraft_version}] ${mod_name} ${mod_version}"
87-
relations {
88-
requiredDependency 'fabric-api'
89-
}
90-
}
91-
afterEvaluate {
92-
uploadTask.dependsOn(remapJar)
93-
}
94-
}
95-
options {
96-
forgeGradleIntegration = false
97-
}
98-
}
99-
100-
tasks.modrinth.configure({
101-
group = 'upload'
102-
})
103-
tasks.modrinthSyncBody.configure({
104-
group = 'upload'
105-
})
106-
107-
modrinth {
108-
token = file("${rootDir}/modrinth_token.txt").exists() ? file("${rootDir}/modrinth_token.txt").text : ''
109-
projectId = modrinth_id
110-
versionNumber = "fabric-${mod_version}"
111-
versionName = "[FABRIC][${minecraft_version}] ${mod_name} ${mod_version}"
112-
uploadFile = remapJar
113-
versionType = release_type.toUpperCase()
114-
changelog = file('changelog.md').text
115-
gameVersions = [minecraft_version]
116-
loaders = ['fabric']
117-
dependencies {
118-
required.project 'P7dR8mSH' // Fabric API
119-
}
120-
syncBodyFrom = file("${rootDir}/readme.md").text
121-
}
122-
tasks.modrinth.dependsOn(build)
123-
124-
modUpdate {
125-
serverURL = 'https://update.maxhenkel.de/'
126-
modID = mod_id
127-
gameVersion = minecraft_version
128-
modLoader = 'fabric'
129-
modVersion = mod_version
130-
changelogFile = file('changelog.md')
131-
releaseType = release_type
132-
tags = recommended == 'true' ? ['recommended'] : []
133-
}
134-
135-
shadowJar {
136-
configurations = [project.configurations.shadow]
137-
archiveClassifier = 'shadow-dev'
138-
relocate 'de.maxhenkel.configbuilder', "de.maxhenkel.${mod_id}.configbuilder"
139-
}
140-
141-
remapJar {
142-
dependsOn shadowJar
143-
inputFile = shadowJar.archiveFile.get()
144-
}

changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
- Updated to 1.20.4
1+
- Updated dependencies

gradle.properties

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,43 @@
1-
org.gradle.jvmargs=-Xmx2G
1+
org.gradle.jvmargs=-Xmx4G
2+
org.gradle.daemon=false
3+
4+
mod_loader=fabric
25
minecraft_version=1.20.4
36
minecraft_dependency=1.20.4
7+
fabric_loader_version=0.14.25
8+
fabric_loader_dependency=>=0.14.25
9+
fabric_api_version=0.91.1+1.20.4
10+
fabric_api_dependency_breaks=<0.91.1+1.20.4
411

5-
configbuilder_version=1.1.2
6-
7-
curseforge_minecraft_version=1.20.4
8-
loader_version=0.14.25
9-
fabric_version=0.91.1+1.20.4
10-
mod_version=1.20.4-1.0.4
1112
mod_compatibility_version=1
12-
maven_group=de.maxhenkel.status
13-
archives_base_name=status
13+
14+
# Mod information
15+
mod_version=1.20.4-1.0.5
1416
mod_id=status
15-
mod_name=Status
17+
mod_display_name=Status
18+
19+
# Script configuration
20+
use_mixins=true
21+
enable_configbuilder=true
22+
23+
# Project upload
24+
curseforge_upload_id=687609
25+
modrinth_upload_id=b93awgkg
26+
upload_release_type=alpha
27+
upload_recommended=false
28+
29+
# Fabric API modules
30+
included_fabric_api_modules=\
31+
fabric-api-base, \
32+
fabric-lifecycle-events-v1, \
33+
fabric-networking-api-v1, \
34+
fabric-resource-loader-v0, \
35+
fabric-key-binding-api-v1
1636

17-
curse_id=687609
18-
modrinth_id=b93awgkg
19-
release_type=beta
20-
recommended=true
37+
# Gradle plugins
38+
mod_gradle_script_version=1.0.20
39+
shadow_version=8.1.1
40+
fabric_loom_version=1.4-SNAPSHOT
41+
mod_update_version=2.0.0
42+
cursegradle_version=1.4.0
43+
minotaur_version=2.+

gradle/wrapper/gradle-wrapper.jar

-18.2 KB
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

gradlew

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ done
8383
# This is normally unused
8484
# shellcheck disable=SC2034
8585
APP_BASE_NAME=${0##*/}
86-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
86+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
8788

8889
# Use the maximum available, or set MAX_FD != -1 to use that value.
8990
MAX_FD=maximum
@@ -130,26 +131,29 @@ location of your Java installation."
130131
fi
131132
else
132133
JAVACMD=java
133-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
134+
if ! command -v java >/dev/null 2>&1
135+
then
136+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
134137
135138
Please set the JAVA_HOME variable in your environment to match the
136139
location of your Java installation."
140+
fi
137141
fi
138142

139143
# Increase the maximum file descriptors if we can.
140144
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
141145
case $MAX_FD in #(
142146
max*)
143147
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
144-
# shellcheck disable=SC3045
148+
# shellcheck disable=SC2039,SC3045
145149
MAX_FD=$( ulimit -H -n ) ||
146150
warn "Could not query maximum file descriptor limit"
147151
esac
148152
case $MAX_FD in #(
149153
'' | soft) :;; #(
150154
*)
151155
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
152-
# shellcheck disable=SC3045
156+
# shellcheck disable=SC2039,SC3045
153157
ulimit -n "$MAX_FD" ||
154158
warn "Could not set maximum file descriptor limit to $MAX_FD"
155159
esac
@@ -198,11 +202,11 @@ fi
198202
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
199203
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
200204

201-
# Collect all arguments for the java command;
202-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
203-
# shell script including quotes and variable substitutions, so put them in
204-
# double quotes to make sure that they get re-expanded; and
205-
# * put everything else in single quotes, so that it's not re-expanded.
205+
# Collect all arguments for the java command:
206+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207+
# and any embedded shellness will be escaped.
208+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209+
# treated as '${Hostname}' itself on the command line.
206210

207211
set -- \
208212
"-Dorg.gradle.appname=$APP_BASE_NAME" \

readme.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ A [Fabric](https://fabricmc.net/) mod that enables you to set a status.
55
This mod must be installed on the server. Vanilla clients are still able to join a server with this mod. If you want to
66
set a status, you need this mod installed on your client.
77

8-
It requires [Fabric API](https://www.curseforge.com/minecraft/mc-mods/fabric-api)
9-
108
---
119

1210
## Features
@@ -45,16 +43,16 @@ set your status. The status is not persisted between playing sessions by default
4543
**Client Configuration**
4644
`.minecraft/config/status/status-client.properties`
4745

48-
Key | Default Value | Description
49-
--- | --- | ---
50-
`persist_state` | `false` | If the status should be persisted between playing sessions.
51-
`show_join_message` | `true` | If the reminder when joining the server should be shown.
46+
| Key | Default Value | Description |
47+
|---------------------|---------------|-------------------------------------------------------------|
48+
| `persist_state` | `false` | If the status should be persisted between playing sessions. |
49+
| `show_join_message` | `true` | If the reminder when joining the server should be shown. |
5250

5351
**Server Configuration**
5452
`<your-server-directory>/config/status/status-server.properties`
5553

56-
Key | Default Value | Description
57-
--- | --- | ---
58-
`no_sleep_title`|`No Sleep` | The title of the no sleep popup
59-
`no_sleep_player_subtitle` | `%s does not want you to sleep` | The subtitle of the no sleep popup if one player does not want to skip the night
60-
`no_sleep_multiple_subtitle` | `Some players do not want you to sleep` | The subtitle of the no sleep popup if multiple players do not want to skip the night
54+
| Key | Default Value | Description |
55+
|------------------------------|-----------------------------------------|--------------------------------------------------------------------------------------|
56+
| `no_sleep_title` | `No Sleep` | The title of the no sleep popup |
57+
| `no_sleep_player_subtitle` | `%s does not want you to sleep` | The subtitle of the no sleep popup if one player does not want to skip the night |
58+
| `no_sleep_multiple_subtitle` | `Some players do not want you to sleep` | The subtitle of the no sleep popup if multiple players do not want to skip the night |

settings.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
pluginManagement {
22
repositories {
3-
jcenter()
3+
gradlePluginPortal()
44
maven { url = 'https://maven.fabricmc.net/' }
55
maven { url = 'https://maven.maxhenkel.de/repository/public/' }
6-
gradlePluginPortal()
76
}
87
}

src/main/java/de/maxhenkel/status/Status.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ public void onInitialize() {
4141
STATE_MANAGER = new PlayerStateManager();
4242

4343
ServerLifecycleEvents.SERVER_STARTING.register(server -> {
44-
SERVER_CONFIG = ConfigBuilder.build(server.getServerDirectory().toPath().resolve("config").resolve(MODID).resolve("status-server.properties"), ServerConfig::new);
44+
SERVER_CONFIG = ConfigBuilder
45+
.builder(ServerConfig::new)
46+
.path(server.getServerDirectory().toPath().resolve("config").resolve(MODID).resolve("status-server.properties"))
47+
.build();
4548
});
4649

4750
ServerLoginConnectionEvents.QUERY_START.register((handler, server, sender, synchronizer) -> {

0 commit comments

Comments
 (0)