-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
239 lines (204 loc) · 8.04 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
/*
* *************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
/* build with:
* ./gradlew publish (this pushed to nexus staging repo also)
* nexus-plugin docs say to use:
* ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
* or:
* ./gradlew publishToSonatype closeSonatypeStagingRepository
* or to publish locally
* ./gradlew publishToMavenLocal
*
* to update this wrapper version
* $ gradle wrapper --gradle-version 6.7 --distribution-type all
*/
plugins {
id 'groovy'
id 'application'
// https://docs.gradle.org/current/userguide/publishing_maven.html
id 'maven-publish'
// https://docs.gradle.org/current/userguide/signing_plugin.html
id 'signing'
id("io.github.gradle-nexus.publish-plugin") version "1.0.0"
}
repositories {
mavenCentral()
jcenter()
// mavenLocal()
}
group 'net.codebuilders'
version "4.1.6.16" // based on AOO version and patch number
description 'Groovy UNO Extension extends the Apache OpenOffice UNO API'
mainClassName = 'org.openoffice.FakeClassName'
ext.isReleaseVersion = !version.endsWith("SNAPSHOT") // used to not pgp sign snapshots
dependencies {
compileOnly 'org.codehaus.groovy:groovy-all:3.0.8'
compileOnly "net.codebuilders:juh:4.1.6"
compileOnly "net.codebuilders:ridl:4.1.6"
compileOnly "net.codebuilders:unoil:4.1.6"
compileOnly "net.codebuilders:jurt:4.1.6"
testImplementation 'org.spockframework:spock-core:2.0-M4-groovy-3.0'
// this and slf4j for spock-reports
// you can use testRuntimeClasspath if you don't want to use spock-report-specific features in your Specs
testRuntimeClasspath( 'com.athaydes:spock-reports:2.0.1-RC3' ) { // was testImplementation
transitive = false // this avoids affecting your version of Groovy/Spock
}
// if you don't already have slf4j-api and an implementation of it in the classpath, add this!
testImplementation 'org.slf4j:slf4j-api:1.7.30'
testCompile 'org.slf4j:slf4j-simple:1.7.30'
testImplementation 'net.codebuilders:bootstrap-connector:4.1.6.0'
}
groovydoc {
docTitle = "Groovy UNO Extension API"
header = "Apache OpenOffice Groovy UNO" // doesn't seem to work
footer = "Generated documentation ${version}"
windowTitle = docTitle
use = true // create class and package usage pages
}
// jar.baseName = 'guno-extension'
archivesBaseName = 'guno-extension'
sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'guno-extension'
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = 'Groovy UNO Extension API'
description = 'Groovy UNO Extension extends the Apache OpenOffice UNO API'
url = 'http://codebuilders.net'
inceptionYear = '2016'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
name = 'Apache OpenOffice Project'
email = '[email protected]'
url = 'http://www.openoffice.org'
organization = 'Apache Software Foundation'
organizationUrl = 'http://www.apache.org'
}
developer {
name = 'Carl Marcum'
email = '[email protected]'
url = 'http://codebuilders.net'
organization = 'Code Builders, LLC'
organizationUrl = 'http://codebuilders.net'
}
}
scm {
// url = 'http://svn.apache.org/repos/asf/openoffice/devtools/guno-extension/trunk'
// developerConnection = 'https://svn.apache.org/repos/asf/openoffice/devtools/guno-extension/trunk'
// connection = 'http://svn.apache.org/repos/asf/openoffice/devtools/guno-extension/trunk'
url = 'https://github.com/cbmarcum/guno-extension'
developerConnection = 'https://github.com/cbmarcum/guno-extension'
connection = 'https://github.com/cbmarcum/guno-extension'
}
}
}
}
repositories {
maven {
// change URLs to point to your repos, e.g. http://my.org/repo
def releasesRepoUrl = "$buildDir/repos/releases"
def snapshotsRepoUrl = "$buildDir/repos/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
}
signing {
// required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
required { isReleaseVersion }
sign publishing.publications.mavenJava
sign configurations.archives
}
nexusPublishing {
repositories {
sonatype {
def ossUser = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : ''
def ossPass = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : ''
def ossStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: project.hasProperty("sonatypeOssStagingProfileId") ? project.sonatypeOssStagingProfileId : ''
// nexusUrl = uri("https://s01.oss.sonatype.org/service/local/")
// snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
username = ossUser
password = ossPass
stagingProfileId = ossStagingProfileId
}
}
}
// MAY WANT THIS WITH GROOVYDOC ??
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
groovydoc.mustRunAfter clean
jar.mustRunAfter groovydoc
publish.mustRunAfter assemble
groovydoc.dependsOn clean
jar.dependsOn groovydoc
publish.dependsOn assemble
// custom tasks for creating source/javadoc jars
// VERIFY THIS OVERRIDE INCLUDES EVERYTHING THE BUILTIN ONE DOES
task sourcesJar(type: Jar, dependsOn: classes, overwrite: true) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task copyResources(type: Copy, dependsOn: groovydoc) {
into groovydoc.destinationDir
from sourceSets.main.resources
}
// overwrites the available task and replaces groovydocJar
task javadocJar(type: Jar, dependsOn: copyResources, overwrite: true) {
archiveClassifier = 'javadoc'
from groovydoc.destinationDir
}
// add groovydoc/source jar tasks as artifacts
artifacts {
archives sourcesJar
// archives groovydocJar
archives javadocJar
}
// spock tests not ran without this block
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}