From 09cfbc32217ea9e58d5c776f698086a9637a4916 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Fri, 7 Mar 2025 18:18:10 +0400 Subject: [PATCH] feat: move build cmds to script, generate custom jre --- build.sh | 30 ++++++++++++++++++++++++++++++ me.theentropyshard.teslauncher.yml | 30 ++++++++++++++---------------- 2 files changed, 44 insertions(+), 16 deletions(-) create mode 100644 build.sh diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..f88e6ab --- /dev/null +++ b/build.sh @@ -0,0 +1,30 @@ +#!/usr/bin/sh -eu + +export PATH="$PWD/jdk/bin:$PATH" +export JAVA_HOME="$PWD/jdk" + +# check if JDK works +java --version + +# build TESLauncher +cd src +./gradlew shadowJar +cd .. + +# install built JAR named TESLauncher-x.y.z.jar +find src/build/libs/ -name "TESL*.jar" -type f -exec \ + install -D -m 644 {} /app/tesl.jar \; +# + +# generate JRE with all modules enabled +jlink \ + --strip-debug --no-man-pages --no-header-files --compress=2 \ + --add-modules ALL-MODULE-PATH --output jre +# + +# check if JRE works +./jre/bin/java --version + +# install JRE +mkdir -p /app/lib/jvm/openj9 +cp -r ./jre/* /app/lib/jvm/openj9 diff --git a/me.theentropyshard.teslauncher.yml b/me.theentropyshard.teslauncher.yml index 18d3709..aa969c9 100644 --- a/me.theentropyshard.teslauncher.yml +++ b/me.theentropyshard.teslauncher.yml @@ -3,29 +3,24 @@ runtime: org.freedesktop.Platform runtime-version: '24.08' sdk: org.freedesktop.Sdk command: /app/tesl.sh + build-options: build-args: # sorry, but i dont want to google how to vendor gradle deps - --share=network + finish-args: - --share=ipc - --socket=x11 - --device=dri - --socket=pulseaudio - --share=network + modules: - - name: openj9 - buildsystem: simple - sources: - - type: archive - strip-components: 0 - url: https://pkg.dc09.ru/openj9/jre.tar.zst - sha256: b9e288ea41dedc3ba3090299a2c90185dbe155c33219ced67ed1a99dc4751125 - build-commands: - - './bin/java --version' - - 'mkdir -p /app/lib/jvm/openj9' - - 'cp -r ./* /app/lib/jvm/openj9' - - name: tesl-build + # 1. + # download OpenJ9 JDK, build TESLauncher, install JAR, + # generate JRE with jlink and install it + - name: build buildsystem: simple sources: - type: archive @@ -37,11 +32,14 @@ modules: url: https://git.dc09.ru/TESLauncher/TESLauncher.git branch: master dest: src + - type: file + path: build.sh build-commands: - - 'PATH="$PWD/jdk/bin:$PATH" JAVA_HOME="$PWD/jdk" java --version' - - 'export PATH="$PWD/jdk/bin:$PATH" JAVA_HOME="$PWD/jdk" && cd src && ./gradlew shadowJar && cd ..' - - 'find src/build/libs/ -name "TESL*.jar" -type f -exec install -D -m 644 {} /app/tesl.jar \;' - - name: tesl-run + - 'chmod +x build.sh && ./build.sh' + + # 2. + # install a script and a dot-desktop + - name: run buildsystem: simple sources: - type: file