Skip to content

Commit

Permalink
Java 21, build cleanup
Browse files Browse the repository at this point in the history
- Minimum macOS now 11/Big Sur
  • Loading branch information
airsquared committed Sep 29, 2023
1 parent d385dc3 commit d5a747f
Show file tree
Hide file tree
Showing 36 changed files with 44 additions and 836 deletions.
8 changes: 3 additions & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Declare files that will always have CRLF line endings on checkout.
gpl-3.0.txt text eol=lf
LICENSE_windows.txt text eol=crlf
libraries_used.txt text eol=lf
libraries_used_windows.txt text eol=crlf
/dist/windows/files/LICENSE text eol=crlf
/libraries_used.txt text eol=lf
/dist/windows/files/libraries_used.txt text eol=crlf
gradlew.bat text eol=crlf
gradlew text eol=lf

# Tell GitHub’s linguist which files to ignore
gradle/InnoSetup6/* linguist-vendored
gradlew linguist-vendored
gradlew.bat linguist-vendored
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '20'
java-version: '21'
distribution: 'zulu'
- name: Install Linux dependencies
run: sudo apt-get install libplist-dev libimobiledevice-dev libirecovery-1.0-dev
Expand All @@ -24,6 +24,7 @@ jobs:
uses: gradle/gradle-build-action@v2
with:
arguments: build --no-daemon --scan
dependency-graph: generate-and-submit
- uses: initdc/upload-artifact@feat/artifact-per-file
with:
artifact-per-file: true
Expand Down
4 changes: 2 additions & 2 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/Main__Linux_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/Main__Windows_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/Main__macOS_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bugs/problems or have a feature request.

## Built With

- JDK 20
- JDK 21
- [IntelliJ Idea](https://www.jetbrains.com/idea/)
- [Gradle](https://gradle.org/)
- [JLink Plugin](https://github.com/beryx/badass-jlink-plugin)
Expand Down
59 changes: 22 additions & 37 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform

plugins {
id 'application'
id 'com.github.ben-manes.versions' version '0.46.0'
id 'org.beryx.jlink' version '2.26.0'
id 'com.github.ben-manes.versions' version '0.48.0'
id 'org.beryx.jlink' version '3.0.0'
id 'org.openjfx.javafxplugin' version '0.1.0'
id 'org.javamodularity.moduleplugin' version '1.8.12'

id 'idea'
}
Expand All @@ -37,11 +36,11 @@ version = '3.5.2'
description = 'A cross-platform GUI and CLI app for saving SHSH blobs'
String appIdentifier = 'airsquared.blobsaver.app'
String copyright = 'Copyright (c) 2023 airsquared'
def os = DefaultNativePlatform.currentOperatingSystem
var os = DefaultNativePlatform.currentOperatingSystem

startScripts.enabled = distZip.enabled = distTar.enabled = false

java.toolchain.languageVersion = JavaLanguageVersion.of(20)
java.toolchain.languageVersion = JavaLanguageVersion.of(21)

repositories {
mavenCentral()
Expand All @@ -57,43 +56,42 @@ dependencies {
implementation 'info.picocli:picocli:4.7.5'

testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation 'org.testfx:openjfx-monocle:jdk-12.0.1+2'
}

javafx {
version = '20'
version = '21'
modules = [ 'javafx.controls', 'javafx.fxml' ]
}

def addExports = ['--add-exports=javafx.graphics/com.sun.javafx.css=airsquared.blobsaver', '--add-exports=java.base/jdk.internal.misc=airsquared.blobsaver']
var addExports = '--add-exports=javafx.graphics/com.sun.javafx.css=airsquared.blobsaver'

compileJava {
options.compilerArgs.addAll addExports
options.compilerArgs.add addExports
}

application {
mainModule = 'airsquared.blobsaver'
mainClass = 'airsquared.blobsaver.app.Main'
applicationDefaultJvmArgs.addAll addExports
applicationDefaultJvmArgs.add addExports
}

private String getJarDirectory() {
String dir = ''
var dir = ''
if (DefaultNativePlatform.currentOperatingSystem.isMacOsX()) dir = 'macos/Contents'
else if (DefaultNativePlatform.currentOperatingSystem.isWindows()) dir = 'windows/files'
else if (DefaultNativePlatform.currentOperatingSystem.isLinux()) dir = 'linux'
return "${projectDir}/dist/${dir}"
}

run {
systemProperty 'jar.directory', getJarDirectory()
systemProperty 'jar.directory', jarDirectory
}

test {
useJUnitPlatform()
systemProperty 'jar.directory', getJarDirectory()
jvmArgs addExports
jvmArgs '--add-exports=javafx.graphics/com.sun.glass.ui=org.testfx.monocle'
systemProperty 'jar.directory', jarDirectory
}

jlink {
Expand All @@ -102,8 +100,7 @@ jlink {
'--dedup-legal-notices=error-if-not-same-content'
}
launcher {
jvmArgs = [ '-Djar.directory={{BIN_DIR}}' ]
jvmArgs.addAll addExports
jvmArgs = [ '-Djar.directory={{BIN_DIR}}', addExports ]
if (findProperty('noConsole') != 'false') {
noConsole = true
}
Expand All @@ -116,48 +113,36 @@ jlink {

if (os.isMacOsX()) {
installerType = 'dmg'
String arch = DefaultNativePlatform.currentArchitecture.amd64 ? 'intel' : 'arm'
var arch = DefaultNativePlatform.currentArchitecture.amd64 ? 'intel' : 'arm'
installerName = "${name}-${arch}"
imageOptions.addAll '--mac-package-identifier', appIdentifier
//noinspection GroovyAssignabilityCheck
imageOptions.addAll '--mac-package-identifier', appIdentifier,
'--app-content', "${projectDir}/dist/macos/Contents/Frameworks," +
"${projectDir}/dist/macos/Contents/MacOS"
icon = "${projectDir}/dist/macos/Contents/Resources/blob.icns"
} else if (os.isWindows()) {
installerOptions.addAll '--win-dir-chooser', '--win-menu', '--win-shortcut'
icon = "${projectDir}/dist/windows/blob.ico"
imageOptions.addAll '--app-content', fileTree("${projectDir}/dist/windows/files").join(',')
} else {
installerOptions.addAll '--linux-shortcut', '--linux-menu-group', 'Utility;Archiving;Java',
'--linux-rpm-license-type', 'GPLv3'
icon = "${projectDir}/src/main/resources/airsquared/blobsaver/app/blob_emoji.png"
icon = "${projectDir}/src/main/resources/airsquared/blobsaver/app/blob.png"
imageOptions.addAll '--app-content', fileTree("${projectDir}/dist/linux").join(',') + ',' +
"${projectDir}/LICENSE,${projectDir}/libraries_used.txt"
}
if (findProperty('installerType') != null) {
installerType = findProperty('installerType')
}
}
if (os.isMacOsX()) jpackageImage.doLast {
copy {
from "${projectDir}/dist/macos/Contents/MacOS" into layout.buildDirectory.dir('jpackage/blobsaver.app/Contents/MacOS')
}
copy {
from "${projectDir}/dist/macos/Contents/Frameworks" into layout.buildDirectory.dir('jpackage/blobsaver.app/Contents/Frameworks')
}
copy {
from "${projectDir}/LICENSE", "${projectDir}/libraries_used.txt"
into layout.buildDirectory.dir('jpackage/blobsaver.app/Contents/Resources')
}
exec { // needed to prevent "application is damaged" error when opening quarantined app
commandLine 'codesign', '--force', '--deep', '--sign', '-', "${layout.buildDirectory.get()}/jpackage/blobsaver.app"
}
} else if (os.isWindows()) jpackageImage.doLast {
copy {
from "${projectDir}/dist/windows/files", layout.buildDirectory.dir('jpackage/blobsaver/runtime/bin/zip.dll')
rename 'LICENSE_windows', 'LICENSE'
rename 'libraries_used_windows.txt', 'libraries_used.txt'
into layout.buildDirectory.dir('jpackage/blobsaver')
}
} else jpackageImage.doLast {
copy {
from "${projectDir}/dist/linux", "${projectDir}/LICENSE", "${projectDir}/libraries_used.txt"
into layout.buildDirectory.dir('jpackage/blobsaver/lib')
}
}
}

Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit d5a747f

Please sign in to comment.