Repository navigation
Expand file tree
/
Copy pathbuild.gradle
More file actions
136 lines (118 loc) · 3.69 KB
/
Copy pathbuild.gradle
File metadata and controls
136 lines (118 loc) · 3.69 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
plugins {
id "groovy"
id "maven-publish"
id "signing"
}
repositories {
mavenCentral()
}
configurations {
provided
}
sourceSets {
main { compileClasspath += configurations.provided }
test {
compileClasspath += configurations.provided
runtimeClasspath += configurations.provided
}
}
dependencies {
provided localGroovy()
provided "org.spockframework:spock-core:2.3-groovy-3.0"
implementation "cglib:cglib-nodep:3.3.0"
}
java {
withJavadocJar()
withSourcesJar()
}
String publishUser = project.findProperty("publish.user")
String publishPassword = project.findProperty("publish.password")
String publishUrl = project.findProperty("publish.url")
publishing {
repositories {
maven {
name = "test"
url = layout.buildDirectory.dir("local-repo")
}
maven {
name = "remote"
url = publishUrl
credentials {
username publishUser
password publishPassword
}
}
}
publications {
lib(MavenPublication) {
from components.java
pom {
name = "Jenkins Shared Library Test Framework"
packaging = "jar"
description = "Spock test framework for unit testing Jenkins Shared Libraries"
url = "https://github.com/papiocloudsoftware/shared-library-test-framework"
scm {
url = "https://github.com/papiocloudsoftware/shared-library-test-framework"
connection = "scm:git:https://github.com/papiocloudsoftware/shared-library-test-framework.git"
developerConnection = "scm:git:https://github.com/papiocloudsoftware/shared-library-test-framework.git"
}
licenses {
license {
name = "MIT License"
url = "http://www.opensource.org/licenses/mit-license.php"
distribution = "repo"
}
}
developers {
developer {
id = "mschenke"
name = "Max Schenkelberg"
email = "max@papiocloud.com"
}
}
}
}
}
}
def signingKeyFile = findProperty("signing.keyfile")
def signingKey = signingKeyFile ? file(signingKeyFile).text : null
def signingPassword = findProperty("signing.password")
if (signingKey != null && signingPassword != null) {
signing {
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.lib
}
}
task setReleaseVersion {
doFirst {
project.version = project.version - "-SNAPSHOT"
def props = new Properties()
def gradleProps = file("gradle.properties")
gradleProps.withInputStream {
props.load(it)
}
props.version = project.version
gradleProps.withOutputStream {
props.store(it, null)
}
}
}
task updateSnapshotVersion {
dependsOn tasks.setReleaseVersion
doFirst {
def props = new Properties()
def gradleProps = file("gradle.properties")
gradleProps.withInputStream {
props.load(it)
}
String[] versionParts = project.version.split("[.]")
versionParts[versionParts.length - 1] = (Integer.parseInt(versionParts[versionParts.length - 1]) + 1) + "-SNAPSHOT"
props.version = versionParts.join(".")
gradleProps.withOutputStream {
props.store(it, null)
}
}
}
task publishToRemote {
dependsOn tasks.publishLibPublicationToRemoteRepository
}