Skip to content

Commit

Permalink
Merge pull request #89 from VazkiiMods/1.21
Browse files Browse the repository at this point in the history
1.21 to master
  • Loading branch information
Uraneptus authored Dec 30, 2024
2 parents 483744e + 47ef284 commit a524e04
Show file tree
Hide file tree
Showing 27 changed files with 494 additions and 414 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'
- name: Validate gradlew integrity
uses: gradle/wrapper-validation-action@v3
uses: gradle/actions/wrapper-validation@v3

- name: Cache
uses: actions/cache@v4
with:
Expand All @@ -35,28 +36,28 @@ jobs:
run: |
VERSION=$(awk -F '=' '/^version/ { print $2; }' build.properties)
BUILD=$(awk -F '=' '/build_number/ { print $2; }' build.properties)
echo "forge=build/libs/Morph-o-Tool-${VERSION}-${BUILD}.jar" >> "$GITHUB_OUTPUT"
echo "neoforge=build/libs/Morph-o-Tool-${VERSION}-${BUILD}.jar" >> "$GITHUB_OUTPUT"
- name: Sign jars
env:
SIGNING_KEY: ${{ secrets.VIOLET_MOON_SIGNING_KEY }}
if: ${{ env.SIGNING_KEY != '' }}
run: |
echo "${SIGNING_KEY}" | gpg --import -
gpg --local-user "Violet Moon Signing Key" --armor \
--detach-sign ${{ steps.calculate_artifact_names.outputs.forge }}
- name: Archive Forge Artifacts
--detach-sign ${{ steps.calculate_artifact_names.outputs.neoforge }}
- name: Archive NeoForge Artifacts
uses: actions/upload-artifact@v4
with:
name: Forge
name: NeoForge
path: |
${{ steps.calculate_artifact_names.outputs.forge }}
${{ steps.calculate_artifact_names.outputs.forge }}.asc
${{ steps.calculate_artifact_names.outputs.neoforge }}
${{ steps.calculate_artifact_names.outputs.neoforge }}.asc
- name: Upload Releases
if: startsWith(github.ref, 'refs/tags/release-')
env:
GH_TOKEN: ${{ github.token }}
GIT_REF: ${{ github.ref }}
FORGE_JAR: ${{ steps.calculate_artifact_names.outputs.forge }}
NEOFORGE_JAR: ${{ steps.calculate_artifact_names.outputs.neoforge }}
CURSEFORGE_TOKEN: ${{ secrets.VAZKII_CURSEFORGE_TOKEN }}
MODRINTH_TOKEN: ${{ secrets.VAZKII_MODRINTH_TOKEN }}
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Thumbs.db

## ForgeGradle
/run
/runs

## eclipse
/.settings
Expand Down
83 changes: 27 additions & 56 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,40 @@ plugins {
id 'eclipse'
id 'maven-publish'
id 'pmd'
id 'com.diffplug.spotless' version '5.12.5'
id 'net.minecraftforge.gradle' version '5.1.+'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
id 'org.spongepowered.mixin' version '0.7.+'
id 'com.diffplug.spotless' version '6.25.0'
id 'net.neoforged.gradle.userdev' version '7.0.145'
}

ext.configFile = file('build.properties')
ext.config = parseConfig(configFile)

version = "${config.version}-${config.build_number}"
group = "vazkii.${config.mod_id}" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = config.mod_name

java.toolchain.languageVersion = JavaLanguageVersion.of(17)
repositories {
mavenLocal()
}

base {
archivesName = config.mod_name
}

java.toolchain.languageVersion = JavaLanguageVersion.of(21)

compileJava.options.compilerArgs << "-Xlint:all,-classfile,-processing,-deprecation" << "-Werror"

if (System.getenv('BUILD_NUMBER') != null) {
version += "." + System.getenv('BUILD_NUMBER')
}

minecraft {
// The mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD Snapshot are built nightly.
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.

mappings channel: "${config.mapping_channel}", version: "${config.mapping_version}"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.

// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
workingDirectory project.file('run')

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

mods {
morphtool {
source sourceSets.main
}
}
}

server {
workingDirectory project.file('run')

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
runs {
configureEach {
systemProperty 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
systemProperty 'forge.logging.console.level', 'debug'
modSource project.sourceSets.main
}

mods {
morphtool {
source sourceSets.main
}
}
}
client {
}
}

Expand All @@ -77,7 +46,11 @@ repositories {
}

dependencies {
minecraft "net.minecraftforge:forge:${config.mc_version}-${config.forge_version}"
implementation "net.neoforged:neoforge:21.1.1"

//test mods
implementation "curse.maven:applied-energistics-2-223794:5610903"
implementation "curse.maven:storage-drawers-223852:5840297"
}

spotless {
Expand All @@ -93,10 +66,8 @@ spotless {
}

pmd {
toolVersion '6.22.0'
// no way around this warning unless we upgrade Gradle, apparently
//incrementalAnalysis.set(true)
ruleSets.clear()
toolVersion '6.35.0'
incrementalAnalysis.set(true)
ruleSetFiles = files("spotless/pmd-ruleset.xml")
}

Expand All @@ -115,7 +86,7 @@ task incrementBuildNumber {

import java.util.regex.Pattern
task sortArtifacts(type: Copy) {
from jar.destinationDir
from jar.getDestinationDirectory()
into config.dir_output
//Put each jar with a classifier in a subfolder with the classifier as its name
eachFile {
Expand All @@ -142,7 +113,7 @@ def parseConfig(File config) {

jar {
//rename the default output, for some better... sanity with scipts
archiveName = "${baseName}-${version}.${extension}"
//archiveName = "${archiveBaseName}-${archiveVersion}.${archiveExtension}"

manifest {
attributes([
Expand Down
14 changes: 7 additions & 7 deletions build.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Wed Aug 07 18:14:56 UTC 2024
mapping_channel=parchment
forge_version=47.1.3
#Thu Dec 26 03:19:15 UTC 2024
neoforge_version=21.1.90
mod_id=morphtool
dir_repo=./
build_number=39
build_number=40
dir_output=../Build Output/Morphtool/
mapping_version=2023.09.03-1.20.1
version=1.7
version=1.8
mod_name=Morph-o-Tool
mc_version=1.20.1
mc_version=1.21.1
neogradle.subsystems.parchment.minecraftVersion=1.21
neogradle.subsystems.parchment.mappingsVersion=2024.11.17
4 changes: 1 addition & 3 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
- Ported to 1.20.1 (1.21 port is coming next)
- Fixed: Rotation feature not working
- Fixed: Removing an Item from the Tool changes its title to the raw name
- Ported to 1.21.1
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
58 changes: 30 additions & 28 deletions push_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,36 @@
import re
from jproperties import Properties


def main():
build = Properties()
with open('build.properties', 'rb') as f:
build.load(f , "utf-8")

mc_version, mcv_meta = build['mc_version']
version, v_meta = build['version']
build_number, bn_meta = build['build_number']

print('MC Version:', mc_version)
print('Version:', version)
print('Build Number', build_number)

changelog = '-m "Changelog:" '
with open('changelog.txt', 'r') as f:
content = f.read()

content = content.replace('"', '\'');
changelog = changelog + re.sub(r'(- .+)\n?', '-m "\g<1>" ', content)

os.system('git tag -a release-{}-{}-{} {}'.format(mc_version, version, build_number, changelog))

build['build_number'] = str(int(build_number) + 1)
with open("build.properties", "wb") as f:
build.store(f, encoding="utf-8")

os.system('git commit -a -m build')
os.system('git push origin master release-{}-{}-{}'.format(mc_version, version, build_number))
build = Properties()
with open('build.properties', 'rb') as f:
build.load(f, "utf-8")

mc_version, mcv_meta = build['mc_version']
version, v_meta = build['version']
build_number, bn_meta = build['build_number']

print('MC Version:', mc_version)
print('Version:', version)
print('Build Number', build_number)

changelog = '-m "Changelog:" '
with open('changelog.txt', 'r') as f:
content = f.read()

content = content.replace('"', '\'');
changelog = changelog + re.sub(r'(- .+)\n?', '-m "\g<1>" ', content)

os.system('git tag -a release-{}-{}-{} {}'.format(mc_version, version, build_number, changelog))

build['build_number'] = str(int(build_number) + 1)
with open("build.properties", "wb") as f:
build.store(f, encoding="utf-8")

os.system('git commit -a -m build')
os.system('git push origin master release-{}-{}-{}'.format(mc_version, version, build_number))


if __name__ == '__main__':
main()
main()
42 changes: 21 additions & 21 deletions scripts/upload_releases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ function release_github() {
-f tag_name="${TAGNAME}")"
GH_RELEASE_PAGE=$(echo "$GH_RELEASE_RESPONSE" | jq -r .html_url)

echo >&2 'Uploading Forge Jar and Signature to GitHub'
gh release upload "${TAGNAME}" "${FORGE_JAR}#Forge Jar"
gh release upload "${TAGNAME}" "${FORGE_JAR}.asc#Forge Signature"
echo >&2 'Uploading NeoForge Jar and Signature to GitHub'
gh release upload "${TAGNAME}" "${NEOFORGE_JAR}#NeoForge Jar"
gh release upload "${TAGNAME}" "${NEOFORGE_JAR}.asc#NeoForge Signature"
}

function release_modrinth() {
echo >&2 'Uploading Forge Jar to Modrinth'
local MODRINTH_FORGE_SPEC
MODRINTH_FORGE_SPEC=$(cat <<EOF
echo >&2 'Uploading NeoForge Jar to Modrinth'
local MODRINTH_NEOFORGE_SPEC
MODRINTH_NEOFORGE_SPEC=$(cat <<EOF
{
"dependencies": [],
"version_type": "release",
"loaders": ["forge"],
"loaders": ["neoforge"],
"featured": false,
"project_id": "rtbzFq0N",
"file_parts": [
Expand All @@ -42,24 +42,24 @@ function release_modrinth() {
EOF
)

MODRINTH_FORGE_SPEC=$(echo "${MODRINTH_FORGE_SPEC}" | \
MODRINTH_NEOFORGE_SPEC=$(echo "${MODRINTH_NEOFORGE_SPEC}" | \
jq --arg name "${VERSION}" \
--arg mcver "${MC_VERSION}" \
--arg changelog "${GH_RELEASE_PAGE}" \
'.name=$ARGS.named.name | .version_number=$ARGS.named.name | .game_versions=[$ARGS.named.mcver] | .changelog=$ARGS.named.changelog')
curl 'https://api.modrinth.com/v2/version' \
-H "Authorization: $MODRINTH_TOKEN" \
-F "data=$MODRINTH_FORGE_SPEC" \
-F "jar=@${FORGE_JAR}" # TODO modrinth doesn't allow asc files. Remember to readd "signature" to the spec when reenabling this. \ -F "signature=@${FORGE_JAR}.asc"
-F "data=$MODRINTH_NEOFORGE_SPEC" \
-F "jar=@${NEOFORGE_JAR}" # TODO modrinth doesn't allow asc files. Remember to readd "signature" to the spec when reenabling this. \ -F "signature=@${NEOFORGE_JAR}.asc"
}

function release_curseforge() {
# Java versions, Loaders, and Environment tags are actually "game versions" (lmfao), as are real game versions.

# Hardcoded from https://minecraft.curseforge.com/api/game/version-types (which is undocumented, btw)
# I'm not betting on these changing any time soon, so hardcoding is ok
local CURSEFORGE_JAVA_VERSION=8326 # Java 17
local CURSEFORGE_FORGE_VERSION=7498
local CURSEFORGE_JAVA_VERSION=11135 # Java 21
local CURSEFORGE_NEOFORGE_VERSION=10150
local CURSEFORGE_CLIENT_VERSION=9638
local CURSEFORGE_SERVER_VERSION=9639
# For the Minecraft one, don't hardcode so we don't have to remember to come change this every time.
Expand All @@ -73,31 +73,31 @@ function release_curseforge() {
jq --arg mcver "${MC_VERSION}" \
'map(select(.name == $ARGS.named.mcver and .gameVersionTypeID != 1 and .gameVersionTypeID != 615)) | first | .id')

echo >&2 'Uploading Forge Jar to CurseForge'
local CURSEFORGE_FORGE_SPEC
CURSEFORGE_FORGE_SPEC=$(cat <<EOF
echo >&2 'Uploading NeoForge Jar to CurseForge'
local CURSEFORGE_NEOFORGE_SPEC
CURSEFORGE_NEOFORGE_SPEC=$(cat <<EOF
{
"changelogType": "text",
"releaseType": "release"
}
EOF
)

local CURSEFORGE_FORGE_GAMEVERS="[\
local CURSEFORGE_NEOFORGE_GAMEVERS="[\
$CURSEFORGE_JAVA_VERSION,\
$CURSEFORGE_CLIENT_VERSION,\
$CURSEFORGE_SERVER_VERSION,\
$CURSEFORGE_FORGE_VERSION,\
$CURSEFORGE_NEOFORGE_VERSION,\
$CURSEFORGE_GAME_VERSION]"

CURSEFORGE_FORGE_SPEC=$(echo "$CURSEFORGE_FORGE_SPEC" | \
CURSEFORGE_NEOFORGE_SPEC=$(echo "$CURSEFORGE_NEOFORGE_SPEC" | \
jq --arg changelog "$GH_RELEASE_PAGE" \
--argjson gamevers "$CURSEFORGE_FORGE_GAMEVERS" \
--argjson gamevers "$CURSEFORGE_NEOFORGE_GAMEVERS" \
'.gameVersions=$ARGS.named.gamevers | .changelog=$ARGS.named.changelog')
curl 'https://minecraft.curseforge.com/api/projects/245287/upload-file' \
-H "X-Api-Token: $CURSEFORGE_TOKEN" \
-F "metadata=$CURSEFORGE_FORGE_SPEC" \
-F "file=@$FORGE_JAR"
-F "metadata=$CURSEFORGE_NEOFORGE_SPEC" \
-F "file=@$NEOFORGE_JAR"
# TODO: Upload the asc as an 'Additional file'
}

Expand Down
Loading

0 comments on commit a524e04

Please sign in to comment.