From 40fa27b6659dc821c6572ebcc2d7f2dbb552a001 Mon Sep 17 00:00:00 2001 From: Fallen_Breath Date: Wed, 29 May 2024 01:10:24 +0800 Subject: [PATCH] update from mod template f20d0fadf703564beafe10bd5b8816b282bdfcc1 --- .github/workflows/build.yml | 2 +- .github/workflows/matrix_prep.yml | 2 +- common.gradle | 35 ++++++++++++++++++------------- gradle.properties | 2 +- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b46c41e4..1079ec21 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: step.build +name: _step.build on: workflow_call: diff --git a/.github/workflows/matrix_prep.yml b/.github/workflows/matrix_prep.yml index 64d96176..d0a0cc49 100644 --- a/.github/workflows/matrix_prep.yml +++ b/.github/workflows/matrix_prep.yml @@ -1,4 +1,4 @@ -name: step.matrix_prepare +name: _step.matrix_prepare on: workflow_call: diff --git a/common.gradle b/common.gradle index 7a9f5b79..32f8b8e0 100644 --- a/common.gradle +++ b/common.gradle @@ -100,12 +100,7 @@ if (mcVersion >= 12005) { } else { JAVA_COMPATIBILITY = JavaVersion.VERSION_1_8 } - -// mixin does not support java 21 yet JavaVersion MIXIN_COMPATIBILITY_LEVEL = JAVA_COMPATIBILITY -if (MIXIN_COMPATIBILITY_LEVEL > JavaVersion.VERSION_17) { - MIXIN_COMPATIBILITY_LEVEL = JavaVersion.VERSION_17 -} loom { accessWidenerPath = file("tweakermore.accesswidener") @@ -131,24 +126,36 @@ remapJar { remapperIsolation = true } -String versionSuffix = '' +String modVersionSuffix = '' +String artifactVersion = project.mod_version // detect github action environment variables // https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables if (System.getenv("BUILD_RELEASE") != "true") { String buildNumber = System.getenv("BUILD_ID") - versionSuffix += buildNumber != null ? ('+build.' + buildNumber) : '-SNAPSHOT' + modVersionSuffix += buildNumber != null ? ('+build.' + buildNumber) : '-SNAPSHOT' + artifactVersion += '-SNAPSHOT' // A non-release artifact is always a SNAPSHOT artifact } -String fullModVersion = project.mod_version + versionSuffix +String finalModVersion = project.mod_version + modVersionSuffix +String fullProjectVersion, fullArtifactVersion + +// Example version values: +// project.mod_version 1.0.3 (the base mod version) +// finalModVersion 1.0.3+build.88 (the actual mod version to use) +// fullProjectVersion mc1.15.2-v1.0.3+build.88 (in build output jar name) +// fullArtifactVersion mc1.15.2-v1.0.3-SNAPSHOT (maven artifact version) group = project.maven_group if (System.getenv("JITPACK") == "true") { // move mc version into archivesBaseName, so jitpack will be able to organize archives from multiple subprojects correctly base.archivesName = project.archives_base_name + '-mc' + project.minecraft_version - version = 'v' + fullModVersion + fullProjectVersion = 'v' + finalModVersion + fullArtifactVersion = 'v' + artifactVersion } else { base.archivesName = project.archives_base_name - version = 'mc' + project.minecraft_version + '-v' + fullModVersion + fullProjectVersion = 'mc' + project.minecraft_version + '-v' + finalModVersion + fullArtifactVersion = 'mc' + project.minecraft_version + '-v' + artifactVersion } +version = fullProjectVersion // See https://youtrack.jetbrains.com/issue/IDEA-296490 // if IDEA complains about "Cannot resolve resource filtering of MatchingCopyAction" and you want to know why @@ -157,14 +164,14 @@ processResources { inputs.property "id", project.mod_id inputs.property "name", project.mod_name - inputs.property "version", fullModVersion + inputs.property "version", finalModVersion inputs.property "minecraft_dependency", project.minecraft_dependency filesMatching("fabric.mod.json") { def valueMap = [ "id": project.mod_id, "name": project.mod_name, - "version": fullModVersion, + "version": finalModVersion, "minecraft_dependency": project.minecraft_dependency, "malilib_dependency": project.malilib_dependency, ] @@ -261,8 +268,8 @@ publishing { publications { mavenJava(MavenPublication) { artifactId base.archivesName.get() - from components.java + version = fullArtifactVersion } } @@ -271,7 +278,7 @@ publishing { // mavenLocal() maven { - url = version.endsWith("SNAPSHOT") ? "https://maven.fallenbreath.me/snapshots" : "https://maven.fallenbreath.me/releases" + url = fullArtifactVersion.endsWith("SNAPSHOT") ? "https://maven.fallenbreath.me/snapshots" : "https://maven.fallenbreath.me/releases" credentials(PasswordCredentials) { username = 'fallen' password = System.getenv("FALLENS_MAVEN_TOKEN") diff --git a/gradle.properties b/gradle.properties index 463a4fdd..5aea0c76 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ # Fabric Basic Properties # https://fallen-breath.github.io/fabric-versions/ - loader_version=0.15.10 + loader_version=0.15.11 # Mod Properties mod_id = tweakermore