This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 123
/
Copy pathjava-shared.gradle
104 lines (91 loc) · 2.36 KB
/
java-shared.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
apply plugin: 'eclipse'
apply plugin: 'com.github.ben-manes.versions'
// confugure java plugin
java {
// set target platform version
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
// generate sources and javadoc jars
withJavadocJar()
withSourcesJar()
}
// declare repositories
repositories {
mavenCentral()
}
task listRepos {
description 'Prints all repositories used for dependency resolution'
doLast {
println 'Repositories used for dependency resolution:'
rootProject.repositories.each { println "Name: ${it.name}; Url: ${it.url}" }
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
// javadoc
tasks.named('javadoc').configure {
source = sourceSets.main.allJava
title = "$project.name - $parent.name"
options {
windowTitle = "$project.name - $parent.name"
// level PRIVATE is used to validate javadoc on private members
// level PROTECTED would be sufficient for documentation purposes
//memberLevel = JavadocMemberLevel.PROTECTED
memberLevel = JavadocMemberLevel.PRIVATE
linkSource = true
encoding = 'UTF-8'
charSet = 'UTF-8'
docEncoding = 'UTF-8'
tags += [
'formatter'
]
exclude '**/*.md'
tags(
'apiNote:a:"API Note:"',
'implSpec:a:"Implementation Requirements:"',
'implNote:a:"Implementation Note:"'
)
}
options.addStringOption('Xwerror', '-quiet')
options.addStringOption('Xdoclint:-missing', '-quiet')
}
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
tasks.named('build').configure {
dependsOn javadoc
}
// apply global testing configuration
tasks.named('test').configure {
testLogging {
showStandardStreams = false
showExceptions = true
showCauses = true
showStackTraces = true
}
beforeSuite { descriptor ->
if (descriptor.className != null) {
logger.lifecycle("Testing ${descriptor.className}")
}
}
afterTest { descriptor, event ->
def msg = "${descriptor.className}.${descriptor.name} finished with ${event.resultType} (${event.endTime - event.startTime}ms)"
if (event.resultType == TestResult.ResultType.FAILURE) {
logger.error(msg, event.exception)
} else if (event.resultType == TestResult.ResultType.SKIPPED) {
logger.warn(msg)
} else {
logger.lifecycle(msg)
}
}
}
// eclipse IDE integration
eclipse {
classpath {
downloadJavadoc true
downloadSources true
}
}