Upload files to "/"

This commit is contained in:
aidan committed 2026-11-11 01:20:27 +02:00
1 parent 06269f1f65
commit 6d94493e58
4 files changed
+146 -27

No files matched your search

+10 -5
View File
@@ -1,12 +1,17 @@
# Build OpenPrestige and collect the host binaries in dist/.
$ErrorActionPreference = 'Continue'
param([string]$Python = 'python')
$ErrorActionPreference = 'Stop'
Set-Location $PSScriptRoot
if (Test-Path 'C:\Program Files\Eclipse Adoptium\jdk-21.0.12.101-hotspot') { $env:JAVA_HOME = 'C:\Program Files\Eclipse Adoptium\jdk-21.0.12.101-hotspot' }
& .\gradlew.bat remapJar --console=plain
if ($LASTEXITCODE -ne 0) { throw 'gradle remapJar failed' }
& .\gradlew.bat bundlePayloads "-PpythonExecutable=$Python" --console=plain
if ($LASTEXITCODE -ne 0) { throw 'gradle bundlePayloads failed' }
$env:PRESTIGE_PAYLOAD = $null
$env:PRESTIGE_BUNDLE = Join-Path $PSScriptRoot 'build/bundle'
cargo build --release --manifest-path injector\Cargo.toml
if ($LASTEXITCODE -ne 0) { throw 'cargo build failed' }
New-Item -ItemType Directory -Force dist | Out-Null
Copy-Item injector\target\release\OpenPrestigeInjector.exe, injector\target\release\prestige_native.dll dist\ -Force
Get-ChildItem build\libs\prestige-*.jar | Where-Object { $_.Name -notmatch '-(dev|sources)\.jar$' } | Copy-Item -Destination dist\ -Force
Write-Host 'Done: dist\OpenPrestigeInjector.exe + native library + Fabric mod JAR'
$version = (Get-Content gradle.properties | Where-Object { $_ -like 'mod_version=*' }) -replace '^mod_version=', ''
& $Python scripts/package_release.py offline dist $version windows-x86_64 dist/OpenPrestigeInjector.exe dist/prestige_native.dll build/bundle/common.jar
if ($LASTEXITCODE -ne 0) { throw 'release packaging failed' }
Write-Host 'Done: dist contains the offline multi-version Windows bundle'
+8 -6
View File
@@ -12,13 +12,15 @@ if [ -n "${JAVA_HOME:-}" ]; then
PATH="$JAVA_HOME/bin:$PATH"
export PATH
fi
./gradlew remapJar --console=plain
./gradlew bundlePayloads "-PpythonExecutable=${PYTHON:-python3}" --console=plain
unset PRESTIGE_PAYLOAD
export PRESTIGE_BUNDLE="$PWD/build/bundle"
cargo build --release --manifest-path injector/Cargo.toml
mkdir -p dist
cp -f "injector/target/release/OpenPrestigeInjector" "injector/target/release/$LIB" dist/
chmod +x dist/OpenPrestigeInjector
for jar in build/libs/prestige-*.jar; do
case "$jar" in *-dev.jar|*-sources.jar) continue ;; esac
cp -f "$jar" dist/
done
echo "Done: dist/OpenPrestigeInjector + dist/$LIB + Fabric mod JAR"
VERSION=$(sed -n 's/^mod_version=//p' gradle.properties)
case "$(uname -s)" in Linux) PLATFORM=linux ;; Darwin) PLATFORM=macos ;; esac
case "$(uname -m)" in x86_64) ARCH=x86_64 ;; arm64|aarch64) ARCH=aarch64 ;; *) echo 'Unsupported architecture' >&2; exit 1 ;; esac
"${PYTHON:-python3}" scripts/package_release.py offline dist "$VERSION" "$PLATFORM-$ARCH" dist/OpenPrestigeInjector "dist/$LIB" build/bundle/common.jar
echo "Done: dist contains the offline multi-version host bundle"
+6 -7
View File
@@ -37,12 +37,11 @@ python scripts\build_release_imgui.py || goto :fail
rem ---- payload jar -------------------------------------------------------
echo === Building payload jar
call "%CD%\gradlew.bat" remapJar --console=plain || goto :fail
set "JAR="
for /f "delims=" %%j in ('dir /b /o-d "build\libs\prestige-*.jar" ^| findstr /v /i /c:"-dev.jar" /c:"-sources.jar"') do if not defined JAR set "JAR=%CD%\build\libs\%%j"
if not defined JAR (echo no remapped jar in build\libs & goto :fail)
rem The native library uses this exact payload JAR.
set "PRESTIGE_PAYLOAD=%JAR%"
call "%CD%\gradlew.bat" bundlePayloads --console=plain || goto :fail
set "JAR=%CD%\build\bundle\common.jar"
set "PRESTIGE_PAYLOAD="
set "PRESTIGE_BUNDLE=%CD%\build\bundle"
if not exist "%OUT%" mkdir "%OUT%" || goto :fail
@@ -54,7 +53,7 @@ call :build linux-x86_64 x86_64-unknown-linux-gnu OpenPrestigeInjector libpresti
call :build linux-aarch64 aarch64-unknown-linux-gnu OpenPrestigeInjector libprestige_native.so zigbuild aarch64-unknown-linux-gnu.2.17 || goto :fail
call :build macos-universal universal2-apple-darwin OpenPrestigeInjector libprestige_native.dylib zigbuild || goto :fail
copy /y "%JAR%" "%OUT%\" >nul || goto :fail
rem Standalone Fabric mods are in versions\*\build\libs.
python scripts\package_release.py checksums "%OUT%" || goto :fail
echo.
echo === Done: %OUT%
+122 -9
View File
@@ -2,15 +2,17 @@ plugins {
id 'net.fabricmc.fabric-loom-remap' version '1.17.21'
}
version = project.mod_version
version = "${project.mod_version}+${project.minecraft_version}"
group = project.maven_group
base {
archivesName = project.archives_base_name
}
def accessWidener = stonecutter.eval(stonecutter.current.version, '>=1.21.11')
? 'prestige-client.accesswidener' : 'prestige-client-legacy.accesswidener'
loom {
accessWidenerPath = file('src/main/resources/prestige-client.accesswidener')
accessWidenerPath = rootProject.file("src/main/resources/${accessWidener}")
runs {
client {
client()
@@ -62,22 +64,118 @@ dependencies {
shade "io.github.spair:imgui-java-natives-macos:${project.imgui_version}"
// ClassTransform (net.lenni0451, customised build); engine/EnginePlugin uses it to apply the client's @CTransformer hooks.
shade files('libs/classtransform-bundled.jar')
shade files(rootProject.file('libs/classtransform-bundled.jar'))
// Yarn tiny shipped as prestige-engine/mappings.tiny for the production (Intermediary) runtime
engineMappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
}
processResources {
exclude { it.name.endsWith('.accesswidener') && it.name != accessWidener }
inputs.property "version", project.version
inputs.property "minecraft_version", project.minecraft_version
filteringCharset "UTF-8"
filesMatching("fabric.mod.json") {
expand "version": project.version
expand "version": project.version, "minecraft_version": project.minecraft_version, "access_widener": accessWidener
}
filesMatching("prestige-engine/minecraft-version.txt") {
expand "minecraft_version": project.minecraft_version
}
if (stonecutter.eval(stonecutter.current.version, '<1.21.11')) {
doLast {
def manifestFile = new File(destinationDir, 'prestige_ui/manifest_live.json')
def manifest = new groovy.json.JsonSlurper().parse(manifestFile)
def unavailable = manifest.modules.findAll { it['class'].contains('.module.spear.') }.collect { it.name }.toSet()
manifest.modules.removeAll { unavailable.contains(it.name) }
manifestFile.text = groovy.json.JsonOutput.toJson(manifest)
['modules.tsv', 'settings.tsv'].each { name ->
def table = new File(destinationDir, "prestige_ui/${name}")
table.text = table.readLines('UTF-8').findAll { row ->
!unavailable.contains(row.split('\t', -1)[name == 'modules.tsv' ? 1 : 0])
}.join('\n') + '\n'
}
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.release = 21
options.compilerArgs += ['-Xmaxerrs', '1000']
}
// Each version's compiled transformer annotations own the target set. Generate
// anchors from them so renamed/merged game classes cannot leave stale targets.
def engineSources = layout.buildDirectory.dir('generated/engine/java')
def engineResources = layout.buildDirectory.dir('generated/engine/resources')
def generateEngineMetadata = tasks.register('generateEngineMetadata') {
dependsOn tasks.named('compileJava')
inputs.files(tasks.named('compileJava').flatMap { it.destinationDirectory })
inputs.files(configurations.engineMappings)
outputs.dirs(engineSources, engineResources)
doLast {
def namedToIntermediary = [:]
new java.util.zip.ZipFile(configurations.engineMappings.singleFile).withCloseable { zip ->
zip.getInputStream(zip.getEntry('mappings/mappings.tiny')).withReader('UTF-8') { reader ->
reader.eachLine { line ->
def fields = line.split('\t')
if (fields[0] == 'c') namedToIntermediary[fields[2]] = fields[1]
}
}
}
def targets = new TreeSet<String>()
def transformers = new TreeSet<String>()
fileTree(tasks.named('compileJava').get().destinationDirectory).matching {
include 'dev/zprestige/prestige/mixin/*.class'
}.each { file ->
def node = new org.objectweb.asm.tree.ClassNode()
new org.objectweb.asm.ClassReader(file.bytes).accept(node, org.objectweb.asm.ClassReader.SKIP_CODE)
def annotation = (node.visibleAnnotations ?: []).find { it.desc == 'Lnet/lenni0451/classtransform/annotations/CTransformer;' }
if (annotation == null) annotation = (node.invisibleAnnotations ?: []).find { it.desc == 'Lnet/lenni0451/classtransform/annotations/CTransformer;' }
if (annotation != null) {
transformers.add(node.name.replace('/', '.'))
def values = annotation.values
for (int i = 0; i < values.size(); i += 2) {
if (values[i] == 'value') values[i + 1].each { targets.add(it.internalName) }
if (values[i] == 'name') values[i + 1].each { targets.add(it.replace('.', '/')) }
}
}
}
def sourceRoot = engineSources.get().asFile
def sources = new File(sourceRoot, 'dev/zprestige/prestige/engine/mixin')
def resources = new File(engineResources.get().asFile, 'prestige-engine')
assert sourceRoot.canonicalPath.startsWith(layout.buildDirectory.get().asFile.canonicalPath + File.separator)
delete sourceRoot
sources.mkdirs()
resources.mkdirs()
def named = targets.toList()
def intermediary = named.collect { target ->
if (!namedToIntermediary.containsKey(target)) throw new GradleException("No intermediary mapping for ${target}")
namedToIntermediary[target]
}
['N': named, 'I': intermediary].each { prefix, names ->
names.eachWithIndex { target, index ->
def name = String.format('%s%02d', prefix, index)
new File(sources, "${name}.java").text = """package dev.zprestige.prestige.engine.mixin;
@org.spongepowered.asm.mixin.Mixin(targets = "${target.replace('/', '.')}", remap = false, priority = 2000)
public abstract class ${name} {}
"""
}
}
new File(resources, 'targets.named.list').text = named.collect { it.replace('/', '.') }.join('\n') + '\n'
new File(resources, 'targets.intermediary.list').text = intermediary.collect { it.replace('/', '.') }.join('\n') + '\n'
new File(resources, 'transformers.list').text = transformers.join('\n') + '\n'
}
}
def compileEngineAnchors = tasks.register('compileEngineAnchors', JavaCompile) {
dependsOn generateEngineMetadata
source engineSources
classpath = sourceSets.main.compileClasspath
destinationDirectory = layout.buildDirectory.dir('classes/engine')
}
sourceSets.main.output.dir(engineResources, builtBy: generateEngineMetadata)
sourceSets.main.output.dir(compileEngineAnchors.flatMap { it.destinationDirectory }, builtBy: compileEngineAnchors)
processResources {
exclude 'prestige-engine/targets.named.list', 'prestige-engine/targets.intermediary.list', 'prestige-engine/transformers.list'
}
java {
@@ -86,12 +184,27 @@ java {
withSourcesJar()
}
tasks.named('sourcesJar') {
dependsOn generateEngineMetadata
from engineSources
}
// Applied scripts do not inherit plugin implementation classes; pass ASM operations
// from Loom's existing classpath instead of adding another dependency.
ext.hookAsm = [
node: { new org.objectweb.asm.tree.ClassNode() },
reader: { data -> new org.objectweb.asm.ClassReader(data) },
arguments: { descriptor -> org.objectweb.asm.Type.getArgumentTypes(descriptor).toList() },
methodInstruction: { instruction -> instruction instanceof org.objectweb.asm.tree.MethodInsnNode }
]
apply from: rootProject.file('gradle/hook-check.gradle')
jar {
// Optional custom native builds take precedence over the upstream binaries.
from('build/core-natives') {
from(rootProject.file('build/core-natives')) {
into 'prestige-natives'
}
from('build/arm-natives') {
from(rootProject.file('build/arm-natives')) {
into 'prestige-natives'
}
// Unpack the shaded libs (imgui classes + native dll, ClassTransform) into the mod jar.
@@ -101,13 +214,13 @@ jar {
exclude 'META-INF/MANIFEST.MF', 'META-INF/*.SF', 'META-INF/*.RSA', 'META-INF/*.DSA'
exclude 'module-info.class', 'META-INF/versions/**'
exclude 'imgui/extension/**'
if (file('build/core-natives/windows-x86_64/imgui-java64.dll').isFile()) {
if (rootProject.file('build/core-natives/windows-x86_64/imgui-java64.dll').isFile()) {
exclude 'io/imgui/java/native-bin/imgui-java64.dll'
}
if (file('build/core-natives/linux-x86_64/libimgui-java64.so').isFile()) {
if (rootProject.file('build/core-natives/linux-x86_64/libimgui-java64.so').isFile()) {
exclude 'io/imgui/java/native-bin/libimgui-java64.so'
}
if (file('build/core-natives/macos-universal/libimgui-java64.dylib').isFile()) {
if (rootProject.file('build/core-natives/macos-universal/libimgui-java64.dylib').isFile()) {
exclude 'io/imgui/java/native-bin/libimgui-java64.dylib'
}
}