forked from sebivenlo/testfx-monocle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
126 lines (104 loc) · 3.46 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
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
classpath 'org.openjfx:javafx-plugin:0.0.7'
}
}
apply plugin: 'org.openjfx.javafxplugin'
// print welcome message.
apply from: rootProject.file("gradle/welcome.gradle")
wrapper {
gradleVersion = '5.4.1'
distributionUrl = "https://services.gradle.org/distributions/" +
"gradle-${gradleVersion}-bin.zip"
}
// task to print gradle and groovy versions.
task("versions", group: "help").doLast {
println "Java version: ${System.properties["java.version"]}"
println "Gradle version: ${gradle.gradleVersion}"
println "Groovy version: ${GroovySystem.version}"
}
// task to create main and test source directories.
task("initSourceDirs", group: "build setup").doLast {
// ignore source directories for projects without source sets.
if (!project.hasProperty("sourceSets")) { return }
// list all source directories.
def sourceSets = project.sourceSets as SourceSetContainer
def sourceDirs = sourceSets*.allSource.srcDirs.flatten() as List<File>
// create source directories, for those who not exists.
for (sourceDir in sourceDirs) { sourceDir.mkdirs() }
}
// provide java tasks.
apply plugin: "java"
repositories {
jcenter()
}
javafx {
modules = [ 'javafx.controls', 'javafx.graphics' ]
version = '12.0.1'
}
// java language level.
sourceCompatibility = "9"
targetCompatibility = "9"
// configure publish tasks.
apply from: rootProject.file("gradle/publish-bintray.gradle")
// task to create jar with source code.
task("sourceJar", type: Jar) {
group "Build"
description "An archive of the source code"
classifier "sources"
from sourceSets.main.allJava
}
// task to create jar with javadocs.
task("javadocJar", type: Jar) {
group "Build"
description "An archive of the javadoc"
classifier "javadoc"
from javadoc
}
jar.finalizedBy sourceJar
jar.finalizedBy javadocJar
artifacts {
archives jar
archives sourceJar
archives javadocJar
}
compileJava {
javadoc {
options.addStringOption("Xdoclint:none", "-quiet")
options.addMultilineStringsOption('-add-exports').setValue(['javafx.graphics/com.sun.glass.ui=ALL-UNNAMED',
'javafx.graphics/com.sun.glass.events=ALL-UNNAMED',
'javafx.graphics/com.sun.glass.ui.delegate=ALL-UNNAMED',
'javafx.graphics/com.sun.glass.utils=ALL-UNNAMED',
'javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED',])
}
}
ext {
def buildTimeAndDate = new Date()
buildDate = buildTimeAndDate.format("yyyy-MM-dd")
buildTime = buildTimeAndDate.format("HH:mm:ss.SSSZ")
javaVersion = System.properties["java.version"]
javaVendor = System.properties["java.vendor"]
javaVmVersion = System.properties["java.vm.version"]
}
jar {
manifest.attributes(
"Created-By": project.javaVersion +
" (" + project.javaVendor + " " + project.javaVmVersion + ")",
"Build-Date": project.buildDate,
"Build-Time": project.buildTime,
"Specification-Title": project.name,
"Specification-Version": project.version,
"Specification-Vendor": project.vendor,
"Implementation-Title": project.name,
"Implementation-Version": project.version,
"Implementation-Vendor": project.vendor,
"Automatic-Module-Name": "org.testfx.monocle",
)
}