forked from gradle/gradle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
129 lines (104 loc) · 2.52 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
// tag::apply-java-plugin[]
plugins {
id 'java-library'
}
// tag::java-extension[]
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
// end::java-extension[]
version = '1.2.1'
// end::apply-java-plugin[]
// tag::java-dependency-mgmt[]
repositories {
mavenCentral()
}
dependencies {
implementation 'org.hibernate:hibernate-core:3.6.7.Final'
}
// end::java-dependency-mgmt[]
// tag::java-basic-test-config[]
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1'
}
test {
useJUnitPlatform()
maxHeapSize = '1G'
testLogging {
events "passed"
}
}
// end::java-basic-test-config[]
// tag::practical-integ-test-source-set[]
sourceSets {
intTest {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
}
configurations {
intTestImplementation.extendsFrom implementation
intTestRuntimeOnly.extendsFrom runtimeOnly
}
dependencies {
intTestImplementation 'org.junit.jupiter:junit-jupiter:5.7.1'
}
// end::practical-integ-test-source-set[]
// tag::using-custom-doclet[]
configurations {
asciidoclet
}
dependencies {
asciidoclet 'org.asciidoctor:asciidoclet:1.+'
}
tasks.register('configureJavadoc') {
doLast {
javadoc {
options.doclet = 'org.asciidoctor.Asciidoclet'
options.docletpath = configurations.asciidoclet.files.toList()
}
}
}
javadoc {
dependsOn configureJavadoc
}
// end::using-custom-doclet[]
// tag::skip-tests-condition[]
def skipTestsProvider = providers.gradleProperty('mySkipTests')
test.onlyIf("mySkipTests property is not set") {
!skipTestsProvider.present
}
// end::skip-tests-condition[]
// tag::java-compiler-options[]
compileJava {
options.incremental = true
options.fork = true
options.failOnError = false
}
// end::java-compiler-options[]
// tag::java-release-flag[]
compileJava {
options.release = 7
}
// end::java-release-flag[]
// tag::integ-test-task[]
tasks.register('integrationTest', Test) {
description = 'Runs integration tests.'
group = 'verification'
testClassesDirs = sourceSets.intTest.output.classesDirs
classpath = sourceSets.intTest.runtimeClasspath
shouldRunAfter test
useJUnitPlatform()
testLogging {
events "passed"
}
}
check.dependsOn integrationTest
// end::integ-test-task[]
// tag::defining-custom-javadoc-task[]
tasks.register('testJavadoc', Javadoc) {
source = sourceSets.test.allJava
}
// end::defining-custom-javadoc-task[]