Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macOS-latest]
java: [ '17' ]
os: [windows-latest, ubuntu-latest, macOS-13]
java: [ '21' ]
fail-fast: false
steps:
# ____ _ __ __ ___ ____ __
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: |
mv releases/tokentool-*-1.x86_64.rpm releases/tokentool-${{ github.event.release.tag_name }}_x86_64.rpm
mv releases/tokentool_*-1_amd64.deb releases/tokentool_${{ github.event.release.tag_name }}_amd64.deb
if [ -e releases/tokentool_*1_amd64.deb ]; then mv releases/tokentool_*1_amd64.deb releases/tokentool_${{ github.event.release.tag_name }}_amd64.deb; fi
- name: Upload Linux RPM Release Asset
id: upload-release-asset-rpm
uses: actions/upload-release-asset@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/verify-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macOS-latest]
java: [ '17' ]
os: [windows-latest, ubuntu-latest, macOS-13]
java: [ '21' ]
fail-fast: false
steps:
- name: Git checkout
Expand Down
182 changes: 113 additions & 69 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import java.time.LocalDateTime
plugins {
application
java
id("org.openjfx.javafxplugin") version "0.0.13"
id("org.beryx.jlink") version "2.25.0"
id("com.diffplug.spotless") version "6.11.0"
id("org.openjfx.javafxplugin") version "0.0.14"
id("org.beryx.jlink") version "3.1.1"
id("com.diffplug.spotless") version "6.25.0"
id("io.wusa.semver-git-plugin") version "2.3.7"
}

Expand All @@ -18,10 +18,12 @@ semver {
initialVersion = "2.0.0" // (default) initial version in semantic versioning
tagType = io.wusa.TagType.LIGHTWEIGHT

branches { // list of branch configurations
branches {
// list of branch configurations
branch {
incrementer = "NO_VERSION_INCREMENTER" // NO_VERSION_INCREMENTER, PATCH_INCREMENTER, MINOR_INCREMENTER, MAJOR_INCREMENTER, CONVENTIONAL_COMMITS_INCREMENTER
formatter = Transformer<Any, io.wusa.Info> { info: io.wusa.Info -> "${info.version.major}.${info.version.minor}.${info.version.patch}" }
formatter =
Transformer<Any, io.wusa.Info> { info: io.wusa.Info -> "${info.version.major}.${info.version.minor}.${info.version.patch}" }
regex = ".+" // regex for the branch you want to configure, put this one last
}
}
Expand All @@ -35,9 +37,15 @@ val environment: String by project

// Custom properties
ext {
val os = org.gradle.internal.os.OperatingSystem.current()

if (semver.info.dirty || semver.info.version.toString().endsWith(semver.snapshotSuffix)) {
val os =
org.gradle.internal.os.OperatingSystem
.current()

if (semver.info.dirty ||
semver.info.version
.toString()
.endsWith(semver.snapshotSuffix)
) {
set("sentryDSN", "")
set("environment", "Development")
} else {
Expand All @@ -61,19 +69,19 @@ application {
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
modularity.inferModulePath.set(true)
}

javafx {
version = "17.0.2"
version = "21.0.6"
modules = listOf("javafx.base", "javafx.controls", "javafx.fxml", "javafx.swing", "javafx.graphics")
}

spotless {
java {
licenseHeaderFile("${projectDir}/spotless.license.java")
licenseHeaderFile("$projectDir/spotless.license.java")
targetExclude("**/module-info.java")
googleJavaFormat()
}
Expand All @@ -87,7 +95,6 @@ spotless {
}
}


// In this section you declare where to find the dependencies of your project
repositories {
mavenCentral()
Expand All @@ -111,7 +118,7 @@ dependencies {
implementation(group = "org.apache.pdfbox", name = "pdfbox", version = "2.0.27")

// To decrypt password/secured PDFs
implementation(group = "org.bouncycastle", name = "bcmail-jdk15on", version = "1.70")
implementation(group = "org.bouncycastle", name = "bcmail-jdk18on", version = "1.80")

// For pdf image extraction, specifically for jpeg2000 (jpx) support.
implementation(group = "com.github.jai-imageio", name = "jai-imageio-core", version = "1.4.0")
Expand All @@ -128,8 +135,9 @@ dependencies {
implementation(group = "com.google.code.gson", name = "gson", version = "2.10")
}

val sharedManifest = the<JavaPluginConvention>().manifest {
attributes(
val sharedManifest =
the<JavaPluginConvention>().manifest {
attributes(
"Implementation-Title" to project.name,
"Implementation-Version" to semver.info,
"Implementation-Vendor" to vendor,
Expand All @@ -140,20 +148,22 @@ val sharedManifest = the<JavaPluginConvention>().manifest {
"Built-JDK" to System.getProperty("java.version"),
"Source-Compatibility" to project.java.sourceCompatibility,
"Target-Compatibility" to project.java.targetCompatibility,
"Main-Class" to mainClassName
)
}
"Main-Class" to mainClassName,
)
}

tasks.jar {
manifest = project.the<JavaPluginConvention>().manifest {
from(sharedManifest)
}
manifest =
project.the<JavaPluginConvention>().manifest {
from(sharedManifest)
}
}

tasks.register<Jar>("uberJar") {
manifest = project.the<JavaPluginConvention>().manifest {
from(sharedManifest)
}
manifest =
project.the<JavaPluginConvention>().manifest {
from(sharedManifest)
}

archiveClassifier.set("uber")

Expand All @@ -172,19 +182,31 @@ tasks.register<Jar>("uberJar") {
jlink {
// We need to keep the semver down to just major.minor.patch (no -alpha.1 or -rc.1, etc) otherwise jpackage fails
val appVersion = "${semver.info.version.major}.${semver.info.version.minor}.${semver.info.version.patch}"
project.version = appVersion;

options.set(listOf("--strip-debug", "--strip-native-commands", "--compress", "2", "--no-header-files", "--no-man-pages"))
project.version = appVersion

options.set(
listOf(
"--strip-debug",
"--strip-native-commands",
"--compress",
"2",
"--no-header-files",
"--no-man-pages",
"--ignore-signing-information",
),
)

forceMerge("log4j-api", "gson")
forceMerge("log4j-api", "gson", "bcmail")

launcher {
name = "TokenTool"
jvmArgs = listOf("-Dfile.encoding=UTF-8")
}

jpackage {
val os = org.gradle.internal.os.OperatingSystem.current()
val os =
org.gradle.internal.os.OperatingSystem
.current()
// not working :(
// installerOutputDir = releaseDir
// installerOutputDir = file("releases")
Expand All @@ -195,25 +217,34 @@ jlink {
imageName = "TokenTool"

installerName = "TokenTool"
installerOptions = mutableListOf(
installerOptions =
mutableListOf(
"--verbose",
"--description", project.description,
"--copyright", "Copyright 2000-2020 RPTools.net",
"--license-file", "package/license/COPYING.AFFERO",
"--app-version", appVersion,
"--vendor", vendor
)
"--description",
project.description,
"--copyright",
"Copyright 2000-2020 RPTools.net",
"--license-file",
"package/license/COPYING.AFFERO",
"--app-version",
appVersion,
"--vendor",
vendor,
)

if (os.isWindows) {
println("Setting Windows installer options")
imageOptions.addAll(listOf("--icon", "package/windows/TokenTool.ico"))
installerOptions.addAll(listOf(
installerOptions.addAll(
listOf(
"--win-dir-chooser",
"--win-per-user-install",
"--win-shortcut",
"--win-menu",
"--win-menu-group", "RPTools"
))
"--win-menu-group",
"RPTools",
),
)
}

if (os.isMacOsX) {
Expand All @@ -224,21 +255,30 @@ jlink {
if (os.isLinux) {
println("Setting Linux installer options")
imageOptions.addAll(listOf("--icon", "package/linux/tokentool.png"))
installerOptions.addAll(listOf(
"--linux-menu-group", "RPTools",
"--linux-shortcut")
installerOptions.addAll(
listOf(
"--linux-menu-group",
"RPTools",
"--linux-shortcut",
),
)

if (installerType == "deb") {
installerOptions.addAll(listOf(
"--linux-deb-maintainer", "admin@rptools.net"
))
installerOptions.addAll(
listOf(
"--linux-deb-maintainer",
"admin@rptools.net",
),
)
}

if (installerType == "rpm") {
installerOptions.addAll(listOf(
"--linux-rpm-license-type", "AGPLv3"
))
installerOptions.addAll(
listOf(
"--linux-rpm-license-type",
"AGPLv3",
),
)
}
}
}
Expand All @@ -250,27 +290,31 @@ tasks.register<GenerateBuildProperties>("generateBuildProperties") {
}

// A task that generates various dynamic properties used at runtime
open class GenerateBuildProperties @javax.inject.Inject constructor(objects: ObjectFactory) : DefaultTask() {
@OutputDirectory
val outputDir: DirectoryProperty = objects.directoryProperty()

@TaskAction
fun compile() {
val dir = outputDir.get().asFile
val srcFile = File(dir, "build.properties")
logger.quiet("output dir = $dir")

srcFile.writeText("# Auto-Generated properties from Gradle compileJava step\n")
srcFile.appendText("# ${LocalDateTime.now()}\n\n")
srcFile.appendText("version=${project.semver.info}\n")
srcFile.appendText("vendor=${project.ext["vendor"]}\n")
srcFile.appendText("environment=${project.ext["environment"]}\n")
srcFile.appendText("sentryDSN=${project.ext["sentryDSN"]}\n")
srcFile.appendText("git-commit=${project.semver.info.shortCommit}\n")
srcFile.appendText("git-commit-sha=${project.semver.info.commit}\n")
open class GenerateBuildProperties
@javax.inject.Inject
constructor(
objects: ObjectFactory,
) : DefaultTask() {
@OutputDirectory
val outputDir: DirectoryProperty = objects.directoryProperty()

@TaskAction
fun compile() {
val dir = outputDir.get().asFile
val srcFile = File(dir, "build.properties")
logger.quiet("output dir = $dir")

srcFile.writeText("# Auto-Generated properties from Gradle compileJava step\n")
srcFile.appendText("# ${LocalDateTime.now()}\n\n")
srcFile.appendText("version=${project.semver.info}\n")
srcFile.appendText("vendor=${project.ext["vendor"]}\n")
srcFile.appendText("environment=${project.ext["environment"]}\n")
srcFile.appendText("sentryDSN=${project.ext["sentryDSN"]}\n")
srcFile.appendText("git-commit=${project.semver.info.shortCommit}\n")
srcFile.appendText("git-commit-sha=${project.semver.info.commit}\n")
}
}
}

tasks.getByName<Zip>("distZip").enabled = false
tasks.getByName<Tar>("distTar").enabled = false
tasks.named("compileJava") { dependsOn("generateBuildProperties") }
tasks.named("compileJava") { dependsOn("generateBuildProperties") }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading