Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Customize JRE #1177

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Note that the issue will be automatically closed if you do not fill out the titl
- Suwayomi-Server version: (Example: v1.1.1-r1535-win32)
- Server Operating System: (Example: Ubuntu 20.04)
- Server Desktop Environment: N/A or (Example: Gnome 40)
- Server JVM version: bundled with win32 or (Example: Java 8 Update 281 or OpenJDK 8u281)
- Server JVM version: bundled with win32 or (Example: Java 21.0.5 or Temurin 21.0.5)
- Client Operating System: <usually the same as above Server Operating System>
- Client Web Browser: (Example: Google Chrome 89.0.4389.82)

Expand Down
39 changes: 38 additions & 1 deletion .github/workflows/build_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,37 @@ jobs:
path: scripts.tar.gz
if-no-files-found: error

jlink:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
name: linux-x64
- os: windows-latest
name: windows-x64
- os: macos-14
name: macOS-arm64
- os: macos-13
name: macOS-x64
os: [ubuntu-latest, windows-latest, macos-14, macos-13]

steps:
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'

- name: Package JDK
run: jlink --add-modules java.base,java.compiler,java.datatransfer,java.desktop,java.instrument,java.logging,java.management,java.naming,java.prefs,java.scripting,java.se,java.security.jgss,java.security.sasl,java.sql,java.transaction.xa,java.xml,jdk.attach,jdk.crypto.ec,jdk.jdi,jdk.management,jdk.net,jdk.random,jdk.unsupported,jdk.unsupported.desktop,jdk.zipfs --output suwa --strip-debug --no-man-pages --no-header-files --compress=2

- name: Upload JDK package
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}-jre
path: suwa

bundle:
strategy:
fail-fast: false
Expand All @@ -90,7 +121,7 @@ jobs:
- windows-x64

name: Make ${{ matrix.os }} release
needs: build
needs: [build,jlink]
runs-on: ubuntu-latest
steps:
- name: Download Jar
Expand All @@ -99,6 +130,12 @@ jobs:
name: jar
path: server/build

- name: Download JRE
uses: actions/download-artifact@v4
with:
name: ${{ matrix.os }}-jre
path: jre

- name: Download icons
uses: actions/download-artifact@v4
with:
Expand Down
39 changes: 38 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,37 @@ jobs:
path: scripts.tar.gz
if-no-files-found: error

jlink:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
name: linux-x64
- os: windows-latest
name: windows-x64
- os: macos-14
name: macOS-arm64
- os: macos-13
name: macOS-x64
os: [ubuntu-latest, windows-latest, macos-14, macos-13]

steps:
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'

- name: Package JDK
run: jlink --add-modules java.base,java.compiler,java.datatransfer,java.desktop,java.instrument,java.logging,java.management,java.naming,java.prefs,java.scripting,java.se,java.security.jgss,java.security.sasl,java.sql,java.transaction.xa,java.xml,jdk.attach,jdk.crypto.ec,jdk.jdi,jdk.management,jdk.net,jdk.random,jdk.unsupported,jdk.unsupported.desktop,jdk.zipfs --output suwa --strip-debug --no-man-pages --no-header-files --compress=2

- name: Upload JDK package
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}-jre
path: suwa

bundle:
strategy:
fail-fast: false
Expand All @@ -92,7 +123,7 @@ jobs:
- windows-x64

name: Make ${{ matrix.os }} release
needs: build
needs: [build, jlink]
runs-on: ubuntu-latest
steps:
- name: Download Jar
Expand All @@ -101,6 +132,12 @@ jobs:
name: jar
path: server/build

- name: Download JRE
uses: actions/download-artifact@v4
with:
name: ${{ matrix.os }}-jre
path: jre

- name: Download icons
uses: actions/download-artifact@v4
with:
Expand Down
41 changes: 28 additions & 13 deletions scripts/bundler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ main() {
JRE_URL="https://github.com/adoptium/temurin21-binaries/releases/download/$JRE_RELEASE/$JRE"
ELECTRON="electron-$electron_version-linux-x64.zip"
ELECTRON_URL="https://github.com/electron/electron/releases/download/$electron_version/$ELECTRON"
download_jre_and_electron
download_electron
setup_jre
tree "$RELEASE_NAME"

RELEASE="$RELEASE_NAME.tar.gz"
make_linux_bundle
Expand All @@ -72,7 +74,9 @@ main() {
JRE_URL="https://github.com/adoptium/temurin21-binaries/releases/download/$JRE_RELEASE/$JRE"
ELECTRON="electron-$electron_version-darwin-x64.zip"
ELECTRON_URL="https://github.com/electron/electron/releases/download/$electron_version/$ELECTRON"
download_jre_and_electron
download_electron
setup_jre
tree "$RELEASE_NAME"

RELEASE="$RELEASE_NAME.zip"
make_macos_bundle
Expand All @@ -86,7 +90,9 @@ main() {
JRE_URL="https://github.com/adoptium/temurin21-binaries/releases/download/$JRE_RELEASE/$JRE"
ELECTRON="electron-$electron_version-darwin-arm64.zip"
ELECTRON_URL="https://github.com/electron/electron/releases/download/$electron_version/$ELECTRON"
download_jre_and_electron
download_electron
setup_jre
tree "$RELEASE_NAME"

RELEASE="$RELEASE_NAME.zip"
make_macos_bundle
Expand All @@ -100,7 +106,9 @@ main() {
JRE_URL="https://github.com/adoptium/temurin21-binaries/releases/download/$JRE_RELEASE/$JRE"
ELECTRON="electron-$electron_version-win32-x64.zip"
ELECTRON_URL="https://github.com/electron/electron/releases/download/$electron_version/$ELECTRON"
download_jre_and_electron
download_electron
setup_jre
tree "$RELEASE_NAME"

RELEASE="$RELEASE_NAME.zip"
make_windows_bundle
Expand Down Expand Up @@ -130,26 +138,30 @@ download_launcher() {
mv "Suwayomi-Launcher.jar" "$RELEASE_NAME/Suwayomi-Launcher.jar"
}

download_jre_and_electron() {
if [ ! -f "$JRE" ]; then
curl -L "$JRE_URL" -o "$JRE"
fi
download_electron() {
if [ ! -f "$ELECTRON" ]; then
curl -L "$ELECTRON_URL" -o "$ELECTRON"
fi

unzip "$ELECTRON" -d "$RELEASE_NAME/electron/"
}

setup_jre() {
if [ -d "./jre" ]; then
mv "./jre" "$RELEASE_NAME/jre"
return
fi
if [ ! -f "$JRE" ]; then
curl -L "$JRE_URL" -o "$JRE"
fi

local ext="${JRE##*.}"
if [ "$ext" = "zip" ]; then
unzip "$JRE"
else
tar xvf "$JRE"
fi
mv "$JRE_DIR" "$RELEASE_NAME/jre"
unzip "$ELECTRON" -d "$RELEASE_NAME/electron/"

mkdir "$RELEASE_NAME/bin"

tree
}

copy_linux_package_assets_to() {
Expand All @@ -166,6 +178,7 @@ copy_linux_package_assets_to() {
}

make_linux_bundle() {
mkdir "$RELEASE_NAME/bin"
cp "$JAR" "$RELEASE_NAME/bin/Suwayomi-Server.jar"
cp "scripts/resources/suwayomi-launcher.sh" "$RELEASE_NAME/"
cp "scripts/resources/suwayomi-server.sh" "$RELEASE_NAME/"
Expand All @@ -174,6 +187,7 @@ make_linux_bundle() {
}

make_macos_bundle() {
mkdir "$RELEASE_NAME/bin"
cp "$JAR" "$RELEASE_NAME/bin/Suwayomi-Server.jar"
cp "scripts/resources/Suwayomi Launcher.command" "$RELEASE_NAME/"

Expand Down Expand Up @@ -237,6 +251,7 @@ make_windows_bundle() {
#WINEARCH=win32 wine "$rcedit" "$RELEASE_NAME/electron/electron.exe" \
# --set-icon "$icon"

mkdir "$RELEASE_NAME/bin"
cp "$JAR" "$RELEASE_NAME/bin/Suwayomi-Server.jar"
cp "scripts/resources/Suwayomi Launcher.bat" "$RELEASE_NAME"

Expand Down
Loading