forked from allegro/axion-release-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
258 lines (219 loc) · 8.18 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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
import com.bmuschko.gradle.docker.tasks.container.DockerCreateContainer
import com.bmuschko.gradle.docker.tasks.container.DockerStartContainer
import com.bmuschko.gradle.docker.tasks.container.DockerStopContainer
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
plugins {
id 'groovy'
id 'java-gradle-plugin'
id 'maven-publish'
id 'signing'
id 'jacoco'
id 'pl.allegro.tech.build.axion-release' version '1.12.1'
id 'com.github.kt3k.coveralls' version '2.8.2'
id 'com.gradle.plugin-publish' version '0.12.0'
id 'io.github.gradle-nexus.publish-plugin' version '1.0.0'
id 'com.coditory.integration-test' version "1.0.5"
id 'com.adarshr.test-logger' version '2.1.1'
id 'com.github.johnrengelman.shadow' version '6.1.0'
id 'com.bmuschko.docker-remote-api' version '3.2.1'
}
scmVersion {
tag {
prefix = 'axion-release'
}
hooks {
pre 'fileUpdate', [files: ['README.md', 'mkdocs.yml'], pattern: { v, p -> /'$v'/ }, replacement: { v, p -> "'$v'" }]
pre 'commit'
}
versionCreator 'versionWithBranch'
}
group = 'pl.allegro.tech.build'
version = scmVersion.version
java {
withSourcesJar()
withJavadocJar()
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
repositories {
mavenCentral()
maven {
name = 'ajoberstar-backup'
url = 'https://ajoberstar.org/bintray-backup/'
}
}
project.ext.versions = [
jgit : '5.12.0.202106070339-r',
jsch : '0.1.55',
jschAgent: '0.0.9'
]
sourceSets {
main {
java { srcDirs = [] } // no source dirs for the java compiler
groovy { srcDirs = ["src/main/java", "src/main/groovy"] } // compile everything in src/ with groovy
}
remoteTest {
java.srcDir project.file('src/test-remote/java')
groovy.srcDir project.file('src/test-remote/groovy')
resources.srcDir project.file('src/test-remote/resources')
resources.srcDir project.sourceSets.test.resources
resources.srcDir project.sourceSets.main.resources
compileClasspath = project.sourceSets.main.output +
project.sourceSets.test.output +
project.configurations.testRuntime
runtimeClasspath = output + compileClasspath
}
}
dependencies {
shadow gradleApi()
shadow localGroovy()
compile group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: versions.jgit
compile group: 'org.eclipse.jgit', name: 'org.eclipse.jgit.ssh.jsch', version: versions.jgit
runtimeOnly group: 'org.eclipse.jgit', name: 'org.eclipse.jgit.ui', version: versions.jgit
runtimeOnly group: 'org.eclipse.jgit', name: 'org.eclipse.jgit.gpg.bc', version: versions.jgit
implementation group: 'com.jcraft', name: 'jsch', version: versions.jsch
implementation group: 'com.jcraft', name: 'jsch.agentproxy.core', version: versions.jschAgent
implementation group: 'com.jcraft', name: 'jsch.agentproxy.jsch', version: versions.jschAgent
implementation group: 'com.jcraft', name: 'jsch.agentproxy.sshagent', version: versions.jschAgent
implementation group: 'com.jcraft', name: 'jsch.agentproxy.pageant', version: versions.jschAgent
implementation group: 'com.jcraft', name: 'jsch.agentproxy.usocket-jna', version: versions.jschAgent
implementation group: 'com.jcraft', name: 'jsch.agentproxy.usocket-nc', version: versions.jschAgent
implementation group: 'com.github.zafarkhaja', name: 'java-semver', version: '0.9.0'
testCompile(group: 'org.ajoberstar.grgit', name: 'grgit-core', version: '4.1.0') {
exclude group: 'org.eclipse.jgit', module: 'org.eclipse.jgit.ui'
exclude group: 'org.eclipse.jgit', module: 'org.eclipse.jgit'
}
testCompile group: 'org.spockframework', name: 'spock-core', version: '1.3-groovy-2.5'
testCompile group: 'cglib', name: 'cglib-nodep', version: '3.1'
testCompile group: 'org.objenesis', name: 'objenesis', version: '2.4'
testCompile group: 'org.apache.sshd', name: 'sshd-core', version: '1.6.0'
testCompile group: 'org.apache.sshd', name: 'sshd-git', version: '1.6.0'
testCompile gradleTestKit()
}
task relocateShadowJar(type: ConfigureShadowRelocation) {
target = tasks.shadowJar
}
tasks.shadowJar.dependsOn tasks.relocateShadowJar
shadowJar {
archiveClassifier.set('')
}
project.configurations {
remoteTest {
extendsFrom project.configurations.testRuntime
description = 'Dependencies for tests with Docker'
transitive = true
visible = true
}
}
task buildDockerImage(type: DockerBuildImage) {
inputDir = file('docker')
tag = 'test/axion-release-remote:latest'
}
task createDockerContainer(type: DockerCreateContainer) {
dependsOn buildDockerImage
targetImageId { buildDockerImage.getImageId() }
portBindings = ['2222:22']
}
task startDockerContainer(type: DockerStartContainer) {
dependsOn createDockerContainer
targetContainerId { createDockerContainer.getContainerId() }
}
task stopDockerContainer(type: DockerStopContainer) {
targetContainerId { createDockerContainer.getContainerId() }
}
task remoteTest(type: Test) {
testClassesDirs = project.sourceSets.remoteTest.output.classesDirs
classpath = project.sourceSets.main.output +
project.sourceSets.test.output +
project.sourceSets.remoteTest.runtimeClasspath +
project.configurations.testRuntime +
project.configurations.remoteTestRuntime
dependsOn startDockerContainer
finalizedBy stopDockerContainer
}
tasks.check.dependsOn integrationTest, remoteTest
gradlePlugin {
testSourceSets project.sourceSets.integration
}
jacoco {
toolVersion = '0.8.2'
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
if (System.getenv("GRADLE_PORTAL_KEY")) {
pluginBundle {
website = 'https://github.com/allegro/axion-release-plugin'
vcsUrl = 'https://github.com/allegro/axion-release-plugin'
description = 'Release and version management plugin.'
tags = ['release', 'version']
plugins {
release {
id = 'pl.allegro.tech.build.axion-release'
displayName = 'axion-release-plugin'
}
}
mavenCoordinates {
groupId = 'pl.allegro.tech.build'
artifactId = 'axion-release-plugin'
}
}
}
publishing {
publications {
sonatype(MavenPublication) { publication ->
from project.shadow.component(publication)
artifact sourcesJar
artifact javadocJar
pom {
name = project.name
description = 'Gradle release and version management plugin'
url = 'https://github.com/allegro/axion-release-plugin'
inceptionYear = '2014'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'adamdubiel'
name = 'Adam Dubiel'
}
developer {
id = 'bgalek'
name = 'Bartosz Gałek'
}
}
scm {
url = 'https://github.com/allegro/axion-release-plugin'
connection = 'scm:[email protected]:allegro/axion-release-plugin.git'
developerConnection = 'scm:[email protected]:allegro/axion-release-plugin.git'
}
}
}
}
}
nexusPublishing {
repositories {
sonatype {
username = System.getenv("SONATYPE_USERNAME")
password = System.getenv("SONATYPE_PASSWORD")
}
}
}
if (System.getenv("GPG_KEY_ID")) {
signing {
useInMemoryPgpKeys(
System.getenv("GPG_KEY_ID"),
System.getenv("GPG_PRIVATE_KEY"),
System.getenv("GPG_PRIVATE_KEY_PASSWORD")
)
sign publishing.publications
}
}