forked from allegro/axion-release-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
220 lines (178 loc) · 6.71 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
plugins {
id 'groovy'
id 'java-gradle-plugin'
id 'maven'
id 'jacoco'
id 'pl.allegro.tech.build.axion-release' version '1.9.1'
id 'com.github.kt3k.coveralls' version '2.8.2'
id 'com.gradle.plugin-publish' version '0.9.10'
id 'com.bmuschko.nexus' version '2.3.1' apply false
id 'io.codearte.nexus-staging' version '0.11.0' apply false
id 'com.bmuschko.docker-remote-api' version '3.2.1'
}
if (project.hasProperty('mavenCentral')) {
apply from: 'gradle/mavenCentral.gradle'
}
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
sourceCompatibility = '1.7'
repositories {
mavenCentral()
}
project.ext.versions = [
jgit: '4.11.0.201803080745-r',
jsch: '0.1.54',
jschAgent: '0.0.9'
]
sourceSets {
integration {
java.srcDir project.file('src/integration/java')
groovy.srcDir project.file('src/integration/groovy')
resources.srcDir project.file('src/integration/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
}
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 {
compile gradleApi()
compile localGroovy()
compile group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: versions.jgit
compile group: 'org.eclipse.jgit', name: 'org.eclipse.jgit.ui', version: versions.jgit
compile group: 'com.jcraft', name: 'jsch', version: versions.jsch
compile group: 'com.jcraft', name: 'jsch.agentproxy.core', version: versions.jschAgent
compile group: 'com.jcraft', name: 'jsch.agentproxy.jsch', version: versions.jschAgent
compile group: 'com.jcraft', name: 'jsch.agentproxy.sshagent', version: versions.jschAgent
compile group: 'com.jcraft', name: 'jsch.agentproxy.pageant', version: versions.jschAgent
compile group: 'com.jcraft', name: 'jsch.agentproxy.usocket-jna', version: versions.jschAgent
compile group: 'com.jcraft', name: 'jsch.agentproxy.usocket-nc', version: versions.jschAgent
compile group: 'com.github.zafarkhaja', name: 'java-semver', version: '0.9.0'
testCompile (group: 'org.ajoberstar', name: 'grgit', version: '1.7.2') {
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.0-groovy-2.4') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
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()
}
test {
testLogging {
events 'passed', 'skipped', 'failed'
exceptionFormat = 'full'
}
}
project.configurations {
integration {
extendsFrom project.configurations.testRuntime
description = 'Dependencies for integration tests'
transitive = true
visible = true
}
remoteTest {
extendsFrom project.configurations.testRuntime
description = 'Dependencies for tests with Docker'
transitive = true
visible = true
}
}
task integrationTest(type: Test) {
testClassesDirs = project.sourceSets.integration.output.classesDirs
classpath = project.sourceSets.main.output +
project.sourceSets.test.output +
project.sourceSets.integration.runtimeClasspath +
project.configurations.testRuntime +
project.configurations.integrationRuntime
testLogging {
events 'passed', 'skipped', 'failed'
showStandardStreams = true
exceptionFormat = 'full'
}
}
task buildDockerImage(type: com.bmuschko.gradle.docker.tasks.image.DockerBuildImage) {
inputDir = file('docker')
tag = 'test/axion-release-remote:latest'
}
task createDockerContainer(type: com.bmuschko.gradle.docker.tasks.container.DockerCreateContainer) {
dependsOn buildDockerImage
targetImageId { buildDockerImage.getImageId() }
portBindings = ['2222:22']
}
task startDockerContainer(type: com.bmuschko.gradle.docker.tasks.container.DockerStartContainer) {
dependsOn createDockerContainer
targetContainerId { createDockerContainer.getContainerId() }
}
task stopDockerContainer(type: com.bmuschko.gradle.docker.tasks.container.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
testLogging {
events 'passed', 'skipped', 'failed'
exceptionFormat = 'full'
}
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
}
}
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'
}
}