-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
158 lines (142 loc) · 4.68 KB
/
build.gradle
File metadata and controls
158 lines (142 loc) · 4.68 KB
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
plugins {
id 'groovy'
id('java-library')
id('signing')
id('maven-publish')
id("se.alipsa.nexus-release-plugin") version '2.0.1'
id("com.github.ben-manes.versions").version("0.53.0")
}
group = 'se.alipsa.groovy'
version = '0.3.1' // remember to change Extension module info if changing version
description = "Groovy extensions for Junit 5+"
repositories {
if (version.contains('SNAPSHOT')) {
mavenLocal()
}
mavenCentral()
}
JavaCompile javaCompile = compileJava {
options.release = 17
options.deprecation = true
options.compilerArgs << "-Xlint:unchecked"
}
compileGroovy {
options.deprecation = true
}
dependencies {
def groovyVersion="5.0.4"
def junitVersion = '6.0.3'
compileOnly "org.apache.groovy:groovy:$groovyVersion"
compileOnly "org.apache.groovy:groovy-ant:$groovyVersion"
compileOnly "org.apache.groovy:groovy-groovydoc:$groovyVersion"
compileOnly "org.apache.groovy:groovy-templates:$groovyVersion"
compileOnly "org.junit.jupiter:junit-jupiter-api:$junitVersion"
compileOnly "org.junit.platform:junit-platform-launcher:$junitVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testImplementation "org.junit.platform:junit-platform-launcher:$junitVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
testRuntimeOnly "org.junit.platform:junit-platform-launcher:$junitVersion"
testImplementation "org.apache.groovy:groovy:$groovyVersion"
}
test {
useJUnitPlatform()
}
tasks.register('antGroovydoc', DefaultTask) {
group = 'documentation'
description = 'Generate Groovydoc using Ant with custom config'
def outputDir = layout.buildDirectory.dir("groovydocant")
def groovySrcDirs = sourceSets.main.groovy.srcDirs
def compileClasspath = sourceSets.main.compileClasspath
def docTitle = "${project.name} ${project.version}"
def windowTitle = "${project.name} ${project.version}"
outputs.dir(outputDir)
doLast {
def outputDirFile = outputDir.get().asFile
ant.taskdef(
name: 'groovydoc',
classname: 'org.codehaus.groovy.ant.Groovydoc',
classpath: compileClasspath.asPath
)
ant.groovydoc(
destdir: outputDirFile,
sourcepath: groovySrcDirs.join(':'),
packagenames: '*',
javaVersion: 'JAVA_17',
doctitle: docTitle,
windowtitle: windowTitle
) {
// Does not work, groovydoc does not support modules e,g,
// URL will become https://docs.oracle.com/en/java/javase/21/docs/api/java/net/URL.html
// instead of https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/net/URL.html
//link packages: 'java.', href: 'https://docs.oracle.com/en/java/javase/21/docs/api/'
link packages:"groovy.,org.codehaus.groovy.", href: "http://docs.groovy-lang.org/latest/html/api/"
}
}
}
tasks.register('javadocJar', Jar) {
dependsOn tasks.named('antGroovydoc')
archiveClassifier.set('javadoc')
from layout.buildDirectory.dir("groovydocant")
}
tasks.register('sourcesJar', Jar) {
dependsOn tasks.named('classes')
archiveClassifier.set('sources')
from sourceSets.main.allSource
}
publishing {
publications {
maven(MavenPublication) {
from components.java
artifact(javadocJar)
artifact(sourcesJar)
pom {
name = 'Groovier Junit'
description = "${project.description}"
url = "https://github.com/Alipsa/groovier-junit"
properties = [
'maven.compiler.release': "${javaCompile.options.release.get()}"
]
licenses {
license {
name = 'MIT License'
url = 'https://raw.githubusercontent.com/Alipsa/groovier-junit/master/LICENSE'
}
}
developers {
developer {
id = 'perNyfelt'
name = 'Per Nyfelt'
}
}
scm {
url = 'https://github.com/Alipsa/groovier-junit/tree/master'
connection = 'scm:git:https://github.com/Alipsa/groovier-junit.git'
developerConnection = 'scm:git:https://github.com/Alipsa/groovier-junit.git'
}
}
}
}
if (project.ext.properties.sonatypeUsername) {
repositories {
maven {
credentials {
username = sonatypeUsername
password = sonatypePassword
}
}
}
}
}
signing {
if (project.properties['signing.keyId'] != null) {
//project.logger.lifecycle("Signing artifacts...")
sign publishing.publications.maven
} else {
project.logger.debug("signing.keyId is not defined, skipping signing of artifacts...")
}
}
nexusReleasePlugin {
userName = project.ext.properties.sonatypeUsername
password = project.ext.properties.sonatypePassword
mavenPublication = publishing.publications.maven
}