-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
123 lines (101 loc) · 4.27 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
plugins {
id 'groovy'
id 'application'
id 'io.micronaut.minimal.application' version '3.4.0'
id 'org.javamodularity.moduleplugin' version '1.8.10'
id 'org.openjfx.javafxplugin' version '0.0.13'
id 'org.beryx.jlink' version '2.25.0'
id 'com.gluonhq.gluonfx-gradle-plugin' version '1.0.15'
}
def appName = 'SupernautFX Hello'
version = helloAppVersion
mainClassName = 'app.supernaut.fx.sample.gradle.HelloFX'
application {
mainModule = 'hellofx'
mainClass = 'app.supernaut.fx.sample.gradle.HelloFX'
}
repositories {
mavenCentral()
maven { url 'https://gitlab.com/api/v4/projects/26584840/packages/maven' /* gitlab-supernaut-maven */ }
}
dependencies {
implementation "app.supernaut:app.supernaut.fx:${supernautVersion}" // Supernaut.FX and FxLauncher API
implementation "org.slf4j:slf4j-api:${slf4jVersion}" // Logging API
implementation "jakarta.inject:jakarta.inject-api" // For @Singleton annotation, etc.
runtimeOnly "app.supernaut:app.supernaut.fx.micronaut:${supernautVersion}" // Micronaut-based implementation of FxLauncher
runtimeOnly "org.slf4j:slf4j-jdk14:${slf4jVersion}" // Implementation of slf4j-api
constraints {
implementation("io.micronaut:micronaut-inject:${micronautVersion}") {
because 'We want the `micronautVersion` setting in `gradle.properties` to allow overriding the transitive version from `app.supernaut.fx.micronaut`'
}
}
testImplementation "org.spockframework:spock-core:${spockVersion}" // We are planning on adding some sample Spock tests in the future
testRuntimeOnly "net.bytebuddy:byte-buddy:1.11.20" // allows Spock to mock classes (in addition to interfaces)
testRuntimeOnly "org.objenesis:objenesis:3.2" // Allow Spock to mock classes with constructor arguments
}
configurations.all {
exclude group: 'javax.annotation', module: "javax.annotation-api"
exclude group: 'org.yaml', module: "snakeyaml"
}
micronaut {
version = "${micronautVersion}"
runtime "none"
}
javafx {
version = javaFxVersion
modules = ['javafx.graphics', 'javafx.controls', 'javafx.fxml']
}
modularity.disableEffectiveArgumentsAdjustment()
compileJava {
options.release = 11
options.compilerArgs << '-Xlint:deprecation' << '-Xlint:unchecked'
}
test {
useJUnitPlatform() // We're using Spock 2.0 and JUnit 5
moduleOptions {
runOnClasspath = true
}
}
run {
moduleOptions {
addModules = ['app.supernaut.fx.micronaut']
}
}
def os = org.gradle.internal.os.OperatingSystem.current()
jlink {
addExtraDependencies("javafx")
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages', '--add-modules', 'app.supernaut.fx.micronaut,org.slf4j.jul']
launcher {
name = appName
jvmArgs = []
}
mergedModule {
requires 'org.slf4j'
requires 'jakarta.inject'
requires 'jakarta.annotation'
uses 'io.micronaut.core.optim.StaticOptimizations.Loader'
}
jpackage {
skipInstaller = false
// Which installers to make
if (os.linux) {
installerType = null // default is ['rpm', 'deb']
} else if (os.macOsX) {
installerType = 'dmg' // default is ['pkg', 'dmg']
} else if (os.windows) {
installerType = 'exe' // default is ['exe', 'msi']
}
def appVersionForJpackage = version // Be careful here, some version strings won't work with all installers
imageOptions = ["--verbose", "--app-version", appVersionForJpackage]
installerOptions = ["--app-version", appVersionForJpackage]
if (os.macOsX) {
// No resource-dir for now // imageOptions += [ '--resource-dir', "${projectDir}/src/macos/resource-dir" ]
if (signMacOS.toBoolean()) {
logger.warn "Setting --mac-sign in jpackage imageOptions"
imageOptions += [ '--mac-sign' ]
}
} else if (os.windows) {
installerOptions += ['--win-dir-chooser', '--win-menu', '--win-shortcut']
}
}
}