Skip to content

Commit d79a292

Browse files
committed
Merge pull request #2 from zombiedev/project-dir
use project dir in getGitVersion
2 parents abb0bd6 + 98f7bb6 commit d79a292

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/main/groovy/com/cinnober/gradle/semver_git/SemverGitPlugin.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ import org.gradle.api.Plugin
2929

3030
class SemverGitPlugin implements Plugin<Project> {
3131

32-
def static String getGitVersion(String nextVersion, String snapshotSuffix) {
33-
def proc = "git describe --exact-match".execute();
32+
def static String getGitVersion(String nextVersion, String snapshotSuffix, File projectDir = null) {
33+
def proc = "git describe --exact-match".execute(null, projectDir);
3434
proc.waitFor();
3535
if (proc.exitValue() == 0) {
3636
return checkVersion(proc.text.trim());
3737
}
38-
proc = "git describe".execute();
38+
proc = "git describe".execute(null, projectDir);
3939
proc.waitFor();
4040
if (proc.exitValue() == 0) {
4141
def describe = proc.text.trim()
@@ -111,7 +111,7 @@ class SemverGitPlugin implements Plugin<Project> {
111111
if (project.ext.properties.containsKey("snapshotSuffix")) {
112112
snapshotSuffix = project.ext.snapshotSuffix
113113
}
114-
project.version = getGitVersion(nextVersion, snapshotSuffix)
114+
project.version = getGitVersion(nextVersion, snapshotSuffix, project.projectDir)
115115
project.task('showVersion') {
116116
group = 'Help'
117117
description = 'Show the project version'

0 commit comments

Comments
 (0)