|
| 1 | +plugins { |
| 2 | + java |
| 3 | + application |
| 4 | + id("org.gradlex.extra-java-module-info") version "1.13.1" |
| 5 | + id("org.gradlex.jvm-dependency-conflict-resolution") version "2.4" |
| 6 | + id("org.gradlex.java-module-dependencies") version "1.10" |
| 7 | + id("org.gradlex.java-module-packaging") version "1.1" |
| 8 | +} |
| 9 | + |
| 10 | +group = "org.jabreftest.test" |
| 11 | + |
| 12 | +// "1.0-SNAPSHOT" cannot be used; otherwise we get |
| 13 | +// java.lang.IllegalArgumentException: Version [1.0-SNAPSHOT] contains invalid component [0-SNAPSHOT] |
| 14 | +// 0.1.0 cannaot be used; otherwise we get |
| 15 | +// Bundler Mac Application Image skipped because of a configuration problem: The first number in an app-version cannot be zero or negative. |
| 16 | +version = "1.0.0" |
| 17 | + |
| 18 | +repositories { |
| 19 | + mavenCentral() |
| 20 | +} |
| 21 | + |
| 22 | +val javafx = "25" |
| 23 | +val junitVersion = "5.13.4" |
| 24 | + |
| 25 | +java { |
| 26 | + toolchain { |
| 27 | + languageVersion.set(JavaLanguageVersion.of(25)) |
| 28 | + } |
| 29 | +} |
| 30 | + |
| 31 | +tasks.withType<JavaCompile>().configureEach { |
| 32 | + options.encoding = "UTF-8" |
| 33 | +} |
| 34 | + |
| 35 | +application { |
| 36 | + mainModule.set("javafx.reproducer") |
| 37 | + mainClass.set("org.jabreftest.test.javafxreproducer.HelloApplication") |
| 38 | +} |
| 39 | + |
| 40 | +dependencies { |
| 41 | + implementation("org.openjfx:javafx-controls:$javafx") |
| 42 | + implementation("org.openjfx:javafx-fxml:$javafx") |
| 43 | + testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion") |
| 44 | + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion") |
| 45 | +} |
| 46 | + |
| 47 | +tasks.test { |
| 48 | + useJUnitPlatform() |
| 49 | +} |
| 50 | + |
| 51 | +jvmDependencyConflicts.patch { |
| 52 | + listOf("base", "controls", "fxml", "graphics").forEach { jfxModule -> |
| 53 | + module("org.openjfx:javafx-$jfxModule") { |
| 54 | + addTargetPlatformVariant("", "none", "none") // matches the empty Jars: to get better errors |
| 55 | + addTargetPlatformVariant("linux", OperatingSystemFamily.LINUX, MachineArchitecture.X86_64) |
| 56 | + addTargetPlatformVariant("linux-aarch64", OperatingSystemFamily.LINUX, MachineArchitecture.ARM64) |
| 57 | + addTargetPlatformVariant("mac", OperatingSystemFamily.MACOS, MachineArchitecture.X86_64) |
| 58 | + addTargetPlatformVariant("mac-aarch64", OperatingSystemFamily.MACOS, MachineArchitecture.ARM64) |
| 59 | + addTargetPlatformVariant("win", OperatingSystemFamily.WINDOWS, MachineArchitecture.X86_64) |
| 60 | + } |
| 61 | + } |
| 62 | +} |
| 63 | + |
| 64 | +extraJavaModuleInfo { |
| 65 | + failOnAutomaticModules = true |
| 66 | + failOnModifiedDerivedModuleNames = true |
| 67 | + skipLocalJars = true |
| 68 | +} |
| 69 | + |
| 70 | +// Source: https://github.com/jjohannes/java-module-system/blob/main/gradle/plugins/src/main/kotlin/targets.gradle.kts |
| 71 | +// Configure variants for OS. Target name can be any string, but should match the name used in GitHub actions. |
| 72 | +javaModulePackaging { |
| 73 | + // Configuration shared by all targets and applications |
| 74 | + vendor = "JabRef" |
| 75 | + jlinkOptions.addAll( |
| 76 | + "--strip-debug", "--compress", "2", "--no-header-files", "--no-man-pages" |
| 77 | + // "--ignore-signing-information", |
| 78 | + // "--compress", "zip-6", |
| 79 | + // "--no-header-files", |
| 80 | + // "--no-man-pages", |
| 81 | + // "--bind-services", |
| 82 | + ) |
| 83 | + |
| 84 | + target("ubuntu-22.04") { |
| 85 | + operatingSystem = OperatingSystemFamily.LINUX |
| 86 | + architecture = MachineArchitecture.X86_64 |
| 87 | + packageTypes = listOf("app-image", "deb", "rpm") |
| 88 | + } |
| 89 | + target("ubuntu-22.04-arm") { |
| 90 | + operatingSystem = OperatingSystemFamily.LINUX |
| 91 | + architecture = MachineArchitecture.ARM64 |
| 92 | + packageTypes = listOf("app-image", "deb", "rpm") |
| 93 | + } |
| 94 | + target("macos-13") { |
| 95 | + operatingSystem = OperatingSystemFamily.MACOS |
| 96 | + architecture = MachineArchitecture.X86_64 |
| 97 | + packageTypes = listOf("app-image", "dmg", "pkg") |
| 98 | + singleStepPackaging = true |
| 99 | + } |
| 100 | + target("macos-14") { |
| 101 | + operatingSystem = OperatingSystemFamily.MACOS |
| 102 | + architecture = MachineArchitecture.ARM64 |
| 103 | + packageTypes = listOf("app-image", "dmg", "pkg") |
| 104 | + singleStepPackaging = true |
| 105 | + } |
| 106 | + target("windows-latest") { |
| 107 | + operatingSystem = OperatingSystemFamily.WINDOWS |
| 108 | + architecture = MachineArchitecture.X86_64 |
| 109 | + packageTypes = listOf("app-image", "msi") |
| 110 | + } |
| 111 | +} |
0 commit comments