-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
162 lines (144 loc) · 5.02 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
id 'groovy'
id 'java-library'
id 'signing'
id 'maven-publish'
id('io.github.gradle-nexus.publish-plugin') version '2.0.0'
id "com.github.ben-manes.versions" version "0.51.0"
}
group = 'se.alipsa.groovy'
version = '1.0.7-SNAPSHOT'
description = 'Extensions to Groovy SQL'
repositories {
if (version.contains('SNAPSHOT')) {
mavenLocal()
}
mavenCentral()
}
dependencies {
def groovyVersion = "4.0.23"
// By using compileOnly instead of implementation, the jar will not be available at runtime
// and hence users can use whatever compatible version of Groovy that they want
compileOnly "org.apache.groovy:groovy:${groovyVersion}"
compileOnly "org.apache.groovy:groovy-sql:${groovyVersion}"
//implementation 'org.apache.logging.log4j:log4j-api:2.23.1'
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.2'
//testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation 'com.h2database:h2:2.3.232'
testImplementation "org.apache.groovy:groovy:${groovyVersion}"
testImplementation "org.apache.groovy:groovy-sql:${groovyVersion}"
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked"
}
test {
testLogging.showStandardStreams = true
useJUnitPlatform()
testLogging {
// set options for log level LIFECYCLE
events TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
showExceptions true
showCauses true
showStackTraces true
// set options for log level DEBUG and INFO
debug {
events TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}
//Maven Central uploads
task javadocJar(type: Jar, dependsOn: groovydoc) {
archiveClassifier.set 'javadoc'
from groovydoc.destinationDir
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier.set 'sources'
from sourceSets.main.allSource
}
nexusPublishing {
repositories {
sonatype()
}
}
publishing {
publications {
maven(MavenPublication) {
from components.java
artifact(javadocJar)
artifact(sourcesJar)
pom {
name = 'Groovy Data Utils'
description = "${project.description}"
url = "https://github.com/Alipsa/data-utils"
licenses {
license {
name = 'MIT License'
url = 'https://raw.githubusercontent.com/Alipsa/data-utils/master/LICENSE'
}
}
developers {
developer {
id = 'perNyfelt'
name = 'Per Nyfelt'
}
}
scm {
url = 'https://github.com/Alipsa/data-utils/tree/master'
connection = 'scm:git:https://github.com/Alipsa/data-utils.git'
developerConnection = 'scm:git:https://github.com/Alipsa/data-utils.git'
}
}
}
}
}
signing {
if (project.properties['signing.keyId'] != null) {
project.logger.lifecycle("Signing artifacts...")
sign publishing.publications.maven
}
}
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 {
gradleReleaseChannel = "current"
resolutionStrategy {
componentSelection {
all {
if (isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)) {
reject('Release candidate')
}
}
}
}
}