Skip to content

Commit

Permalink
Merge pull request #2 from zombiedev/project-dir
Browse files Browse the repository at this point in the history
use project dir in getGitVersion
  • Loading branch information
MikaelUmaN committed Mar 7, 2016
2 parents abb0bd6 + 98f7bb6 commit d79a292
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ import org.gradle.api.Plugin

class SemverGitPlugin implements Plugin<Project> {

def static String getGitVersion(String nextVersion, String snapshotSuffix) {
def proc = "git describe --exact-match".execute();
def static String getGitVersion(String nextVersion, String snapshotSuffix, File projectDir = null) {
def proc = "git describe --exact-match".execute(null, projectDir);
proc.waitFor();
if (proc.exitValue() == 0) {
return checkVersion(proc.text.trim());
}
proc = "git describe".execute();
proc = "git describe".execute(null, projectDir);
proc.waitFor();
if (proc.exitValue() == 0) {
def describe = proc.text.trim()
Expand Down Expand Up @@ -111,7 +111,7 @@ class SemverGitPlugin implements Plugin<Project> {
if (project.ext.properties.containsKey("snapshotSuffix")) {
snapshotSuffix = project.ext.snapshotSuffix
}
project.version = getGitVersion(nextVersion, snapshotSuffix)
project.version = getGitVersion(nextVersion, snapshotSuffix, project.projectDir)
project.task('showVersion') {
group = 'Help'
description = 'Show the project version'
Expand Down

0 comments on commit d79a292

Please sign in to comment.