From f2ceaa3382159effba78b63522871c244a36ac84 Mon Sep 17 00:00:00 2001 From: soloturn Date: Sun, 20 Dec 2020 07:54:03 +0100 Subject: [PATCH 1/3] update to jgitver-0.14.0, gradle-6.8.3 --- build.gradle.kts | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../integration/test/gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index e42d295..cc25663 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -38,7 +38,7 @@ pluginBundle { } dependencies { - implementation("fr.brouillard.oss:jgitver:0.12.0") + implementation("fr.brouillard.oss:jgitver:0.14.0") } java { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ac33e99..442d913 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/test/integration/test/gradle/wrapper/gradle-wrapper.properties b/src/test/integration/test/gradle/wrapper/gradle-wrapper.properties index ac33e99..442d913 100644 --- a/src/test/integration/test/gradle/wrapper/gradle-wrapper.properties +++ b/src/test/integration/test/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From afdbd3e07177128a2798436de2c2d34f68bab13f Mon Sep 17 00:00:00 2001 From: soloturn Date: Sun, 20 Dec 2020 08:23:17 +0100 Subject: [PATCH 2/3] update readme to reflect current version --- README.md | 167 +++++++++++++++++++++++------------------------------- 1 file changed, 70 insertions(+), 97 deletions(-) diff --git a/README.md b/README.md index c626e04..8bda34b 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,7 @@ In order to find the latest version published of [gradle-jgitver-plugin](https:/ see the project [build.gradle.kts](build.gradle.kts) to see how the project is using itself to manage its own versions. -Find latest version of the plugin: [click here](https://plugins.gradle.org/plugin/fr.brouillard.oss.gradle.jgitver) - -### Usage for modern gradle versions _(>= 2.1)_ +### Add the plugin ``` plugins { @@ -20,22 +18,20 @@ plugins { } ``` -### Usage for all gradle versions _(including < 2.1)_ -``` -buildscript { - repositories { - maven { - url "https://plugins.gradle.org/m2/" - } - } - dependencies { - classpath "gradle.plugin.fr.brouillard.oss.gradle:gradle-jgitver-plugin:0.9.1" - } -} +### Use it + +Besides calculating a version automatically when running any gradle task, like `gradle build`, the plugin registers a +task `version` which you can call to print out the calculated version of your project: -apply plugin: 'fr.brouillard.oss.gradle.jgitver' ``` +$ ./gradlew version +> Task :version +Version: 0.10.1-rc03-2-dirty + +BUILD SUCCESSFUL in 1s +1 actionable task: 1 executed +``` ## Documentation @@ -47,49 +43,11 @@ Finally have a look at the [configuration](#configuration) paragraph to have ful ![Gradle Example](src/doc/images/gradle-example.gif?raw=true "Gradle Example") -### Tasks - -#### Version - -Since 0.2.0 the plugin automatically registers a task `version` which you can call to print out the calculated version of your project: - -``` -$ ./gradlew version -:version -Version: 0.0.2-4 - -BUILD SUCCESSFUL - -Total time: 5.769 secs -``` - -Before 0.2.0, in order to know the current version of your project, just print out the version in a task looking like the following: - -``` -task version { - doLast { - println 'Version: ' + version - } -} -``` - -then just call the task - -``` -$ ./gradlew version -:version -Version: 0.0.2-4 - -BUILD SUCCESSFUL - -Total time: 5.769 secs -``` - ### Configuration -#### version >= 0.2.0 +#### build.gradle -Starting from `0.2.0` it is possible to configure the plugin inside the `build.gradle`. +Optionally, configure the plugin inside the `build.gradle`. ~~~~ jgitver { @@ -104,10 +62,10 @@ jgitver { useGitCommitTimestamp true/false useGitCommitID true/false gitCommitIDLength integer - maxDepth integer ( >= 0.7.0) + maxDepth integer nonQualifierBranches string (comma separated list of branches) - versionPattern string (only for PATTERN strategy, >= 0.6.0) - tagVersionPattern string (only for PATTERN strategy >= 0.6.0) + versionPattern string (only for PATTERN strategy) + tagVersionPattern string (only for PATTERN strategy) policy { repeatable closure pattern string (regexp with capturing group) transformations array (array of string) @@ -117,6 +75,37 @@ jgitver { ~~~~ +#### build.gradle.kts + +Optionally, configure the plugin inside the `build.gradle.kts`. + +~~~~ +jgitver { + strategy = fr.brouillard.oss.jgitver.Strategies.PATTERN | MAVEN | CONFIGURABLE + mavenLike = true/false (deprecated, use strategy instead) + policy = fr.brouillard.oss.jgitver.LookupPolicy.MAX | LATEST | NEAREST + autoIncrementPatch = true/false + useDistance = true/false + useDirty = true/false + useSnapshot = true/false + failIfDirty = true/false + useGitCommitTimestamp = true/false + useGitCommitID = true/false + gitCommitIDLength = integer + maxDepth = integer + nonQualifierBranches = "string" (comma separated list of branches) + versionPattern = "string" (only for PATTERN strategy) + tagVersionPattern = "string" (only for PATTERN strategy) + policy { repeatable closure + pattern = "string" (regexp with capturing group) + transformations array (array of string) + } + distanceCalculatorKind = fr.brouillard.oss.jgitver.impl.DistanceCalculator.CalculatorKind.FIRST_PARENT | LOG | DEPTH +} + +~~~~ + +#### Defaults If you do not provide such a configuration (or fill only partial configuration) the following defaults will be used - _strategy_: `CONFIGURABLE` - _mavenLike_: `false` @@ -138,20 +127,7 @@ If you do not provide such a configuration (or fill only partial configuration) - the pattern must be a regular Java [Pattern](https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html) string with one matching group - distanceCalculatorKind: `FIRST_PARENT` -#### version < 0.2.0 - -Before `0.2.0` no configuration was possible. -The plugin used [jgitver](https://github.com/McFoggy/jgitver) with the following settings: - -- _mavenLike_: `false` -- _autoIncrementPatch_: `true` -- _nonQualifierBranches_: `'master'` -- _useDistance_: `true` -- _useGitCommitId_: `false` - -#### Configuration examples - -##### provide specific branch policies +#### Example to provide specific branch policies Given the following configuration ``` @@ -176,9 +152,9 @@ $ gradlew version Version: 1.0.1-3-LOGINPAGE ``` -### Metadatas +#### Add metadata -Since `0.3.0`, jgitver [Metadatas](https://github.com/jgitver/jgitver/blob/master/src/main/java/fr/brouillard/oss/jgitver/metadata/Metadatas.java#L25) are exposed via gradle extension properties using the Metadata name in lower case. +Jgitver [Metadatas](https://github.com/jgitver/jgitver/blob/master/src/main/java/fr/brouillard/oss/jgitver/metadata/Metadatas.java#L25) are exposed via gradle extension properties using the Metadata name in lower case. For example, one could enhance it's jar Manifest with the git commit id using: @@ -195,10 +171,10 @@ jar { } ``` -### Building on detached HEAD +#### Building on detached HEAD When working on a __detached HEAD__, as often on CI environments behind a SCM webhook, no branch information exists anymore from git. -Since `0.4.1` it now possible to provide externally the branch information via a system property or an environment variable. +It is possible to provide externally the branch information via a system property or an environment variable. - all operating systems/shells: `gradlew version -Djgitver.branch=mybranch` - bash only (_zsh?_) one line: `JGITVER_BRANCH=mybranch && gradlew version` @@ -212,32 +188,26 @@ Since `0.4.1` it now possible to provide externally the branch information via a ## Local build & sample test project - `$ ./gradlew install version` will install the current version inside the local maven repository and will print the published version -- minimal test project `build.gradle` file +- minimal test project `build.gradle.kts` file ````gradle - buildscript { - repositories { + plugins { + id("fr.brouillard.oss.gradle.jgitver") version "0.9.1" + } + repositories { mavenLocal() - } - dependencies { - classpath "fr.brouillard.oss.gradle:gradle-jgitver-plugin:0.3.2" - } } - apply plugin: 'fr.brouillard.oss.gradle.jgitver' ```` -- test project `build.gradle` file with Maven like versioning +- test project `build.gradle.kts` file with Maven like versioning ````gradle - buildscript { - repositories { + plugins { + id("fr.brouillard.oss.gradle.jgitver") version "0.9.1" + } + repositories { mavenLocal() - } - dependencies { - classpath "fr.brouillard.oss.gradle:gradle-jgitver-plugin:0.3.2" - } } - apply plugin: 'fr.brouillard.oss.gradle.jgitver' jgitver { - mavenLike true + strategy = fr.brouillard.oss.jgitver.Strategies.MAVEN } ```` @@ -246,10 +216,13 @@ Since `0.4.1` it now possible to provide externally the branch information via a Some integration tests are available to make some manual trials/verifications of the plugin. ```` +# first install it into the local maven repo, then read the current version into a variable, +# afterwards call it using the following schema: +# bash src/test/integration/test/build.sh CONTEXT JGITVER_GRADLE_VERSION EXPECTED_COMPUTED_VERSION ./gradlew install version -cd src/test/integration/test -./build.sh CONTEXT JGITVER_GRADLE_VERSION EXPECTED_COMPUTED_VERSION -# example ./build.sh tag-regexp 0.5.1-2 2.0.1-1 +GRADLE_JGIT_VERSION=`gradle version | grep "Version" | awk '{print $2}'` +echo GRADLE_JGIT_VERSION +./src/test/integration/test/build.sh tag-regexp ${GRADLE_JGIT_VERSION} 2.0.1-1 ```` ## Linux environment for windows users From e6e45293ee1d20cae015718be49d00871d6f57a1 Mon Sep 17 00:00:00 2001 From: soloturn Date: Sun, 20 Dec 2020 11:23:20 +0100 Subject: [PATCH 3/3] testcases now use newest gradle --- .gitignore | 5 +++-- .../{jgitver.gradle => jgitver.gradle.kts} | 0 .../contexts/distance-depth/jgitver.gradle | 3 --- .../contexts/distance-depth/jgitver.gradle.kts | 3 +++ .../distance-first_parent/jgitver.gradle | 3 --- .../distance-first_parent/jgitver.gradle.kts | 3 +++ .../contexts/distance-log/jgitver.gradle | 3 --- .../contexts/distance-log/jgitver.gradle.kts | 3 +++ .../contexts/maven-like/jgitver.gradle | 3 --- .../contexts/maven-like/jgitver.gradle.kts | 3 +++ .../contexts/merged-branches/jgitver.gradle | 3 --- .../merged-branches/jgitver.gradle.kts | 3 +++ .../contexts/policy-latest/jgitver.gradle | 3 --- .../contexts/policy-latest/jgitver.gradle.kts | 3 +++ .../{jgitver.gradle => jgitver.gradle.kts} | 0 .../contexts/policy-nearest/jgitver.gradle | 3 --- .../contexts/policy-nearest/jgitver.gradle.kts | 3 +++ .../contexts/tag-regexp/jgitver.gradle | 4 ---- .../contexts/tag-regexp/jgitver.gradle.kts | 4 ++++ .../contexts/v1.2-tags-regexp/expectation.txt | 1 + .../contexts/v1.2-tags-regexp/jgitver.gradle | 4 ---- .../v1.2-tags-regexp/jgitver.gradle.kts | 4 ++++ .../version-strategy-normal/jgitver.gradle | 5 ----- .../version-strategy-normal/jgitver.gradle.kts | 5 +++++ .../version-strategy-tag/jgitver.gradle | 5 ----- .../version-strategy-tag/jgitver.gradle.kts | 5 +++++ src/test/integration/test/base-build.gradle | 18 ------------------ .../integration/test/base-build.gradle.kts | 10 ++++++++++ src/test/integration/test/build.sh | 6 +++--- 29 files changed, 56 insertions(+), 62 deletions(-) rename src/test/integration/contexts/distance-default/{jgitver.gradle => jgitver.gradle.kts} (100%) delete mode 100644 src/test/integration/contexts/distance-depth/jgitver.gradle create mode 100644 src/test/integration/contexts/distance-depth/jgitver.gradle.kts delete mode 100644 src/test/integration/contexts/distance-first_parent/jgitver.gradle create mode 100644 src/test/integration/contexts/distance-first_parent/jgitver.gradle.kts delete mode 100644 src/test/integration/contexts/distance-log/jgitver.gradle create mode 100644 src/test/integration/contexts/distance-log/jgitver.gradle.kts delete mode 100644 src/test/integration/contexts/maven-like/jgitver.gradle create mode 100644 src/test/integration/contexts/maven-like/jgitver.gradle.kts delete mode 100644 src/test/integration/contexts/merged-branches/jgitver.gradle create mode 100644 src/test/integration/contexts/merged-branches/jgitver.gradle.kts delete mode 100644 src/test/integration/contexts/policy-latest/jgitver.gradle create mode 100644 src/test/integration/contexts/policy-latest/jgitver.gradle.kts rename src/test/integration/contexts/policy-max/{jgitver.gradle => jgitver.gradle.kts} (100%) delete mode 100644 src/test/integration/contexts/policy-nearest/jgitver.gradle create mode 100644 src/test/integration/contexts/policy-nearest/jgitver.gradle.kts delete mode 100644 src/test/integration/contexts/tag-regexp/jgitver.gradle create mode 100644 src/test/integration/contexts/tag-regexp/jgitver.gradle.kts create mode 100644 src/test/integration/contexts/v1.2-tags-regexp/expectation.txt delete mode 100644 src/test/integration/contexts/v1.2-tags-regexp/jgitver.gradle create mode 100644 src/test/integration/contexts/v1.2-tags-regexp/jgitver.gradle.kts delete mode 100644 src/test/integration/contexts/version-strategy-normal/jgitver.gradle create mode 100644 src/test/integration/contexts/version-strategy-normal/jgitver.gradle.kts delete mode 100644 src/test/integration/contexts/version-strategy-tag/jgitver.gradle create mode 100644 src/test/integration/contexts/version-strategy-tag/jgitver.gradle.kts delete mode 100644 src/test/integration/test/base-build.gradle create mode 100644 src/test/integration/test/base-build.gradle.kts diff --git a/.gitignore b/.gitignore index 662f869..9d884f2 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,8 @@ build/ src/test/integration/test/.git/ src/test/integration/test/build/ src/test/integration/test/.gradle/ -src/test/integration/test/build.gradle +src/test/integration/test/build.gradle.kts src/test/integration/test/content .idea/ -*.iml \ No newline at end of file +*.iml + diff --git a/src/test/integration/contexts/distance-default/jgitver.gradle b/src/test/integration/contexts/distance-default/jgitver.gradle.kts similarity index 100% rename from src/test/integration/contexts/distance-default/jgitver.gradle rename to src/test/integration/contexts/distance-default/jgitver.gradle.kts diff --git a/src/test/integration/contexts/distance-depth/jgitver.gradle b/src/test/integration/contexts/distance-depth/jgitver.gradle deleted file mode 100644 index b137d3e..0000000 --- a/src/test/integration/contexts/distance-depth/jgitver.gradle +++ /dev/null @@ -1,3 +0,0 @@ -jgitver { - distanceCalculatorKind "DEPTH" -} \ No newline at end of file diff --git a/src/test/integration/contexts/distance-depth/jgitver.gradle.kts b/src/test/integration/contexts/distance-depth/jgitver.gradle.kts new file mode 100644 index 0000000..c8e3aba --- /dev/null +++ b/src/test/integration/contexts/distance-depth/jgitver.gradle.kts @@ -0,0 +1,3 @@ +jgitver { + distanceCalculatorKind = fr.brouillard.oss.jgitver.impl.DistanceCalculator.CalculatorKind.DEPTH +} \ No newline at end of file diff --git a/src/test/integration/contexts/distance-first_parent/jgitver.gradle b/src/test/integration/contexts/distance-first_parent/jgitver.gradle deleted file mode 100644 index 0942fce..0000000 --- a/src/test/integration/contexts/distance-first_parent/jgitver.gradle +++ /dev/null @@ -1,3 +0,0 @@ -jgitver { - distanceCalculatorKind "FIRST_PARENT" -} \ No newline at end of file diff --git a/src/test/integration/contexts/distance-first_parent/jgitver.gradle.kts b/src/test/integration/contexts/distance-first_parent/jgitver.gradle.kts new file mode 100644 index 0000000..2736c22 --- /dev/null +++ b/src/test/integration/contexts/distance-first_parent/jgitver.gradle.kts @@ -0,0 +1,3 @@ +jgitver { + distanceCalculatorKind = fr.brouillard.oss.jgitver.impl.DistanceCalculator.CalculatorKind.FIRST_PARENT +} \ No newline at end of file diff --git a/src/test/integration/contexts/distance-log/jgitver.gradle b/src/test/integration/contexts/distance-log/jgitver.gradle deleted file mode 100644 index fdcb1fe..0000000 --- a/src/test/integration/contexts/distance-log/jgitver.gradle +++ /dev/null @@ -1,3 +0,0 @@ -jgitver { - distanceCalculatorKind "LOG" -} \ No newline at end of file diff --git a/src/test/integration/contexts/distance-log/jgitver.gradle.kts b/src/test/integration/contexts/distance-log/jgitver.gradle.kts new file mode 100644 index 0000000..9aa94a3 --- /dev/null +++ b/src/test/integration/contexts/distance-log/jgitver.gradle.kts @@ -0,0 +1,3 @@ +jgitver { + distanceCalculatorKind = fr.brouillard.oss.jgitver.impl.DistanceCalculator.CalculatorKind.LOG +} \ No newline at end of file diff --git a/src/test/integration/contexts/maven-like/jgitver.gradle b/src/test/integration/contexts/maven-like/jgitver.gradle deleted file mode 100644 index 296f943..0000000 --- a/src/test/integration/contexts/maven-like/jgitver.gradle +++ /dev/null @@ -1,3 +0,0 @@ -jgitver { - mavenLike true -} \ No newline at end of file diff --git a/src/test/integration/contexts/maven-like/jgitver.gradle.kts b/src/test/integration/contexts/maven-like/jgitver.gradle.kts new file mode 100644 index 0000000..8b7acee --- /dev/null +++ b/src/test/integration/contexts/maven-like/jgitver.gradle.kts @@ -0,0 +1,3 @@ +jgitver { + strategy = fr.brouillard.oss.jgitver.Strategies.MAVEN +} \ No newline at end of file diff --git a/src/test/integration/contexts/merged-branches/jgitver.gradle b/src/test/integration/contexts/merged-branches/jgitver.gradle deleted file mode 100644 index 7e95fe2..0000000 --- a/src/test/integration/contexts/merged-branches/jgitver.gradle +++ /dev/null @@ -1,3 +0,0 @@ -jgitver { - mavenLike false -} \ No newline at end of file diff --git a/src/test/integration/contexts/merged-branches/jgitver.gradle.kts b/src/test/integration/contexts/merged-branches/jgitver.gradle.kts new file mode 100644 index 0000000..f8fccf7 --- /dev/null +++ b/src/test/integration/contexts/merged-branches/jgitver.gradle.kts @@ -0,0 +1,3 @@ +jgitver { + strategy = fr.brouillard.oss.jgitver.Strategies.CONFIGURABLE +} \ No newline at end of file diff --git a/src/test/integration/contexts/policy-latest/jgitver.gradle b/src/test/integration/contexts/policy-latest/jgitver.gradle deleted file mode 100644 index 120c64b..0000000 --- a/src/test/integration/contexts/policy-latest/jgitver.gradle +++ /dev/null @@ -1,3 +0,0 @@ -jgitver { - policy "LATEST" -} \ No newline at end of file diff --git a/src/test/integration/contexts/policy-latest/jgitver.gradle.kts b/src/test/integration/contexts/policy-latest/jgitver.gradle.kts new file mode 100644 index 0000000..1182e25 --- /dev/null +++ b/src/test/integration/contexts/policy-latest/jgitver.gradle.kts @@ -0,0 +1,3 @@ +jgitver { + policy = fr.brouillard.oss.jgitver.LookupPolicy.LATEST +} \ No newline at end of file diff --git a/src/test/integration/contexts/policy-max/jgitver.gradle b/src/test/integration/contexts/policy-max/jgitver.gradle.kts similarity index 100% rename from src/test/integration/contexts/policy-max/jgitver.gradle rename to src/test/integration/contexts/policy-max/jgitver.gradle.kts diff --git a/src/test/integration/contexts/policy-nearest/jgitver.gradle b/src/test/integration/contexts/policy-nearest/jgitver.gradle deleted file mode 100644 index 9c16d1e..0000000 --- a/src/test/integration/contexts/policy-nearest/jgitver.gradle +++ /dev/null @@ -1,3 +0,0 @@ -jgitver { - policy "NEAREST" -} \ No newline at end of file diff --git a/src/test/integration/contexts/policy-nearest/jgitver.gradle.kts b/src/test/integration/contexts/policy-nearest/jgitver.gradle.kts new file mode 100644 index 0000000..c3479c3 --- /dev/null +++ b/src/test/integration/contexts/policy-nearest/jgitver.gradle.kts @@ -0,0 +1,3 @@ +jgitver { + policy = fr.brouillard.oss.jgitver.LookupPolicy.NEAREST +} \ No newline at end of file diff --git a/src/test/integration/contexts/tag-regexp/jgitver.gradle b/src/test/integration/contexts/tag-regexp/jgitver.gradle deleted file mode 100644 index 8820b43..0000000 --- a/src/test/integration/contexts/tag-regexp/jgitver.gradle +++ /dev/null @@ -1,4 +0,0 @@ -jgitver { - mavenLike false - regexVersionTag 'r(.*)' -} \ No newline at end of file diff --git a/src/test/integration/contexts/tag-regexp/jgitver.gradle.kts b/src/test/integration/contexts/tag-regexp/jgitver.gradle.kts new file mode 100644 index 0000000..18788f3 --- /dev/null +++ b/src/test/integration/contexts/tag-regexp/jgitver.gradle.kts @@ -0,0 +1,4 @@ +jgitver { + strategy = fr.brouillard.oss.jgitver.Strategies.PATTERN + regexVersionTag = "r(.*)" +} \ No newline at end of file diff --git a/src/test/integration/contexts/v1.2-tags-regexp/expectation.txt b/src/test/integration/contexts/v1.2-tags-regexp/expectation.txt new file mode 100644 index 0000000..a42406f --- /dev/null +++ b/src/test/integration/contexts/v1.2-tags-regexp/expectation.txt @@ -0,0 +1 @@ +./build.sh v1.2-tags-regexp $JGITVER_GRADLE_PLUGIN_VERSION 1.2.3-1 \ No newline at end of file diff --git a/src/test/integration/contexts/v1.2-tags-regexp/jgitver.gradle b/src/test/integration/contexts/v1.2-tags-regexp/jgitver.gradle deleted file mode 100644 index c110072..0000000 --- a/src/test/integration/contexts/v1.2-tags-regexp/jgitver.gradle +++ /dev/null @@ -1,4 +0,0 @@ -jgitver { - mavenLike false - regexVersionTag 'v(1\\.2.*)' -} \ No newline at end of file diff --git a/src/test/integration/contexts/v1.2-tags-regexp/jgitver.gradle.kts b/src/test/integration/contexts/v1.2-tags-regexp/jgitver.gradle.kts new file mode 100644 index 0000000..7aabac2 --- /dev/null +++ b/src/test/integration/contexts/v1.2-tags-regexp/jgitver.gradle.kts @@ -0,0 +1,4 @@ +jgitver { + strategy = fr.brouillard.oss.jgitver.Strategies.PATTERN + regexVersionTag = "v(1\\.2.*)" +} \ No newline at end of file diff --git a/src/test/integration/contexts/version-strategy-normal/jgitver.gradle b/src/test/integration/contexts/version-strategy-normal/jgitver.gradle deleted file mode 100644 index 8e35421..0000000 --- a/src/test/integration/contexts/version-strategy-normal/jgitver.gradle +++ /dev/null @@ -1,5 +0,0 @@ -jgitver { - strategy "PATTERN" - versionPattern "\${v}-standard" - tagVersionPattern "\${v}-tag" -} \ No newline at end of file diff --git a/src/test/integration/contexts/version-strategy-normal/jgitver.gradle.kts b/src/test/integration/contexts/version-strategy-normal/jgitver.gradle.kts new file mode 100644 index 0000000..be37ee7 --- /dev/null +++ b/src/test/integration/contexts/version-strategy-normal/jgitver.gradle.kts @@ -0,0 +1,5 @@ +jgitver { + strategy = fr.brouillard.oss.jgitver.Strategies.PATTERN + versionPattern = "\${v}-standard" + tagVersionPattern = "\${v}-tag" +} \ No newline at end of file diff --git a/src/test/integration/contexts/version-strategy-tag/jgitver.gradle b/src/test/integration/contexts/version-strategy-tag/jgitver.gradle deleted file mode 100644 index 8e35421..0000000 --- a/src/test/integration/contexts/version-strategy-tag/jgitver.gradle +++ /dev/null @@ -1,5 +0,0 @@ -jgitver { - strategy "PATTERN" - versionPattern "\${v}-standard" - tagVersionPattern "\${v}-tag" -} \ No newline at end of file diff --git a/src/test/integration/contexts/version-strategy-tag/jgitver.gradle.kts b/src/test/integration/contexts/version-strategy-tag/jgitver.gradle.kts new file mode 100644 index 0000000..be37ee7 --- /dev/null +++ b/src/test/integration/contexts/version-strategy-tag/jgitver.gradle.kts @@ -0,0 +1,5 @@ +jgitver { + strategy = fr.brouillard.oss.jgitver.Strategies.PATTERN + versionPattern = "\${v}-standard" + tagVersionPattern = "\${v}-tag" +} \ No newline at end of file diff --git a/src/test/integration/test/base-build.gradle b/src/test/integration/test/base-build.gradle deleted file mode 100644 index 5d6fefe..0000000 --- a/src/test/integration/test/base-build.gradle +++ /dev/null @@ -1,18 +0,0 @@ -buildscript { - repositories { - mavenLocal() - maven { - url "https://plugins.gradle.org/m2/" - } - jcenter() - } - dependencies { - classpath "fr.brouillard.oss.gradle:gradle-jgitver-plugin:${System.env.JGITVER_GRADLE_VERSION}" - } -} - -repositories { - jcenter() -} -apply plugin: 'fr.brouillard.oss.gradle.jgitver' - diff --git a/src/test/integration/test/base-build.gradle.kts b/src/test/integration/test/base-build.gradle.kts new file mode 100644 index 0000000..12f2056 --- /dev/null +++ b/src/test/integration/test/base-build.gradle.kts @@ -0,0 +1,10 @@ +plugins { + id("fr.brouillard.oss.gradle.jgitver") version "0.9.1" +} + +repositories { + mavenLocal() + maven { + url = uri("https://plugins.gradle.org/m2/") + } +} diff --git a/src/test/integration/test/build.sh b/src/test/integration/test/build.sh index a3e3165..49cc26a 100755 --- a/src/test/integration/test/build.sh +++ b/src/test/integration/test/build.sh @@ -15,11 +15,11 @@ if [[ $# -ne 3 ]] ; then exit 1 fi -if [[ -f ../contexts/$1/jgitver.gradle ]] ; then +if [[ -f ../contexts/$1/jgitver.gradle.kts ]] ; then if [[ -f ../contexts/$1/git-history.sh ]] ; then ../contexts/$1/git-history.sh - cat base-build.gradle ../contexts/$1/jgitver.gradle > build.gradle - (export JGITVER_GRADLE_VERSION=$2 && ./gradlew -b build.gradle version) | tee build.log + cat base-build.gradle.kts ../contexts/$1/jgitver.gradle.kts > build.gradle.kts + (export JGITVER_GRADLE_VERSION=$2 && ./gradlew -b build.gradle.kts version) | tee build.log COMPUTED_VERSION=`grep Version: build.log | cut -f 2 -d ' '` rm build.log if [ "$COMPUTED_VERSION" != "$3" ]; then