-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
159 lines (147 loc) · 4.64 KB
/
build.gradle.kts
File metadata and controls
159 lines (147 loc) · 4.64 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
/*
* #%L
* CICS Bundle Gradle Plugin
* %%
* Copyright (C) 2019 IBM Corp.
* %%
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
* #L%
*/
plugins {
id("groovy")
id("java-gradle-plugin")
id("maven-publish")
id("com.gradle.plugin-publish") version "1.2.0"
id("signing")
`kotlin-dsl`
}
group = "com.ibm.cics"
version = "1.0.8"
val isReleaseVersion by extra(!version.toString().endsWith("SNAPSHOT"))
gradlePlugin {
plugins {
register("com.ibm.cics.bundle") {
id = "com.ibm.cics.bundle"
displayName = "CICS Bundle Gradle Plugin"
description = "A Gradle plugin to build CICS bundles, including external dependencies."
implementationClass = "com.ibm.cics.cbgp.BundlePlugin"
}
}
}
pluginBundle {
website = "https://github.com/IBM/cics-bundle-gradle"
vcsUrl = "https://github.com/IBM/cics-bundle-gradle"
tags = listOf("cics", "cicsts", "cicsbundle", "cics-bundle")
}
val ossrhUser: String? by project
val ossrhPassword: String? by project
signing {
setRequired { !gradle.taskGraph.hasTask(":publishToMavenLocal") }
val signingKeyId: String? by project
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign(publishing.publications)
}
fun MavenPom.licenseEpl20() {
licenses {
license {
name.set("EPL-2.0")
url.set("https://www.eclipse.org/legal/epl-2.0/")
}
}
}
fun MavenPom.ibmDeveloper() {
developers {
developer {
name.set("IBM")
email.set("noreply@ibm.com")
organization.set("IBM")
organizationUrl.set("https://www.ibm.com")
}
}
}
fun MavenPom.ibmScm() {
scm {
connection.set("scm:git:git://github.com/IBM/cics-bundle-gradle.git")
developerConnection.set("scm:git:ssh://github.com:IBM/cics-bundle-gradle.git")
url.set("http://github.com/IBM/cics-bundle-gradle/tree/main")
}
}
publishing {
repositories {
if (isReleaseVersion) {
maven {
name = "OSSRH"
url = uri("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/")
credentials {
username = ossrhUser
password = ossrhPassword
}
}
} else {
maven {
name = "SonatypeSnapshots"
url = uri("https://central.sonatype.com/repository/maven-snapshots")
credentials {
username = ossrhUser
password = ossrhPassword
}
}
}
}
publications {
withType<MavenPublication>().configureEach {
pom {
url.set("https://github.com/IBM/cics-bundle-gradle")
licenseEpl20()
ibmDeveloper()
ibmScm()
}
when (name) {
"pluginMaven" -> {
pom {
name.set("CICS Bundle Gradle")
description.set("A Gradle plugin to build CICS bundles, and deploy them into CICS TS")
}
}
"com.ibm.cics.bundlePluginMarkerMaven" -> {
pom {
name.set("CICS Bundle Gradle Plugin")
description.set("A Gradle plugin to build CICS bundles, including external dependencies.")
}
}
}
}
}
}
repositories {
maven {
name = "SonatypeSnapshots"
url = uri("https://central.sonatype.com/repository/maven-snapshots")
}
mavenCentral()
}
defaultTasks("build")
dependencies {
implementation("com.ibm.cics:cics-bundle-common:2.0.2")
testImplementation("junit:junit:4.13.2")
testImplementation("com.github.tomakehurst:wiremock-jre8:2.35.1")
testImplementation(enforcedPlatform("org.spockframework:spock-bom:2.3-groovy-3.0"))
testImplementation("org.spockframework:spock-junit4")
testImplementation("org.spockframework:spock-core")
}
tasks.named<Test>("test") {
useJUnitPlatform()
}
tasks.register("publishAll") {
group = "publishing"
if (isReleaseVersion) {
dependsOn("publishPlugins") // Publish to Gradle Plugin Portal if a release
}
dependsOn("publish") // Publish to Sonatype Snapshots or Central Staging, defined in 'publishing' extension
}