From 9544630b808c625442938c48dd9ced2f9522bc0b Mon Sep 17 00:00:00 2001 From: Martin Paljak Date: Tue, 25 Jul 2023 21:26:15 +0300 Subject: [PATCH] Use Conveyor to package an update the desktop version (#7) * Conveyor experiments * Conveyor changes, module fixes --- .github/workflows/robot.yml | 2 +- Makefile | 3 ++ build.gradle | 34 +++++++-------- conveyor.conf | 75 ++++++++++++++++++++++++++++++++++ src/main/java/module-info.java | 2 +- version.txt | 5 ++- 6 files changed, 101 insertions(+), 20 deletions(-) create mode 100644 Makefile create mode 100644 conveyor.conf diff --git a/.github/workflows/robot.yml b/.github/workflows/robot.yml index bdf90e2..f6db8f3 100644 --- a/.github/workflows/robot.yml +++ b/.github/workflows/robot.yml @@ -25,7 +25,7 @@ jobs: distribution: zulu cache: 'gradle' - name: Package - run: date +%y%m%d > version.txt && ./gradlew --no-daemon jar + run: date +%y.%m.%d.${{github.run_number}} > version.txt && ./gradlew --no-daemon shadowJar - uses: actions/upload-artifact@v3 with: name: jar diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..262af6d --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +conveyor: + ./gradlew clean shadowJar + conveyor make site --overwrite diff --git a/build.gradle b/build.gradle index cdb4dd8..e7c7d4a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,13 @@ plugins { id 'application' + id 'com.github.johnrengelman.shadow' version '8.1.1' id 'org.openjfx.javafxplugin' version '0.0.14' id 'com.palantir.git-version' version '3.0.0' // for gitVersion() + id 'dev.hydraulic.conveyor' version '1.6' id 'org.beryx.jlink' version '2.25.0' - // id 'com.gluonhq.client-gradle-plugin' version '0.1.42' - // id 'com.gluonhq.gluonfx-gradle-plugin' version '1.0.16' } +// Cheap enforcer +assert JavaVersion.current().equals(JavaVersion.VERSION_17) group 'pro.javacard.nfc4pc' version = file('version.txt').text.trim() @@ -21,6 +23,12 @@ repositories { mavenCentral() } +java { + toolchain { + languageVersion = JavaLanguageVersion.of(17) + } +} + compileJava { sourceCompatibility = '17' targetCompatibility = '17' @@ -32,17 +40,6 @@ javafx { //configuration = 'compileOnly' } -jlink { - launcher { - name = 'nfc4pc' - } -} - -//gluonClient { -// reflectionList = ["pro.javacard.nfc4pc.MainWrapper"] -//} - - application { mainModule = "pro.javacard.nfc4pc" mainClass = "pro.javacard.nfc4pc.MainWrapper" @@ -53,12 +50,15 @@ jar { attributes 'Main-Class': application.mainClass attributes 'Implementation-Version': gitVersion() } - from { - configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } - } - duplicatesStrategy = DuplicatesStrategy.INCLUDE +// from { +// configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } +// } +// duplicatesStrategy = DuplicatesStrategy.INCLUDE } +shadowJar { + archiveClassifier.set('') +} dependencies { testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' diff --git a/conveyor.conf b/conveyor.conf new file mode 100644 index 0000000..3585191 --- /dev/null +++ b/conveyor.conf @@ -0,0 +1,75 @@ +// This is a hashbang include. You can run the command after the #! to see what +// configuration is being extracted from the Gradle build using the Conveyor plugin. +include "#!./gradlew -q printConveyorConfig" + +// Config file documentation: https://conveyor.hydraulic.dev/latest/configs +app { + display-name = "NFC4PC" + rdns-name = "pro.javacard.nfc4pc" + vcs-url = "https://github.com/martinpaljak/NFC4PC" + // Windows gets square icons, macOS and Linux icons with rounded corners. + icons = { + label = "NFC" + } + license = "LGPL-3.0-only" + contact-email = "martin@martinpaljak.net" + + // Ensure the icons are also included as data files so we can set the window icon. + // See the method HelloApplication.loadIconsFromStage() + + windows.inputs += TASK/rendered-icons/windows + linux.inputs += TASK/rendered-icons/linux + + // Check for and apply updates synchronously on every app launch instead of in the background. + // Consider removing this line for your own app! + updates = aggressive + + // For iteration speed. Remove for release. + compression-level = low + + machines = ["mac"] +} + +app.site { + display-name = "Download NFC4PC" + + # Where the installed packages can check for online updates. + base-url = "localhost:3000" + + # Import an HTML template or additional files to the generated site. + #inputs += "my-template-dir/*" -> . + + # Change the set of images used for the logo, as found in the resolved inputs. + #icons = "my-icons-*.png" + + # Which keys appear in the metadata.properties file in the generated site. + export-keys = [ app.version, app.revision ] + + # HTML to add into the area. + extra-header-html = """ + + """ + + # Directory to upload/copy the site to over SFTP. + copy-to = "mrtn@mrtn.ee:public_html/nfc4pc/" + + # Whether to show the "Packaged by Conveyor" badge at the bottom of the download page. + # Can only be disabled for commercial products. + # Open source projects are required to advertise the fact that they're packaged with Conveyor. + show-conveyor-badge = true +} + +app.jvm { + constant-app-arguments = "--desktop" + #modules += "java.{desktop,logging,net.http}" +} + +app.mac { + info-plist { + LSUIElement = 1 + } +} + +conveyor.compatibility-level = 11 diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 2529aed..9d3dd51 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,7 +1,7 @@ module pro.javacard.nfc4pc { requires javafx.controls; requires javafx.graphics; - requires javafx.swingEmpty; + requires javafx.swing; requires apdu4j.pcsc; requires apdu4j.core; requires java.desktop; diff --git a/version.txt b/version.txt index 5b69858..51b0aec 100644 --- a/version.txt +++ b/version.txt @@ -1 +1,4 @@ -next +23.07.25.3 + + +