mirror of
https://github.com/Darkrock-Studios/hammer-editor.git
synced 2026-10-19 09:34:23 +00:00
Drop the JetBrains Runtime requirement (#873)
Nothing in the desktop app needs the JBR anymore, so go back to OpenJDK (Temurin 21) everywhere: - Remove the JETBRAINS vendor pin from the desktop toolchain and from the launcher that jpackage bundles as the app runtime - Replace the setup-jbr composite action with actions/setup-java; the retry logic only existed to survive rate limits on the jetbrains distribution's release listing - Swap the JBR SDK tarball for Temurin 21 in the snap and flatpak builds, and verify the snap download's checksum - Standardize the remaining 'adopt' setup-java steps on 'temurin'
This commit is contained in:
parent
146919556d
commit
5eebd1b4e6
6 changed files with 48 additions and 111 deletions
64
.github/actions/setup-jbr/action.yml
vendored
64
.github/actions/setup-jbr/action.yml
vendored
|
|
@ -1,64 +0,0 @@
|
|||
name: 'Set up JBR'
|
||||
description: 'Set up the JetBrains Runtime, retrying through transient GitHub rate limits on the JBR download.'
|
||||
|
||||
inputs:
|
||||
token:
|
||||
description: 'GitHub token used for authenticated JBR downloads.'
|
||||
required: true
|
||||
cache:
|
||||
description: "Build tool to cache dependencies for (passed through to setup-java's cache input). Empty disables caching."
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Set up JBR (attempt 1)
|
||||
id: attempt1
|
||||
uses: actions/setup-java@v5
|
||||
continue-on-error: true
|
||||
# The jetbrains distribution authenticates its release-listing API call via
|
||||
# the GITHUB_TOKEN env var, not the `token` input — without it the request is
|
||||
# unauthenticated and hits GitHub's per-IP rate limit.
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.token }}
|
||||
with:
|
||||
distribution: 'jetbrains'
|
||||
java-version: 21
|
||||
token: ${{ inputs.token }}
|
||||
cache: ${{ inputs.cache }}
|
||||
|
||||
- name: Back off before retry
|
||||
if: steps.attempt1.outcome == 'failure'
|
||||
shell: bash
|
||||
run: sleep 30
|
||||
|
||||
- name: Set up JBR (attempt 2)
|
||||
id: attempt2
|
||||
if: steps.attempt1.outcome == 'failure'
|
||||
uses: actions/setup-java@v5
|
||||
continue-on-error: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.token }}
|
||||
with:
|
||||
distribution: 'jetbrains'
|
||||
java-version: 21
|
||||
token: ${{ inputs.token }}
|
||||
cache: ${{ inputs.cache }}
|
||||
|
||||
- name: Back off before final retry
|
||||
if: steps.attempt1.outcome == 'failure' && steps.attempt2.outcome == 'failure'
|
||||
shell: bash
|
||||
run: sleep 60
|
||||
|
||||
# Final attempt: no continue-on-error, so a persistent failure still fails the job.
|
||||
- name: Set up JBR (attempt 3)
|
||||
if: steps.attempt1.outcome == 'failure' && steps.attempt2.outcome == 'failure'
|
||||
uses: actions/setup-java@v5
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.token }}
|
||||
with:
|
||||
distribution: 'jetbrains'
|
||||
java-version: 21
|
||||
token: ${{ inputs.token }}
|
||||
cache: ${{ inputs.cache }}
|
||||
47
.github/workflows/prepare-release.yml
vendored
47
.github/workflows/prepare-release.yml
vendored
|
|
@ -15,8 +15,8 @@ jobs:
|
|||
- name: Set up JDK
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: 21
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
cache: gradle
|
||||
|
||||
- name: Run Unit Tests
|
||||
|
|
@ -50,10 +50,11 @@ jobs:
|
|||
- name: Checkout code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Set up JBR
|
||||
uses: ./.github/actions/setup-jbr
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
|
||||
- name: Gradle caching
|
||||
uses: actions/cache@v6
|
||||
|
|
@ -149,10 +150,11 @@ jobs:
|
|||
- name: Checkout code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Set up JBR
|
||||
uses: ./.github/actions/setup-jbr
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
|
||||
- name: Gradle caching
|
||||
uses: actions/cache@v6
|
||||
|
|
@ -260,10 +262,11 @@ jobs:
|
|||
- name: Checkout code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Set up JBR
|
||||
uses: ./.github/actions/setup-jbr
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
|
||||
- name: Gradle caching
|
||||
uses: actions/cache@v6
|
||||
|
|
@ -348,8 +351,8 @@ jobs:
|
|||
- name: Set up JDK
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: 21
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
|
||||
- name: Gradle caching
|
||||
uses: actions/cache@v6
|
||||
|
|
@ -410,8 +413,8 @@ jobs:
|
|||
- name: Set up JDK
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: 21
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
|
||||
- name: Gradle caching
|
||||
uses: actions/cache@v6
|
||||
|
|
@ -482,10 +485,11 @@ jobs:
|
|||
- name: Checkout code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Set up JBR
|
||||
uses: ./.github/actions/setup-jbr
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
cache: gradle
|
||||
|
||||
- name: Grant Permission to Execute
|
||||
|
|
@ -520,10 +524,11 @@ jobs:
|
|||
- name: Checkout code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Set up JBR
|
||||
uses: ./.github/actions/setup-jbr
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
cache: gradle
|
||||
|
||||
- name: Install Flatpak and flatpak-builder
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ configurations.all {
|
|||
kotlin {
|
||||
jvmToolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(libs.versions.jvm.get().toInt()))
|
||||
vendor.set(JvmVendorSpec.JETBRAINS)
|
||||
}
|
||||
jvm()
|
||||
sourceSets {
|
||||
|
|
@ -77,15 +76,15 @@ kotlin {
|
|||
}
|
||||
}
|
||||
|
||||
// Pin jpackage's bundled runtime to the JetBrains Runtime.
|
||||
val jbrLauncher = javaToolchains.launcherFor {
|
||||
// Pin jpackage's bundled runtime to the project's toolchain JDK rather than
|
||||
// whichever JVM happens to be running Gradle.
|
||||
val packagingLauncher = javaToolchains.launcherFor {
|
||||
languageVersion.set(JavaLanguageVersion.of(libs.versions.jvm.get().toInt()))
|
||||
vendor.set(JvmVendorSpec.JETBRAINS)
|
||||
}
|
||||
|
||||
compose.desktop {
|
||||
application {
|
||||
javaHome = jbrLauncher.get().metadata.installationPath.asFile.absolutePath
|
||||
javaHome = packagingLauncher.get().metadata.installationPath.asFile.absolutePath
|
||||
mainClass = "com.darkrockstudios.apps.hammer.desktop.MainKt"
|
||||
nativeDistributions {
|
||||
targetFormats(
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ modules:
|
|||
build-args:
|
||||
- --share=network
|
||||
build-commands:
|
||||
# Extract JBR, setup environment, and build with Gradle
|
||||
# Extract the JDK, setup environment, and build with Gradle
|
||||
# All in one command block so environment variables persist
|
||||
- |
|
||||
tar -xzf jbr.tar.gz
|
||||
export JAVA_HOME=$PWD/jbrsdk_jcef-21.0.9-linux-x64-b1163.86
|
||||
tar -xzf jdk.tar.gz
|
||||
export JAVA_HOME=$PWD/jdk-21.0.12+8
|
||||
export PATH=$JAVA_HOME/bin:$PATH
|
||||
java -version
|
||||
chmod +x gradlew
|
||||
|
|
@ -54,6 +54,6 @@ modules:
|
|||
- type: dir
|
||||
path: ..
|
||||
- type: file
|
||||
url: https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk_jcef-21.0.9-linux-x64-b1163.86.tar.gz
|
||||
sha256: 81d780fbea669d67a40a65a678ad0710d224c31439472d2d8933109c95cacf57
|
||||
dest-filename: jbr.tar.gz
|
||||
url: https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.12%2B8/OpenJDK21U-jdk_x64_linux_hotspot_21.0.12_8.tar.gz
|
||||
sha256: e4446ff06a276155697597cc0f1b15da004ff083f4964a35271ecee567177370
|
||||
dest-filename: jdk.tar.gz
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ pluginManagement {
|
|||
}
|
||||
}
|
||||
|
||||
// F-Droid can't provide JBR or reach foojay, so skip both for F-Droid builds.
|
||||
// F-Droid can't reach foojay, so skip the toolchain resolver for F-Droid builds.
|
||||
// The flag is honoured from -Pfdroid=true, an `fdroid` entry in gradle.properties,
|
||||
// or the FDROID_BUILD environment variable - the same sources the module build
|
||||
// scripts read, so a single gradle.properties line drives the whole build.
|
||||
|
|
|
|||
|
|
@ -39,41 +39,38 @@ parts:
|
|||
override-build: |
|
||||
set -euo pipefail
|
||||
|
||||
# Download and setup JetBrains Runtime SDK (full JDK with jlink/jpackage)
|
||||
# createDistributable bundles whatever JVM is in JAVA_HOME, so any
|
||||
# silent fall-through to the container's OpenJDK ships a non-JBR
|
||||
# runtime and the app crashes on startup with the Nucleus check.
|
||||
echo "Downloading JetBrains Runtime SDK..."
|
||||
wget https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk_jcef-21.0.9-linux-x64-b1163.86.tar.gz
|
||||
tar -xzf jbrsdk_jcef-21.0.9-linux-x64-b1163.86.tar.gz
|
||||
export JAVA_HOME=$PWD/jbrsdk_jcef-21.0.9-linux-x64-b1163.86
|
||||
# A full JDK, not a JRE: createDistributable needs jlink/jpackage,
|
||||
# and it bundles whatever JVM is in JAVA_HOME into lib/runtime/.
|
||||
echo "Downloading Temurin JDK..."
|
||||
wget https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.12%2B8/OpenJDK21U-jdk_x64_linux_hotspot_21.0.12_8.tar.gz -O jdk.tar.gz
|
||||
echo "e4446ff06a276155697597cc0f1b15da004ff083f4964a35271ecee567177370 jdk.tar.gz" | sha256sum -c -
|
||||
tar -xzf jdk.tar.gz
|
||||
export JAVA_HOME=$PWD/jdk-21.0.12+8
|
||||
export PATH=$JAVA_HOME/bin:$PATH
|
||||
|
||||
# Fail fast if the JBR SDK extract didn't produce a usable toolchain.
|
||||
# Fail fast if the extract didn't produce a usable toolchain.
|
||||
test -x "$JAVA_HOME/bin/java"
|
||||
test -x "$JAVA_HOME/bin/jlink"
|
||||
test -x "$JAVA_HOME/bin/jpackage"
|
||||
|
||||
echo "Building with JBR SDK (JAVA_HOME=$JAVA_HOME)"
|
||||
echo "Building with JDK (JAVA_HOME=$JAVA_HOME)"
|
||||
java -version
|
||||
|
||||
# Run gradle build with createDistributable
|
||||
# This will now bundle JBR (not OpenJDK) in lib/runtime/
|
||||
chmod +x ./gradlew
|
||||
# First build all necessary JARs, then create the distributable
|
||||
./gradlew :desktop:jvmJar --no-daemon
|
||||
./gradlew :desktop:createDistributable -x desktopTest --no-daemon
|
||||
# Copy the gradle output to the install directory
|
||||
# Note: outputBaseDir is set to 'installers' in build.gradle.kts
|
||||
# This includes the bundled JBR at lib/runtime/
|
||||
# This includes the bundled runtime at lib/runtime/
|
||||
mkdir -p $CRAFT_PART_INSTALL/lib
|
||||
cp -r desktop/build/installers/main/app/hammer $CRAFT_PART_INSTALL/lib/hammer
|
||||
# Create the bin directory and launcher script
|
||||
# Use the bundled JBR runtime instead of system OpenJDK
|
||||
mkdir -p $CRAFT_PART_INSTALL/bin
|
||||
cat > $CRAFT_PART_INSTALL/bin/hammer << 'EOF'
|
||||
#!/bin/bash
|
||||
# Use the bundled JetBrains Runtime (JBR) that comes with the distributable
|
||||
# Use the bundled runtime that comes with the distributable
|
||||
export JAVA_HOME=$SNAP/lib/hammer/lib/runtime
|
||||
export PATH=$JAVA_HOME/bin:$PATH
|
||||
exec $SNAP/lib/hammer/bin/hammer "$@"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue