-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathbuild.gradle
More file actions
211 lines (184 loc) · 5.11 KB
/
build.gradle
File metadata and controls
211 lines (184 loc) · 5.11 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
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
plugins {
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
id "signing"
id 'java-gradle-plugin'
id "groovy"
id "eclipse"
id "maven-publish"
id "com.gradle.plugin-publish" version "2.1.1"
id 'to.wetransform.semantic-release-version' version '2.1.3'
id 'to.wetransform.conventions' version '3.0.0'
}
wetransform {
setup {
spotless {
licenseHeader = '''\
/*
* Copyright $YEAR the original author or authors.
*
* Licensed 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.
*/
'''.stripIndent()
}
publish {
// publishing is configured manually below, not using conventions here
disable = true
}
}
}
repositories {
mavenCentral()
}
group = 'org.standardout'
jar {
// include license into jar
into 'META-INF', {
from 'LICENSE'
}
}
def isCI = "true".equals(System.getenv("CI"))
def isRelease = !version.endsWith('-SNAPSHOT')
dependencies {
implementation gradleApi()
implementation libs.bnd.bndlib
implementation libs.osgi.core
implementation libs.commons.io
implementation libs.gradle.download.task
implementation localGroovy()
// Testing
testImplementation testLibs.junit.jupiter
testRuntimeOnly testLibs.junit.platform.launcher
testImplementation testLibs.assertj.core
}
test {
useJUnitPlatform()
}
tasks.wrapper {
distributionType = Wrapper.DistributionType.ALL
gradleVersion = '9.4.1'
}
sourceSets {
functionalTest {
groovy.srcDir file('src/functionalTest/groovy')
resources.srcDir file('src/functionalTest/resources')
compileClasspath += sourceSets.main.output + configurations.testCompileClasspath
runtimeClasspath += output + compileClasspath + configurations.testRuntimeClasspath
}
}
tasks.register('functionalTest', Test) {
description = 'Runs the functional tests.'
group = 'verification'
testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.functionalTest.runtimeClasspath
useJUnitPlatform()
maxParallelForks = 1
}
tasks.named('check') {
dependsOn tasks.named('functionalTest')
}
dependencies {
functionalTestImplementation testLibs.junit.jupiter
functionalTestRuntimeOnly testLibs.junit.platform.launcher
functionalTestImplementation testLibs.assertj.core
functionalTestImplementation gradleTestKit()
}
gradlePlugin {
testSourceSets.add(sourceSets.functionalTest)
def githubUrl = 'https://github.com/stempler/bnd-platform'
website = githubUrl
vcsUrl = githubUrl
plugins {
bndPlatform {
id = 'org.standardout.bnd-platform'
implementationClass = 'org.standardout.gradle.plugin.platform.PlatformPlugin'
displayName = 'bnd-platform'
description = 'Build OSGi bundles and p2 repositories / Eclipse Update Sites from existing libraries and their dependencies, e.g. from Maven repositories. Useful for instance for creating a target platform for Eclipse/Equinox or Maven Tycho build from third party dependencies.'
tags.set([
'bnd',
'osgi',
'p2',
'eclipse',
'tycho'
])
}
}
}
nexusPublishing {
repositories {
// see https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/#configuration
sonatype {
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
}
}
}
def configurePom(pom) {
pom.description = 'Build OSGi bundles and Eclipse Update Sites from existing JARs, e.g. from Maven repositories (Plugin for Gradle)'
pom.url = 'https://github.com/stempler/bnd-platform'
pom.scm {
url = 'scm:git:https://github.com/stempler/bnd-platform.git'
connection = 'scm:git:https://github.com/stempler/bnd-platform.git'
developerConnection = 'scm:git:https://github.com/stempler/bnd-platform.git'
}
pom.licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
pom.developers {
developer {
id = 'stempler'
name = 'Simon Templer'
email = 'simon@templer.cc'
}
}
}
publishing {
publications {
pluginMaven(MavenPublication) {
groupId "${group}"
artifactId 'bnd-platform'
version "${version}"
pom {
name = 'bnd-platform'
packaging = 'jar'
configurePom(pom)
}
}
}
afterEvaluate {
publications {
bndPlatformPluginMarkerMaven {
pom { pom ->
configurePom(pom)
}
}
}
}
}
// sign all artifacts
signing {
if (isCI) {
// use in ASCII armored key for CI
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
}
}
tasks.withType(Sign) {
onlyIf {
isRelease || isCI
}
}