forked from arrow-kt/arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
260 lines (218 loc) · 8.36 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
/*
* Copyright (C) 2017 The Arrow Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.github.benmanes.gradle.versions.reporter.PlainTextReporter
buildscript {
ext {
// Constants
ankKotlinVersion = '1.3.11'
dokka_version = '0.9.18'
ktlint_version = '7.3.0'
gradleVersionsPluginVersion = '0.21.0'
jUnitVersion = '4.12'
jUnitVintageVersion = '5.4.0'
javaVersion = JavaVersion.VERSION_1_7
kotlinPoetVersion = '1.1.0'
kotlinTestVersion = '3.3.1'
kotlinVersion = '1.3.21'
kotlinxCollectionsImmutableVersion = '0.1'
kotlinxCoroutinesVersion = '1.1.1'
projectReactorVersion = '3.2.6.RELEASE'
retrofitVersion = '2.5.0'
rxJavaVersion = '2.2.7'
}
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
jcenter()
maven { url "https://dl.bintray.com/kotlin/kotlin-dev" }
maven { url "https://dl.bintray.com/jetbrains/markdown/" }
maven { url "https://dl.bintray.com/arrow-kt/arrow-kt/" }
}
dependencies {
classpath "com.github.ben-manes:gradle-versions-plugin:$gradleVersionsPluginVersion"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'io.arrow-kt:ank-gradle-plugin:0.7.1'
classpath 'org.ajoberstar:gradle-git-publish:2.0.0'
classpath "net.rdrei.android.buildtimetracker:gradle-plugin:0.11.1"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
classpath "me.champeau.gradle:jmh-gradle-plugin:0.4.7"
classpath "gradle.plugin.io.morethan.jmhreport:gradle-jmh-report:0.9.0"
classpath "org.jlleitschuh.gradle:ktlint-gradle:$ktlint_version"
}
}
def pathApiDocs = "${rootDir}/modules/docs/arrow-docs/docs/docs/apidocs"
allprojects {
apply plugin: 'base'
clean.doFirst {
delete "${rootDir}/infographic/arrow-infographic.txt"
delete pathApiDocs
}
repositories {
jcenter()
maven { url 'https://kotlin.bintray.com/kotlinx' }
maven { url "https://dl.bintray.com/kotlin/kotlin-dev" }
maven { url "https://dl.bintray.com/arrow-kt/arrow-kt" }
maven { url "https://dl.bintray.com/jetbrains/markdown/" }
}
}
subprojects { project ->
group = GROUP
version = VERSION_NAME
apply plugin: 'kotlin'
apply plugin: 'jacoco'
apply plugin: 'org.jetbrains.dokka'
apply plugin: "org.jlleitschuh.gradle.ktlint"
archivesBaseName = POM_ARTIFACT_ID
jacoco {
toolVersion '0.8.2'
}
//dokka log spam `Can't find node by signature` comes from https://github.com/Kotlin/dokka/issues/269
dokka {
outputFormat = 'jekyll'
outputDirectory = pathApiDocs
includes = ['README.md']
reportUndocumented = false
// Specifies the location of the project source code on the Web.
// If provided, Dokka generates "source" links for each declaration.
// Repeat for multiple mappings
linkMapping {
// Source directory
dir = "src/main/kotlin"
// URL showing where the source code can be accessed through the web browser
url = "https://github.com/arrow-kt/arrow/blob/master/${relativeProjectPath('src/main/kotlin')}"
// Suffix which is used to append the line number to the URL. Use #L for GitHub
suffix = "#L"
}
}
task codeCoverageReport(type: JacocoReport) {
reports {
xml.enabled true
xml.destination file("${buildDir}/reports/jacoco/report.xml")
html.enabled true
csv.enabled false
}
classDirectories = fileTree(
dir: 'build/classes/kotlin/main',
)
sourceDirectories = files('src/main/kotlin')
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
}
apply plugin: 'com.jfrog.bintray'
bintray {
publish = true
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
configurations = ['archives']
pkg {
repo = 'arrow-kt'
name = project.name
userOrg = POM_DEVELOPER_ID
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/arrow-kt/arrow.git'
}
}
compileKotlin.kotlinOptions.freeCompilerArgs += ["-Xskip-runtime-version-check"]
test {
useJUnitPlatform()
testLogging {
exceptionFormat 'full'
events "passed", "skipped", "failed", "standardOut", "standardError"
}
}
tasks.withType(Test) {
maxParallelForks = Runtime.runtime.availableProcessors()
}
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
apply plugin: "build-time-tracker"
buildtimetracker {
reporters {
csv {
output "build/times.csv"
append true
header false
}
}
}
}
configurations {
buildableProjects
}
dependencies {
buildableProjects(subprojects)
}
tasks.create('repl') {
final classpathConfig = rootProject.buildscript.configurations.getByName("classpath")
final buildableProjectsConfig = configurations.getByName('buildableProjects')
dependsOn(buildableProjectsConfig)
doFirst {
javaexec {
classpath(
classpathConfig.resolvedConfiguration.resolvedArtifacts.findAll {
it.moduleVersion.id.group == 'org.jetbrains.kotlin'
}.collect {
it.file
}
)
main = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
standardInput = System.in
args("-cp", buildableProjectsConfig.files.join(':'))
}
}
}
tasks.wrapper {
gradleVersion = "5.0"
distributionType = Wrapper.DistributionType.ALL
}
apply plugin: 'com.github.ben-manes.versions'
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
dependencyUpdates {
outputFormatter { result ->
final dependenciesToCheck = [
'org.jetbrains.kotlin:kotlin-stdlib',
'org.jetbrains.kotlin:kotlin-stdlib-jdk7',
'org.jetbrains.kotlin:kotlin-stdlib-jdk8',
'org.jetbrains.kotlin:kotlin-gradle-plugin',
'org.jetbrains.kotlinx:kotlinx-coroutines-core'
]
final disallowedQualifiers = ['alpha', 'beta', 'rc', 'cr', 'm', 'preview', 'eap']
final isDisallowed = { dependency -> { qualifier -> dependency.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/ } }
final dependencies = result.current.dependencies
.plus(result.outdated.dependencies)
.plus(result.exceeded.dependencies)
.plus(result.unresolved.dependencies)
.findAll { dependency -> dependenciesToCheck.any { it == "${dependency.group}:${dependency.name}" } }
def plainTextReporter = new PlainTextReporter(project, revision, gradleReleaseChannel)
plainTextReporter.write(System.out, result)
final isRejected = dependencies
.any { dependency -> disallowedQualifiers.any(isDisallowed(dependency)) }
if (isRejected) {
final title = "\nError: Kotlin and Coroutines must depends on release version!"
final message = dependencies
.inject(title) { acc, dependency ->
"$acc\n${dependency.group}:${dependency.name}:${dependency.version}"
}
throw new GradleException(message)
}
}
}
task checkDependenciesVersion {
dependsOn dependencyUpdates
}