Skip to content

Commit

Permalink
Release v1.2.1 for MC 1.20.4 Fabric
Browse files Browse the repository at this point in the history
  • Loading branch information
cpburnz committed Sep 12, 2024
1 parent f5dc195 commit 9cc55b2
Show file tree
Hide file tree
Showing 7 changed files with 226 additions and 176 deletions.
4 changes: 2 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Change History
==============


1.2.1 for Minecraft 1.20.6 with Fabric 0.100.0 (2024-09-06)
-----------------------------------------------------------
1.2.1 for Minecraft 1.20.4 with Fabric 0.97.0 (2024-09-11)
----------------------------------------------------------

New features:

Expand Down
6 changes: 3 additions & 3 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ Java Environment
----------------

Create a ".env" file, and assign the `JAVA_HOME` variable to the path of the
Java 21 JDK. E.g.,
Java 17 JDK. E.g.,

```shell
# Define the version of Java to use with Gradle (i.e., "./gradlew").
JAVA_HOME=/usr/lib/jvm/java-21-openjdk
JAVA_HOME=/usr/lib/jvm/java-17-openjdk
```

The "env-gradlew" script is a wrapper around "gradlew", and loads the ".env" file to ensure Gradle is run with the proper version of Java.
Expand Down Expand Up @@ -52,4 +52,4 @@ The release JAR can be compiled by running the "assemble" task:
./env-gradlew assemble
```

The release JAR will be located at "build/libs/Prometheus-Exporter-{MC Version}-forge-{Mod Version}.jar".
The release JAR will be located at "build/libs/Prometheus-Exporter-{MC Version}-{Mod Loader}-{Mod Version}.jar".
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ for the following versions:
- Minecraft 1.20.6 with Fabric 0.100.0.
- Minecraft 1.20.6 with Forge 50.1.0.
- Minecraft 1.20.6 with NeoForge 20.6.0.
- Minecraft 1.20.4 with Fabric 0.97.0.
- Minecraft 1.20.4 with Forge 49.1.0.
- Minecraft 1.20.4 with NeoForge 20.4.0.
- Minecraft 1.20.2 with Forge 48.1.0.
Expand Down Expand Up @@ -68,6 +69,6 @@ Known compatible Grafana dashboards are listed in [dashboards.md].
[Prometheus]: https://prometheus.io/
[dashboards.md]: https://github.com/cpburnz/minecraft-prometheus-exporter/blob/master/dashboards.md
[issue on GitHub]: https://github.com/cpburnz/minecraft-prometheus-exporter/issues
[metrics.md]: https://github.com/cpburnz/minecraft-prometheus-exporter/blob/mc1.20.6-fabric/metrics.md
[output.txt]: https://github.com/cpburnz/minecraft-prometheus-exporter/blob/mc1.20.6-fabric/examples/output.txt
[prometheus_exporter-server.toml]: https://github.com/cpburnz/minecraft-prometheus-exporter/blob/mc1.20.6-fabric/examples/prometheus_exporter-server.toml
[metrics.md]: https://github.com/cpburnz/minecraft-prometheus-exporter/blob/mc1.20.4-fabric/metrics.md
[output.txt]: https://github.com/cpburnz/minecraft-prometheus-exporter/blob/mc1.20.4-fabric/examples/output.txt
[prometheus_exporter-server.toml]: https://github.com/cpburnz/minecraft-prometheus-exporter/blob/mc1.20.4-fabric/examples/prometheus_exporter-server.toml
79 changes: 64 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ plugins {
id 'fabric-loom' version '1.7-SNAPSHOT'

// Shadow Jar plugin: bundle dependencies.
id 'com.gradleup.shadow' version '8.3.0'
id 'com.github.johnrengelman.shadow' version '7.1.2'

// CurseForge plugin.
id 'net.darkhax.curseforgegradle' version '1.1.25'

// GitHub plugin.
id 'com.github.breadmoirai.github-release' version '2.4.1'
}

// Project settings.
Expand All @@ -23,8 +29,8 @@ base {
archivesName = 'Prometheus-Exporter'
}

// Mojang ships Java 21 to end users in 1.20.5+, so your mod should target Java 21.
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"

repositories {
Expand Down Expand Up @@ -98,7 +104,7 @@ processResources {
}

// Project JAR settings.
tasks.named('jar', Jar).configure {
jar {
// Include the Minecraft version in the JAR name.
archiveAppendix = "${minecraft_version}-fabric"

Expand All @@ -119,26 +125,29 @@ tasks.named('jar', Jar).configure {
}

// Configure Shadow Jar.
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar;
tasks.named('shadowJar', ShadowJar).configure {
shadowJar {
// Remove JAR suffix.
archiveAppendix = tasks.jar.archiveAppendix
archiveClassifier = tasks.jar.archiveClassifier

// Relocate shadowed dependencies.
enableRelocation = true
relocationPrefix = "${mod_package}.vendor"

// Only bundle dependencies explicitly marked to shadow.
configurations = [project.configurations.shadow]

// Exclude unused classes.
minimize()
}

// Vendor dependencies with Shadow Jar.
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
tasks.register('vendorShadowJarDeps', ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = "${mod_package}.vendor"
}

tasks.shadowJar.dependsOn tasks.vendorShadowJarDeps

// Remap the Shadow Jar because the Minecraft classes must be obfuscated.
import net.fabricmc.loom.task.RemapJarTask;
tasks.named('remapJar', RemapJarTask).configure {
remapJar {
// Include the Minecraft version in the JAR name.
archiveAppendix = jar.archiveAppendix

Expand All @@ -156,8 +165,48 @@ java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
//withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

// Publish release to CurseForge.
import net.darkhax.curseforgegradle.TaskPublishCurseForge
tasks.register('publishCurseForge', TaskPublishCurseForge) {
var curseforge_token = System.env.CURSEFORGE_TOKEN
var project_id = 351938

apiToken = curseforge_token

upload(project_id, remapJar.archiveFile) {
changelog = file('CHANGES.md').filterLine {
!it.startsWith('Change History') && !it.startsWith('====')
}.toString()
changelogType = 'markdown'
releaseType = 'release'

addEnvironment 'Server'
addRequirement 'fabric-api'
}
}

// Publish release to GitHub.
githubRelease {
var branch = "mc${minecraft_version}-fabric"
var changes_url = "https://github.com/cpburnz/minecraft-prometheus-exporter/blob/${branch}/CHANGES.md"
var github_token = System.env.GITHUB_TOKEN

body = "Release v${mod_version} for Minecraft ${minecraft_version} with Fabric ${fabric_version_min}. See [CHANGES.md](${changes_url})."
draft = false
releaseAssets = remapJar.archiveFile
releaseName = "Minecraft ${minecraft_version} (Fabric) / v${mod_version}"
repo = 'minecraft-prometheus-exporter'
tagName = "${minecraft_version}-fabric-${mod_version}"
targetCommitish = branch
token = github_token ?: ""
}

// Alias for publishing to GitHub.
tasks.register('publishGithub')
tasks.publishGithub.dependsOn tasks.githubRelease
Loading

0 comments on commit 9cc55b2

Please sign in to comment.