-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
107 lines (93 loc) · 2.63 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
plugins {
id "org.jetbrains.kotlin.jvm" version "1.8.10"
id "com.github.ben-manes.versions" version "0.45.0"
id "org.sonarqube" version "3.5.0.2730"
id "com.adarshr.test-logger" version "3.2.0" apply false
}
allprojects {
apply plugin: "jacoco"
group = "dev.capybaralabs.d4j-store"
version = "0.7.1"
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" } // Reactor & D4J snapshots
}
}
subprojects {
apply plugin: "maven-publish"
}
configurations.create("internal") {
visible false
canBeConsumed false
canBeResolved false
}
configure(subprojects.findAll { it.name != 'platform' }) {
apply plugin: "org.jetbrains.kotlin.jvm"
apply plugin: "com.adarshr.test-logger"
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
configurations {
compileClasspath.extendsFrom(internal)
runtimeClasspath.extendsFrom(internal)
testCompileClasspath.extendsFrom(internal)
testRuntimeClasspath.extendsFrom(internal)
}
dependencies {
internal platform(project(':platform'))
}
testlogger {
theme "mocha-parallel"
slowThreshold 500
showFullStackTraces true
}
publishing {
publications {
create("main", MavenPublication) {
from(components.kotlin)
}
}
}
}
// See https://github.com/gradle/gradle/issues/8881#issuecomment-593227192
task codeCoverageReport(type: JacocoReport) {
// Gather execution data from all subprojects
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
// Add all relevant sourcesets from the subprojects
subprojects.each {
sourceSets it.sourceSets.main
}
reports {
xml.required.set(true)
html.required.set(true)
csv.required.set(false)
}
}
// always run the tests before generating the report
codeCoverageReport.dependsOn {
subprojects.findAll { it.name != 'platform' }*.test
}
tasks.withType(org.sonarqube.gradle.SonarTask) {
dependsOn codeCoverageReport
}
sonarqube {
properties {
property "sonar.projectKey", "dev.capybaralabs.d4j.store.postgres:d4j-postgres-store"
property "sonar.coverage.jacoco.xmlReportPaths", "${rootDir}/build/reports/jacoco/codeCoverageReport/codeCoverageReport.xml"
property "sonar.coverage.exclusions", "tck/**/*"
}
}
def isNonStable = { String version ->
def stableKeyword = ["RELEASE", "FINAL", "GA"].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
// https://github.com/ben-manes/gradle-versions-plugin
tasks.named("dependencyUpdates").configure {
checkConstraints = true
rejectVersionIf {
isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)
}
}