forked from IBM/cics-bundle-gradle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
93 lines (80 loc) · 2.54 KB
/
build.gradle.kts
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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
/*
* #%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 "0.10.1"
id("org.jetbrains.kotlin.jvm") version "1.3.50"
}
group = "com.ibm.cics"
version = "0.0.1-SNAPSHOT"
val isReleaseVersion by extra(!version.toString().endsWith("SNAPSHOT"))
val onlyIfSnapshot: (PublishToMavenRepository).() -> Unit = {
this.onlyIf { !isReleaseVersion }
}
// Only publish to Gradle plugin portal if a release
tasks.publishPlugins{ enabled = isReleaseVersion }
// Only publish to Sonatype Snapshots if a snapshot
tasks.withType<org.gradle.api.publish.maven.tasks.PublishToMavenRepository>().configureEach { onlyIfSnapshot }
tasks.withType<org.gradle.api.publish.maven.tasks.GenerateMavenPom>().configureEach { onlyIfSnapshot }
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
publishing {
repositories {
maven {
name = "Sonatype Snapshots"
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
credentials {
username = ossrhUser
password = ossrhPassword
}
}
}
}
repositories {
mavenCentral()
}
defaultTasks("build")
dependencies {
implementation("com.ibm.cics:cics-bundle-common:0.0.2")
testCompile("junit:junit:4.12")
testImplementation("org.spockframework:spock-core:1.1-groovy-2.4") {
exclude(module = "groovy-all")
}
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
tasks.register("publishAll") {
dependsOn("publishPlugins")
dependsOn("publish")
}