Compare commits
34 commits
Author | SHA1 | Date | |
---|---|---|---|
7440631325 | |||
65a38facda | |||
3e70a53714 | |||
afe6d3ebc9 | |||
34cedc21e6 | |||
e71f4f60ee | |||
68f42777af | |||
1f7861e314 | |||
765c07a85e | |||
bf51d1d826 | |||
9737f66f64 | |||
d17afba52e | |||
c32a7ebdec | |||
062758a5f0 | |||
860d985059 | |||
c678bb7889 | |||
c16f95a8d3 | |||
6d23cead06 | |||
24b12f131e | |||
e1891c47af | |||
17b5ceaaf6 | |||
ebc5b66fac | |||
7a1ff7ee24 | |||
d45e700b6b | |||
b9c865bc6f | |||
51dbfe9c4e | |||
a1054cf46a | |||
fa23243ff5 | |||
ffda5e3ad4 | |||
4efc2ba2d6 | |||
6081bdfdd5 | |||
e47f762a6f | |||
617c0b89ac | |||
6634ab3baf |
71 changed files with 924 additions and 537 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
version: 2
|
||||||
defaults: &defaults
|
defaults: &defaults
|
||||||
working_directory: ~/repo
|
working_directory: ~/repo
|
||||||
docker:
|
docker:
|
||||||
|
@ -7,8 +8,6 @@ defaults: &defaults
|
||||||
TERM: dumb
|
TERM: dumb
|
||||||
CI: true
|
CI: true
|
||||||
|
|
||||||
version: 2.0
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_gradle:
|
build_gradle:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
|
|
19
.github/workflows/gradle.yml
vendored
Normal file
19
.github/workflows/gradle.yml
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
name: Java CI with Gradle
|
||||||
|
|
||||||
|
on: [push, pull_request, workflow_dispatch]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up JDK 1.8
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 1.8
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
|
- name: Test with Gradle
|
||||||
|
run: ./gradlew check
|
52
.gitignore
vendored
52
.gitignore
vendored
|
@ -1,32 +1,14 @@
|
||||||
|
.vscode/*
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
!.vscode/launch.json
|
!.vscode/launch.json
|
||||||
!.vscode/settings.json
|
!.vscode/settings.json
|
||||||
!.vscode/tasks.json
|
!.vscode/tasks.json
|
||||||
!gradle-wrapper.jar
|
|
||||||
|
__pycache__
|
||||||
.classpath
|
.classpath
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.gradle
|
.gradle
|
||||||
.history
|
.history
|
||||||
.idea_modules/
|
|
||||||
.idea/**/contentModel.xml
|
|
||||||
.idea/**/dataSources.ids
|
|
||||||
.idea/**/dataSources.local.xml
|
|
||||||
.idea/**/dataSources/
|
|
||||||
.idea/**/dbnavigator.xml
|
|
||||||
.idea/**/dictionaries
|
|
||||||
.idea/**/dynamic.xml
|
|
||||||
.idea/**/gradle.xml
|
|
||||||
.idea/**/libraries
|
|
||||||
.idea/**/mongoSettings.xml
|
|
||||||
.idea/**/shelf
|
|
||||||
.idea/**/sqlDataSources.xml
|
|
||||||
.idea/**/tasks.xml
|
|
||||||
.idea/**/uiDesigner.xml
|
|
||||||
.idea/**/usage.statistics.xml
|
|
||||||
.idea/**/workspace.xml
|
|
||||||
.idea/caches/build_file_checksums.ser
|
|
||||||
.idea/httpRequests
|
|
||||||
.idea/replstate.xml
|
|
||||||
.kobalt
|
.kobalt
|
||||||
.mtj.tmp/
|
.mtj.tmp/
|
||||||
.mvn/timing.properties
|
.mvn/timing.properties
|
||||||
|
@ -35,20 +17,39 @@
|
||||||
.project
|
.project
|
||||||
.scannerwork
|
.scannerwork
|
||||||
.settings
|
.settings
|
||||||
.vscode/*
|
|
||||||
*.class
|
*.class
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
*.ctxt
|
*.ctxt
|
||||||
*.ear
|
|
||||||
*.iws
|
*.iws
|
||||||
*.jar
|
|
||||||
*.log
|
*.log
|
||||||
*.nar
|
*.nar
|
||||||
*.rar
|
*.rar
|
||||||
*.sublime-*
|
*.sublime-*
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
*.war
|
|
||||||
*.zip
|
*.zip
|
||||||
|
/**/.idea_modules/
|
||||||
|
/**/.idea/**/caches/build_file_checksums.ser
|
||||||
|
/**/.idea/**/contentModel.xml
|
||||||
|
/**/.idea/**/dataSources.ids
|
||||||
|
/**/.idea/**/dataSources.local.xml
|
||||||
|
/**/.idea/**/dataSources/
|
||||||
|
/**/.idea/**/dbnavigator.xml
|
||||||
|
/**/.idea/**/dictionaries
|
||||||
|
/**/.idea/**/dynamic.xml
|
||||||
|
/**/.idea/**/gradle.xml
|
||||||
|
/**/.idea/**/httpRequests
|
||||||
|
/**/.idea/**/libraries
|
||||||
|
/**/.idea/**/mongoSettings.xml
|
||||||
|
/**/.idea/**/replstate.xml
|
||||||
|
/**/.idea/**/shelf
|
||||||
|
/**/.idea/**/shelf/
|
||||||
|
/**/.idea/**/sqlDataSources.xml
|
||||||
|
/**/.idea/**/tasks.xml
|
||||||
|
/**/.idea/**/uiDesigner.xml
|
||||||
|
/**/.idea/**/usage.statistics.xml
|
||||||
|
/**/.idea/**/workspace.xml
|
||||||
|
/**/.idea/$CACHE_FILE$
|
||||||
|
/**/.idea/$PRODUCT_WORKSPACE_FILE$
|
||||||
atlassian-ide-plugin.xml
|
atlassian-ide-plugin.xml
|
||||||
bin/
|
bin/
|
||||||
build/
|
build/
|
||||||
|
@ -80,3 +81,4 @@ release.properties
|
||||||
target/
|
target/
|
||||||
test-output
|
test-output
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
venv
|
||||||
|
|
31
.gitlab-ci.yml
Normal file
31
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
image: gradle:alpine
|
||||||
|
|
||||||
|
variables:
|
||||||
|
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- export GRADLE_USER_HOME=`pwd`/.gradle
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
|
||||||
|
build:
|
||||||
|
stage: build
|
||||||
|
script: ./gradlew --build-cache assemble
|
||||||
|
cache:
|
||||||
|
key: "$CI_COMMIT_REF_NAME"
|
||||||
|
policy: push
|
||||||
|
paths:
|
||||||
|
- build
|
||||||
|
- .gradle
|
||||||
|
|
||||||
|
test:
|
||||||
|
stage: test
|
||||||
|
script: ./gradlew check
|
||||||
|
cache:
|
||||||
|
key: "$CI_COMMIT_REF_NAME"
|
||||||
|
policy: pull
|
||||||
|
paths:
|
||||||
|
- build
|
||||||
|
- .gradle
|
16
.idea/checkstyle-idea.xml
generated
Normal file
16
.idea/checkstyle-idea.xml
generated
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CheckStyle-IDEA">
|
||||||
|
<option name="configuration">
|
||||||
|
<map>
|
||||||
|
<entry key="checkstyle-version" value="8.19" />
|
||||||
|
<entry key="copy-libs" value="true" />
|
||||||
|
<entry key="location-0" value="BUNDLED:(bundled):Sun Checks" />
|
||||||
|
<entry key="location-1" value="BUNDLED:(bundled):Google Checks" />
|
||||||
|
<entry key="scan-before-checkin" value="false" />
|
||||||
|
<entry key="scanscope" value="JavaOnly" />
|
||||||
|
<entry key="suppress-errors" value="false" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Erik's Code Style" />
|
||||||
|
</state>
|
||||||
|
</component>
|
1
.idea/copyright/Erik_s_Copyright_Notice.xml
generated
1
.idea/copyright/Erik_s_Copyright_Notice.xml
generated
|
@ -1,5 +1,6 @@
|
||||||
<component name="CopyrightManager">
|
<component name="CopyrightManager">
|
||||||
<copyright>
|
<copyright>
|
||||||
|
<option name="allowReplaceRegexp" value="Copyright" />
|
||||||
<option name="notice" value="&#36;file.fileName Copyright (c) 2018-&#36;today.year, Erik C. Thauvin (erik@thauvin.net) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of this project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." />
|
<option name="notice" value="&#36;file.fileName Copyright (c) 2018-&#36;today.year, Erik C. Thauvin (erik@thauvin.net) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of this project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." />
|
||||||
<option name="myName" value="Erik's Copyright Notice" />
|
<option name="myName" value="Erik's Copyright Notice" />
|
||||||
</copyright>
|
</copyright>
|
||||||
|
|
30
.idea/jarRepositories.xml
generated
Normal file
30
.idea/jarRepositories.xml
generated
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Maven Central repository" />
|
||||||
|
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jboss.community" />
|
||||||
|
<option name="name" value="JBoss Community repository" />
|
||||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="MavenLocal" />
|
||||||
|
<option name="name" value="MavenLocal" />
|
||||||
|
<option name="url" value="file:/$MAVEN_REPOSITORY$/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="BintrayJCenter" />
|
||||||
|
<option name="name" value="BintrayJCenter" />
|
||||||
|
<option name="url" value="https://jcenter.bintray.com/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="MavenLocal" />
|
||||||
|
<option name="name" value="MavenLocal" />
|
||||||
|
<option name="url" value="file:$MAVEN_REPOSITORY$/" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
9
.idea/misc.xml
generated
9
.idea/misc.xml
generated
|
@ -1,6 +1,15 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="FrameworkDetectionExcludesConfiguration">
|
||||||
|
<file type="web" url="file://$PROJECT_DIR$/examples/annotation-processor/java" />
|
||||||
|
<file type="web" url="file://$PROJECT_DIR$/examples/annotation-processor/kotlin" />
|
||||||
|
<file type="web" url="file://$PROJECT_DIR$/examples/java" />
|
||||||
|
<file type="web" url="file://$PROJECT_DIR$/examples/kotlin" />
|
||||||
|
</component>
|
||||||
|
<component name="JavaScriptSettings">
|
||||||
|
<option name="languageLevel" value="ES6" />
|
||||||
|
</component>
|
||||||
<component name="NodePackageJsonFileManager">
|
<component name="NodePackageJsonFileManager">
|
||||||
<packageJsonPaths />
|
<packageJsonPaths />
|
||||||
</component>
|
</component>
|
||||||
|
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/semver-gradle.iml" filepath="$PROJECT_DIR$/.idea/semver-gradle.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
2
.idea/scopes/Copyright.xml
generated
2
.idea/scopes/Copyright.xml
generated
|
@ -1,3 +1,3 @@
|
||||||
<component name="DependencyValidationManager">
|
<component name="DependencyValidationManager">
|
||||||
<scope name="Copyright" pattern="file[semver.main]:*.kt/||file[semver.test]:*.kt/" />
|
<scope name="Copyright" pattern="file[semver-gradle]:src/main/kotlin/net/thauvin/erik/gradle/semver//*||file[semver-gradle]:src/test/kotlin/net/thauvin/erik/gradle/semver//*||file[examples-kotlin.main]:*/||file[examples-kotlin.test]:*/||file[examples-java.main]:*/||file[examples-java.test]:*/||file[ap-examples-kotlin.main]:*/||file[ap-examples-java.main]:*/" />
|
||||||
</component>
|
</component>
|
|
@ -1,8 +1,5 @@
|
||||||
language: java
|
language: java
|
||||||
|
dist: trusty
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- CI=true
|
|
||||||
|
|
||||||
jdk:
|
jdk:
|
||||||
- oraclejdk8
|
- oraclejdk8
|
||||||
|
|
68
CHANGELOG.md
Normal file
68
CHANGELOG.md
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
# Change Log
|
||||||
|
|
||||||
|
## [1.0.4](https://github.com/ethauvin/semver-gradle/tree/1.0.4) (2019-07-26)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver-gradle/compare/1.0.3-beta...1.0.4)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Access semver version properties in Gradle build file. [\#8](https://github.com/ethauvin/semver-gradle/issues/8)
|
||||||
|
|
||||||
|
## [1.0.3-beta](https://github.com/ethauvin/semver-gradle/tree/1.0.3-beta) (2019-07-25)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver-gradle/compare/1.0.2...1.0.3-beta)
|
||||||
|
|
||||||
|
**Closed issues:**
|
||||||
|
|
||||||
|
- Thanks! [\#7](https://github.com/ethauvin/semver-gradle/issues/7)
|
||||||
|
|
||||||
|
## [1.0.2](https://github.com/ethauvin/semver-gradle/tree/1.0.2) (2019-05-24)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver-gradle/compare/1.0.1...1.0.2)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- version.properties write issue when using NetBeans on Windows. [\#6](https://github.com/ethauvin/semver-gradle/issues/6)
|
||||||
|
|
||||||
|
## [1.0.1](https://github.com/ethauvin/semver-gradle/tree/1.0.1) (2019-05-24)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver-gradle/compare/1.0.0...1.0.1)
|
||||||
|
|
||||||
|
## [1.0.0](https://github.com/ethauvin/semver-gradle/tree/1.0.0) (2019-04-23)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver-gradle/compare/0.9.9-beta...1.0.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Optionally save version properties [\#1](https://github.com/ethauvin/semver-gradle/issues/1)
|
||||||
|
- Set prerelease from commandline [\#3](https://github.com/ethauvin/semver-gradle/issues/3)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Extended existing tests to include semver property [\#5](https://github.com/ethauvin/semver-gradle/pull/5) ([rveede](https://github.com/rveede))
|
||||||
|
- Include full semver version in version.properties [\#4](https://github.com/ethauvin/semver-gradle/pull/4) ([rveede](https://github.com/rveede))
|
||||||
|
|
||||||
|
## [0.9.9-beta](https://github.com/ethauvin/semver-gradle/tree/0.9.9-beta) (2018-12-20)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver-gradle/compare/0.9.8-beta...0.9.9-beta)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Add option for disabling saves every project evaluation [\#2](https://github.com/ethauvin/semver-gradle/pull/2) ([lewismorgan](https://github.com/lewismorgan))
|
||||||
|
|
||||||
|
## [0.9.8-beta](https://github.com/ethauvin/semver-gradle/tree/0.9.8-beta) (2018-07-14)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver-gradle/compare/0.9.7-beta...0.9.8-beta)
|
||||||
|
|
||||||
|
## [0.9.7-beta](https://github.com/ethauvin/semver-gradle/tree/0.9.7-beta) (2018-07-13)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver-gradle/compare/0.9.6-beta...0.9.7-beta)
|
||||||
|
|
||||||
|
## [0.9.6-beta](https://github.com/ethauvin/semver-gradle/tree/0.9.6-beta) (2018-07-10)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver-gradle/compare/0.9.5-beta...0.9.6-beta)
|
||||||
|
|
||||||
|
## [0.9.5-beta](https://github.com/ethauvin/semver-gradle/tree/0.9.5-beta) (2018-07-07)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver-gradle/compare/0.9.4-beta...0.9.5-beta)
|
||||||
|
|
||||||
|
## [0.9.4-beta](https://github.com/ethauvin/semver-gradle/tree/0.9.4-beta) (2018-07-03)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver-gradle/compare/0.9.3-beta...0.9.4-beta)
|
||||||
|
|
||||||
|
## [0.9.3-beta](https://github.com/ethauvin/semver-gradle/tree/0.9.3-beta) (2018-07-02)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver-gradle/compare/0.9.2-beta...0.9.3-beta)
|
||||||
|
|
||||||
|
## [0.9.2-beta](https://github.com/ethauvin/semver-gradle/tree/0.9.2-beta) (2018-07-01)
|
||||||
|
|
||||||
|
|
||||||
|
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
|
@ -1,4 +1,4 @@
|
||||||
Copyright (c) 2018-2019, Erik C. Thauvin (erik@thauvin.net)
|
Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
|
53
README.md
53
README.md
|
@ -1,4 +1,4 @@
|
||||||
[](http://opensource.org/licenses/BSD-3-Clause) [](https://sonarcloud.io/dashboard?id=ethauvin_semver-gradle) [](https://travis-ci.org/ethauvin/semver-gradle) [](https://circleci.com/gh/ethauvin/semver-gradle/tree/master) [](https://plugins.gradle.org/plugin/net.thauvin.erik.gradle.semver)
|
[](http://opensource.org/licenses/BSD-3-Clause) [](https://sonarcloud.io/dashboard?id=ethauvin_semver-gradle) [](https://travis-ci.com/ethauvin/semver-gradle) [](https://circleci.com/gh/ethauvin/semver-gradle/tree/master) [](https://plugins.gradle.org/plugin/net.thauvin.erik.gradle.semver)
|
||||||
|
|
||||||
# Semantic Version Plugin for Gradle
|
# Semantic Version Plugin for Gradle
|
||||||
|
|
||||||
|
@ -244,6 +244,57 @@ test.semver=1.0.0
|
||||||
|
|
||||||
- __Examples__: [Java](https://github.com/ethauvin/semver-gradle/tree/master/examples/java), [Kotlin](https://github.com/ethauvin/semver-gradle/tree/master/examples/kotlin)
|
- __Examples__: [Java](https://github.com/ethauvin/semver-gradle/tree/master/examples/java), [Kotlin](https://github.com/ethauvin/semver-gradle/tree/master/examples/kotlin)
|
||||||
|
|
||||||
|
### Semver Extension Properties
|
||||||
|
|
||||||
|
The values stored in the version properties file can individually be accessed using the `semver` extension, for example:
|
||||||
|
|
||||||
|
```gradle
|
||||||
|
fooTask {
|
||||||
|
doFirst {
|
||||||
|
println "Build: $semver.buildMeta"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The semver extension properties are:
|
||||||
|
|
||||||
|
Property | Description
|
||||||
|
:-------------------------|:----------------------------
|
||||||
|
`semver.semver` | The full semantic version.
|
||||||
|
`semver.version` | Same as `semver.semver`.
|
||||||
|
`semver.major` | The major version.
|
||||||
|
`semver.minor` | The minor version.
|
||||||
|
`semver.patch` | The patch version.
|
||||||
|
`semver.preRelease` | The pre-release version
|
||||||
|
`semver.preReleasePrefix` | The pre-release prefix
|
||||||
|
`semver.buildMeta` | The build metatdata version
|
||||||
|
`semver.buildMetaPrefix` | The build metadata prefix
|
||||||
|
`semver.separator` | The version separator.
|
||||||
|
|
||||||
|
## Version is "unspecified"
|
||||||
|
|
||||||
|
This is a common problem stemming from the configuration and build phases in Gradle.
|
||||||
|
|
||||||
|
It is always preferable to access to version during the execution stage, in a `doFirst` or `doLast` closure within your tasks:
|
||||||
|
|
||||||
|
```gradle
|
||||||
|
task foo() {
|
||||||
|
doFirst {
|
||||||
|
println project.version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
or if absolutely necessary, at the end of the configuration stage in a `project.afterEvaluate` block:
|
||||||
|
|
||||||
|
```gradle
|
||||||
|
foo {
|
||||||
|
project.afterEvaluate {
|
||||||
|
println project.version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Source Code Generation
|
## Source Code Generation
|
||||||
|
|
||||||
If you'd like to incorporate the version number data into your source code, please have a look at the [__Semantic Version Annotation Processor__](https://github.com/ethauvin/semver).
|
If you'd like to incorporate the version number data into your source code, please have a look at the [__Semantic Version Annotation Processor__](https://github.com/ethauvin/semver).
|
||||||
|
|
9
bitbucket-pipelines.yml
Normal file
9
bitbucket-pipelines.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
image: openjdk:8
|
||||||
|
|
||||||
|
pipelines:
|
||||||
|
default:
|
||||||
|
- step:
|
||||||
|
caches:
|
||||||
|
- gradle
|
||||||
|
script:
|
||||||
|
- bash ./gradlew check
|
|
@ -2,24 +2,26 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
`java-gradle-plugin`
|
`java-gradle-plugin`
|
||||||
`kotlin-dsl`
|
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
jacoco
|
jacoco
|
||||||
id("com.github.ben-manes.versions") version "0.21.0"
|
kotlin("jvm") version "1.3.72"
|
||||||
id("com.gradle.build-scan") version "2.2.1"
|
id("com.github.ben-manes.versions") version "0.36.0"
|
||||||
id("com.gradle.plugin-publish") version "0.10.1"
|
id("com.gradle.plugin-publish") version "0.12.0"
|
||||||
id("io.gitlab.arturbosch.detekt") version "1.0.0-RC14"
|
id("io.gitlab.arturbosch.detekt") version "1.14.2"
|
||||||
id("org.jlleitschuh.gradle.ktlint") version "7.3.0"
|
id("org.gradle.kotlin.kotlin-dsl") version "1.3.6"
|
||||||
id("org.sonarqube") version "2.7"
|
id("org.sonarqube") version "3.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
version = "1.0.0"
|
version = "1.0.5-beta"
|
||||||
group = "net.thauvin.erik.gradle"
|
group = "net.thauvin.erik.gradle"
|
||||||
|
|
||||||
var github = "https://github.com/ethauvin/semver-gradle"
|
object VersionInfo {
|
||||||
var packageName = "net.thauvin.erik.gradle.semver"
|
const val spek = "2.0.13"
|
||||||
|
}
|
||||||
|
val versions: VersionInfo by extra { VersionInfo }
|
||||||
|
|
||||||
var spek_version = "2.0.2"
|
val github = "https://github.com/ethauvin/semver-gradle"
|
||||||
|
val packageName = "net.thauvin.erik.gradle.semver"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
|
@ -28,12 +30,15 @@ repositories {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(gradleApi())
|
implementation(gradleApi())
|
||||||
|
|
||||||
|
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
|
||||||
|
implementation(kotlin("stdlib"))
|
||||||
testImplementation(kotlin("reflect"))
|
testImplementation(kotlin("reflect"))
|
||||||
testImplementation(kotlin("test"))
|
testImplementation(kotlin("test"))
|
||||||
|
|
||||||
testImplementation(gradleTestKit())
|
testImplementation(gradleTestKit())
|
||||||
|
|
||||||
testImplementation("org.spekframework.spek2:spek-dsl-jvm:$spek_version")
|
testImplementation("org.spekframework.spek2:spek-dsl-jvm:${versions.spek}")
|
||||||
testRuntimeOnly("org.spekframework.spek2:spek-runner-junit5:$spek_version")
|
testRuntimeOnly("org.spekframework.spek2:spek-runner-junit5:${versions.spek}")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
@ -56,28 +61,14 @@ tasks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"check" {
|
|
||||||
dependsOn("ktlintCheck")
|
|
||||||
}
|
|
||||||
|
|
||||||
"sonarqube" {
|
"sonarqube" {
|
||||||
dependsOn("jacocoTestReport")
|
dependsOn("jacocoTestReport")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buildScan {
|
|
||||||
link("GitHub", "https://github.com/ethauvin/semver-gradle/tree/master")
|
|
||||||
if ("true" == System.getenv("CI")) {
|
|
||||||
publishOnFailure()
|
|
||||||
tag("CI")
|
|
||||||
}
|
|
||||||
termsOfServiceUrl = "https://gradle.com/terms-of-service"
|
|
||||||
termsOfServiceAgree = "yes"
|
|
||||||
}
|
|
||||||
|
|
||||||
detekt {
|
detekt {
|
||||||
input = files("src/main/kotlin", "src/test/kotlin")
|
// input = files("src/main/kotlin", "src/test/kotlin")
|
||||||
filters = ".*/resources/.*,.*/build/.*"
|
// filters = ".*/resources/.*,.*/build/.*"
|
||||||
baseline = project.rootDir.resolve("detekt-baseline.xml")
|
baseline = project.rootDir.resolve("detekt-baseline.xml")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
<?xml version="1.0" ?>
|
<?xml version="1.0" ?>
|
||||||
<SmellBaseline>
|
<SmellBaseline>
|
||||||
<Blacklist timestamp="1555043579716"></Blacklist>
|
<ManuallySuppressedIssues></ManuallySuppressedIssues>
|
||||||
<Whitelist timestamp="1555043579714">
|
<CurrentIssues>
|
||||||
<ID>ComplexMethod:Utils.kt$Utils$fun loadProperties(file: File): Properties</ID>
|
|
||||||
<ID>MagicNumber:Utils.kt$Utils$3</ID>
|
<ID>MagicNumber:Utils.kt$Utils$3</ID>
|
||||||
<ID>MagicNumber:Utils.kt$Utils$4</ID>
|
<ID>MagicNumber:Utils.kt$Utils$4</ID>
|
||||||
<ID>MaxLineLength:SemverPlugin.kt$net.thauvin.erik.gradle.semver.SemverPlugin.kt</ID>
|
<ID>MagicNumber:Utils.kt$Utils$5</ID>
|
||||||
<ID>NestedBlockDepth:Utils.kt$Utils$fun loadProperties(file: File): Properties</ID>
|
<ID>NestedBlockDepth:Utils.kt$Utils$fun loadProperties(file: File): Properties</ID>
|
||||||
<ID>NestedBlockDepth:Utils.kt$Utils$fun parseSemVer(input: String, version: Version): String</ID>
|
<ID>NestedBlockDepth:Utils.kt$Utils$fun parseSemVer(input: String?, version: Version): Boolean</ID>
|
||||||
<ID>NestedBlockDepth:Utils.kt$Utils$fun saveProperties(config: SemverConfig, version: Version)</ID>
|
<ID>NestedBlockDepth:Utils.kt$Utils$fun saveProperties(projectDir: File, config: SemverConfig, version: Version)</ID>
|
||||||
</Whitelist>
|
</CurrentIssues>
|
||||||
</SmellBaseline>
|
</SmellBaseline>
|
|
@ -1,8 +1,8 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'application'
|
id 'application'
|
||||||
id 'net.thauvin.erik.gradle.semver' version '0.9.9-beta'
|
id 'net.thauvin.erik.gradle.semver' version '1.0.4'
|
||||||
id 'com.github.ben-manes.versions' version '0.21.0'
|
id 'com.github.ben-manes.versions' version '0.28.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
// ./gradlew
|
// ./gradlew
|
||||||
|
@ -14,13 +14,16 @@ mainClassName = 'com.example.Example'
|
||||||
|
|
||||||
defaultTasks 'run'
|
defaultTasks 'run'
|
||||||
|
|
||||||
compileJava.options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java")
|
|
||||||
|
|
||||||
def semverProcessor = "net.thauvin.erik:semver:1.2.0"
|
def semverProcessor = "net.thauvin.erik:semver:1.2.0"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
annotationProcessor semverProcessor
|
annotationProcessor semverProcessor
|
||||||
compileOnly semverProcessor
|
implementation semverProcessor
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java")
|
||||||
|
options.compilerArgs += [ "-Asemver.project.dir=$projectDir" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
35
examples/annotation-processor/java/gradlew
vendored
35
examples/annotation-processor/java/gradlew
vendored
|
@ -7,7 +7,7 @@
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@ -125,8 +125,8 @@ if $darwin; then
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if $cygwin ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
@ -154,19 +154,19 @@ if $cygwin ; then
|
||||||
else
|
else
|
||||||
eval `echo args$i`="\"$arg\""
|
eval `echo args$i`="\"$arg\""
|
||||||
fi
|
fi
|
||||||
i=$((i+1))
|
i=`expr $i + 1`
|
||||||
done
|
done
|
||||||
case $i in
|
case $i in
|
||||||
(0) set -- ;;
|
0) set -- ;;
|
||||||
(1) set -- "$args0" ;;
|
1) set -- "$args0" ;;
|
||||||
(2) set -- "$args0" "$args1" ;;
|
2) set -- "$args0" "$args1" ;;
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -175,14 +175,9 @@ save () {
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
APP_ARGS=$(save "$@")
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
@rem you may not use this file except in compliance with the License.
|
@rem you may not use this file except in compliance with the License.
|
||||||
@rem You may obtain a copy of the License at
|
@rem You may obtain a copy of the License at
|
||||||
@rem
|
@rem
|
||||||
@rem http://www.apache.org/licenses/LICENSE-2.0
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
@rem
|
@rem
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This file is automatically generated.
|
* This file is automatically generated.
|
||||||
* Do not modify! -- ALL CHANGES WILL BE ERASED!
|
* Do not modify! -- ALL CHANGES WILL BE ERASED!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.example;
|
package com.example;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -12,17 +13,17 @@ import java.util.Date;
|
||||||
* @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a>
|
* @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a>
|
||||||
*/
|
*/
|
||||||
public final class GeneratedVersion {
|
public final class GeneratedVersion {
|
||||||
public final static String PROJECT = "Java Example";
|
public static final String PROJECT = "Java Example";
|
||||||
public final static Date BUILDDATE = new Date(1556045173358L);
|
public static final Date BUILDDATE = new Date(1564027571537L);
|
||||||
public final static int MAJOR = 2;
|
public static final int MAJOR = 2;
|
||||||
public final static int MINOR = 8;
|
public static final int MINOR = 10;
|
||||||
public final static int PATCH = 0;
|
public static final int PATCH = 0;
|
||||||
public final static String PRERELEASE = "";
|
public static final String PRERELEASE = "";
|
||||||
public final static String PRERELEASE_PREFIX = "-";
|
public static final String PRERELEASE_PREFIX = "-";
|
||||||
public final static String BUILDMETA = "";
|
public static final String BUILDMETA = "";
|
||||||
public final static String BUILDMETA_PREFIX = "+";
|
public static final String BUILDMETA_PREFIX = "+";
|
||||||
public final static String SEPARATOR = ".";
|
public static final String SEPARATOR = ".";
|
||||||
public final static String VERSION = "2.8.0";
|
public static final String VERSION = "2.10.0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables the default constructor.
|
* Disables the default constructor.
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#Generated by the Semver Plugin for Gradle
|
#Generated by the Semver Plugin for Gradle
|
||||||
#Tue Apr 23 11:46:10 PDT 2019
|
#Wed Jul 24 21:06:09 PDT 2019
|
||||||
version.buildmeta=
|
version.buildmeta=
|
||||||
version.major=2
|
version.major=2
|
||||||
version.minor=8
|
version.minor=10
|
||||||
version.patch=0
|
version.patch=0
|
||||||
version.prerelease=
|
version.prerelease=
|
||||||
version.project=Java Example
|
version.project=Java Example
|
||||||
|
version.semver=2.10.0
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm").version("1.3.30")
|
kotlin("jvm").version("1.3.61")
|
||||||
application
|
application
|
||||||
id("org.jetbrains.kotlin.kapt").version("1.3.30")
|
id("org.jetbrains.kotlin.kapt").version("1.3.61")
|
||||||
id("net.thauvin.erik.gradle.semver").version("0.9.9-beta")
|
id("net.thauvin.erik.gradle.semver").version("1.0.4")
|
||||||
id("com.github.ben-manes.versions").version("0.21.0")
|
id("com.github.ben-manes.versions").version("0.28.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
// ./gradlew
|
// ./gradlew
|
||||||
|
@ -17,7 +17,7 @@ var semverProcessor = "net.thauvin.erik:semver:1.2.0"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
kapt(semverProcessor)
|
kapt(semverProcessor)
|
||||||
compileOnly(semverProcessor)
|
implementation(semverProcessor)
|
||||||
|
|
||||||
implementation(kotlin("stdlib"))
|
implementation(kotlin("stdlib"))
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
35
examples/annotation-processor/kotlin/gradlew
vendored
35
examples/annotation-processor/kotlin/gradlew
vendored
|
@ -7,7 +7,7 @@
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@ -125,8 +125,8 @@ if $darwin; then
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if $cygwin ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
@ -154,19 +154,19 @@ if $cygwin ; then
|
||||||
else
|
else
|
||||||
eval `echo args$i`="\"$arg\""
|
eval `echo args$i`="\"$arg\""
|
||||||
fi
|
fi
|
||||||
i=$((i+1))
|
i=`expr $i + 1`
|
||||||
done
|
done
|
||||||
case $i in
|
case $i in
|
||||||
(0) set -- ;;
|
0) set -- ;;
|
||||||
(1) set -- "$args0" ;;
|
1) set -- "$args0" ;;
|
||||||
(2) set -- "$args0" "$args1" ;;
|
2) set -- "$args0" "$args1" ;;
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -175,14 +175,9 @@ save () {
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
APP_ARGS=$(save "$@")
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
@rem you may not use this file except in compliance with the License.
|
@rem you may not use this file except in compliance with the License.
|
||||||
@rem You may obtain a copy of the License at
|
@rem You may obtain a copy of the License at
|
||||||
@rem
|
@rem
|
||||||
@rem http://www.apache.org/licenses/LICENSE-2.0
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
@rem
|
@rem
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#Generated by the Semver Plugin for Gradle
|
#Generated by the Semver Plugin for Gradle
|
||||||
#Tue Apr 23 11:46:40 PDT 2019
|
#Wed Jul 24 21:06:46 PDT 2019
|
||||||
version.buildmeta=
|
version.buildmeta=
|
||||||
version.major=14
|
version.major=14
|
||||||
version.minor=1
|
version.minor=3
|
||||||
version.patch=0
|
version.patch=0
|
||||||
version.prerelease=
|
version.prerelease=
|
||||||
version.project=Kotlin Example
|
version.project=Kotlin Example
|
||||||
|
version.semver=14.3.0
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'application'
|
id 'application'
|
||||||
id 'net.thauvin.erik.gradle.semver' version '0.9.9-beta'
|
id 'net.thauvin.erik.gradle.semver' version '1.0.4'
|
||||||
id 'com.github.ben-manes.versions' version '0.21.0'
|
id 'com.github.ben-manes.versions' version '0.36.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
// ./gradlew
|
// ./gradlew
|
||||||
|
@ -10,14 +10,14 @@ plugins {
|
||||||
// ./gradlew incrementMinor run
|
// ./gradlew incrementMinor run
|
||||||
// ./gradlew incrementMajor run
|
// ./gradlew incrementMajor run
|
||||||
// ./gradlew incrementBuildMeta run
|
// ./gradlew incrementBuildMeta run
|
||||||
|
// ./gradlew echoVersion
|
||||||
|
|
||||||
mainClassName = 'App'
|
|
||||||
|
|
||||||
defaultTasks 'run'
|
defaultTasks 'run'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.0-M1'
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
|
||||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.0-M1'
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -28,6 +28,13 @@ test {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
application {
|
||||||
|
mainClassName = 'App'
|
||||||
|
// project.afterEvaluate {
|
||||||
|
// println "Version: $version"
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
semver {
|
semver {
|
||||||
// properties = "example.properties"
|
// properties = "example.properties"
|
||||||
// keysPrefix = "example."
|
// keysPrefix = "example."
|
||||||
|
@ -44,9 +51,14 @@ incrementBuildMeta {
|
||||||
|
|
||||||
run {
|
run {
|
||||||
doFirst {
|
doFirst {
|
||||||
|
// println "Version: ${-> version}"
|
||||||
println "Version: $version"
|
println "Version: $version"
|
||||||
}
|
}
|
||||||
|
|
||||||
// args = ['example.properties']
|
// args = ['example.properties']
|
||||||
args = ['version.properties']
|
args = ['version.properties']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task echoVersion(type:Exec) {
|
||||||
|
commandLine 'echo', "${-> project.version}"
|
||||||
|
}
|
||||||
|
|
BIN
examples/java/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
examples/java/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
37
examples/java/gradlew
vendored
37
examples/java/gradlew
vendored
|
@ -7,7 +7,7 @@
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@ -82,6 +82,7 @@ esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
@ -125,10 +126,11 @@ if $darwin; then
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if $cygwin ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
@ -154,19 +156,19 @@ if $cygwin ; then
|
||||||
else
|
else
|
||||||
eval `echo args$i`="\"$arg\""
|
eval `echo args$i`="\"$arg\""
|
||||||
fi
|
fi
|
||||||
i=$((i+1))
|
i=`expr $i + 1`
|
||||||
done
|
done
|
||||||
case $i in
|
case $i in
|
||||||
(0) set -- ;;
|
0) set -- ;;
|
||||||
(1) set -- "$args0" ;;
|
1) set -- "$args0" ;;
|
||||||
(2) set -- "$args0" "$args1" ;;
|
2) set -- "$args0" "$args1" ;;
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -175,14 +177,9 @@ save () {
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
APP_ARGS=$(save "$@")
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|
27
examples/java/gradlew.bat
vendored
27
examples/java/gradlew.bat
vendored
|
@ -5,7 +5,7 @@
|
||||||
@rem you may not use this file except in compliance with the License.
|
@rem you may not use this file except in compliance with the License.
|
||||||
@rem You may obtain a copy of the License at
|
@rem You may obtain a copy of the License at
|
||||||
@rem
|
@rem
|
||||||
@rem http://www.apache.org/licenses/LICENSE-2.0
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
@rem
|
@rem
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
@ -51,7 +54,7 @@ goto fail
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
@ -61,28 +64,14 @@ echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#Generated by the Semver Plugin for Gradle
|
#Generated by the Semver Plugin for Gradle
|
||||||
#Tue Apr 23 11:43:18 PDT 2019
|
#Fri Sep 25 17:38:33 PDT 2020
|
||||||
version.buildmeta=20190423114318
|
version.buildmeta=20200925173833
|
||||||
version.major=1
|
version.major=1
|
||||||
version.minor=1
|
version.minor=0
|
||||||
version.patch=8
|
version.patch=0
|
||||||
version.prerelease=alpha
|
version.prerelease=
|
||||||
|
version.semver=1.0.0+20200925173833
|
||||||
|
|
|
@ -4,10 +4,10 @@ import java.time.LocalDateTime
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm").version("1.3.30")
|
kotlin("jvm").version("1.4.10")
|
||||||
application
|
application
|
||||||
id("net.thauvin.erik.gradle.semver").version("0.9.9-beta")
|
id("net.thauvin.erik.gradle.semver").version("1.0.4")
|
||||||
id("com.github.ben-manes.versions").version("0.21.0")
|
id("com.github.ben-manes.versions").version("0.36.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
// ./gradlew
|
// ./gradlew
|
||||||
|
@ -20,7 +20,7 @@ defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("stdlib"))
|
implementation(kotlin("stdlib"))
|
||||||
testImplementation("org.testng:testng:6.14.3")
|
testImplementation("org.testng:testng:7.3.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -29,6 +29,9 @@ repositories {
|
||||||
|
|
||||||
application {
|
application {
|
||||||
mainClassName = "com.example.MainKt"
|
mainClassName = "com.example.MainKt"
|
||||||
|
// project.afterEvaluate {
|
||||||
|
// println("Version: $version")
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
semver {
|
semver {
|
||||||
|
|
BIN
examples/kotlin/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
examples/kotlin/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
37
examples/kotlin/gradlew
vendored
37
examples/kotlin/gradlew
vendored
|
@ -7,7 +7,7 @@
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@ -82,6 +82,7 @@ esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
@ -125,10 +126,11 @@ if $darwin; then
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if $cygwin ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
@ -154,19 +156,19 @@ if $cygwin ; then
|
||||||
else
|
else
|
||||||
eval `echo args$i`="\"$arg\""
|
eval `echo args$i`="\"$arg\""
|
||||||
fi
|
fi
|
||||||
i=$((i+1))
|
i=`expr $i + 1`
|
||||||
done
|
done
|
||||||
case $i in
|
case $i in
|
||||||
(0) set -- ;;
|
0) set -- ;;
|
||||||
(1) set -- "$args0" ;;
|
1) set -- "$args0" ;;
|
||||||
(2) set -- "$args0" "$args1" ;;
|
2) set -- "$args0" "$args1" ;;
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -175,14 +177,9 @@ save () {
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
APP_ARGS=$(save "$@")
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|
27
examples/kotlin/gradlew.bat
vendored
27
examples/kotlin/gradlew.bat
vendored
|
@ -5,7 +5,7 @@
|
||||||
@rem you may not use this file except in compliance with the License.
|
@rem you may not use this file except in compliance with the License.
|
||||||
@rem You may obtain a copy of the License at
|
@rem You may obtain a copy of the License at
|
||||||
@rem
|
@rem
|
||||||
@rem http://www.apache.org/licenses/LICENSE-2.0
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
@rem
|
@rem
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
@ -51,7 +54,7 @@ goto fail
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
@ -61,28 +64,14 @@ echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#Generated by the Semver Plugin for Gradle
|
#Generated by the Semver Plugin for Gradle
|
||||||
#Tue Apr 23 11:45:33 PDT 2019
|
#Mon Nov 09 21:24:16 PST 2020
|
||||||
version.buildmeta=20190423114533
|
version.buildmeta=20201109212416
|
||||||
version.major=1
|
version.major=1
|
||||||
version.minor=2
|
version.minor=2
|
||||||
version.patch=4
|
version.patch=4
|
||||||
version.prerelease=beta
|
version.prerelease=beta
|
||||||
|
version.semver=1.2.4-beta+20201109212416
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "net.thauvin.erik.gradle:semver:1.0.0"
|
classpath "net.thauvin.erik.gradle:semver:1.0.5-beta"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +14,7 @@ apply plugin: 'net.thauvin.erik.gradle.semver'
|
||||||
|
|
||||||
mainClassName = 'App'
|
mainClassName = 'App'
|
||||||
|
|
||||||
version = 1.0
|
//version = 1.0
|
||||||
|
|
||||||
def f = new File("version.properties")
|
def f = new File("version.properties")
|
||||||
|
|
||||||
|
@ -29,6 +30,13 @@ repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
application {
|
||||||
|
println(project.version)
|
||||||
|
project.afterEvaluate {
|
||||||
|
println(project.version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
incrementBuildMeta {
|
incrementBuildMeta {
|
||||||
doFirst {
|
doFirst {
|
||||||
|
@ -39,13 +47,17 @@ incrementBuildMeta {
|
||||||
|
|
||||||
run {
|
run {
|
||||||
doFirst {
|
doFirst {
|
||||||
println("Version: $version")
|
println("Version: $semver.major$semver.separator$semver.minor$semver.separator$semver.patch$semver.preReleasePrefix$semver.preRelease$semver.buildMetaPrefix$semver.buildMeta")
|
||||||
args = [f.name]
|
args = [f.name]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task echoVersion(type:Exec) {
|
||||||
|
commandLine "echo", "${-> version}"
|
||||||
|
}
|
||||||
|
|
||||||
semver {
|
semver {
|
||||||
properties = "$projectDir/${f.name}"
|
properties = "${f.name}"
|
||||||
keysPrefix = f.name.substring(0, f.name.indexOf(".") + 1)
|
keysPrefix = f.name.substring(0, f.name.indexOf(".") + 1)
|
||||||
buildMetaKey = "meta"
|
buildMetaKey = "meta"
|
||||||
semverKey = "fullversion"
|
semverKey = "fullversion"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
2
examples/test/gradlew
vendored
2
examples/test/gradlew
vendored
|
@ -7,7 +7,7 @@
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
|
2
examples/test/gradlew.bat
vendored
2
examples/test/gradlew.bat
vendored
|
@ -5,7 +5,7 @@
|
||||||
@rem you may not use this file except in compliance with the License.
|
@rem you may not use this file except in compliance with the License.
|
||||||
@rem You may obtain a copy of the License at
|
@rem You may obtain a copy of the License at
|
||||||
@rem
|
@rem
|
||||||
@rem http://www.apache.org/licenses/LICENSE-2.0
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
@rem
|
@rem
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
|
0
examples/test/locked
Normal file
0
examples/test/locked
Normal file
8
examples/test/locked.properties
Normal file
8
examples/test/locked.properties
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#Generated by the Semver Plugin for Gradle
|
||||||
|
#Fri Apr 19 13:31:37 PDT 2019
|
||||||
|
version.fullversion=11.0.0-alpha+20190419133137
|
||||||
|
version.major=11
|
||||||
|
version.meta=20190419133137
|
||||||
|
version.minor=0
|
||||||
|
version.patch=0
|
||||||
|
version.prerelease=alpha
|
|
@ -1,15 +0,0 @@
|
||||||
/*
|
|
||||||
* This Java source file was generated by the Gradle 'init' task.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
public class AppTest {
|
|
||||||
@Test
|
|
||||||
public void testAppHasAGreeting() {
|
|
||||||
App classUnderTest = new App();
|
|
||||||
assertNotNull("app should have a greeting", classUnderTest.getGreeting());
|
|
||||||
}
|
|
||||||
}
|
|
8
examples/version.properties
Normal file
8
examples/version.properties
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#Generated by the Semver Plugin for Gradle
|
||||||
|
#Thu May 23 22:24:06 PDT 2019
|
||||||
|
version.fullversion=1.0.0
|
||||||
|
version.major=1
|
||||||
|
version.meta=
|
||||||
|
version.minor=0
|
||||||
|
version.patch=0
|
||||||
|
version.prerelease=
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
37
gradlew
vendored
37
gradlew
vendored
|
@ -7,7 +7,7 @@
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@ -82,6 +82,7 @@ esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
@ -125,10 +126,11 @@ if $darwin; then
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if $cygwin ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
@ -154,19 +156,19 @@ if $cygwin ; then
|
||||||
else
|
else
|
||||||
eval `echo args$i`="\"$arg\""
|
eval `echo args$i`="\"$arg\""
|
||||||
fi
|
fi
|
||||||
i=$((i+1))
|
i=`expr $i + 1`
|
||||||
done
|
done
|
||||||
case $i in
|
case $i in
|
||||||
(0) set -- ;;
|
0) set -- ;;
|
||||||
(1) set -- "$args0" ;;
|
1) set -- "$args0" ;;
|
||||||
(2) set -- "$args0" "$args1" ;;
|
2) set -- "$args0" "$args1" ;;
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -175,14 +177,9 @@ save () {
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
APP_ARGS=$(save "$@")
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|
27
gradlew.bat
vendored
27
gradlew.bat
vendored
|
@ -5,7 +5,7 @@
|
||||||
@rem you may not use this file except in compliance with the License.
|
@rem you may not use this file except in compliance with the License.
|
||||||
@rem You may obtain a copy of the License at
|
@rem You may obtain a copy of the License at
|
||||||
@rem
|
@rem
|
||||||
@rem http://www.apache.org/licenses/LICENSE-2.0
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
@rem
|
@rem
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
@ -51,7 +54,7 @@ goto fail
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
@ -61,28 +64,14 @@ echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
|
|
@ -22,7 +22,7 @@ gradle_opts="--console=plain --no-build-cache --no-daemon"
|
||||||
maven_args="compile exec:java"
|
maven_args="compile exec:java"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Version: 1.1.2
|
# Version: 1.1.3
|
||||||
#
|
#
|
||||||
|
|
||||||
if [ "$java8" = true ]
|
if [ "$java8" = true ]
|
||||||
|
@ -102,6 +102,7 @@ checkDeps() {
|
||||||
read -p "Check Examples depencencies? [y/n] " cont
|
read -p "Check Examples depencencies? [y/n] " cont
|
||||||
clear
|
clear
|
||||||
case $cont in
|
case $cont in
|
||||||
|
[Nn] ) return ;;
|
||||||
* ) for ex in "${!examples[@]}"
|
* ) for ex in "${!examples[@]}"
|
||||||
do
|
do
|
||||||
runGradle $(echo "${examples[ex]}" | cut -d " " -f 1) dU
|
runGradle $(echo "${examples[ex]}" | cut -d " " -f 1) dU
|
||||||
|
@ -117,7 +118,6 @@ checkDeps() {
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
done ;;
|
done ;;
|
||||||
[Nn] ) return ;;
|
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ showMenu() {
|
||||||
echo " 6. Check Everything"
|
echo " 6. Check Everything"
|
||||||
}
|
}
|
||||||
|
|
||||||
readOptions(){
|
readOptions() {
|
||||||
local choice
|
local choice
|
||||||
read -p "Enter choice [1-6]: " choice
|
read -p "Enter choice [1-6]: " choice
|
||||||
case $choice in
|
case $choice in
|
||||||
|
|
|
@ -1 +1,17 @@
|
||||||
|
plugins {
|
||||||
|
id("com.gradle.enterprise").version("3.3.4")
|
||||||
|
}
|
||||||
|
|
||||||
|
gradleEnterprise {
|
||||||
|
buildScan {
|
||||||
|
link("GitHub", "https://github.com/ethauvin/semver-gradle/tree/master")
|
||||||
|
if ("true" == System.getenv("CI")) {
|
||||||
|
publishOnFailure()
|
||||||
|
tag("CI")
|
||||||
|
}
|
||||||
|
termsOfServiceUrl = "https://gradle.com/terms-of-service"
|
||||||
|
termsOfServiceAgree = "yes"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rootProject.name = "semver"
|
rootProject.name = "semver"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* SemverConfig.kt
|
* SemverConfig.kt
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -32,7 +32,11 @@
|
||||||
|
|
||||||
package net.thauvin.erik.gradle.semver
|
package net.thauvin.erik.gradle.semver
|
||||||
|
|
||||||
open class SemverConfig {
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
open class SemverConfig @Inject constructor(
|
||||||
|
private val semVersion: Version
|
||||||
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
const val DEFAULT_KEYS_PREFIX = "version."
|
const val DEFAULT_KEYS_PREFIX = "version."
|
||||||
const val DEFAULT_PROPERTIES = "${DEFAULT_KEYS_PREFIX}properties"
|
const val DEFAULT_PROPERTIES = "${DEFAULT_KEYS_PREFIX}properties"
|
||||||
|
@ -48,6 +52,8 @@ open class SemverConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
var properties = DEFAULT_PROPERTIES
|
var properties = DEFAULT_PROPERTIES
|
||||||
|
|
||||||
|
// Keys
|
||||||
var semverKey = DEFAULT_SEMVER_KEY
|
var semverKey = DEFAULT_SEMVER_KEY
|
||||||
get() = "$keysPrefix$field"
|
get() = "$keysPrefix$field"
|
||||||
var majorKey = DEFAULT_MAJOR_KEY
|
var majorKey = DEFAULT_MAJOR_KEY
|
||||||
|
@ -68,10 +74,32 @@ open class SemverConfig {
|
||||||
get() = "$keysPrefix$field"
|
get() = "$keysPrefix$field"
|
||||||
var keysPrefix = DEFAULT_KEYS_PREFIX
|
var keysPrefix = DEFAULT_KEYS_PREFIX
|
||||||
|
|
||||||
|
// Extension Properties
|
||||||
|
val semver: String
|
||||||
|
get() = semVersion.semver
|
||||||
|
val version: String
|
||||||
|
get() = semVersion.semver
|
||||||
|
val major: Int
|
||||||
|
get() = semVersion.major
|
||||||
|
val minor: Int
|
||||||
|
get() = semVersion.minor
|
||||||
|
val patch: Int
|
||||||
|
get() = semVersion.patch
|
||||||
|
val preRelease: String
|
||||||
|
get() = semVersion.preRelease
|
||||||
|
val buildMeta: String
|
||||||
|
get() = semVersion.buildMeta
|
||||||
|
val preReleasePrefix: String
|
||||||
|
get() = semVersion.preReleasePrefix
|
||||||
|
val buildMetaPrefix: String
|
||||||
|
get() = semVersion.buildMetaPrefix
|
||||||
|
val separator: String
|
||||||
|
get() = semVersion.separator
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "SemverConfig(" +
|
return "SemverConfig(" +
|
||||||
"properties='$properties', " +
|
"properties='$properties', " +
|
||||||
"semver='$semverKey', " +
|
"semverKey='$semverKey', " +
|
||||||
"majorKey='$majorKey', " +
|
"majorKey='$majorKey', " +
|
||||||
"minorKey='$minorKey', " +
|
"minorKey='$minorKey', " +
|
||||||
"patchKey='$patchKey', " +
|
"patchKey='$patchKey', " +
|
||||||
|
@ -80,7 +108,16 @@ open class SemverConfig {
|
||||||
"buildMetaKey='$buildMetaKey', " +
|
"buildMetaKey='$buildMetaKey', " +
|
||||||
"buildMetaPrefixKey='$buildMetaPrefixKey', " +
|
"buildMetaPrefixKey='$buildMetaPrefixKey', " +
|
||||||
"separator='$separatorKey', " +
|
"separator='$separatorKey', " +
|
||||||
"keysPrefix='$keysPrefix')" +
|
"keysPrefix='$keysPrefix', " +
|
||||||
|
"semver='$semver', " +
|
||||||
|
"major='$major', " +
|
||||||
|
"minor='$minor', " +
|
||||||
|
"patch='$patch', " +
|
||||||
|
"preRelease='$preRelease', " +
|
||||||
|
"buildMeta='$buildMeta', " +
|
||||||
|
"preReleasePrefix='$preReleasePrefix', " +
|
||||||
|
"buildMetaPrefix='$buildMetaPrefix', " +
|
||||||
|
"separator='$separator'" +
|
||||||
')'
|
')'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* SemverIncrementBuildMetaTask.kt
|
* SemverIncrementBuildMetaTask.kt
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -59,7 +59,7 @@ open class SemverIncrementBuildMetaTask @Inject constructor(
|
||||||
version.buildMeta = buildMeta
|
version.buildMeta = buildMeta
|
||||||
project.version = version.semver
|
project.version = version.semver
|
||||||
logger.lifecycle("Version: ${project.version}")
|
logger.lifecycle("Version: ${project.version}")
|
||||||
Utils.saveProperties(config, version)
|
Utils.saveProperties(project.projectDir, config, version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* SemverIncrementTask.kt
|
* SemverIncrementTask.kt
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -54,9 +54,10 @@ open class SemverIncrementTask @Inject constructor(
|
||||||
version.increment(
|
version.increment(
|
||||||
isMajor = type == SemverConfig.DEFAULT_MAJOR_KEY,
|
isMajor = type == SemverConfig.DEFAULT_MAJOR_KEY,
|
||||||
isMinor = type == SemverConfig.DEFAULT_MINOR_KEY,
|
isMinor = type == SemverConfig.DEFAULT_MINOR_KEY,
|
||||||
isPatch = type == SemverConfig.DEFAULT_PATCH_KEY)
|
isPatch = type == SemverConfig.DEFAULT_PATCH_KEY
|
||||||
|
)
|
||||||
project.version = version.semver
|
project.version = version.semver
|
||||||
logger.lifecycle("Version: ${project.version}")
|
logger.lifecycle("Version: ${project.version}")
|
||||||
Utils.saveProperties(config, version)
|
Utils.saveProperties(project.projectDir, config, version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* SemverPlugin.kt
|
* SemverPlugin.kt
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -36,7 +36,6 @@ import org.gradle.api.GradleException
|
||||||
import org.gradle.api.Plugin
|
import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.util.GradleVersion
|
import org.gradle.util.GradleVersion
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
class SemverPlugin : Plugin<Project> {
|
class SemverPlugin : Plugin<Project> {
|
||||||
private val simpleName = SemverPlugin::class.simpleName
|
private val simpleName = SemverPlugin::class.simpleName
|
||||||
|
@ -47,7 +46,7 @@ class SemverPlugin : Plugin<Project> {
|
||||||
if (GradleVersion.current() < GradleVersion.version("4.8.1")) {
|
if (GradleVersion.current() < GradleVersion.version("4.8.1")) {
|
||||||
throw GradleException("The $simpleName plugin requires Gradle version 4.8.1 or greater.")
|
throw GradleException("The $simpleName plugin requires Gradle version 4.8.1 or greater.")
|
||||||
}
|
}
|
||||||
config = project.extensions.create("semver", SemverConfig::class.java)
|
config = project.extensions.create("semver", SemverConfig::class.java, version)
|
||||||
project.afterEvaluate(this::afterEvaluate)
|
project.afterEvaluate(this::afterEvaluate)
|
||||||
|
|
||||||
project.tasks.apply {
|
project.tasks.apply {
|
||||||
|
@ -59,22 +58,27 @@ class SemverPlugin : Plugin<Project> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun afterEvaluate(project: Project) {
|
private fun afterEvaluate(project: Project) {
|
||||||
val propsFile = File(config.properties)
|
val propsFile = Utils.getPropertiesFile(project.projectDir, config.properties)
|
||||||
|
|
||||||
if (project.version != "unspecified") {
|
if (project.version != "unspecified") {
|
||||||
project.logger.warn(
|
project.logger.warn(
|
||||||
"Please specify the version in ${propsFile.name} and remove it from ${project.buildFile.name}")
|
"Please specify the version in ${propsFile.name} and remove it from ${project.buildFile.name}"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
propsFile.apply {
|
propsFile.apply {
|
||||||
val isNew = !exists()
|
val isNew = !exists()
|
||||||
|
|
||||||
project.logger.info(
|
project.logger.info(
|
||||||
"[$simpleName] Attempting to read properties from: `$absoluteFile`. [exists: $isNew, isFile: $isFile, canRead: ${propsFile.canRead()}]")
|
"[$simpleName] Attempting to read properties from: `$absoluteFile`. " +
|
||||||
|
"[exists: $isNew, isFile: $isFile, canRead: ${canRead()}]"
|
||||||
|
)
|
||||||
|
|
||||||
val props = Utils.loadProperties(this)
|
val props = Utils.loadProperties(this)
|
||||||
val requiredProps = setOf(config.semverKey, config.majorKey, config.minorKey, config.patchKey,
|
val requiredProps = setOf(
|
||||||
config.preReleaseKey, config.buildMetaKey)
|
config.semverKey, config.majorKey, config.minorKey, config.patchKey,
|
||||||
|
config.preReleaseKey, config.buildMetaKey
|
||||||
|
)
|
||||||
val hasReqProps = !isNew && props.stringPropertyNames().containsAll(requiredProps) &&
|
val hasReqProps = !isNew && props.stringPropertyNames().containsAll(requiredProps) &&
|
||||||
Utils.isNotSystemProperty(requiredProps)
|
Utils.isNotSystemProperty(requiredProps)
|
||||||
|
|
||||||
|
@ -89,7 +93,7 @@ class SemverPlugin : Plugin<Project> {
|
||||||
|
|
||||||
if (!hasReqProps || !isFile) {
|
if (!hasReqProps || !isFile) {
|
||||||
project.logger.info("[$simpleName] Saving version properties to `$absoluteFile`.")
|
project.logger.info("[$simpleName] Saving version properties to `$absoluteFile`.")
|
||||||
Utils.saveProperties(config, version)
|
Utils.saveProperties(project.projectDir, config, version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* SortedProperties.kt
|
* SortedProperties.kt
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Utils.kt
|
* Utils.kt
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -36,6 +36,7 @@ import org.gradle.api.GradleException
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileInputStream
|
import java.io.FileInputStream
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
|
import java.io.IOException
|
||||||
import java.util.Properties
|
import java.util.Properties
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,11 +51,6 @@ object Utils {
|
||||||
return canRead() && isFile
|
return canRead() && isFile
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Int.length() = when (this) {
|
|
||||||
0 -> 1
|
|
||||||
else -> Math.log10(Math.abs(toDouble())).toInt() + 1
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun Properties.put(key: String, value: String, isValidCondition: Boolean) {
|
private fun Properties.put(key: String, value: String, isValidCondition: Boolean) {
|
||||||
if (isValidCondition) put(key, value)
|
if (isValidCondition) put(key, value)
|
||||||
}
|
}
|
||||||
|
@ -66,16 +62,24 @@ object Utils {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getPropertiesFile(projectDir: File, propsFile: String): File {
|
||||||
|
return if (File(propsFile).isAbsolute) {
|
||||||
|
File(propsFile)
|
||||||
|
} else {
|
||||||
|
File(projectDir, propsFile)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun loadProperties(file: File): Properties {
|
fun loadProperties(file: File): Properties {
|
||||||
var isNew = false
|
var isNew = false
|
||||||
val props = Properties()
|
val props = Properties()
|
||||||
file.apply {
|
file.apply {
|
||||||
if (!exists()) {
|
try {
|
||||||
if (!createNewFile()) {
|
if (!exists() && createNewFile()) {
|
||||||
throw GradleException("Unable to create: `$absoluteFile`")
|
|
||||||
} else {
|
|
||||||
isNew = true
|
isNew = true
|
||||||
}
|
}
|
||||||
|
} catch (e: IOException) {
|
||||||
|
throw GradleException("Unable to create: `$absoluteFile`", e)
|
||||||
}
|
}
|
||||||
if (canReadFile()) {
|
if (canReadFile()) {
|
||||||
FileInputStream(this).reader().use { reader ->
|
FileInputStream(this).reader().use { reader ->
|
||||||
|
@ -127,79 +131,51 @@ object Utils {
|
||||||
fun parseSemVer(input: String?, version: Version): Boolean {
|
fun parseSemVer(input: String?, version: Version): Boolean {
|
||||||
if (input.isNullOrBlank()) return false
|
if (input.isNullOrBlank()) return false
|
||||||
|
|
||||||
var semver = StringBuilder(input)
|
|
||||||
var start = semver.indexOf(version.separator)
|
|
||||||
var minor = -1
|
|
||||||
var major = -1
|
|
||||||
var patch = -1
|
|
||||||
var preRelease = ""
|
|
||||||
var buildMeta = ""
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// major
|
val max = 5
|
||||||
if (start != -1) {
|
val min = 3
|
||||||
major = Math.abs(semver.substring(0, start).toInt())
|
|
||||||
semver.delete(0, start + major.length())
|
val parts = input.split(
|
||||||
start = semver.indexOf(version.separator)
|
Regex("[\\Q${version.separator}${version.preReleasePrefix}${version.buildMetaPrefix}\\E]"),
|
||||||
// minor
|
max
|
||||||
if (start != -1) {
|
)
|
||||||
minor = Math.abs(semver.substring(0, start).toInt())
|
|
||||||
semver = semver.delete(0, start + minor.length())
|
if (parts.size >= min) {
|
||||||
start = semver.indexOf(version.preReleasePrefix)
|
version.major = parts[0].toInt()
|
||||||
// patch
|
version.minor = parts[1].toInt()
|
||||||
if (start != -1) {
|
version.patch = parts[2].toInt()
|
||||||
patch = Math.abs(semver.substring(0, start).toInt())
|
version.preRelease = ""
|
||||||
semver.delete(0, start + minor.length())
|
version.buildMeta = ""
|
||||||
start = semver.lastIndexOf(version.buildMetaPrefix)
|
|
||||||
// pre-release
|
if (parts.size > min) {
|
||||||
if (start != -1) {
|
when {
|
||||||
preRelease = semver.substring(0, start)
|
parts.size == max -> {
|
||||||
semver.delete(0, preRelease.length)
|
version.preRelease = parts[3]
|
||||||
start = semver.indexOf(version.buildMetaPrefix)
|
version.buildMeta = parts[4]
|
||||||
// build meta
|
}
|
||||||
if (start != -1) {
|
parts.size == 4 -> {
|
||||||
buildMeta = semver.substring(version.preReleasePrefix.length)
|
if (input.endsWith(version.buildMetaPrefix + parts[3])) {
|
||||||
semver.clear()
|
version.buildMeta = parts[3]
|
||||||
|
} else {
|
||||||
|
version.preRelease = parts[3]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// no build meta
|
throw NumberFormatException("Not enough parts.")
|
||||||
preRelease = semver.toString()
|
|
||||||
semver.clear()
|
|
||||||
}
|
|
||||||
} else if (semver.isNotEmpty()) {
|
|
||||||
// no pre-release
|
|
||||||
start = semver.lastIndexOf(version.buildMetaPrefix)
|
|
||||||
// patch & build meta
|
|
||||||
if (start != -1) {
|
|
||||||
patch = semver.substring(0, start).toInt()
|
|
||||||
semver.delete(0, start + minor.length())
|
|
||||||
buildMeta = semver.toString()
|
|
||||||
} else {
|
|
||||||
// patch
|
|
||||||
patch = semver.toString().toInt()
|
|
||||||
}
|
|
||||||
semver.clear()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (e: NumberFormatException) {
|
} catch (e: NumberFormatException) {
|
||||||
throw GradleException("Unable to parse version: \"$input\" (${e.message})", e)
|
throw GradleException("Unable to parse version: \"$input\" (${e.message})", e)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (semver.isNotEmpty()) throw GradleException("Unable to parse version: \"$input\".")
|
|
||||||
|
|
||||||
version.major = major
|
|
||||||
version.minor = minor
|
|
||||||
version.patch = patch
|
|
||||||
version.preRelease = preRelease
|
|
||||||
version.buildMeta = buildMeta
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun saveProperties(config: SemverConfig, version: Version) {
|
fun saveProperties(projectDir: File, config: SemverConfig, version: Version) {
|
||||||
val propsFile = File(config.properties)
|
val propsFile = getPropertiesFile(projectDir, config.properties)
|
||||||
SortedProperties().apply {
|
SortedProperties().apply {
|
||||||
|
try {
|
||||||
propsFile.apply {
|
propsFile.apply {
|
||||||
if (canReadFile()) {
|
if (canReadFile()) {
|
||||||
FileInputStream(this).reader().use { load(it) }
|
FileInputStream(this).reader().use { load(it) }
|
||||||
|
@ -215,24 +191,33 @@ object Utils {
|
||||||
put(config.buildMetaKey, version.buildMeta)
|
put(config.buildMetaKey, version.buildMeta)
|
||||||
put(config.semverKey, version.semver)
|
put(config.semverKey, version.semver)
|
||||||
|
|
||||||
put(config.buildMetaPrefixKey, version.buildMetaPrefix,
|
put(
|
||||||
|
config.buildMetaPrefixKey, version.buildMetaPrefix,
|
||||||
version.buildMetaPrefix != Version.DEFAULT_BUILDMETA_PREFIX ||
|
version.buildMetaPrefix != Version.DEFAULT_BUILDMETA_PREFIX ||
|
||||||
containsKey(config.buildMetaPrefixKey))
|
containsKey(config.buildMetaPrefixKey)
|
||||||
put(config.preReleasePrefixKey, version.preReleasePrefix,
|
)
|
||||||
|
put(
|
||||||
|
config.preReleasePrefixKey, version.preReleasePrefix,
|
||||||
version.preReleasePrefix != Version.DEFAULT_PRERELEASE_PREFIX ||
|
version.preReleasePrefix != Version.DEFAULT_PRERELEASE_PREFIX ||
|
||||||
containsKey(config.preReleasePrefixKey))
|
containsKey(config.preReleasePrefixKey)
|
||||||
put(config.separatorKey, version.separator,
|
)
|
||||||
|
put(
|
||||||
|
config.separatorKey, version.separator,
|
||||||
version.separator != Version.DEFAULT_SEPARATOR ||
|
version.separator != Version.DEFAULT_SEPARATOR ||
|
||||||
containsKey(config.separatorKey))
|
containsKey(config.separatorKey)
|
||||||
|
)
|
||||||
|
|
||||||
if (canWrite()) {
|
if (canWrite()) {
|
||||||
FileOutputStream(this).writer().use {
|
FileOutputStream(this).writer().use {
|
||||||
store(it, "Generated by the Semver Plugin for Gradle")
|
store(it, "Generated by the Semver Plugin for Gradle")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw GradleException("Unable to write version to: `$absoluteFile`")
|
throw IOException("Can't write.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e: IOException) {
|
||||||
|
throw GradleException("Unable to write version to: `${propsFile.absoluteFile}`", e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Version.kt
|
* Version.kt
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* SemverConfigSpec.kt
|
* SemverConfigSpec.kt
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -40,8 +40,8 @@ import kotlin.test.assertTrue
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object SemverConfigSpec : Spek({
|
object SemverConfigSpec : Spek({
|
||||||
Feature("SemverConfig") {
|
Feature("SemverConfig") {
|
||||||
|
val config = SemverConfig(Version())
|
||||||
Scenario("Testing configs") {
|
Scenario("Testing configs") {
|
||||||
val config by memoized { SemverConfig() }
|
|
||||||
val vars = listOf(
|
val vars = listOf(
|
||||||
config.semverKey,
|
config.semverKey,
|
||||||
config.majorKey,
|
config.majorKey,
|
||||||
|
@ -90,7 +90,8 @@ object SemverConfigSpec : Spek({
|
||||||
config.preReleasePrefixKey,
|
config.preReleasePrefixKey,
|
||||||
config.buildMetaKey,
|
config.buildMetaKey,
|
||||||
config.buildMetaPrefixKey,
|
config.buildMetaPrefixKey,
|
||||||
config.separatorKey)
|
config.separatorKey
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Then("all config keys should start with test.xxxx") {
|
Then("all config keys should start with test.xxxx") {
|
||||||
|
@ -98,6 +99,26 @@ object SemverConfigSpec : Spek({
|
||||||
assertTrue(k.startsWith("test."), k)
|
assertTrue(k.startsWith("test."), k)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
When("checking extension properties") {}
|
||||||
|
|
||||||
|
Then("semver should be defaults") {
|
||||||
|
val defaultSemver =
|
||||||
|
"${Version.DEFAULT_MAJOR}${Version.DEFAULT_SEPARATOR}${Version.DEFAULT_MINOR}${Version.DEFAULT_SEPARATOR}${Version.DEFAULT_PATCH}"
|
||||||
|
assertEquals(config.semver, defaultSemver)
|
||||||
|
assertEquals(
|
||||||
|
"${config.major}${config.separator}${config.minor}${config.separator}${config.patch}",
|
||||||
|
defaultSemver
|
||||||
|
)
|
||||||
|
assertEquals(config.preRelease, Version.DEFAULT_EMPTY)
|
||||||
|
assertEquals(config.buildMeta, Version.DEFAULT_EMPTY)
|
||||||
|
assertEquals(config.preReleasePrefix, Version.DEFAULT_PRERELEASE_PREFIX)
|
||||||
|
assertEquals(config.buildMetaPrefix, Version.DEFAULT_BUILDMETA_PREFIX)
|
||||||
|
}
|
||||||
|
|
||||||
|
Then("semver = version") {
|
||||||
|
assertEquals(config.semver, config.version)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* SemverVersionSpec.kt
|
* SemverVersionSpec.kt
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* UtilsSpec.kt
|
* UtilsSpec.kt
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -32,26 +32,30 @@
|
||||||
package net.thauvin.erik.gradle.semver
|
package net.thauvin.erik.gradle.semver
|
||||||
|
|
||||||
import net.thauvin.erik.gradle.semver.Utils.canReadFile
|
import net.thauvin.erik.gradle.semver.Utils.canReadFile
|
||||||
|
import org.gradle.api.GradleException
|
||||||
import org.spekframework.spek2.Spek
|
import org.spekframework.spek2.Spek
|
||||||
import org.spekframework.spek2.style.gherkin.Feature
|
import org.spekframework.spek2.style.gherkin.Feature
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.Properties
|
import java.util.*
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
import kotlin.test.assertFailsWith
|
||||||
import kotlin.test.assertNull
|
import kotlin.test.assertNull
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object UtilsSpec : Spek({
|
object UtilsSpec : Spek(
|
||||||
|
{
|
||||||
Feature("Utils") {
|
Feature("Utils") {
|
||||||
val version = Version()
|
val version = Version()
|
||||||
val config = SemverConfig()
|
val config = SemverConfig(version)
|
||||||
val propsFile = File("test.properties")
|
val propsFile = File("test.properties")
|
||||||
|
val projectDir = File("./")
|
||||||
lateinit var props: Properties
|
lateinit var props: Properties
|
||||||
|
|
||||||
Scenario("Save/Load Properties") {
|
Scenario("Save/Load Properties") {
|
||||||
When("saving the property") {
|
When("saving the property") {
|
||||||
config.properties = propsFile.name
|
config.properties = propsFile.name
|
||||||
Utils.saveProperties(config, version)
|
Utils.saveProperties(projectDir, config, version)
|
||||||
}
|
}
|
||||||
|
|
||||||
Then("properties file should exists and be readable") {
|
Then("properties file should exists and be readable") {
|
||||||
|
@ -85,12 +89,22 @@ object UtilsSpec : Spek({
|
||||||
Pair(config.minorKey, "1"),
|
Pair(config.minorKey, "1"),
|
||||||
Pair(config.patchKey, "1"),
|
Pair(config.patchKey, "1"),
|
||||||
Pair(config.preReleaseKey, "beta"),
|
Pair(config.preReleaseKey, "beta"),
|
||||||
Pair(config.buildMetaKey, "007"))
|
Pair(config.buildMetaKey, "007")
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Then("none should already exists") {
|
Then("none should already exists") {
|
||||||
assertTrue(Utils.isNotSystemProperty(setOf(config.majorKey, config.minorKey, config.patchKey, config.preReleaseKey,
|
assertTrue(
|
||||||
config.buildMetaKey)))
|
Utils.isNotSystemProperty(
|
||||||
|
setOf(
|
||||||
|
config.majorKey,
|
||||||
|
config.minorKey,
|
||||||
|
config.patchKey,
|
||||||
|
config.preReleaseKey,
|
||||||
|
config.buildMetaKey
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Then("version should match system properties") {
|
Then("version should match system properties") {
|
||||||
|
@ -113,7 +127,7 @@ object UtilsSpec : Spek({
|
||||||
}
|
}
|
||||||
|
|
||||||
When("saving properties") {
|
When("saving properties") {
|
||||||
Utils.saveProperties(config, version)
|
Utils.saveProperties(projectDir, config, version)
|
||||||
}
|
}
|
||||||
|
|
||||||
lateinit var newProps: Properties
|
lateinit var newProps: Properties
|
||||||
|
@ -142,30 +156,114 @@ object UtilsSpec : Spek({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Scenario("Testing Version Parsing") {
|
Scenario("Version Parsing") {
|
||||||
When("validating version parsing") {
|
When("validating version parsing") {}
|
||||||
listOf("1.0.0", "2.1.0-beta", "3.2.1-beta+007", "4.3.2+007").forEach {
|
|
||||||
|
Then("versions should parse") {
|
||||||
|
listOf(
|
||||||
|
"1.0.0",
|
||||||
|
"2.1.0-beta",
|
||||||
|
"3.2.1-beta+007",
|
||||||
|
"4.3.2+007",
|
||||||
|
"11.11.1",
|
||||||
|
"111.11.11-beta",
|
||||||
|
"1111.111.11-beta+001.12"
|
||||||
|
).forEach {
|
||||||
assertTrue(Utils.parseSemVer(it, version), "parsing semver: $it")
|
assertTrue(Utils.parseSemVer(it, version), "parsing semver: $it")
|
||||||
assertEquals(it, version.semver, it)
|
assertEquals(it, version.semver, it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Then("should throw exceptions") {
|
||||||
|
assertFailsWith<GradleException>("2.1.1a") {
|
||||||
|
Utils.parseSemVer("2.1.1a", version)
|
||||||
|
}
|
||||||
|
assertFailsWith<GradleException>("2a.1.1") {
|
||||||
|
Utils.parseSemVer("2a.1.1", version)
|
||||||
|
}
|
||||||
|
assertFailsWith<GradleException>("2.1a.1") {
|
||||||
|
Utils.parseSemVer("2.1a.1", version)
|
||||||
|
}
|
||||||
|
assertFailsWith<GradleException>("2.1") {
|
||||||
|
Utils.parseSemVer("2.1", version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Given("new prefixes") {
|
Given("new prefixes") {
|
||||||
version.preReleasePrefix = "."
|
version.preReleasePrefix = "."
|
||||||
version.buildMetaPrefix = "."
|
version.buildMetaPrefix = "."
|
||||||
}
|
}
|
||||||
|
|
||||||
Then("validating prefixes parsing") {
|
Then("prefixes should parse") {
|
||||||
listOf("2.1.0.beta.1", "2.1.1.1", "3.2.1.beta.1.007").forEach {
|
listOf("2.1.0.beta.1", "2.1.1.1", "3.2.1.beta.1.007").forEach {
|
||||||
assertTrue(Utils.parseSemVer(it, version), "parsing semver: $it")
|
assertTrue(Utils.parseSemVer(it, version), "parsing semver: $it")
|
||||||
assertEquals(it, version.semver, it)
|
assertEquals(it, version.semver, it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Then("verifying pre-release and meta") {
|
Then("last pre-release and meta should match") {
|
||||||
assertEquals(version.preRelease, "beta.1")
|
assertEquals(version.preRelease, "beta")
|
||||||
assertEquals(version.buildMeta, "007")
|
assertEquals(version.buildMeta, "1.007")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Scenario("Load locked properties") {
|
||||||
|
lateinit var locked: File
|
||||||
|
|
||||||
|
Given("the locked location") {
|
||||||
|
locked = File("locked")
|
||||||
|
}
|
||||||
|
|
||||||
|
Then("loading locked properties") {
|
||||||
|
assertFailsWith<GradleException> {
|
||||||
|
Utils.loadProperties(File(locked, propsFile.name))
|
||||||
|
}
|
||||||
|
locked.delete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Scenario("Save to locked properties") {
|
||||||
|
lateinit var propsLocked: File
|
||||||
|
Given("the locked properties") {
|
||||||
|
propsLocked = File(System.getProperty("user.home") + File.separator + "locked.properties")
|
||||||
|
propsLocked.createNewFile()
|
||||||
|
propsLocked.setReadOnly()
|
||||||
|
config.properties = propsLocked.name
|
||||||
|
}
|
||||||
|
|
||||||
|
Then("saving the locked properties file") {
|
||||||
|
assertFailsWith<GradleException> {
|
||||||
|
Utils.saveProperties(propsLocked.parentFile, config, version)
|
||||||
|
}
|
||||||
|
propsLocked.delete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Scenario("Save/Load Properties in foo") {
|
||||||
|
lateinit var fooDir: File
|
||||||
|
lateinit var fooProps: File
|
||||||
|
When("saving the foo property") {
|
||||||
|
fooDir = File("foo")
|
||||||
|
fooDir.mkdir()
|
||||||
|
fooProps = File(fooDir, propsFile.name)
|
||||||
|
config.properties = fooProps.absolutePath
|
||||||
|
Utils.saveProperties(projectDir, config, version)
|
||||||
|
}
|
||||||
|
|
||||||
|
Then("foo properties file should exists and be readable") {
|
||||||
|
assertEquals(fooProps.canReadFile(), fooProps.canRead() && fooProps.isFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
When("loading the foo properties file") {
|
||||||
|
props = Utils.loadProperties(fooProps)
|
||||||
|
fooProps.delete()
|
||||||
|
fooDir.delete()
|
||||||
|
}
|
||||||
|
|
||||||
|
Then("version in foo properties should be the same") {
|
||||||
|
assertEquals(props.getProperty(config.semverKey), version.semver)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue