forked from JFXtras/jfxtras
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
302 lines (265 loc) · 9.17 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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
plugins {
id 'com.github.johnrengelman.shadow' version '2.0.2'
}
ext {
apiProject = false
}
allprojects {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'eclipse'
apply plugin: 'idea'
// force source/target compatibility
tasks.withType(JavaCompile) {
sourceCompatibility = rootProject.sourceCompatibility
targetCompatibility = rootProject.targetCompatibility
}
// apply vrl license header plugin
// if (!project.plugins.findPlugin(eu.mihosoft.vrl.vlicenseheaderutil.gradle.VLicenseHeaderPlugin)) {
// project.apply(plugin: eu.mihosoft.vrl.vlicenseheaderutil.gradle.VLicenseHeaderPlugin)
// }
// // license template (will be used as header in all Java source files)
// repairHeaders.licenseHeaderText = new File(projectDir,"../license-template.txt")
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
url 'http://oss.sonatype.org/content/repositories/releases/'
}
}
signing {
sign configurations.archives
}
signArchives.onlyIf {
project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')
}
uploadArchives.onlyIf {
project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')
}
uploadArchives {
if (!project.hasProperty('sonatypeUsername') || !project.hasProperty('sonatypePassword')) {
return
}
repositories.mavenDeployer {
beforeDeployment {
MavenDeployment deployment -> signing.signPom(deployment)
}
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots') {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom.project {
artifactId "${project.name}"
name "${project.name}"
url 'http://jfxtras.org'
description 'Miscellaneous components for JavaFX'
packaging 'jar'
licenses {
license {
name 'BSD'
url 'http://www.opensource.org/licenses/bsd-license.php'
distribution 'repo'
}
}
scm {
url 'scm:[email protected]:jfxtras/jfxtras.git'
connection 'scm:[email protected]:jfxtras/jfxtras.git'
developerConnection 'scm:[email protected]:jfxtras/jfxtras.git'
}
developers {
developer { name 'Tom Eugelink' }
}
}
}
}
}
subprojects {
// Needed until Gradle supports class-scanning for Java 9
tasks.withType(Test) {
scanForTestClasses = false
include '**/*Test.class'
include '**/*Test1.class'
exclude 'jfxtras/labs/test/JFXtrasGuiTest.class'
}
apply from: rootProject.file('gradle/javadoc.gradle')
// Force Java 9 in Eclipse config
// https://docs.gradle.org/current/dsl/org.gradle.plugins.ide.eclipse.model.EclipseClasspath.html
eclipse {
classpath {
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-9/' // Add correct container
file {
whenMerged { classpath ->
classpath.entries.removeAll { entry -> entry.kind == 'con' && !entry.path.contains('JavaSE-9')} // Remove all other containers
classpath.entries.findAll{ it.kind == 'src' && it.entryAttributes['gradle_used_by_scope'].equals('test') }.each { // Mark test folders as containing test sourcers
it.entryAttributes['test'] = 'true'
}
}
}
}
jdt {
sourceCompatibility = org.gradle.api.JavaVersion.VERSION_1_9
targetCompatibility = org.gradle.api.JavaVersion.VERSION_1_9
}
}
tasks.eclipse.dependsOn(cleanEclipse)
// follow advise from https://guides.gradle.org/building-java-9-modules/
afterEvaluate {
if (project.moduleName == 'jfxtras.test.support') {
// skip module configuration for now
return
}
compileJava {
inputs.property('moduleName', moduleName)
doFirst {
options.compilerArgs = [
'--module-path', classpath.asPath,
]
classpath = files()
}
}
/* TODO: FIX how testing should be configured
compileTestJava {
inputs.property('moduleName', moduleName)
doFirst {
options.compilerArgs = [
'--module-path', classpath.asPath,
'--add-modules', 'junit',
'--add-reads', "$moduleName=junit",
'--patch-module', "$moduleName=" + files(sourceSets.test.java.srcDirs).asPath,
]
classpath = files()
}
}
test {
inputs.property('moduleName', moduleName)
doFirst {
jvmArgs = [
'--module-path', classpath.asPath,
'--add-modules', 'ALL-MODULE-PATH',
'--add-reads', "$moduleName=junit",
'--patch-module', "$moduleName=" + files(sourceSets.test.java.outputDir).asPath,
]
classpath = files()
}
}
*/
}
}
project(':jfxtras-agenda') {
project.ext.apiProject = true
project.moduleName = 'jfxtras.agenda'
dependencies {
compile project(':jfxtras-controls')
testCompile project(':jfxtras-test-support')
}
}
project(':jfxtras-common') {
project.ext.apiProject = true
project.moduleName = 'jfxtras.common'
dependencies {
testCompile project(':jfxtras-test-support')
}
}
project(':jfxtras-controls') {
project.ext.apiProject = true
project.moduleName = 'jfxtras.controls'
dependencies {
compile project(':jfxtras-common')
compile project(':jfxtras-fxml')
testCompile project(':jfxtras-test-support')
}
}
project(':jfxtras-icalendarfx') {
project.ext.apiProject = true
project.moduleName = 'jfxtras.icalendarfx'
dependencies {
testCompile project(':jfxtras-test-support')
}
}
project(':jfxtras-icalendaragenda') {
project.ext.apiProject = true
project.moduleName = 'jfxtras.icalendaragenda'
dependencies {
compile project(':jfxtras-agenda')
compile project(':jfxtras-controls')
compile project(':jfxtras-icalendarfx')
testCompile project(':jfxtras-test-support')
}
}
project(':jfxtras-menu') {
project.ext.apiProject = true
project.moduleName = 'jfxtras.menu'
dependencies {
compile project(':jfxtras-common')
testCompile project(':jfxtras-test-support')
}
}
project(':jfxtras-gauge-linear') {
project.ext.apiProject = true
project.moduleName = 'jfxtras.gauge.linear'
dependencies {
compile project(':jfxtras-common')
testCompile project(':jfxtras-test-support')
}
}
project(':jfxtras-font-roboto') {
project.ext.apiProject = true
project.moduleName = 'jfxtras.font.roboto'
dependencies {
testCompile project(':jfxtras-test-support')
}
}
project(':jfxtras-test-support') {
project.moduleName = 'jfxtras.test.support' // use a name even if no actual module exists
// must configure the following dependencies with modules instead
dependencies {
compile "junit:junit:$junitVersion"
compile "org.mockito:mockito-all:$mockitoVersion"
compile "org.testfx:testfx-core:testfxVersion"
compile "org.testfx:testfx-junit:$testfxVersion", {
exclude group: 'junit', module: 'junit'
}
}
}
// wait for every subproject to be configured before reconfiguring root project
evaluationDependsOnChildren()
// find all api projects
ext.apiProjects = subprojects.findAll { prj -> prj.apiProject }.name
// mark all apiProjects as dependencies
project(':') {
dependencies {
apiProjects.each { projectName -> compile project(projectName) }
}
}
// apply common settings affecting javadoc/sources
apply from: rootProject.file('gradle/javadoc.gradle')
// copy all sources to a single directory
task copyDocs(type: Copy) {
destinationDir = "${buildDir}/sources" as File
project.apiProjects.each { projectName ->
from(project(projectName).sourceSets.main.allSource)
}
}
// update dependencies on javadoc task
javadoc {
dependsOn copyDocs
include '**/*.java'
source = copyDocs.destinationDir
}
// update sourcesJar
sourcesJar {
dependsOn copyDocs
from copyDocs.destinationDir
}
// configure shadowJar
shadowJar {
classifier = '' // do not append "-all", so the generated shadow jar replaces the existing jfxtras-all.jar (instead of generating jfxtras-all-all.jar)
}
jar.finalizedBy shadowJar