/
build.gradle
212 lines (185 loc) · 6.93 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
import java.text.SimpleDateFormat
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'com.google.osdetector' version '1.7.3'
id 'org.javamodularity.moduleplugin' version '1.8.12'
id 'org.beryx.jlink' version '2.25.0'
id 'net.nemerosa.versioning' version '3.0.0'
}
apply plugin: 'maven-publish'
apply plugin: 'signing'
description = 'AppleFX is a JavaFX library containing controls that look like the ones used in ios and macos'
mainClassName = "$moduleName/eu.hansolo.applefx.Launcher"
Date buildTimeAndDate = new Date()
ext {
moduleName = 'eu.hansolo.applefx'
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")
}
repositories {
mavenCentral()
}
dependencies {
implementation "org.openjfx:javafx-base:${javafxVersion}:${platform}"
implementation "org.openjfx:javafx-graphics:${javafxVersion}:${platform}"
implementation "org.openjfx:javafx-controls:${javafxVersion}:${platform}"
implementation "org.openjfx:javafx-swing:${javafxVersion}:${platform}"
implementation "eu.hansolo:jdktools:17.0.33"
implementation "eu.hansolo:toolbox:17.0.57"
implementation "eu.hansolo:toolboxfx:17.0.47"
}
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' : project.description,
'Bundle-SymbolicName' : 'eu.hansolo.applefx',
'Export-Package' : 'eu.hansolo.applefx.event, eu.hansolo.applefx.fonts, eu.hansolo.applefx.tools',
'Class-Path' : configurations.runtimeClasspath.files.collect { it.getName() }.join(' '),
'Main-Class' : 'eu.hansolo.applefx.Launcher'
)
}
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
// start the from gradle
task Demo(type: JavaExec) {
main = "eu.hansolo.applefx.Launcher"
classpath = sourceSets.main.runtimeClasspath
}
task Test(type: JavaExec) {
main = "eu.hansolo.applefx.TestLauncher"
classpath = sourceSets.main.runtimeClasspath
}
// Fix problems with loading resources
/*
sourceSets {
main {
output.setResourcesDir(java.outputDir)
}
}
*/
run {
inputs.property("moduleName", moduleName)
doFirst {
jvmArgs = [
'--module-path', classpath.asPath,
'--module', mainClassName
]
classpath = files()
}
}
// create one jar for the javadoc
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
// create one jar for the source files
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
signing {
if (gpgkey && gpgpassphrase) {
useInMemoryPgpKeys(gpgkey, gpgpassphrase)
}
sign configurations.archives
sign publishing.publications
}
publishing {
publications {
mavenCustom(MavenPublication) {
group = 'eu.hansolo'
artifactId = 'applefx'
version = "${version}"
from components.java
artifact sourcesJar
artifact javadocJar
pom.withXml {
asNode().dependencies.'*'.findAll {
it.groupId.text() == 'org.openjfx'
}.each {
it.remove(it.classifier)
}
}
pom {
name = 'Countries'
description = 'AppleFX is a JavaFX library containing controls that look like the ones used in ios and macos'
url = "https://github.com/HanSolo/applefx/wiki"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "HanSolo"
name = "Gerrit Grunwald"
email = "han.solo@mac.com"
}
}
scm {
connection = "scm:git:https://HanSolo/applefx"
developerConnection = "scm:git:https://HanSolo/applefx"
url = "https://github.com/HanSolo/applefx"
}
}
}
}
repositories {
maven {
name = "OSSRH"
url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
credentials {
username = null == ciOssrhUsername ? ossrhUsername : ciOssrhUsername
password = null == ciOssrhPassword ? ossrhPassword : ciOssrhPassword
}
}
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/HanSolo/applefx"
credentials {
username = null == ciGHUser ? ghUser : ciGHUser
password = null == ciGHToken ? ghToken : ciGHToken
}
}
}
}