forked from oss-review-toolkit/ort
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
177 lines (143 loc) · 4.55 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
plugins {
// We need to hard-code the version here because of
// https://github.com/gradle/gradle/issues/1697
id 'org.jetbrains.kotlin.jvm' version '1.2.31' apply false
id 'org.jetbrains.dokka' version '0.9.16' apply false
// Note that the detekt Gradle plugin version does not necessarily
// match the detekt tool version.
id 'io.gitlab.arturbosch.detekt' version '1.0.0.RC6-4' apply false
id 'com.github.ben-manes.versions' version '0.17.0' apply false
}
subprojects {
buildscript {
repositories {
jcenter()
}
}
// Apply third-party plugins.
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'org.jetbrains.dokka'
apply plugin: 'io.gitlab.arturbosch.detekt'
apply plugin: 'com.github.ben-manes.versions'
// Apply core plugins.
apply plugin: 'jacoco'
dependencyUpdates.resolutionStrategy = {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean isNonFinalVersion = ['alpha', 'beta', 'rc', 'cr', 'm'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
}
if (isNonFinalVersion) {
selection.reject('Release candidate')
}
}
}
}
sourceSets {
funTest {
kotlin.srcDirs 'src/funTest/kotlin'
}
}
repositories {
jcenter()
}
dependencies {
compile 'org.jetbrains.kotlin:kotlin-stdlib-jre8:1.2.31'
testCompile "io.kotlintest:kotlintest:$kotlintestVersion"
testCompile project(':utils-test')
funTestCompile sourceSets.main.output
funTestCompile sourceSets.test.output
funTestCompile configurations.testCompile
funTestRuntime configurations.testRuntime
funTestCompile "io.kotlintest:kotlintest:$kotlintestVersion"
funTestCompile project(':utils-test')
}
// TODO: Remove this once jackson-module-kotlin and kotlintest are updated.
configurations.all {
resolutionStrategy {
force 'org.jetbrains.kotlin:kotlin-reflect:1.2.31'
}
}
compileKotlin {
kotlinOptions {
allWarningsAsErrors = true
jvmTarget = '1.8'
apiVersion = '1.2'
}
}
compileTestKotlin {
kotlinOptions {
allWarningsAsErrors = true
jvmTarget = '1.8'
apiVersion = '1.2'
}
}
detekt {
version = '1.0.0.RC6-4'
profile('main') {
config = '../detekt.yml'
}
}
test {
testLogging {
events 'started', 'passed', 'skipped', 'failed'
exceptionFormat 'full'
}
}
task funTest(type: Test) {
description = 'Runs the functional tests.'
group = 'Verification'
classpath = sourceSets.funTest.runtimeClasspath
testClassesDirs = sourceSets.funTest.output.classesDirs
systemProperties = [
includeTags: System.getProperty("includeTags"),
excludeTags: System.getProperty("excludeTags")
]
testLogging {
events 'started', 'passed', 'skipped', 'failed'
exceptionFormat 'full'
}
}
jacoco {
toolVersion = '0.8.0'
}
gradle.taskGraph.whenReady { graph ->
def enabled = graph.allTasks.any { it instanceof JacocoReport }
tasks.withType(Test) {
jacoco.enabled = enabled
}
}
task funTestCoverage(type: JacocoReport, dependsOn: funTest) {
description = 'Generates the code coverage report for the functional tests.'
group = 'Reporting'
executionData funTest
sourceSets sourceSets.main
reports {
// Enable XML in addition to HTML for CI integration.
xml.enabled true
}
}
check.dependsOn detektCheck
check.dependsOn funTest
task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
outputFormat = 'javadoc'
outputDirectory = "$buildDir/javadoc"
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task dokkaJar(type: Jar, dependsOn: dokka) {
classifier = 'dokka'
from dokka.outputDirectory
}
task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
classifier = 'javadoc'
from dokkaJavadoc.outputDirectory
}
artifacts {
archives sourcesJar
archives dokkaJar
archives javadocJar
}
}