forked from HanSolo/JDKMon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
170 lines (150 loc) · 5.42 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
import java.text.SimpleDateFormat
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.google.gradle:osdetector-gradle-plugin:1.7.0'
classpath 'org.javamodularity:moduleplugin:1.8.10'
classpath 'org.beryx:badass-jlink-plugin:2.24.4'
}
}
plugins {
id 'java-library'
id 'application'
id 'com.google.osdetector' version '1.7.0'
id 'org.javamodularity.moduleplugin' version '1.8.10'
id 'org.beryx.jlink' version '2.24.4'
id 'net.nemerosa.versioning' version '2.15.1'
}
normalization {
runtimeClasspath {
ignore('/META-INF/MANIFEST.MF')
}
}
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
Date buildTimeAndDate = new Date()
ext {
buildDate = new SimpleDateFormat('yyyy-MM-dd').format(buildTimeAndDate)
buildTime = new SimpleDateFormat('HH:mm:ss.SSSZ').format(buildTimeAndDate)
platform = osdetector.os == 'osx' ? osdetector.arch == 'aarch_64' ? 'mac-aarch64' : 'mac' : osdetector.os == 'windows' ? 'win' : osdetector.os == 'linux' ? osdetector.arch == 'aarch_64' ? 'linux-aarch64' : 'linux' : osdetector.os
ciOssrhUsername = System.getenv('OSSRH_USERNAME')
ciOssrhPassword = System.getenv('OSSRH_PASSWORD')
ciGHUser = System.getenv('GH_USER')
ciGHToken = System.getenv('GH_TOKEN')
gpgkey = System.getenv("GPG_PRIVATE_KEY")
gpgpassphrase = System.getenv("PASSPHRASE")
}
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'io.foojay.api:discoclient:2.0.21'
implementation 'eu.hansolo:jdktools:17.0.11'
implementation 'com.google.gradle:osdetector-gradle-plugin:1.7.0'
implementation 'com.dustinredmond.fxtrayicon:FXTrayIcon:3.1.2'
implementation "org.openjfx:javafx-base:${javafxVersion}:${platform}"
implementation "org.openjfx:javafx-graphics:${javafxVersion}:${platform}"
implementation "org.openjfx:javafx-controls:${javafxVersion}:${platform}"
}
mainClassName = '$moduleName/eu.hansolo.fx.jdkmon.Launcher'
ext.moduleName = 'eu.hansolo.fx.jdkmon'
mainClassName = 'eu.hansolo.fx.jdkmon.Launcher'
description = 'JDKMon is a little tool written in JavaFX that will help you to keep track of updates for your installed distributions of OpenJDK'
jar {
from {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
} {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
manifest {
attributes(
'Built-By' : System.properties['user.name'],
'Created-By' : System.properties['java.version'] + " (" + System.properties['java.vendor'] + " " + System.properties['java.vm.version'] + ")",
'Build-Date' : project.buildDate,
'Build-Time' : project.buildTime,
'Build-Revision' : versioning.info.commit,
'Specification-Title' : project.name,
'Specification-Version' : project.version,
'Implementation-Title' : project.name,
'Implementation-Version': project.version,
'Bundle-Name' : project.name,
'Bundle-License' : 'https://www.apache.org/licenses/LICENSE-2.0;description=Apache License Version 2.0;link=https://spdx.org/licenses/Apache-2.0.html',
'Bundle-Description' : description,
'Bundle-SymbolicName' : 'eu.hansolo.fx.jdkmon',
'Class-Path' : '${project.name}-${project.version}.jar',
'Main-Class' : 'eu.hansolo.fx.jdkmon.Launcher'
)
}
}
/*
tasks.register('uberJar', Jar) {
archiveClassifier = 'uber'
from sourceSets.main.output
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
}
}
*/
jlink {
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
launcher {
name = 'eu.hansolo.fx.jdkmon'
}
}
/*
tasks.withType(JavaCompile) {
options.compilerArgs += "--enable-preview"
}
tasks.withType(Test) {
jvmArgs += "--enable-preview"
}
tasks.withType(JavaExec) {
jvmArgs += "--enable-preview"
}
*/
// start the from gradle
task Main(type: JavaExec) {
mainClass = "eu.hansolo.fx.jdkmon.Launcher"
classpath = sourceSets.main.runtimeClasspath
}
// create properties file including the version
task createProperties(dependsOn: processResources) {
doLast {
new File("$buildDir//classes/java/main/eu/hansolo/fx/jdkmon/version.properties").withWriter { w ->
Properties p = new Properties()
p['version'] = project.version.toString()
p.store w, null
}
}
}
classes {
dependsOn createProperties
}
// Fix problems with loading resources
sourceSets {
main {
output.setResourcesDir(java.classesDirectory)
}
}
run {
inputs.property("moduleName", moduleName)
doFirst {
jvmArgs = [
'--module-path', classpath.asPath,
'--module', mainClassName
]
classpath = files()
}
}