This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
121 lines (108 loc) · 3 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
plugins {
id 'groovy'
id 'java-library'
id 'signing'
id 'maven-publish'
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
id "com.github.ben-manes.versions" version "0.48.0"
}
group 'se.alipsa.groovy'
version '1.0.1-SNAPSHOT'
description = "Groovy library for importing structured text into a matrix"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
if (version.contains('SNAPSHOT')) {
mavenLocal()
}
mavenCentral()
}
dependencies {
def groovyVersion = '4.0.15'
def groovy = "org.apache.groovy:groovy:$groovyVersion"
compileOnly 'se.alipsa.groovy:matrix:1.1.3-SNAPSHOT'
api 'org.apache.commons:commons-csv:1.10.0'
compileOnly groovy
testImplementation groovy
testImplementation 'se.alipsa.groovy:matrix:1.1.3-SNAPSHOT'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.0'
testImplementation 'se.alipsa.groovy:matrix-datasets:1.0.3-SNAPSHOT'
}
test {
testLogging.showStandardStreams = true
useJUnitPlatform()
}
//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 Matrix CSV'
description = "${project.description}"
url = "https://github.com/Alipsa/matrix-csv"
licenses {
license {
name = 'MIT License'
url = 'https://raw.githubusercontent.com/Alipsa/matrix-csv/master/LICENSE'
}
}
developers {
developer {
id = 'perNyfelt'
name = 'Per Nyfelt'
}
}
scm {
url = 'https://github.com/Alipsa/matrix-csv/tree/master'
connection = 'scm:git:https://github.com/Alipsa/matrix-csv.git'
developerConnection = 'scm:git:https://github.com/Alipsa/matrix-csv.git'
}
}
}
}
}
signing {
if (project.properties['signing.keyId'] != null) {
project.logger.lifecycle("Signing artifacts...")
sign publishing.publications.maven
} else {
project.logger.lifecycle("signing.keyId is not defined, skipping signing of artifacts...")
}
}
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 {
resolutionStrategy {
componentSelection {
all {
if (isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)) {
reject('Release candidate')
}
}
}
}
}