forked from TestFX/Monocle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
115 lines (94 loc) · 3.47 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
//-------------------------------------------------------------------------------------------------
// GRADLE PLUGINS.
//-------------------------------------------------------------------------------------------------
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6"
}
}
//-------------------------------------------------------------------------------------------------
// BASIC CONFIGURATION.
//-------------------------------------------------------------------------------------------------
// print welcome message.
apply from: rootProject.file("gradle/welcome.gradle")
// task to add gradle wrapper files.
task("wrapper", type: Wrapper, group: "build setup") {
gradleVersion = "2.12"
distributionUrl = "https://services.gradle.org/distributions/" +
"gradle-${gradleVersion}-all.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() }
}
//-------------------------------------------------------------------------------------------------
// ROOT PROJECT.
//-------------------------------------------------------------------------------------------------
// provide java tasks.
apply plugin: "java"
// java language level.
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
// configure publish tasks.
apply from: rootProject.file("gradle/publish.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
}
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
)
}
javadoc {
options.addStringOption("Xdoclint:none", "-quiet")
}