diff --git a/README.md b/README.md index a619997..ff9901e 100644 --- a/README.md +++ b/README.md @@ -29,11 +29,13 @@ Auto-skip versioning when 'clean' or 'test' tasks are enqueued. **minor** - User defined value, it must be coherent(=0) if you increase _Major_ version. ## Installation -Configure script dependencies in the project _build.gradle_ file: +Configure script dependencies in the project _build.gradle_ file: ``` groovy buildscript { repositories { - jcenter() //not yet + // Please Use jcenter for dependecies: mavenCentral is not enough + jcenter() + // and (for now) maven { url "http://dl.bintray.com/davideas/maven" } // or Gradle Plugins Repository maven { url "https://plugins.gradle.org/m2/" } diff --git a/src/main/groovy/eu/davidea/gradle/VersioningExtension.groovy b/src/main/groovy/eu/davidea/gradle/VersioningExtension.groovy index 14ed79e..664d66f 100644 --- a/src/main/groovy/eu/davidea/gradle/VersioningExtension.groovy +++ b/src/main/groovy/eu/davidea/gradle/VersioningExtension.groovy @@ -69,7 +69,7 @@ class VersioningExtension { patch = Integer.valueOf(versionProps.getProperty(VersionType.PATCH.toString(), "0")) build = Integer.valueOf(versionProps.getProperty(VersionType.BUILD.toString(), "0")) code = Integer.valueOf(versionProps.getProperty(VersionType.CODE.toString(), "0")) - println("INFO - Current versioning: " + toString()) + println("INFO - Current versioning: " + toStringCurrent()) } private isPreRelease() { @@ -129,14 +129,18 @@ class VersioningExtension { return date.format(format) } - String toString() { - return (major > 0 ? "u" + major + "." + minor + " - " : "") + - (propMajor > 0 ? propMajor : major) + - "." + (propMinor > 0 ? propMinor : minor) + - "." + patch + + String toStringCurrent() { + return propMajor + "." + propMinor + "." + patch + (propPreRelease != null && !propPreRelease.isEmpty() ? "-" + propPreRelease : "") + " #" + build + " code=" + code } + String toString() { + return major + "." + minor + "." + patch + + (preRelease != null && !preRelease.isEmpty() ? "-" + preRelease : "") + + " #" + build + + " code=" + code + } + } \ No newline at end of file diff --git a/src/test/groovy/eu/davidea/gradle/GrabVerTest.groovy b/src/test/groovy/eu/davidea/gradle/GrabVerTest.groovy index ec89458..e7548c9 100644 --- a/src/test/groovy/eu/davidea/gradle/GrabVerTest.groovy +++ b/src/test/groovy/eu/davidea/gradle/GrabVerTest.groovy @@ -120,10 +120,10 @@ class GrabVerTest { */ private void printResults(String title) { println("TEST - " + title) - println("TEST - code=" + project.versioning.code) - println("TEST - name=" + project.versioning.name) - println("TEST - fullVersionName=" + project.versioning.fullVersionName) - println("TEST - " + project.versioning) + println("TEST - code=$project.versioning.code") + println("TEST - name=$project.versioning.name") + println("TEST - fullVersionName: $project.versioning.fullVersionName") + println("TEST - New versioning: $project.versioning") } private static void simulateProperties(int major, int minor, int patch, int build, int code) {