/
ReleasePluginMultiprojectIntegrationSpec.groovy
114 lines (98 loc) · 3.91 KB
/
ReleasePluginMultiprojectIntegrationSpec.groovy
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
/*
* Copyright 2014-2015 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nebula.plugin.release
import nebula.plugin.bintray.BintrayPlugin
import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.publish.plugins.PublishingPlugin
class ReleasePluginMultiprojectIntegrationSpec extends GitVersioningIntegrationSpec {
@Override
def setupBuild() {
buildFile << """\
allprojects {
${applyPlugin(ReleasePlugin)}
}
subprojects {
ext.dryRun = true
group = 'test'
${applyPlugin(JavaPlugin)}
}
""".stripIndent()
addSubproject('test-release-common', '// hello')
addSubproject('test-release-client', '''\
dependencies {
compile project(':test-release-common')
}
'''.stripIndent())
git.tag.add(name: 'v0.0.1')
git.commit(message: 'Another commit')
git.add(patterns: ['build.gradle', '.gitignore', 'settings.gradle',
'test-release-common/build.gradle', 'test-release-client/build.gradle'] as Set)
}
def 'choose release version'() {
when:
def results = runTasksSuccessfully('final')
then:
inferredVersion(results.standardOutput) == normal('0.1.0')
new File(projectDir, 'test-release-common/build/libs/test-release-common-0.1.0.jar').exists()
new File(projectDir, 'test-release-client/build/libs/test-release-client-0.1.0.jar').exists()
}
def 'choose candidate version'() {
when:
def results = runTasksSuccessfully('candidate')
then:
inferredVersion(results.standardOutput) == normal('0.1.0-rc.1')
new File(projectDir, 'test-release-common/build/libs/test-release-common-0.1.0-rc.1.jar').exists()
new File(projectDir, 'test-release-client/build/libs/test-release-client-0.1.0-rc.1.jar').exists()
}
def 'build defaults to dev version'() {
when:
def results = runTasksSuccessfully('build')
then:
inferredVersion(results.standardOutput) == dev('0.1.0-dev.2+')
new File(projectDir, 'test-release-common/build/libs').list().find {
it =~ /test-release-common-0\.1\.0-dev\.2\+/
} != null
new File(projectDir, 'test-release-client/build/libs').list().find {
it =~ /test-release-client-0\.1\.0-dev\.2\+/
} != null
}
def 'build defaults to dev version, non-standard branch name included in version string'() {
git.checkout(branch: 'testexample', createBranch: true)
when:
def results = runTasksSuccessfully('build')
then:
inferredVersion(results.standardOutput) == dev('0.1.0-dev.2+')
new File(projectDir, 'test-release-common/build/libs').list().find {
it =~ /test-release-common-0\.1\.0-dev\.2\+testexample\./
} != null
new File(projectDir, 'test-release-client/build/libs').list().find {
it =~ /test-release-client-0\.1\.0-dev\.2\+testexample\./
} != null
}
def 'tasks does not fail'() {
given:
buildFile << """\
allprojects {
${applyPlugin(PublishingPlugin)}
${applyPlugin(BintrayPlugin)}
}
""".stripIndent()
when:
runTasksSuccessfully('tasks', '--all')
then:
noExceptionThrown()
}
}