forked from jobrunr/jobrunr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
119 lines (100 loc) · 3.46 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
plugins {
id 'com.github.ben-manes.versions' version '0.42.0'
id 'org.sonarqube' version '3.3'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'signing'
}
String VERSION = System.getenv('BUILD_VERSION')?.replace("v", "") ?: "v1.0.0-SNAPSHOT".replace("v", "")
subprojects {
group = 'com.lumaserv'
version = VERSION
}
nexusPublishing {
packageGroup = "com.lumaserv"
repositories {
sonatype {
username = "lumaserv"
password = System.getenv('OSSRH_PASSWORD')
stagingProfileId = "6785d1237ee803"
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
useStaging.set(provider {
!VERSION.endsWith("-SNAPSHOT")
})
}
}
}
def isNonStable = { String version ->
def isPreview = ['SNAPSHOT', 'ALPHA'].any { it -> version.toUpperCase().contains(it) }
def isRelease = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
def regex = /(?!\.)(\d+(\.\d+)+)(?![\d\.])?(\.jre\d)?/
def isVersionMatch = (version ==~ regex)
def result = isPreview || !(isRelease || isVersionMatch)
return result
}
tasks.named("dependencyUpdates").configure {
rejectVersionIf {
isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)
}
}
configure(subprojects.findAll {it.name != 'platform'}) {
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'jacoco'
compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'
javadoc.options.encoding = 'UTF-8'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
compileTestJava {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
implementation platform(project(':platform'))
testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation 'io.github.artsok:rerunner-jupiter'
testImplementation 'org.awaitility:awaitility'
testImplementation 'org.assertj:assertj-core'
testImplementation 'com.tngtech.archunit:archunit-junit5'
testImplementation 'net.javacrumbs.json-unit:json-unit-assertj'
testImplementation 'ch.qos.logback:logback-classic'
testImplementation 'org.mockito:mockito-inline'
testImplementation 'org.mockito:mockito-junit-jupiter'
}
test {
finalizedBy jacocoTestReport
reports.junitXml.destination = file("/tmp/reports/$project.name")
reports.html.destination = file("/tmp/reports/$project.name")
useJUnitPlatform()
testLogging {
minGranularity = 3
events "passed", "skipped", "failed"
}
}
jacoco {
toolVersion = "0.8.7"
}
jacocoTestReport {
dependsOn test
reports {
xml.enabled true
}
}
sonarqube {
properties {
property "sonar.sourceEncoding", "UTF-8"
property "sonar.projectKey", "jobrunr_jobrunr"
property "sonar.organization", "jobrunr"
}
}
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}