Skip to content

Commit 4e00e29

Browse files
committed
Merge pull request #9 from palantir/feature/gradle-2.8
Gradle 2.8 + dependency upgrades
2 parents 598c7b5 + f8f330c commit 4e00e29

File tree

4 files changed

+46
-40
lines changed

4 files changed

+46
-40
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ cache:
99
directories:
1010
- "$HOME/.gradle/wrapper"
1111
- "$HOME/.gradle/native"
12-
- "$HOME/.gradle/caches/2.6"
12+
- "$HOME/.gradle/caches/2.8"
1313
- "$HOME/.gradle/caches/modules-2/files-2.1"
14-
- "$HOME/.gradle/caches/modules-2/metadata-2.15"
14+
- "$HOME/.gradle/caches/modules-2/metadata-2.16"
1515
env:
1616
global:
1717
- secure: VjbingJ5Iy8UHiX52yUrjcL4BD5aDvMYNb9k1w/gDWqUzYTunZ13x/aWo0enQJWdP09Chdvt5vfzBe6RY4oBxfyPkomvKO+4tnXKh0ivLlkdpIATrTZHoIZsYZDEOw4OSw7vevXf4BeU5CsFHvIALv3jR9xLxRxJryWolYnyg+Sp2FJVfkD2YmSnZkaZ787v+EF4nYaA8soxIvZBul7QMUPaOlOuF4N2GAAroJ43ImeJpDf+SUHKmBgQNbVpfzcsQf8S82X90xaV3TErU3moCshM1jCr27Awv/LmqR+2KpVi9qx8CjWJ+84MqJu5DUVH4qAXwg2O0k1M+Dn/5LSWu9YzkWcPYSADrO7AVw97zjii4QcjIfDb/Nce2B1bz4qXWTMjWQWgtyr3F1SwwCIyC2r9jKAoHGb3Tf5FISDvU7AI4n5ebegdtg3cIyRtJgp+8k/AhBYSzDcUbcv+tUEgJF21FcY+9jMLWpOdG+MUflVMWtqUtc/Ld52z5AwaELw0Z/1Oq1Gl8dDSzmTxSd/bdkY2rf47RTYYj2Mq+fQFRZ9LyEPBHxK4e4P1O0n6K2atWVlWd1oGSGHl1/tICZsNhKFgQmZe74kK7wIOHoWA8ybvdAQbCd4+Re67whG0KTjGSSx19FskbKEwj0Nul3SvntM8f5W9s78TSiPGEO49LCo=

build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
22
id 'com.jfrog.bintray' version '1.2'
33
id 'com.gradle.plugin-publish' version '0.9.1'
4-
id 'com.palantir.git-version' version '0.1.1'
4+
id 'com.palantir.git-version' version '0.2.0'
55
id 'eclipse'
66
id 'groovy'
77
id 'idea'
@@ -26,11 +26,11 @@ repositories {
2626

2727
dependencies {
2828
compile gradleApi()
29-
compile localGroovy()
30-
compile 'org.eclipse.jgit:org.eclipse.jgit:4.0.2.201509141540-r'
29+
compile 'org.codehaus.groovy:groovy-all:2.4.4'
30+
compile 'org.eclipse.jgit:org.eclipse.jgit:4.1.0.201509280440-r'
3131

3232
testCompile gradleTestKit()
33-
testCompile('org.spockframework:spock-core:1.0-groovy-2.3') {
33+
testCompile('org.spockframework:spock-core:1.0-groovy-2.4') {
3434
exclude module: 'groovy-all'
3535
}
3636
testCompile files(createClasspathManifest)
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Thu Jul 10 17:19:31 BST 2014
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
43
zipStoreBase=GRADLE_USER_HOME
54
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-bin.zip

src/test/groovy/com/palantir/gradle/gitversion/GitVersionPluginTests.groovy

+39-32
Original file line numberDiff line numberDiff line change
@@ -32,36 +32,14 @@ class GitVersionPluginTests extends Specification {
3232
File buildFile
3333
File gitIgnoreFile
3434
File dirtyContentFile
35-
36-
def setup() {
37-
projectDir = temporaryFolder.root
38-
buildFile = temporaryFolder.newFile('build.gradle')
39-
gitIgnoreFile = temporaryFolder.newFile('.gitignore')
40-
dirtyContentFile = temporaryFolder.newFile('dirty')
41-
42-
def pluginClasspathResource = getClass().classLoader.findResource("plugin-classpath.txt")
43-
if (pluginClasspathResource == null) {
44-
throw new IllegalStateException("Did not find plugin classpath resource, run `testClasses` build task.")
45-
}
46-
47-
def pluginClasspath = pluginClasspathResource.readLines()
48-
.collect { it.replace('\\', '\\\\') } // escape backslashes in Windows paths
49-
.collect { "'$it'" }
50-
.join(", ")
51-
52-
buildFile << """
53-
buildscript {
54-
dependencies {
55-
classpath files($pluginClasspath)
56-
}
57-
}
58-
""".stripIndent()
59-
}
35+
List<File> pluginClasspath
6036

6137
def 'exception when project root does not have a git repo' () {
6238
given:
6339
buildFile << '''
64-
apply plugin: 'com.palantir.git-version'
40+
plugins {
41+
id 'com.palantir.git-version'
42+
}
6543
version gitVersion()
6644
'''.stripIndent()
6745

@@ -75,7 +53,9 @@ class GitVersionPluginTests extends Specification {
7553
def 'unspecified when no tags are present' () {
7654
given:
7755
buildFile << '''
78-
apply plugin: 'com.palantir.git-version'
56+
plugins {
57+
id 'com.palantir.git-version'
58+
}
7959
version gitVersion()
8060
'''.stripIndent()
8161
Git git = Git.init().setDirectory(projectDir).call();
@@ -90,7 +70,9 @@ class GitVersionPluginTests extends Specification {
9070
def 'unspecified when no annotated tags are present' () {
9171
given:
9272
buildFile << '''
93-
apply plugin: 'com.palantir.git-version'
73+
plugins {
74+
id 'com.palantir.git-version'
75+
}
9476
version gitVersion()
9577
'''.stripIndent()
9678
gitIgnoreFile << 'build'
@@ -108,7 +90,9 @@ class GitVersionPluginTests extends Specification {
10890
def 'unspecified and dirty when no annotated tags are present and dirty content' () {
10991
given:
11092
buildFile << '''
111-
apply plugin: 'com.palantir.git-version'
93+
plugins {
94+
id 'com.palantir.git-version'
95+
}
11296
version gitVersion()
11397
'''.stripIndent()
11498
gitIgnoreFile << 'build'
@@ -127,7 +111,9 @@ class GitVersionPluginTests extends Specification {
127111
def 'git describe when annotated tag is present' () {
128112
given:
129113
buildFile << '''
130-
apply plugin: 'com.palantir.git-version'
114+
plugins {
115+
id 'com.palantir.git-version'
116+
}
131117
version gitVersion()
132118
'''.stripIndent()
133119
gitIgnoreFile << 'build'
@@ -146,7 +132,9 @@ class GitVersionPluginTests extends Specification {
146132
def 'git describe and dirty when annotated tag is present and dirty content' () {
147133
given:
148134
buildFile << '''
149-
apply plugin: 'com.palantir.git-version'
135+
plugins {
136+
id 'com.palantir.git-version'
137+
}
150138
version gitVersion()
151139
'''.stripIndent()
152140
gitIgnoreFile << 'build'
@@ -164,7 +152,26 @@ class GitVersionPluginTests extends Specification {
164152
}
165153

166154
private GradleRunner with(String... tasks) {
167-
GradleRunner.create().withProjectDir(projectDir).withArguments(tasks)
155+
GradleRunner.create()
156+
.withPluginClasspath(pluginClasspath)
157+
.withProjectDir(projectDir)
158+
.withArguments(tasks)
159+
}
160+
161+
def setup() {
162+
projectDir = temporaryFolder.root
163+
buildFile = temporaryFolder.newFile('build.gradle')
164+
gitIgnoreFile = temporaryFolder.newFile('.gitignore')
165+
dirtyContentFile = temporaryFolder.newFile('dirty')
166+
167+
def pluginClasspathResource = getClass().classLoader.findResource("plugin-classpath.txt")
168+
if (pluginClasspathResource == null) {
169+
throw new IllegalStateException("Did not find plugin classpath resource, run `testClasses` build task.")
170+
}
171+
172+
pluginClasspath = pluginClasspathResource.readLines()
173+
.collect { it.replace('\\', '\\\\') } // escape backslashes in Windows paths
174+
.collect { new File(it) }
168175
}
169176

170177
}

0 commit comments

Comments
 (0)