Skip to content

Commit

Permalink
Blossom dumb
Browse files Browse the repository at this point in the history
  • Loading branch information
kappa-maintainer committed May 4, 2024
1 parent cd37590 commit 21d865c
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 35 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/BuildTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ on:
options:
- Stable
- Experimental
- Bleeding Edge

run-name: "${{ github.event_name == 'pull_request' && 'Pull Request Build, DO NOT DOWNLOAD' || format('{0}#{1}: {2}', github.ref_name, github.run_number, github.event.commits[0].message)}}"

Expand Down Expand Up @@ -50,8 +49,6 @@ jobs:
BRANCH_FEAT=$(echo "${{ steps.branch-names.outputs.current_branch }}" | cut -d'/' -f1 | awk '{print tolower($0)}')
if [ "$BRANCH_FEAT" = "experimental" ]; then
echo "BUILD_TYPE=Experimental" >> $GITHUB_OUTPUT
elif [ "$BRANCH_FEAT" = "bleeding-edge" ]; then
echo "BUILD_TYPE=Bleeding Edge" >> $GITHUB_OUTPUT
else
echo "BUILD_TYPE=Stable" >> $GITHUB_OUTPUT
fi
Expand All @@ -67,17 +64,22 @@ jobs:
- name: Build Jars
run: ./gradlew build -Prun_number = ${{ github.run_number }}

- name: Get version
run: |
./gradlew --quiet printVersion > out.txt
echo "CLEANROOM_VERSION=$(cat version.txt)" >> $GITHUB_ENV
- name: Upload Forge Universal
uses: actions/[email protected]
with:
name: universal
name: universal-${{ env.CLEANROOM_VERSION }}
path: projects/cleanroom/build/libs/*-universal.jar

- name: Upload Forge Installer
id: upload-job
uses: actions/[email protected]
with:
name: installer
name: installer-${{ env.CLEANROOM_VERSION }}
path: projects/cleanroom/build/libs/*-installer.jar
if-no-files-found: error

Expand All @@ -88,4 +90,4 @@ jobs:
token: ${{ secrets.CLEANROOMMC_DISPATCH_TOKEN }} # require PAT :shrug:
repository: CleanroomMC/CleanroomMMC
event-type: cleanroom_upload_artifact
client-payload: '{"commit_hash": "${{ github.sha }}", "run_job_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", "branch": "${{ steps.branch-names.outputs.current_branch }}", "build_type": "${{ inputs.environment || steps.vars.outputs.BUILD_TYPE }}", "actor": "${{ github.actor }}", "number": "${{ github.run_number }}"}'
client-payload: '{"commit_hash": "${{ github.sha }}", "run_job_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", "branch": "${{ steps.branch-names.outputs.current_branch }}", "build_type": "${{ inputs.environment || steps.vars.outputs.BUILD_TYPE }}", "actor": "${{ github.actor }}", "version": "${{ env.CLEANROOM_VERSION }}"}'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
/buildSrc/.gradle/
/buildSrc/build/
/logs/
version.txt
src/main/java/com/cleanroommc/common/CleanroomVersion.java
47 changes: 25 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@ buildscript {
mavenLocal()
mavenCentral()
maven {
name 'MinecraftForge'
url 'https://maven.minecraftforge.net/'
name "MinecraftForge"
url "https://maven.minecraftforge.net/"
}
maven {
name 'Outlands'
url 'https://maven.outlands.top/releases/'
name "Outlands"
url "https://maven.outlands.top/releases/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:6.10.+'
classpath "net.minecraftforge.gradle:ForgeGradle:6.10.+"
}
}

plugins {
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.8"
id "com.palantir.git-version" version "3.0.0"
id "net.kyori.blossom" version "2.1.0"
}

import com.cleanroommc.gradle.helpers.tasks.*
Expand Down Expand Up @@ -49,9 +48,10 @@ def sysProps = System.getProperties()
def details = versionDetails()

group 'com.cleanroommc'
version details.lastTag + "-infdev.build." + details.commitDistance + project.hasProperty("run_number") ? ("+run." + props.run_number) : ""

def spec_version = details.lastTag.subString(details.lastTag.lastIndexOf('.'))
version details.lastTag + "-infdev.build." + details.commitDistance + (project.hasProperty("run_number") ? ("+run." + props.run_number) : "")
def version_txt = new File(project.projectDir, "version.txt")
version_txt.write(version.toString())
def spec_version = details.lastTag.toString().substring(0, details.lastTag.lastIndexOf('.'))

println "Running Cleanroom $version"
println "Java: ${ -> sysProps['java.version']} | JVM: ${ -> sysProps['java.vm.version']} | Vendor: ${ -> sysProps['java.vendor']} | Architecture: ${ -> sysProps['os.arch']}"
Expand Down Expand Up @@ -173,6 +173,21 @@ project(':cleanroom') {
group = 'com.cleanroommc'
version = rootProject.version

compileJava {
doFirst {
def target = new File("${rootProject.projectDir}/src/main/java/com/cleanroommc/common/CleanroomVersion.java")
def template = new File("${rootProject.projectDir}/templates/CleanroomVersion.java")

target.withWriter { def writer ->
template.eachLine { def line ->
def newLine = line.replace("%VERSION%", versionDetails().lastTag)
.replace("%BUILD_VERSION%", rootProject.version.toString())
writer.write(newLine + "\n");
}
}
}
}

sourceSets {
main {
java {
Expand All @@ -181,12 +196,6 @@ project(':cleanroom') {
resources {
srcDirs = ["$rootDir/src/main/resources"]
}
blossom {
javaSources {
property("build_version", project.version.toString())
property("version", project.details.lastTag.toString)
}
}
}
test {
compileClasspath += sourceSets.main.runtimeClasspath
Expand Down Expand Up @@ -1160,10 +1169,4 @@ subprojects {
options.compilerArgs += compiler_jvm_arguments
options.encoding = 'UTF-8'
}
}

tasks.register('printVersion') {
doLast {
println project.version
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public CleanroomContainer() {
Our plan is to make 1.12.2 up-to-date with latest toolchain while adding more feature to
Forge & vanilla, so we don't need to care about higher versions' X point release * Y Mod API headache.
""";
meta.version = "2.0";
meta.version = CleanroomVersion.VERSION;
meta.authorList = Arrays.asList("LexManos", "cpw", "fry", "Rongmario", "kappa_maintainer", "Li");
}

Expand Down
6 changes: 6 additions & 0 deletions templates/CleanroomVersion.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.cleanroommc.common;

public class CleanroomVersion {
public static final String VERSION = "%VERSION%";
public static final String BUILD_VERSION = "%BUILD_VERSION%";
}

0 comments on commit 21d865c

Please sign in to comment.