This repository has been archived by the owner on Dec 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Description =========== This new strategy won't auto increment the normal part of the version as `semver` or `semver2` would do. Instead the whole normal part of the version is taken from a `marker` tag. Other metadata information for prerelease versions are generated in a similar fashion than done in the `semver` strategies but not based on the latest release tag but also on the marker tag. One can define two marker tags in the project. * `ci-0.0.0` * `release-0.0.0` The prefix can not be configured at the moment. The version strategy will look for these markers and determine the normal of the generated version. We have two different markers depending on the current release cycle. We can configure to use a specific marker based on the current git branch. This can be configured with the `releaseBranchPattern` property which has a default value of `/(^release\/.*|^master$)/`. Which means if the current branch is named `master` or starts with `release/` then use the normal from the `release-*` marker tag. If not use the ci marker. This allows to bump the ci version to the next to be released version for development when the release process is kicked off in a sidebranch. To illustrate this: ``` * branch: 'develop', version: '0.2.0-develop.2 /| ◊ | branch: 'master', version: '0.1.0', tag: 'v0.1.0, | | * | branch: 'master', version: '0.1.0-master.1, distance: 1 | | | * branch: 'develop', version: '0.2.0-develop.1 \| ◊ branch: 'develop', version: '0.0.0', tag: 'release-0.1.0', ci-0.2.0, ``` Staging and production build generation works as before. Staging builds will increment based on the previous staging version. This patch also adds a new configuration property which allows to configure which branch(es) are the main development branches. This information is used to construct the snapshot prerelease metadata. A snapshot version gets constructed with the normal version part + encoded branchname + counter. The branchname comes in two flavors. If it is a main branch (`master`, `develop`) by default it won't be prefixed with `branch.` (depending on the semver strategy) Now it's possible to provide a patter for this check `mainBranchPattern` the default value is `/(^master$|^develop$)/` Changes ======= * ![ADD] `staticMarker` version strategy
- Loading branch information
Showing
13 changed files
with
563 additions
and
80 deletions.
There are no files selected for viewing
146 changes: 84 additions & 62 deletions
146
src/integrationTest/groovy/wooga/gradle/version/VersionPluginIntegrationSpec.groovy
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
package wooga.gradle.version | ||
|
||
enum VersionScheme { | ||
semver, semver2 | ||
semver, semver2, staticMarker | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/groovy/wooga/gradle/version/internal/release/base/MarkerTagStrategy.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright 2018-2020 Wooga GmbH | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* | ||
*/ | ||
|
||
package wooga.gradle.version.internal.release.base | ||
|
||
import com.github.zafarkhaja.semver.ParseException | ||
import com.github.zafarkhaja.semver.Version | ||
import org.ajoberstar.grgit.Tag | ||
|
||
class MarkerTagStrategy extends TagStrategy { | ||
|
||
private final String prefix | ||
|
||
Closure<Version> parseTag = { Tag tag -> | ||
try { | ||
if(tag.name.startsWith(prefix)) { | ||
Version.valueOf(tag.name.replace(prefix,"")) | ||
} else | ||
{ | ||
null | ||
} | ||
|
||
} catch (ParseException e) { | ||
null | ||
} | ||
} | ||
|
||
MarkerTagStrategy(String prefix) { | ||
super(false) | ||
this.prefix = prefix | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.