Compare commits
No commits in common. "master" and "1.0.0" have entirely different histories.
189 changed files with 2522 additions and 5805 deletions
|
@ -1,42 +0,0 @@
|
||||||
version: 2.1
|
|
||||||
|
|
||||||
commands:
|
|
||||||
build_and_test:
|
|
||||||
parameters:
|
|
||||||
reports-dir:
|
|
||||||
type: string
|
|
||||||
default: "build/reports/test_results"
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- run:
|
|
||||||
name: Download dependencies
|
|
||||||
command: ./bld download
|
|
||||||
- run:
|
|
||||||
name: Compile source
|
|
||||||
command: ./bld compile
|
|
||||||
- run:
|
|
||||||
name: Run tests
|
|
||||||
command: ./bld jacoco -reports-dir=<< parameters.reports-dir >>
|
|
||||||
- store_test_results:
|
|
||||||
path: << parameters.reports-dir >>
|
|
||||||
- store_artifacts:
|
|
||||||
path: build/reports/jacoco/test/html
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
bld_jdk17:
|
|
||||||
docker:
|
|
||||||
- image: cimg/openjdk:17.0
|
|
||||||
steps:
|
|
||||||
- build_and_test
|
|
||||||
|
|
||||||
bld_jdk21:
|
|
||||||
docker:
|
|
||||||
- image: cimg/openjdk:21.0
|
|
||||||
steps:
|
|
||||||
- build_and_test
|
|
||||||
|
|
||||||
workflows:
|
|
||||||
bld:
|
|
||||||
jobs:
|
|
||||||
- bld_jdk17
|
|
||||||
- bld_jdk21
|
|
|
@ -1,2 +0,0 @@
|
||||||
[*]
|
|
||||||
insert_final_newline = true
|
|
76
.github/workflows/bld.yml
vendored
76
.github/workflows/bld.yml
vendored
|
@ -1,76 +0,0 @@
|
||||||
name: bld-ci
|
|
||||||
|
|
||||||
on: [push, pull_request, workflow_dispatch]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-bld-project:
|
|
||||||
env:
|
|
||||||
COVERAGE_JDK: "17"
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
java-version: [17, 21, 24]
|
|
||||||
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout source repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Set up JDK ${{ matrix.java-version }}
|
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
distribution: "zulu"
|
|
||||||
java-version: ${{ matrix.java-version }}
|
|
||||||
|
|
||||||
- name: Download dependencies [bld example]
|
|
||||||
working-directory: examples/java/bld
|
|
||||||
run: ./bld download
|
|
||||||
|
|
||||||
- name: Compile and run [bld example]
|
|
||||||
working-directory: examples/java/bld
|
|
||||||
run: |
|
|
||||||
./bld compile
|
|
||||||
./bld run
|
|
||||||
./bld run-example
|
|
||||||
|
|
||||||
- name: Run example [gradle java examples]
|
|
||||||
working-directory: examples/java/gradle
|
|
||||||
run: |
|
|
||||||
./gradlew run
|
|
||||||
./gradlew runExample
|
|
||||||
|
|
||||||
- name: Run example [gradle kotlin examples]
|
|
||||||
working-directory: examples/kotlin
|
|
||||||
run: |
|
|
||||||
./gradlew run
|
|
||||||
./gradlew runExample
|
|
||||||
|
|
||||||
- name: Download dependencies
|
|
||||||
run: ./bld download
|
|
||||||
|
|
||||||
- name: Compile source
|
|
||||||
run: ./bld compile
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: ./bld jacoco
|
|
||||||
|
|
||||||
- name: Remove pom.xml
|
|
||||||
if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.os == 'ubuntu-latest'
|
|
||||||
run: rm -rf pom.xml
|
|
||||||
|
|
||||||
- name: SonarCloud Scan
|
|
||||||
uses: sonarsource/sonarcloud-github-action@master
|
|
||||||
if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.os == 'ubuntu-latest'
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
||||||
|
|
||||||
- name: Upload coverage reports to Codecov
|
|
||||||
uses: codecov/codecov-action@v3
|
|
||||||
if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.os == 'ubuntu-latest'
|
|
||||||
env:
|
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
|
@ -1 +0,0 @@
|
||||||
future-release=1.2.1
|
|
87
.gitignore
vendored
87
.gitignore
vendored
|
@ -1,58 +1,31 @@
|
||||||
.gradle
|
**/.idea/dictionaries
|
||||||
|
**/.idea/gradle.xml
|
||||||
|
**/.idea/libraries
|
||||||
|
**/.idea/tasks.xml
|
||||||
|
**/.idea/workspace.xml
|
||||||
|
*.sublime-*
|
||||||
|
*.iws
|
||||||
|
.classpath
|
||||||
.DS_Store
|
.DS_Store
|
||||||
build
|
.gradle
|
||||||
lib/bld/**
|
.kobalt
|
||||||
!lib/bld/bld-wrapper.properties
|
.nb-gradle
|
||||||
!lib/bld/bld-wrapper.jar
|
.project
|
||||||
lib/compile/
|
.settings
|
||||||
lib/runtime/
|
/bin
|
||||||
lib/standalone/
|
/build
|
||||||
lib/test/
|
/deploy
|
||||||
|
/dist
|
||||||
# IDEA ignores
|
/gen
|
||||||
|
/gradle.properties
|
||||||
# User-specific
|
/lib/kotlin*
|
||||||
.idea/**/workspace.xml
|
/libs
|
||||||
.idea/**/tasks.xml
|
/local.properties
|
||||||
.idea/**/usage.statistics.xml
|
/out
|
||||||
.idea/**/dictionaries
|
/proguard-project.txt
|
||||||
.idea/**/shelf
|
/project.properties
|
||||||
|
/target
|
||||||
# AWS User-specific
|
/test-output
|
||||||
.idea/**/aws.xml
|
ehthumbs.db
|
||||||
|
kobaltBuild
|
||||||
# Generated files
|
Thumbs.db
|
||||||
.idea/**/contentModel.xml
|
|
||||||
|
|
||||||
# Sensitive or high-churn files
|
|
||||||
.idea/**/dataSources/
|
|
||||||
.idea/**/dataSources.ids
|
|
||||||
.idea/**/dataSources.local.xml
|
|
||||||
.idea/**/sqlDataSources.xml
|
|
||||||
.idea/**/dynamic.xml
|
|
||||||
.idea/**/uiDesigner.xml
|
|
||||||
.idea/**/dbnavigator.xml
|
|
||||||
|
|
||||||
# Gradle
|
|
||||||
.idea/**/gradle.xml
|
|
||||||
|
|
||||||
# Mongo Explorer plugin
|
|
||||||
.idea/**/mongoSettings.xml
|
|
||||||
|
|
||||||
# mpeltonen/sbt-idea plugin
|
|
||||||
.idea_modules/
|
|
||||||
|
|
||||||
# JIRA plugin
|
|
||||||
atlassian-ide-plugin.xml
|
|
||||||
|
|
||||||
# Cursive Clojure plugin
|
|
||||||
.idea/replstate.xml
|
|
||||||
|
|
||||||
# SonarLint plugin
|
|
||||||
.idea/sonarlint/
|
|
||||||
|
|
||||||
# Editor-based Rest Client
|
|
||||||
.idea/httpRequests
|
|
||||||
|
|
||||||
local.properties
|
|
||||||
target
|
|
28
.idea/app.iml
generated
28
.idea/app.iml
generated
|
@ -1,28 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="JAVA_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<output url="file://$MODULE_DIR$/build/main" />
|
|
||||||
<output-test url="file://$MODULE_DIR$/build/test" />
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" relativeOutputPath="resources" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="module-library" scope="RUNTIME">
|
|
||||||
<library>
|
|
||||||
<CLASSES>
|
|
||||||
<root url="file://$MODULE_DIR$/src/main/resources/templates" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</orderEntry>
|
|
||||||
<orderEntry type="library" name="compile" level="project" />
|
|
||||||
<orderEntry type="library" scope="RUNTIME" name="runtime" level="project" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="test" level="project" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
14
.idea/bld.iml
generated
14
.idea/bld.iml
generated
|
@ -1,14 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="JAVA_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<output url="file://$MODULE_DIR$/build/bld" />
|
|
||||||
<output-test url="file://$MODULE_DIR$/build/bld" />
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$/src/bld">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/bld/java" isTestSource="false" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="library" name="bld" level="project" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
6
.idea/bld.xml
generated
6
.idea/bld.xml
generated
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="BldConfiguration">
|
|
||||||
<events />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<bytecodeTargetLevel target="17">
|
<bytecodeTargetLevel>
|
||||||
<module name="examples-kotlin_main" target="1.8" />
|
<module name="semver_main" target="1.8" />
|
||||||
<module name="examples-kotlin_test" target="1.8" />
|
<module name="semver_test" target="1.8" />
|
||||||
</bytecodeTargetLevel>
|
</bytecodeTargetLevel>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -1,6 +1,6 @@
|
||||||
<component name="CopyrightManager">
|
<component name="CopyrightManager">
|
||||||
<copyright>
|
<copyright>
|
||||||
<option name="notice" value="&#36;file.fileName Copyright (c) 2016-&#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) 2016-&#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="BSD-3 Clause" />
|
<option name="myName" value="Erik's Copyright Notice" />
|
||||||
</copyright>
|
</copyright>
|
||||||
</component>
|
</component>
|
10
.idea/copyright/profiles_settings.xml
generated
10
.idea/copyright/profiles_settings.xml
generated
|
@ -1,3 +1,11 @@
|
||||||
<component name="CopyrightManager">
|
<component name="CopyrightManager">
|
||||||
<settings default="BSD-3 Clause" />
|
<settings>
|
||||||
|
<module2copyright>
|
||||||
|
<element module="Source" copyright="Erik's Copyright Notice" />
|
||||||
|
</module2copyright>
|
||||||
|
<LanguageOptions name="JAVA">
|
||||||
|
<option name="fileTypeOverride" value="3" />
|
||||||
|
<option name="addBlankAfter" value="false" />
|
||||||
|
</LanguageOptions>
|
||||||
|
</settings>
|
||||||
</component>
|
</component>
|
49
.idea/inspectionProfiles/Project_Default.xml
generated
49
.idea/inspectionProfiles/Project_Default.xml
generated
|
@ -1,8 +1,53 @@
|
||||||
<component name="InspectionProjectProfileManager">
|
<component name="InspectionProjectProfileManager">
|
||||||
<profile version="1.0">
|
<profile version="1.0">
|
||||||
<option name="myName" value="Project Default" />
|
<option name="myName" value="Project Default" />
|
||||||
<inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
|
<option name="myLocal" value="true" />
|
||||||
<option name="ADDITIONAL_TAGS" value="created" />
|
<inspection_tool class="FieldMayBeFinal" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="INNER_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="METHOD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="FIELD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="IGNORE_DEPRECATED" value="false" />
|
||||||
|
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||||
|
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||||
|
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||||
|
<option name="myAdditionalJavadocTags" value="created" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="LocalCanBeFinal" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="REPORT_VARIABLES" value="true" />
|
||||||
|
<option name="REPORT_PARAMETERS" value="false" />
|
||||||
|
<option name="REPORT_CATCH_PARAMETERS" value="false" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
|
||||||
|
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
|
||||||
|
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="UnnecessarySemicolon" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="WeakerAccess" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS" value="true" />
|
||||||
|
<option name="SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES" value="false" />
|
||||||
|
<option name="SUGGEST_PRIVATE_FOR_INNERS" value="false" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
</profile>
|
</profile>
|
||||||
</component>
|
</component>
|
204
.idea/intellij-javadocs-4.0.1.xml
generated
204
.idea/intellij-javadocs-4.0.1.xml
generated
|
@ -1,204 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="JavaDocConfiguration">
|
|
||||||
<GENERAL>
|
|
||||||
<MODE>UPDATE</MODE>
|
|
||||||
<OVERRIDDEN_METHODS>false</OVERRIDDEN_METHODS>
|
|
||||||
<SPLITTED_CLASS_NAME>true</SPLITTED_CLASS_NAME>
|
|
||||||
<LEVELS>
|
|
||||||
<LEVEL>FIELD</LEVEL>
|
|
||||||
<LEVEL>TYPE</LEVEL>
|
|
||||||
<LEVEL>METHOD</LEVEL>
|
|
||||||
</LEVELS>
|
|
||||||
<VISIBILITIES>
|
|
||||||
<VISIBILITY>DEFAULT</VISIBILITY>
|
|
||||||
<VISIBILITY>PUBLIC</VISIBILITY>
|
|
||||||
<VISIBILITY>PROTECTED</VISIBILITY>
|
|
||||||
</VISIBILITIES>
|
|
||||||
</GENERAL>
|
|
||||||
<TEMPLATES>
|
|
||||||
<CLASSES>
|
|
||||||
<CLASS>
|
|
||||||
<KEY>^.*(public|protected|private)*.+interface\s+\w+.*</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The interface ${name}.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</CLASS>
|
|
||||||
<CLASS>
|
|
||||||
<KEY>^.*(public|protected|private)*.+enum\s+\w+.*</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The enum ${name}.\n
|
|
||||||
*/</VALUE>
|
|
||||||
</CLASS>
|
|
||||||
<CLASS>
|
|
||||||
<KEY>^.*(public|protected|private)*.+class\s+\w+.*</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The type ${name}.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</CLASS>
|
|
||||||
<CLASS>
|
|
||||||
<KEY>.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The type ${name}.\n
|
|
||||||
*/</VALUE>
|
|
||||||
</CLASS>
|
|
||||||
</CLASSES>
|
|
||||||
<CONSTRUCTORS>
|
|
||||||
<CONSTRUCTOR>
|
|
||||||
<KEY>.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* Instantiates a new ${name}.\n
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.parameterList.parameters as parameter>
|
|
||||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
|
||||||
</#list>
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</CONSTRUCTOR>
|
|
||||||
</CONSTRUCTORS>
|
|
||||||
<METHODS>
|
|
||||||
<METHOD>
|
|
||||||
<KEY>^.*(public|protected|private)*\s*.*(\w(\s*<.+>)*)+\s+get\w+\s*\(.*\).+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* Gets ${partName}.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.parameterList.parameters as parameter>
|
|
||||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
|
||||||
</#list>
|
|
||||||
<#if isNotVoid>
|
|
||||||
*\n
|
|
||||||
* @return the ${partName}\n
|
|
||||||
</#if>
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</METHOD>
|
|
||||||
<METHOD>
|
|
||||||
<KEY>^.*(public|protected|private)*\s*.*(void|\w(\s*<.+>)*)+\s+set\w+\s*\(.*\).+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* Sets ${partName}.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.parameterList.parameters as parameter>
|
|
||||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
|
||||||
</#list>
|
|
||||||
<#if isNotVoid>
|
|
||||||
*\n
|
|
||||||
* @return the ${partName}\n
|
|
||||||
</#if>
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</METHOD>
|
|
||||||
<METHOD>
|
|
||||||
<KEY>^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The entry point of application.\n
|
|
||||||
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
* @param ${element.parameterList.parameters[0].name} the input arguments\n
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</METHOD>
|
|
||||||
<METHOD>
|
|
||||||
<KEY>.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* ${name}<#if isNotVoid> ${return}</#if>.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.parameterList.parameters as parameter>
|
|
||||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
|
||||||
</#list>
|
|
||||||
<#if isNotVoid>
|
|
||||||
*\n
|
|
||||||
* @return the ${return}\n
|
|
||||||
</#if>
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</METHOD>
|
|
||||||
</METHODS>
|
|
||||||
<FIELDS>
|
|
||||||
<FIELD>
|
|
||||||
<KEY>^.*(public|protected|private)*.+static.*(\w\s\w)+.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The constant ${element.getName()}.\n
|
|
||||||
*/</VALUE>
|
|
||||||
</FIELD>
|
|
||||||
<FIELD>
|
|
||||||
<KEY>^.*(public|protected|private)*.*(\w\s\w)+.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
<#if element.parent.isInterface()>
|
|
||||||
* The constant ${element.getName()}.\n
|
|
||||||
<#else>
|
|
||||||
* The ${name}.\n
|
|
||||||
</#if> */</VALUE>
|
|
||||||
</FIELD>
|
|
||||||
<FIELD>
|
|
||||||
<KEY>.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
<#if element.parent.isEnum()>
|
|
||||||
*${name} ${typeName}.\n
|
|
||||||
<#else>
|
|
||||||
* The ${name}.\n
|
|
||||||
</#if>*/</VALUE>
|
|
||||||
</FIELD>
|
|
||||||
</FIELDS>
|
|
||||||
</TEMPLATES>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
17
.idea/kobalt.xml
generated
Normal file
17
.idea/kobalt.xml
generated
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="KobaltSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<KobaltProjectSettings>
|
||||||
|
<option name="autoDownloadKobalt" value="true" />
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="kobaltHome" value="$USER_HOME$/.kobalt/wrapper/dist/kobalt-1.0.84" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</KobaltProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
7
.idea/kotlinc.xml
generated
Normal file
7
.idea/kotlinc.xml
generated
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="KotlinCommonCompilerArguments">
|
||||||
|
<option name="languageVersion" value="1.1" />
|
||||||
|
<option name="apiVersion" value="1.1" />
|
||||||
|
</component>
|
||||||
|
</project>
|
18
.idea/libraries/bld.xml
generated
18
.idea/libraries/bld.xml
generated
|
@ -1,18 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="bld">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
|
||||||
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES>
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
|
||||||
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
<excluded>
|
|
||||||
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
|
||||||
</excluded>
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" />
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" type="SOURCES" />
|
|
||||||
</library>
|
|
||||||
</component>
|
|
17
.idea/libraries/compile.xml
generated
17
.idea/libraries/compile.xml
generated
|
@ -1,17 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="compile">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/compile" />
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/provided" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES>
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/compile" />
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/provided" />
|
|
||||||
</SOURCES>
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" />
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
|
|
||||||
</library>
|
|
||||||
</component>
|
|
14
.idea/libraries/runtime.xml
generated
14
.idea/libraries/runtime.xml
generated
|
@ -1,14 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="runtime">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/runtime" />
|
|
||||||
<root url="file://$PROJECT_DIR$/src/main/resources" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES>
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/runtime" />
|
|
||||||
</SOURCES>
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" />
|
|
||||||
</library>
|
|
||||||
</component>
|
|
18
.idea/libraries/test.xml
generated
18
.idea/libraries/test.xml
generated
|
@ -1,18 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="test">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/test" />
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/provided" />
|
|
||||||
<root url="file://$PROJECT_DIR$/src/test/resources" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES>
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/test" />
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/provided" />
|
|
||||||
</SOURCES>
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
|
|
||||||
</library>
|
|
||||||
</component>
|
|
50
.idea/misc.xml
generated
50
.idea/misc.xml
generated
|
@ -1,16 +1,44 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="EntryPointsManager">
|
<component name="ClientPropertiesManager">
|
||||||
<pattern value="net.thauvin.erik.semver.SemverBuild" method="jacoco" />
|
<properties class="javax.swing.AbstractButton">
|
||||||
<pattern value="net.thauvin.erik.semver.SemverBuild" method="pandoc" />
|
<property name="hideActionText" class="java.lang.Boolean" />
|
||||||
<pattern value="net.thauvin.erik.semver.SemverBuild" method="pmd" />
|
</properties>
|
||||||
<pattern value="net.thauvin.erik.semver.SemverBuild" method="pmdCli" />
|
<properties class="javax.swing.JComponent">
|
||||||
<pattern value="net.thauvin.erik.semver.SemverBuild" />
|
<property name="html.disable" class="java.lang.Boolean" />
|
||||||
|
</properties>
|
||||||
|
<properties class="javax.swing.JEditorPane">
|
||||||
|
<property name="JEditorPane.w3cLengthUnits" class="java.lang.Boolean" />
|
||||||
|
<property name="JEditorPane.honorDisplayProperties" class="java.lang.Boolean" />
|
||||||
|
<property name="charset" class="java.lang.String" />
|
||||||
|
</properties>
|
||||||
|
<properties class="javax.swing.JList">
|
||||||
|
<property name="List.isFileList" class="java.lang.Boolean" />
|
||||||
|
</properties>
|
||||||
|
<properties class="javax.swing.JPasswordField">
|
||||||
|
<property name="JPasswordField.cutCopyAllowed" class="java.lang.Boolean" />
|
||||||
|
</properties>
|
||||||
|
<properties class="javax.swing.JSlider">
|
||||||
|
<property name="Slider.paintThumbArrowShape" class="java.lang.Boolean" />
|
||||||
|
<property name="JSlider.isFilled" class="java.lang.Boolean" />
|
||||||
|
</properties>
|
||||||
|
<properties class="javax.swing.JTable">
|
||||||
|
<property name="Table.isFileList" class="java.lang.Boolean" />
|
||||||
|
<property name="JTable.autoStartsEdit" class="java.lang.Boolean" />
|
||||||
|
<property name="terminateEditOnFocusLost" class="java.lang.Boolean" />
|
||||||
|
</properties>
|
||||||
|
<properties class="javax.swing.JToolBar">
|
||||||
|
<property name="JToolBar.isRollover" class="java.lang.Boolean" />
|
||||||
|
</properties>
|
||||||
|
<properties class="javax.swing.JTree">
|
||||||
|
<property name="JTree.lineStyle" class="java.lang.String" />
|
||||||
|
</properties>
|
||||||
|
<properties class="javax.swing.text.JTextComponent">
|
||||||
|
<property name="caretAspectRatio" class="java.lang.Double" />
|
||||||
|
<property name="caretWidth" class="java.lang.Integer" />
|
||||||
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component name="PDMPlugin">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" project-jdk-name="1.8.x" project-jdk-type="JavaSDK">
|
||||||
<option name="skipTestSources" value="false" />
|
<output url="file://$PROJECT_DIR$/kobaltBuild/classes" />
|
||||||
</component>
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
|
|
||||||
<output url="file://$PROJECT_DIR$/build" />
|
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
6
.idea/modules.xml
generated
6
.idea/modules.xml
generated
|
@ -2,8 +2,10 @@
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/app.iml" filepath="$PROJECT_DIR$/.idea/app.iml" />
|
<module fileurl="file://$PROJECT_DIR$/kobalt/Build.kt.iml" filepath="$PROJECT_DIR$/kobalt/Build.kt.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/bld.iml" filepath="$PROJECT_DIR$/.idea/bld.iml" />
|
<module fileurl="file://$PROJECT_DIR$/semver.iml" filepath="$PROJECT_DIR$/semver.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/modules/semver_main.iml" filepath="$PROJECT_DIR$/.idea/modules/semver_main.iml" group="semver" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/modules/semver_test.iml" filepath="$PROJECT_DIR$/.idea/modules/semver_test.iml" group="semver" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
14
.idea/modules/semver_main.iml
generated
Normal file
14
.idea/modules/semver_main.iml
generated
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module external.linked.project.id="semver:main" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="0.9.7" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||||
|
<output url="file://$MODULE_DIR$/../../build/classes/main" />
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$/../../src/main">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/../../src/main/java" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/../../src/main/resources" type="java-resource" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="Gradle: com.github.spullara.mustache.java:compiler:0.9.4" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
19
.idea/modules/semver_test.iml
generated
Normal file
19
.idea/modules/semver_test.iml
generated
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module external.linked.project.id="semver:test" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="0.9.7" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||||
|
<output-test url="file://$MODULE_DIR$/../../build/classes/test" />
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$/../../src/test">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/../../src/test/java" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/../../src/test/resources" type="java-test-resource" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="module" module-name="semver_main" />
|
||||||
|
<orderEntry type="library" name="Gradle: com.github.spullara.mustache.java:compiler:0.9.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Gradle: org.testng:testng:6.11" level="project" />
|
||||||
|
<orderEntry type="library" name="Gradle: com.beust:jcommander:1.64" level="project" />
|
||||||
|
<orderEntry type="library" name="Gradle: org.yaml:snakeyaml:1.17" level="project" />
|
||||||
|
</component>
|
||||||
|
<component name="TestModuleProperties" production-module="semver_main" />
|
||||||
|
</module>
|
13
.idea/runConfigurations/Run Tests.xml
generated
13
.idea/runConfigurations/Run Tests.xml
generated
|
@ -1,13 +0,0 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="Run Tests" type="JUnit" factoryName="JUnit">
|
|
||||||
<module name="app" />
|
|
||||||
<option name="PACKAGE_NAME" value="moog" />
|
|
||||||
<option name="MAIN_CLASS_NAME" value="net.thauvin.erik" />
|
|
||||||
<option name="METHOD_NAME" value="" />
|
|
||||||
<option name="TEST_OBJECT" value="directory" />
|
|
||||||
<dir value="$PROJECT_DIR$/src/test/java" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Make" enabled="true" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
3
.idea/scopes/Source.xml
generated
Normal file
3
.idea/scopes/Source.xml
generated
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<component name="DependencyValidationManager">
|
||||||
|
<scope name="Source" pattern="file[semver_main]:java//*.java||file[semver_test]:java//*.java" />
|
||||||
|
</component>
|
2
.idea/vcs.xml
generated
2
.idea/vcs.xml
generated
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="" vcs="Git" />
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
7
.travis.yml
Normal file
7
.travis.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
language: java
|
||||||
|
|
||||||
|
jdk:
|
||||||
|
- oraclejdk8
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- chmod +x gradlew
|
79
CHANGELOG.md
79
CHANGELOG.md
|
@ -1,79 +0,0 @@
|
||||||
# Changelog
|
|
||||||
|
|
||||||
## [1.2.1](https://github.com/ethauvin/semver/tree/1.2.1) (2023-10-01)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/ethauvin/semver/compare/1.2.0...1.2.1)
|
|
||||||
|
|
||||||
**Implemented enhancements:**
|
|
||||||
|
|
||||||
- Move from Gradle to bld [\#7](https://github.com/ethauvin/semver/issues/7)
|
|
||||||
|
|
||||||
**Fixed bugs:**
|
|
||||||
|
|
||||||
- NPE with Java 12 and Kotlin 1.3.30 [\#1](https://github.com/ethauvin/semver/issues/1)
|
|
||||||
|
|
||||||
**Closed issues:**
|
|
||||||
|
|
||||||
- Under Java 12 and Gradle 5.4.1 the properties file is not found. [\#6](https://github.com/ethauvin/semver/issues/6)
|
|
||||||
|
|
||||||
## [1.2.0](https://github.com/ethauvin/semver/tree/1.2.0) (2019-05-25)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/ethauvin/semver/compare/1.1.1...1.2.0)
|
|
||||||
|
|
||||||
**Implemented enhancements:**
|
|
||||||
|
|
||||||
- Calculate the version internally. [\#4](https://github.com/ethauvin/semver/issues/4)
|
|
||||||
- Attempt to compile non-existent Java source in Gradle project using Kapt [\#3](https://github.com/ethauvin/semver/issues/3)
|
|
||||||
- kapt and Kotlin 1.3.30 require kapt.use.worker.api=true [\#2](https://github.com/ethauvin/semver/issues/2)
|
|
||||||
|
|
||||||
**Fixed bugs:**
|
|
||||||
|
|
||||||
- Default template is not found in 1.1.1 [\#5](https://github.com/ethauvin/semver/issues/5)
|
|
||||||
|
|
||||||
## [1.1.1](https://github.com/ethauvin/semver/tree/1.1.1) (2019-03-31)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/ethauvin/semver/compare/1.1.0-beta...1.1.1)
|
|
||||||
|
|
||||||
## [1.1.0-beta](https://github.com/ethauvin/semver/tree/1.1.0-beta) (2018-11-04)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/ethauvin/semver/compare/1.0.1...1.1.0-beta)
|
|
||||||
|
|
||||||
## [1.0.1](https://github.com/ethauvin/semver/tree/1.0.1) (2017-05-30)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/ethauvin/semver/compare/1.0.0...1.0.1)
|
|
||||||
|
|
||||||
## [1.0.0](https://github.com/ethauvin/semver/tree/1.0.0) (2017-05-10)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/ethauvin/semver/compare/0.9.6-beta...1.0.0)
|
|
||||||
|
|
||||||
## [0.9.6-beta](https://github.com/ethauvin/semver/tree/0.9.6-beta) (2016-07-15)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/ethauvin/semver/compare/0.9.5-beta...0.9.6-beta)
|
|
||||||
|
|
||||||
## [0.9.5-beta](https://github.com/ethauvin/semver/tree/0.9.5-beta) (2016-02-03)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/ethauvin/semver/compare/0.9.4-beta...0.9.5-beta)
|
|
||||||
|
|
||||||
## [0.9.4-beta](https://github.com/ethauvin/semver/tree/0.9.4-beta) (2016-01-29)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/ethauvin/semver/compare/0.9.3-beta...0.9.4-beta)
|
|
||||||
|
|
||||||
## [0.9.3-beta](https://github.com/ethauvin/semver/tree/0.9.3-beta) (2016-01-28)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/ethauvin/semver/compare/0.9.2-beta...0.9.3-beta)
|
|
||||||
|
|
||||||
## [0.9.2-beta](https://github.com/ethauvin/semver/tree/0.9.2-beta) (2016-01-25)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/ethauvin/semver/compare/0.9.1-beta...0.9.2-beta)
|
|
||||||
|
|
||||||
## [0.9.1-beta](https://github.com/ethauvin/semver/tree/0.9.1-beta) (2016-01-25)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/ethauvin/semver/compare/0.9.0-beta...0.9.1-beta)
|
|
||||||
|
|
||||||
## [0.9.0-beta](https://github.com/ethauvin/semver/tree/0.9.0-beta) (2016-01-24)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/ethauvin/semver/compare/aeee81544c6d2881ccf02458fcef1f6ba1c9c169...0.9.0-beta)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
|
|
@ -1,4 +1,4 @@
|
||||||
Copyright (c) 2016-2024, Erik C. Thauvin (erik@thauvin.net)
|
Copyright (c) 2016-2017, 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
|
||||||
|
@ -24,4 +24,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
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
|
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.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
398
README.html
Normal file
398
README.html
Normal file
|
@ -0,0 +1,398 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="generator" content="pandoc">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||||
|
<title></title>
|
||||||
|
<style type="text/css">code{white-space: pre;}</style>
|
||||||
|
<style type="text/css">
|
||||||
|
div.sourceCode { overflow-x: auto; }
|
||||||
|
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
|
||||||
|
margin: 0; padding: 0; vertical-align: baseline; border: none; }
|
||||||
|
table.sourceCode { width: 100%; line-height: 100%; }
|
||||||
|
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
|
||||||
|
td.sourceCode { padding-left: 5px; }
|
||||||
|
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
|
||||||
|
code > span.dt { color: #902000; } /* DataType */
|
||||||
|
code > span.dv { color: #40a070; } /* DecVal */
|
||||||
|
code > span.bn { color: #40a070; } /* BaseN */
|
||||||
|
code > span.fl { color: #40a070; } /* Float */
|
||||||
|
code > span.ch { color: #4070a0; } /* Char */
|
||||||
|
code > span.st { color: #4070a0; } /* String */
|
||||||
|
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
|
||||||
|
code > span.ot { color: #007020; } /* Other */
|
||||||
|
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
|
||||||
|
code > span.fu { color: #06287e; } /* Function */
|
||||||
|
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
|
||||||
|
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
|
||||||
|
code > span.cn { color: #880000; } /* Constant */
|
||||||
|
code > span.sc { color: #4070a0; } /* SpecialChar */
|
||||||
|
code > span.vs { color: #4070a0; } /* VerbatimString */
|
||||||
|
code > span.ss { color: #bb6688; } /* SpecialString */
|
||||||
|
code > span.im { } /* Import */
|
||||||
|
code > span.va { color: #19177c; } /* Variable */
|
||||||
|
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
|
||||||
|
code > span.op { color: #666666; } /* Operator */
|
||||||
|
code > span.bu { } /* BuiltIn */
|
||||||
|
code > span.ex { } /* Extension */
|
||||||
|
code > span.pp { color: #bc7a00; } /* Preprocessor */
|
||||||
|
code > span.at { color: #7d9029; } /* Attribute */
|
||||||
|
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
|
||||||
|
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
|
||||||
|
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
|
||||||
|
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
|
||||||
|
</style>
|
||||||
|
<link rel="stylesheet" href="github-pandoc.css">
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1 id="semantic-version-annotation-processor">Semantic Version Annotation Processor</h1>
|
||||||
|
<p><a href="http://opensource.org/licenses/BSD-3-Clause"><img src="https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square" alt="License (3-Clause BSD)" /></a> <a href="https://www.versioneye.com/user/projects/56a680101b78fd00390001d2"><img src="https://www.versioneye.com/user/projects/56a680101b78fd00390001d2/badge.svg?style=flat" alt="Dependency Status" /></a> <a href="https://travis-ci.org/ethauvin/semver"><img src="https://travis-ci.org/ethauvin/semver.svg?branch=master" alt="Build Status" /></a> <a href="https://ci.appveyor.com/project/ethauvin/semver"><img src="https://ci.appveyor.com/api/projects/status/nbv4mxd1gpxtx69o?svg=true" alt="Build status" /></a> <a href="https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver"><img src="https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver/badge.svg" alt="Maven Central" /></a> <a href="https://bintray.com/ethauvin/maven/SemVer/_latestVersion"><img src="https://api.bintray.com/packages/ethauvin/maven/SemVer/images/download.svg" alt="Download" /></a></p>
|
||||||
|
<p>An <a href="https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/Processor.html">annotation processor</a> that automatically generates a <code>GeneratedVersion</code> class based on a <a href="https://mustache.github.io/">Mustache</a> template and containing the <a href="http://semver.org/">semantic version</a> (major, minor, patch, etc.) that is read from a <code>Properties</code> file or defined in the <a href="https://docs.oracle.com/javase/tutorial/java/annotations/basics.html">annotation</a>.</p>
|
||||||
|
<p>This processor was inspired by Cédric Beust's <a href="https://github.com/cbeust/version-processor">version-processor</a>.</p>
|
||||||
|
<h2 id="examples">Examples</h2>
|
||||||
|
<ul>
|
||||||
|
<li>Using annotation elements:</li>
|
||||||
|
</ul>
|
||||||
|
<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="kw">import net.thauvin.erik.semver.Version;</span>
|
||||||
|
|
||||||
|
<span class="fu">@Version</span>(major = <span class="dv">1</span>, minor = <span class="dv">0</span>, patch = <span class="dv">0</span>, preRelease = <span class="st">"beta"</span>)
|
||||||
|
<span class="kw">public</span> <span class="kw">class</span> A {
|
||||||
|
<span class="co">// ...</span></code></pre></div>
|
||||||
|
<ul>
|
||||||
|
<li>Or using a <a href="https://docs.oracle.com/javase/tutorial/essential/environment/properties.html">properties</a> file:</li>
|
||||||
|
</ul>
|
||||||
|
<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="kw">import net.thauvin.erik.semver.Version;</span>
|
||||||
|
|
||||||
|
<span class="fu">@Version</span>(properties = <span class="st">"version.properties"</span>)
|
||||||
|
<span class="kw">public</span> <span class="kw">class</span> A {
|
||||||
|
<span class="co">// ...</span></code></pre></div>
|
||||||
|
<div class="sourceCode"><pre class="sourceCode ini"><code class="sourceCode ini"><span class="co"># version.properties</span>
|
||||||
|
<span class="dt">version.major</span><span class="ot">=</span><span class="dv">1</span>
|
||||||
|
<span class="dt">version.minor</span><span class="ot">=</span><span class="dv">0</span>
|
||||||
|
<span class="dt">version.patch</span><span class="ot">=</span><span class="dv">0</span>
|
||||||
|
<span class="dt">version.prerelease</span><span class="ot">=</span><span class="st">beta</span></code></pre></div>
|
||||||
|
<p><a href="https://github.com/ethauvin/semver/tree/master/example">View Example</a></p>
|
||||||
|
<h2 id="template">Template</h2>
|
||||||
|
<p>Upon running the annotation processor, a source file <a href="https://github.com/ethauvin/semver/blob/master/example/src/generated/java/net/thauvin/erik/semver/example/GeneratedVersion.java"><code>GeneratedVersion.java</code></a> is automatically generated with static methods to access the semantic version data. The source is based on a fully customizable <a href="https://mustache.github.io/">Mustache</a> template.</p>
|
||||||
|
<p>To use your own template, simply create a <code>version.mustache</code> file. The processor will automatically look for it.</p>
|
||||||
|
<p>To specify your own template name, use:</p>
|
||||||
|
<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="fu">@Version</span>(template = <span class="st">"version.mustache"</span>)
|
||||||
|
<span class="kw">public</span> <span class="kw">class</span> A {
|
||||||
|
<span class="co">// ...</span></code></pre></div>
|
||||||
|
<h3 id="default-template">Default Template</h3>
|
||||||
|
<p>The <a href="https://github.com/ethauvin/semver/blob/master/src/main/resources/semver.mustache">default template</a> implements the following static fields:</p>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr class="header">
|
||||||
|
<th style="text-align: left;">Field</th>
|
||||||
|
<th style="text-align: left;">Description</th>
|
||||||
|
<th style="text-align: left;">Example</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="odd">
|
||||||
|
<td style="text-align: left;"><code>PROJECT</code></td>
|
||||||
|
<td style="text-align: left;">The project name, if any.</td>
|
||||||
|
<td style="text-align: left;"><code>MyProject</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td style="text-align: left;"><code>BUILDDATE</code></td>
|
||||||
|
<td style="text-align: left;">The build date.</td>
|
||||||
|
<td style="text-align: left;"><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Date.html"><code>java.util.Date</code></a></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td style="text-align: left;"><code>VERSION</code></td>
|
||||||
|
<td style="text-align: left;">The full version string.</td>
|
||||||
|
<td style="text-align: left;"><code>1.0.0-alpha+001</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td style="text-align: left;"><code>MAJOR</code></td>
|
||||||
|
<td style="text-align: left;">The major version.</td>
|
||||||
|
<td style="text-align: left;"><code>1</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td style="text-align: left;"><code>MINOR</code></td>
|
||||||
|
<td style="text-align: left;">The minor version.</td>
|
||||||
|
<td style="text-align: left;"><code>0</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td style="text-align: left;"><code>PATCH</code></td>
|
||||||
|
<td style="text-align: left;">The patch version.</td>
|
||||||
|
<td style="text-align: left;"><code>0</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td style="text-align: left;"><code>PRERELEASE</code></td>
|
||||||
|
<td style="text-align: left;">The pre-release version, if any.</td>
|
||||||
|
<td style="text-align: left;"><code>alpha</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td style="text-align: left;"><code>BUILDMETA</code></td>
|
||||||
|
<td style="text-align: left;">The build metadata, if any.</td>
|
||||||
|
<td style="text-align: left;"><code>001</code></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>And the following methods/functions:</p>
|
||||||
|
<table style="width:100%;">
|
||||||
|
<colgroup>
|
||||||
|
<col style="width: 27%" />
|
||||||
|
<col style="width: 62%" />
|
||||||
|
<col style="width: 10%" />
|
||||||
|
</colgroup>
|
||||||
|
<thead>
|
||||||
|
<tr class="header">
|
||||||
|
<th style="text-align: left;">Method</th>
|
||||||
|
<th style="text-align: left;">Description</th>
|
||||||
|
<th style="text-align: left;">Example</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="odd">
|
||||||
|
<td style="text-align: left;"><code>preReleaseWithPrefix()</code></td>
|
||||||
|
<td style="text-align: left;">Returns the pre-release with a prefix, <code>-</code> by default.</td>
|
||||||
|
<td style="text-align: left;"><code>-alpha</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td style="text-align: left;"><code>buildMetaWithPrefix()</code></td>
|
||||||
|
<td style="text-align: left;">Returns the build metadata with a prefix, <code>+</code> by default.</td>
|
||||||
|
<td style="text-align: left;"><code>+001</code></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<h3 id="custom-template">Custom Template</h3>
|
||||||
|
<p>A very simple custom template might look something like:</p>
|
||||||
|
<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="co">/* version.mustache */</span>
|
||||||
|
<span class="kw">package</span> {{packageName}}
|
||||||
|
|
||||||
|
<span class="kw">import java.util.Date;</span>
|
||||||
|
|
||||||
|
<span class="kw">public</span> <span class="dt">final</span> <span class="kw">class</span> {{className}} {
|
||||||
|
<span class="kw">public</span> <span class="dt">final</span> <span class="dt">static</span> String PROJECT = <span class="st">"{{project}}"</span>;
|
||||||
|
<span class="kw">public</span> <span class="dt">final</span> <span class="dt">static</span> Date DATE = <span class="kw">new</span> Date({{epoch}}L);
|
||||||
|
<span class="kw">public</span> <span class="dt">final</span> <span class="dt">static</span> <span class="dt">int</span> MAJOR = {{major}};
|
||||||
|
<span class="kw">public</span> <span class="dt">final</span> <span class="dt">static</span> <span class="dt">int</span> MINOR = {{minor}};
|
||||||
|
<span class="kw">public</span> <span class="dt">final</span> <span class="dt">static</span> <span class="dt">int</span> PATCH = {{patch}};
|
||||||
|
<span class="kw">public</span> <span class="dt">final</span> <span class="dt">static</span> String PRERELEASE = <span class="st">"{{preRelease}}"</span>;
|
||||||
|
<span class="kw">public</span> <span class="dt">final</span> <span class="dt">static</span> String BUILDMETA = <span class="st">"{{buildMeta}}"</span>;
|
||||||
|
}</code></pre></div>
|
||||||
|
<p>The mustache variables automatically filled in by the processor are:</p>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr class="header">
|
||||||
|
<th style="text-align: left;">Variable</th>
|
||||||
|
<th style="text-align: left;">Description</th>
|
||||||
|
<th style="text-align: left;">Type</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="odd">
|
||||||
|
<td style="text-align: left;"><code>{{packageName}}</code></td>
|
||||||
|
<td style="text-align: left;">The package name.</td>
|
||||||
|
<td style="text-align: left;"><code>String</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td style="text-align: left;"><code>{{className}}</code></td>
|
||||||
|
<td style="text-align: left;">The class name.</td>
|
||||||
|
<td style="text-align: left;"><code>String</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td style="text-align: left;"><code>{{project}}</code></td>
|
||||||
|
<td style="text-align: left;">The project name.</td>
|
||||||
|
<td style="text-align: left;"><code>String</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td style="text-align: left;"><code>{{epoch}}</code></td>
|
||||||
|
<td style="text-align: left;">The build epoch/unix time.</td>
|
||||||
|
<td style="text-align: left;"><code>long</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td style="text-align: left;"><code>{{major}}</code></td>
|
||||||
|
<td style="text-align: left;">The major version.</td>
|
||||||
|
<td style="text-align: left;"><code>int</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td style="text-align: left;"><code>{{minor}}</code></td>
|
||||||
|
<td style="text-align: left;">The minor version.</td>
|
||||||
|
<td style="text-align: left;"><code>int</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td style="text-align: left;"><code>{{patch}}</code></td>
|
||||||
|
<td style="text-align: left;">The patch version.</td>
|
||||||
|
<td style="text-align: left;"><code>int</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td style="text-align: left;"><code>{{preRelease}}</code></td>
|
||||||
|
<td style="text-align: left;">The pre/release version.</td>
|
||||||
|
<td style="text-align: left;"><code>String</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td style="text-align: left;"><code>{{buildMeta}}</code></td>
|
||||||
|
<td style="text-align: left;">The build metadata version.</td>
|
||||||
|
<td style="text-align: left;"><code>String</code></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>Please also look at this <a href="https://github.com/ethauvin/mobibot/blob/master/version.mustache">example</a> using <a href="https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html"><code>java.time</code></a></p>
|
||||||
|
<h2 id="elements-properties">Elements & Properties</h2>
|
||||||
|
<p>The following annotation elements and properties are available:</p>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr class="header">
|
||||||
|
<th style="text-align: left;">Element</th>
|
||||||
|
<th style="text-align: left;">Property</th>
|
||||||
|
<th style="text-align: left;">Description</th>
|
||||||
|
<th style="text-align: left;">Default</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="odd">
|
||||||
|
<td style="text-align: left;"><code>project</code></td>
|
||||||
|
<td style="text-align: left;"><code>version.project</code></td>
|
||||||
|
<td style="text-align: left;">The project name.</td>
|
||||||
|
<td style="text-align: left;"></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td style="text-align: left;"><code>major</code></td>
|
||||||
|
<td style="text-align: left;"><code>version.major</code></td>
|
||||||
|
<td style="text-align: left;">The major version number.</td>
|
||||||
|
<td style="text-align: left;"><code>1</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td style="text-align: left;"><code>minor</code></td>
|
||||||
|
<td style="text-align: left;"><code>version.major</code></td>
|
||||||
|
<td style="text-align: left;">The minor version number.</td>
|
||||||
|
<td style="text-align: left;"><code>0</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td style="text-align: left;"><code>patch</code></td>
|
||||||
|
<td style="text-align: left;"><code>version.patch</code></td>
|
||||||
|
<td style="text-align: left;">The patch version number.</td>
|
||||||
|
<td style="text-align: left;"><code>0</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td style="text-align: left;"><code>preRelease</code></td>
|
||||||
|
<td style="text-align: left;"><code>version.prerelease</code></td>
|
||||||
|
<td style="text-align: left;">The pre-release version.</td>
|
||||||
|
<td style="text-align: left;"></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td style="text-align: left;"><code>buildMeta</code></td>
|
||||||
|
<td style="text-align: left;"><code>version.buildmeta</code></td>
|
||||||
|
<td style="text-align: left;">The build metadata version.</td>
|
||||||
|
<td style="text-align: left;"></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td style="text-align: left;"><code>packageName</code></td>
|
||||||
|
<td style="text-align: left;"></td>
|
||||||
|
<td style="text-align: left;">The package name.</td>
|
||||||
|
<td style="text-align: left;"><em>Same as annotated class</em></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td style="text-align: left;"><code>className</code></td>
|
||||||
|
<td style="text-align: left;"></td>
|
||||||
|
<td style="text-align: left;">The name of the generated class.</td>
|
||||||
|
<td style="text-align: left;"><code>GeneratedVersion</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td style="text-align: left;"><code>properties</code></td>
|
||||||
|
<td style="text-align: left;"></td>
|
||||||
|
<td style="text-align: left;">The properties file.</td>
|
||||||
|
<td style="text-align: left;"></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td style="text-align: left;"><code>template</code></td>
|
||||||
|
<td style="text-align: left;"></td>
|
||||||
|
<td style="text-align: left;">The template file.</td>
|
||||||
|
<td style="text-align: left;"><code>version.mustache</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="odd">
|
||||||
|
<td style="text-align: left;"><code>type</code></td>
|
||||||
|
<td style="text-align: left;"></td>
|
||||||
|
<td style="text-align: left;">Either <code>java</code> or <code>kt</code> for Kotlin.</td>
|
||||||
|
<td style="text-align: left;"><code>java</code></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>In order to easily incorporate with existing projects, the property keys may be assigned custom values:</p>
|
||||||
|
<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="fu">@Version</span>(
|
||||||
|
properties = <span class="st">"example.properties"</span>,
|
||||||
|
majorKey = <span class="st">"example.major"</span>,
|
||||||
|
minorKey = <span class="st">"example.minor"</span>,
|
||||||
|
patchKey = <span class="st">"example.patch"</span>,
|
||||||
|
preReleaseKey = <span class="st">"example.prerelease"</span>,
|
||||||
|
buildMetaKey = <span class="st">"example.buildmeta"</span>,
|
||||||
|
projectKey = <span class="st">"example.project"</span>
|
||||||
|
)
|
||||||
|
<span class="kw">public</span> <span class="kw">class</span> Example {
|
||||||
|
<span class="co">// ...</span></code></pre></div>
|
||||||
|
<div class="sourceCode"><pre class="sourceCode ini"><code class="sourceCode ini"><span class="co"># example.properties</span>
|
||||||
|
<span class="dt">example.project</span><span class="ot">=</span><span class="st">Example</span>
|
||||||
|
<span class="dt">example.major</span><span class="ot">=</span><span class="dv">1</span>
|
||||||
|
<span class="dt">example.minor</span><span class="ot">=</span><span class="dv">0</span>
|
||||||
|
<span class="dt">example.patch</span><span class="ot">=</span><span class="dv">0</span>
|
||||||
|
<span class="co"># ...</span></code></pre></div>
|
||||||
|
<h2 id="usage-with-maven-grail-kobalt-and-kotlin">Usage with Maven, Grail, Kobalt and Kotlin</h2>
|
||||||
|
<h3 id="maven">Maven</h3>
|
||||||
|
<p>To install and run from <a href="http://maven.apache.org/">Maven</a>, configure an artifact as follows:</p>
|
||||||
|
<div class="sourceCode"><pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><dependency></span>
|
||||||
|
<span class="kw"><groupId></span>net.thauvin.erik<span class="kw"></groupId></span>
|
||||||
|
<span class="kw"><artifactId></span>semver<span class="kw"></artifactId></span>
|
||||||
|
<span class="kw"><version></span>1.0<span class="kw"></version></span>
|
||||||
|
<span class="kw"></dependency></span></code></pre></div>
|
||||||
|
<h3 id="gradle">Gradle</h3>
|
||||||
|
<h4 id="class-generation">Class Generation</h4>
|
||||||
|
<p>To install and run from <a href="https://gradle.org/">Gradle</a>, add the following to the <code>build.gradle</code> file:</p>
|
||||||
|
<pre class="gradle"><code>dependencies {
|
||||||
|
compileOnly 'net.thauvin.erik:semver:1.0'
|
||||||
|
}</code></pre>
|
||||||
|
<p>The <code>GeneratedVersion</code> class will be automatically created in the <code>build/generated</code> directory upon compiling.</p>
|
||||||
|
<h4 id="class-source-generation">Class & Source Generation</h4>
|
||||||
|
<p>In order to also incorporate the generated source code into the <code>source tree</code>, use the <a href="https://github.com/ewerk/gradle-plugins/tree/master/annotation-processor-plugin">EWERK Annotation Processor Plugin</a>. Start by adding the following to the very top of the <code>build.gradle</code> file:</p>
|
||||||
|
<pre class="gradle"><code>plugins {
|
||||||
|
id "com.ewerk.gradle.plugins.annotation-processor" version "1.0.4"
|
||||||
|
}</code></pre>
|
||||||
|
<p>Then add the following to the <code>build.gradle</code> file:</p>
|
||||||
|
<pre class="gradle"><code>dependencies {
|
||||||
|
compileOnly 'net.thauvin.erik:semver:1.0'
|
||||||
|
}
|
||||||
|
|
||||||
|
annotationProcessor {
|
||||||
|
library 'net.thauvin.erik:semver:1.0'
|
||||||
|
processor 'net.thauvin.erik.semver.VersionProcessor'
|
||||||
|
// sourcesDir 'src/generated/java'
|
||||||
|
}
|
||||||
|
|
||||||
|
compileJava {
|
||||||
|
// Disable the classpath processor
|
||||||
|
options.compilerArgs << '-proc:none'
|
||||||
|
}</code></pre>
|
||||||
|
<p>The plugin implements a separate compile task that only runs the annotation processor and is executed during the build phase.</p>
|
||||||
|
<p>Please look at the <a href="https://github.com/ethauvin/semver/blob/master/example/build.gradle">build.gradle</a> file in the <a href="https://github.com/ethauvin/semver/tree/master/example">example</a> module directory for a sample.</p>
|
||||||
|
<h3 id="kobalt">Kobalt</h3>
|
||||||
|
<p>To install and run from <a href="http://beust.com/kobalt/">Kobalt</a>, add the following to the <code>Build.kt</code> file:</p>
|
||||||
|
<pre class="gradle"><code>dependencies {
|
||||||
|
apt("net.thauvin.erik:semver:1.0")
|
||||||
|
compileOnly("net.thauvin.erik:semver:1.0")
|
||||||
|
}</code></pre>
|
||||||
|
<p>Please look at the <a href="https://github.com/ethauvin/semver/blob/master/example/kobalt/src/Build.kt">Build.kt</a> file in the <a href="https://github.com/ethauvin/semver/tree/master/example">example</a> module directory for a sample.</p>
|
||||||
|
<h3 id="kotlin">Kotlin</h3>
|
||||||
|
<p>The annotation processor also supports <a href="https://kotlinlang.org/">Kotlin</a>.</p>
|
||||||
|
<p>To generate a Kotlin version file, simply specify the <code>type</code> as follows:</p>
|
||||||
|
<div class="sourceCode"><pre class="sourceCode kotlin"><code class="sourceCode kotlin"><span class="kw">import</span> net.<span class="fu">thauvin</span>.<span class="fu">erik</span>.<span class="fu">semver</span>.<span class="fu">Version</span>
|
||||||
|
|
||||||
|
@<span class="fu">Version</span>(properties = <span class="st">"version.properties"</span>, type=<span class="st">"kt"</span>)
|
||||||
|
<span class="kw">open</span> <span class="kw">class</span> Main {
|
||||||
|
<span class="co">// ...</span></code></pre></div>
|
||||||
|
<p>The <a href="https://github.com/ethauvin/semver/blob/master/src/main/resources/semver-kt.mustache">Kotlin default template</a> implements the same static fields and functions as the <a href="#default-template">Java template</a>.</p>
|
||||||
|
<p>Please look at the <a href="https://github.com/ethauvin/semver-example-kotlin">Example for Kotlin</a> project for samples on using Gradle (<a href="https://github.com/ethauvin/semver-example-kotlin/blob/master/build.gradle">build.gradle</a>) and Kobalt (<a href="https://github.com/ethauvin/semver-example-kotlin/blob/master/kobalt/src/Build.kt">Build.kt</a>).</p>
|
||||||
|
<h3 id="auto-increment">Auto-Increment</h3>
|
||||||
|
<p>Incrementing the version is best left to your favorite build system.</p>
|
||||||
|
<p>For a solution using <a href="https://gradle.org/">Gradle</a>, please have a look at the <a href="https://github.com/ethauvin/semver/blob/master/example/build.gradle">build.gradle</a> file in the <a href="https://github.com/ethauvin/semver/tree/master/example">example</a> module directory. To run the example with patch version auto-incrementing, issue the following command:</p>
|
||||||
|
<pre><code>gradle release run</code></pre>
|
||||||
|
<p>For a solution using <a href="http://beust.com/kobalt/">Kobalt</a> look at my <a href="https://github.com/ethauvin/kobalt-property-file">Property File Editor</a> plug-in.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
337
README.md
337
README.md
|
@ -1,62 +1,31 @@
|
||||||
# Semantic Version Annotation Processor
|
# Semantic Version Annotation Processor
|
||||||
|
|
||||||
[](https://opensource.org/licenses/BSD-3-Clause)
|
[](http://opensource.org/licenses/BSD-3-Clause) [](https://www.versioneye.com/user/projects/56a680101b78fd00390001d2) [](https://travis-ci.org/ethauvin/semver) [](https://ci.appveyor.com/project/ethauvin/semver) [](https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver) [  ](https://bintray.com/ethauvin/maven/SemVer/_latestVersion)
|
||||||
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
|
|
||||||
[](https://rife2.com/bld)
|
|
||||||
[](https://github.com/ethauvin/semver/releases/latest)
|
|
||||||
[](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/semver/)
|
|
||||||
[](https://central.sonatype.com/artifact/net.thauvin.erik/semver)
|
|
||||||
|
|
||||||
[](https://sonarcloud.io/dashboard?id=ethauvin_semver)
|
An [annotation processor](https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/Processor.html) that automatically generates a `GeneratedVersion` class based on a [Mustache](https://mustache.github.io/) template and containing the [semantic version](http://semver.org/) (major, minor, patch, etc.) that is read from a `Properties` file or defined in the [annotation](https://docs.oracle.com/javase/tutorial/java/annotations/basics.html).
|
||||||
[](https://github.com/ethauvin/semver/actions/workflows/bld.yml)
|
|
||||||
[](https://ci.appveyor.com/project/ethauvin/semver)
|
|
||||||
[](https://circleci.com/gh/ethauvin/semver/tree/master)
|
|
||||||
|
|
||||||
An [annotation processor](https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/Processor.html) that automatically generates a `GeneratedVersion` class based on a [Mustache](https://mustache.github.io/) template and containing the [semantic version](https://semver.org/) (major, minor, patch, etc.) that is read from a [Properties](https://docs.oracle.com/javase/tutorial/essential/environment/properties.html) file or defined in the [annotation](https://docs.oracle.com/javase/tutorial/java/annotations/basics.html).
|
This processor was inspired by Cédric Beust's [version-processor](https://github.com/cbeust/version-processor).
|
||||||
|
|
||||||
This processor was inspired by Cédric Beust's [version-processor](https://github.com/cbeust/version-processor) and works well in conjunction with the [__Semantic Version Plugin for Gradle__](https://github.com/ethauvin/semver-gradle).
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
- [Semantic Version Annotation Processor](#semantic-version-annotation-processor)
|
|
||||||
- [Table of Contents](#table-of-contents)
|
|
||||||
- [Examples](#examples)
|
|
||||||
- [Template](#template)
|
|
||||||
- [Default Template](#default-template)
|
|
||||||
- [Custom Template](#custom-template)
|
|
||||||
- [Elements \& Properties](#elements--properties)
|
|
||||||
- [Maven](#maven)
|
|
||||||
- [bld](#bld)
|
|
||||||
- [Gradle](#gradle)
|
|
||||||
- [Class Generation](#class-generation)
|
|
||||||
- [Class \& Source Generation](#class--source-generation)
|
|
||||||
- [Kotlin](#kotlin)
|
|
||||||
- [Kotlin \& Gradle](#kotlin--gradle)
|
|
||||||
- [Auto-Increment](#auto-increment)
|
|
||||||
- [Contributing](#contributing)
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
- Using annotation elements:
|
* Using annotation elements:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
import net.thauvin.erik.semver.Version;
|
import net.thauvin.erik.semver.Version;
|
||||||
|
|
||||||
@Version(major = 2, minor = 1, patch = 1, preRelease = "beta")
|
@Version(major = 1, minor = 0, patch = 0, preRelease = "beta")
|
||||||
public class A {
|
public class A {
|
||||||
// ...
|
// ...
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
- Or using a [properties](hhttps://github.com/ethauvin/semver/blob/master/examples/java/version.properties) file:
|
* Or using a [properties](https://docs.oracle.com/javase/tutorial/essential/environment/properties.html) file:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
import net.thauvin.erik.semver.Version;
|
import net.thauvin.erik.semver.Version;
|
||||||
|
|
||||||
@Version(properties = "version.properties")
|
@Version(properties = "version.properties")
|
||||||
public class A {
|
public class A {
|
||||||
// ...
|
// ...
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
|
@ -67,40 +36,43 @@ version.patch=0
|
||||||
version.prerelease=beta
|
version.prerelease=beta
|
||||||
```
|
```
|
||||||
|
|
||||||
[View Examples](https://github.com/ethauvin/semver/tree/master/examples)
|
[View Example](https://github.com/ethauvin/semver/tree/master/example)
|
||||||
|
|
||||||
## Template
|
## Template
|
||||||
|
|
||||||
Upon running the annotation processor, a source file [GeneratedVersion.java](https://github.com/ethauvin/semver/blob/master/examples/java/src/generated/java/com/example/GeneratedVersion.java) is automatically generated with static methods to access the semantic version data. The source is based on a fully customizable Mustache [template](https://github.com/ethauvin/semver/blob/master/src/main/resources/semver.mustache).
|
Upon running the annotation processor, a source file [`GeneratedVersion.java`](https://github.com/ethauvin/semver/blob/master/example/src/generated/java/net/thauvin/erik/semver/example/GeneratedVersion.java) is automatically generated with static methods to access the semantic version data. The source is based on a fully customizable [Mustache](https://mustache.github.io/) template.
|
||||||
|
|
||||||
To use your own template, simply create a `version.mustache` file in the project's root directory. The processor will automatically look for it.
|
To use your own template, simply create a `version.mustache` file. The processor will automatically look for it.
|
||||||
|
|
||||||
To specify your own template name, use:
|
To specify your own template name, use:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
@Version(template = "version.mustache")
|
@Version(template = "version.mustache")
|
||||||
public class A {
|
public class A {
|
||||||
// ...
|
// ...
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Default Template
|
### Default Template
|
||||||
|
|
||||||
The [default template](https://github.com/ethauvin/semver/blob/master/src/main/resources/semver.mustache) implements the following static variables:
|
The [default template](https://github.com/ethauvin/semver/blob/master/src/main/resources/semver.mustache) implements the following static fields:
|
||||||
|
|
||||||
| Field | Description | Example |
|
Field | Description | Example
|
||||||
|:-------------------|:---------------------------------|:----------------------------------------------------------------------------------|
|
:--------------|:---------------------------------|:-----------------
|
||||||
| `PROJECT` | The project name, if any. | `MyProject` |
|
`PROJECT` | The project name, if any. | `MyProject`
|
||||||
| `BUILDDATE` | The build date. | [`java.util.Date`](https://docs.oracle.com/javase/8/docs/api/java/util/Date.html) |
|
`BUILDDATE` | The build date. | [`java.util.Date`](https://docs.oracle.com/javase/8/docs/api/java/util/Date.html)
|
||||||
| `VERSION` | The full version string. | `1.2.3-alpha+001` |
|
`VERSION` | The full version string. | `1.0.0-alpha+001`
|
||||||
| `MAJOR` | The major version. | `1` |
|
`MAJOR` | The major version. | `1`
|
||||||
| `MINOR` | The minor version. | `2` |
|
`MINOR` | The minor version. | `0`
|
||||||
| `PATCH` | The patch version. | `3` |
|
`PATCH` | The patch version. | `0`
|
||||||
| `PRERELEASE` | The pre-release version, if any. | `alpha` |
|
`PRERELEASE` | The pre-release version, if any. | `alpha`
|
||||||
| `PRERELASE_PREFIX` | The pre-release prefix | `-` |
|
`BUILDMETA` | The build metadata, if any. | `001`
|
||||||
| `BUILDMETA` | The build metadata, if any. | `001` |
|
|
||||||
| `BUILDMETA_PREFIX` | The metadata prefix. | `+` |
|
And the following methods/functions:
|
||||||
| `SEPARATOR` | The version separator. | `.` |
|
|
||||||
|
Method | Description | Example
|
||||||
|
:------------------------|:----------------------------------------------------------|:--------
|
||||||
|
`preReleaseWithPrefix()` | Returns the pre-release with a prefix, `-` by default. | `-alpha`
|
||||||
|
`buildMetaWithPrefix()` | Returns the build metadata with a prefix, `+` by default. | `+001`
|
||||||
|
|
||||||
### Custom Template
|
### Custom Template
|
||||||
|
|
||||||
|
@ -108,166 +80,153 @@ A very simple custom template might look something like:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
/* version.mustache */
|
/* version.mustache */
|
||||||
package {{packageName}};
|
package {{packageName}}
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public final class {{className}} {
|
public final class {{className}} {
|
||||||
public final static String PROJECT = "{{project}}";
|
public final static String PROJECT = "{{project}}";
|
||||||
public final static Date DATE = new Date({{epoch}}L);
|
public final static Date DATE = new Date({{epoch}}L);
|
||||||
public final static String VERSION = "{{semver}}";
|
public final static int MAJOR = {{major}};
|
||||||
|
public final static int MINOR = {{minor}};
|
||||||
|
public final static int PATCH = {{patch}};
|
||||||
|
public final static String PRERELEASE = "{{preRelease}}";
|
||||||
|
public final static String BUILDMETA = "{{buildMeta}}";
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The mustache variables automatically filled in by the processor are:
|
The mustache variables automatically filled in by the processor are:
|
||||||
|
|
||||||
| Variable | Description | Type |
|
Variable | Description | Type
|
||||||
|:------------------------------|:----------------------------|:---------|
|
:-----------------|:----------------------------|:--------
|
||||||
| `{{packageName}}` | The package name. | `String` |
|
`{{packageName}}` | The package name. | `String`
|
||||||
| `{{className}}` | The class name. | `String` |
|
`{{className}}` | The class name. | `String`
|
||||||
| `{{project}}` | The project name. | `String` |
|
`{{project}}` | The project name. | `String`
|
||||||
| `{{epoch}}` | The build epoch/unix time. | `long` |
|
`{{epoch}}` | The build epoch/unix time. | `long`
|
||||||
| `{{major}}` | The major version. | `int` |
|
`{{major}}` | The major version. | `int`
|
||||||
| `{{minor}}` | The minor version. | `int` |
|
`{{minor}}` | The minor version. | `int`
|
||||||
| `{{patch}}` | The patch version. | `int` |
|
`{{patch}}` | The patch version. | `int`
|
||||||
| `{{preRelease}}` | The pre-release version. | `String` |
|
`{{preRelease}}` | The pre/release version. | `String`
|
||||||
| `{{preReleasePrefix}}` | The pre-release prefix. | `String` |
|
`{{buildMeta}}` | The build metadata version. | `String`
|
||||||
| `{{buildMeta}}` | The build metadata version. | `String` |
|
|
||||||
| `{{buildMetaPrefix}}` | The metadata prefix. | `String` |
|
Please also look at this [example](https://github.com/ethauvin/mobibot/blob/master/version.mustache) using [`java.time`](https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html)
|
||||||
| `{{separator}}` | The version separator. | `String` |
|
|
||||||
| `{{semver}}` or `{{version}}` | The full semantic version. | `String` |
|
|
||||||
|
|
||||||
## Elements & Properties
|
## Elements & Properties
|
||||||
|
|
||||||
The following annotation elements and properties are available:
|
The following annotation elements and properties are available:
|
||||||
|
|
||||||
| Element | Property | Description | Default |
|
Element | Property | Description | Default
|
||||||
|:-------------------|:----------------------------|:----------------------------------|:--------------------------|
|
:-------------|:---------------------|:----------------------------------|:-------------------------
|
||||||
| `project` | `version.project` | The project name. | |
|
`project` | `version.project` | The project name. |
|
||||||
| `major` | `version.major` | The major version number. | `1` |
|
`major` | `version.major` | The major version number. | `1`
|
||||||
| `minor` | `version.major` | The minor version number. | `0` |
|
`minor` | `version.major` | The minor version number. | `0`
|
||||||
| `patch` | `version.patch` | The patch version number. | `0` |
|
`patch` | `version.patch` | The patch version number. | `0`
|
||||||
| `preRelease` | `version.prerelease` | The pre-release version. | |
|
`preRelease` | `version.prerelease` | The pre-release version. |
|
||||||
| `preReleasePrefix` | `version.prerelease.prefix` | The pre-release prefix. | `-` |
|
`buildMeta` | `version.buildmeta` | The build metadata version. |
|
||||||
| `buildMeta` | `version.buildmeta` | The build metadata version. | |
|
`packageName` | | The package name. | _Same as annotated class_
|
||||||
| `buildMetaPrefix` | `version.buildmeta.prefix` | The metadata prefix. | `+` |
|
`className` | | The name of the generated class. | `GeneratedVersion`
|
||||||
| `separator` | `version.separator` | The version separator. | `.` |
|
`properties` | | The properties file. |
|
||||||
| `packageName` | | The package name. | _Same as annotated class_ |
|
`template` | | The template file. | `version.mustache`
|
||||||
| `className` | | The name of the generated class. | `GeneratedVersion` |
|
`type` | | Either `java` or `kt` for Kotlin. | `java`
|
||||||
| `properties` | | The properties file. | |
|
|
||||||
| `template` | | The template file. | `version.mustache` |
|
|
||||||
| `type` | | Either `java` or `kt` for Kotlin. | `java` |
|
|
||||||
| `keysPrefix` | | The prefix for all property keys. | `version.` |
|
|
||||||
|
|
||||||
In order to easily incorporate with existing projects, the property keys may be assigned custom values:
|
In order to easily incorporate with existing projects, the property keys may be assigned custom values:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
@Version(
|
@Version(
|
||||||
properties = "example.properties",
|
properties = "example.properties",
|
||||||
keysPrefix = "example.",
|
majorKey = "example.major",
|
||||||
majorKey = "maj",
|
minorKey = "example.minor",
|
||||||
minorKey = "min",
|
patchKey = "example.patch",
|
||||||
patchKey = "build",
|
preReleaseKey = "example.prerelease",
|
||||||
preReleaseKey = "rel",
|
buildMetaKey = "example.buildmeta",
|
||||||
buildMetaKey = "meta",
|
projectKey = "example.project"
|
||||||
projectKey = "project"
|
|
||||||
)
|
)
|
||||||
public class Example {
|
public class Example {
|
||||||
// ...
|
// ...
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
# example.properties
|
# example.properties
|
||||||
example.project=Example
|
example.project=Example
|
||||||
example.maj=1
|
example.major=1
|
||||||
example.min=0
|
example.minor=0
|
||||||
example.build=0
|
example.patch=0
|
||||||
example.rel=beta
|
|
||||||
example.meta=
|
|
||||||
# ...
|
# ...
|
||||||
```
|
```
|
||||||
|
## Usage with Maven, Grail, Kobalt and Kotlin
|
||||||
|
|
||||||
> :warning: `keysPrefix` is a new element staring in `1.1.0` and may break older versions when using custom property keys.\
|
### Maven
|
||||||
> :zap: A quick fix is to include `keysPrefix=""` in the annotation to remove the default `version.` prefix.
|
|
||||||
|
|
||||||
## Maven
|
To install and run from [Maven](http://maven.apache.org/), configure an artifact as follows:
|
||||||
|
|
||||||
To install and run from [Maven](https://maven.apache.org/), configure an artifact as follows:
|
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.thauvin.erik</groupId>
|
<groupId>net.thauvin.erik</groupId>
|
||||||
<artifactId>semver</artifactId>
|
<artifactId>semver</artifactId>
|
||||||
<version>1.2.1</version>
|
<version>1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
```console
|
### Gradle
|
||||||
mvn verify
|
|
||||||
```
|
|
||||||
|
|
||||||
Please look at [pom.xml](https://github.com/ethauvin/semver/blob/master/examples/java/gradle/pom.xml) in the [examples/java/gradle](https://github.com/ethauvin/semver/tree/master/examples/java/gradle) directory for a sample:
|
#### Class Generation
|
||||||
|
|
||||||
|
To install and run from [Gradle](https://gradle.org/), add the following to the `build.gradle` file:
|
||||||
## bld
|
|
||||||
|
|
||||||
To install and run from [bld](https://rife2.com/bld), just add the dependency to your build file:
|
|
||||||
|
|
||||||
```java
|
|
||||||
public class ExampleBuild extends Project {
|
|
||||||
public ExampleBuild() {
|
|
||||||
// ...
|
|
||||||
scope(compile)
|
|
||||||
.include(dependency("net.thauvin.erik", "semver", version(1, 2, 1)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Please look at [ExampleBuild](https://github.com/ethauvin/semver/blob/master/examples/java/bld/src/bld/java/com/example/ExampleBuild.java) in the [examples/java/bld](https://github.com/ethauvin/semver/tree/master/examples/java/bld) directory for a sample. It also shows how to incorporate the generated code into the `source tree`, more information is also available [here](https://forum.uwyn.com/post/36).
|
|
||||||
|
|
||||||
bld also has a [Generated Version](https://github.com/rife2/bld-generated-version) extension which provides similar functionalities.
|
|
||||||
|
|
||||||
## Gradle
|
|
||||||
|
|
||||||
### Class Generation
|
|
||||||
|
|
||||||
To install and run from [Gradle](https://gradle.org/), add the following to [build.gradle](https://github.com/ethauvin/semver/blob/master/examples/java/gradle/build.gradle):
|
|
||||||
|
|
||||||
```gradle
|
```gradle
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
annotationProcessor 'net.thauvin.erik:semver:1.2.1'
|
compileOnly 'net.thauvin.erik:semver:1.0'
|
||||||
compileOnly 'net.thauvin.erik:semver:1.2.1'
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
|
||||||
options.compilerArgs += [ "-Asemver.project.dir=$projectDir" ]
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The directory containing the configuration files (`version.properties`, `version.mustache`) must be specified using the `semver.project.dir` processor argument.
|
The `GeneratedVersion` class will be automatically created in the `build/generated` directory upon compiling.
|
||||||
|
|
||||||
The [`GeneratedVersion.java`](https://github.com/ethauvin/semver/blob/master/examples/java/src/generated/java/com/example/GeneratedVersion.java) class will be automatically created in the `build/generated` directory upon compiling.
|
#### Class & Source Generation
|
||||||
|
|
||||||
Please look at [build.gradle](https://github.com/ethauvin/semver/blob/master/examples/java/gradle/build.gradle) in the [examples/java/gradle](https://github.com/ethauvin/semver/tree/master/examples/java/gradle) directory for a sample.
|
In order to also incorporate the generated source code into the `source tree`, use the [EWERK Annotation Processor Plugin](https://github.com/ewerk/gradle-plugins/tree/master/annotation-processor-plugin). Start by adding the following to the very top of the `build.gradle` file:
|
||||||
|
|
||||||
### Class & Source Generation
|
|
||||||
|
|
||||||
In order to also incorporate the generated source code into the `source tree`, add the following to [build.gradle](https://github.com/ethauvin/semver/blob/master/examples/java/build.gradle):
|
|
||||||
|
|
||||||
```gradle
|
```gradle
|
||||||
tasks.withType(JavaCompile).configureEach {
|
plugins {
|
||||||
options.generatedSourceOutputDirectory.set(file("${projectDir}/src/generated/java"))
|
id "com.ewerk.gradle.plugins.annotation-processor" version "1.0.4"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The [`GeneratedVersion.java`](https://github.com/ethauvin/semver/blob/master/examples/java/src/generated/java/com/example/GeneratedVersion.java) file will now be located in `src/generated`.
|
Then add the following to the `build.gradle` file:
|
||||||
|
|
||||||
## Kotlin
|
```gradle
|
||||||
|
dependencies {
|
||||||
|
compileOnly 'net.thauvin.erik:semver:1.0'
|
||||||
|
}
|
||||||
|
|
||||||
|
annotationProcessor {
|
||||||
|
library 'net.thauvin.erik:semver:1.0'
|
||||||
|
processor 'net.thauvin.erik.semver.VersionProcessor'
|
||||||
|
// sourcesDir 'src/generated/java'
|
||||||
|
}
|
||||||
|
|
||||||
|
compileJava {
|
||||||
|
// Disable the classpath processor
|
||||||
|
options.compilerArgs << '-proc:none'
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The plugin implements a separate compile task that only runs the annotation processor and is executed during the build phase.
|
||||||
|
|
||||||
|
Please look at the [build.gradle](https://github.com/ethauvin/semver/blob/master/example/build.gradle) file in the [example](https://github.com/ethauvin/semver/tree/master/example) module directory for a sample.
|
||||||
|
|
||||||
|
### Kobalt
|
||||||
|
|
||||||
|
To install and run from [Kobalt](http://beust.com/kobalt/), add the following to the `Build.kt` file:
|
||||||
|
|
||||||
|
```gradle
|
||||||
|
dependencies {
|
||||||
|
apt("net.thauvin.erik:semver:1.0")
|
||||||
|
compileOnly("net.thauvin.erik:semver:1.0")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Please look at the [Build.kt](https://github.com/ethauvin/semver/blob/master/example/kobalt/src/Build.kt) file in the [example](https://github.com/ethauvin/semver/tree/master/example) module directory for a sample.
|
||||||
|
|
||||||
|
### Kotlin
|
||||||
|
|
||||||
The annotation processor also supports [Kotlin](https://kotlinlang.org/).
|
The annotation processor also supports [Kotlin](https://kotlinlang.org/).
|
||||||
|
|
||||||
|
@ -278,56 +237,20 @@ import net.thauvin.erik.semver.Version
|
||||||
|
|
||||||
@Version(properties = "version.properties", type="kt")
|
@Version(properties = "version.properties", type="kt")
|
||||||
open class Main {
|
open class Main {
|
||||||
// ...
|
// ...
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The [Kotlin default template](https://github.com/ethauvin/semver/blob/master/src/main/resources/semver-kt.mustache) implements the same static fields and functions as the [Java template](#default-template).
|
The [Kotlin default template](https://github.com/ethauvin/semver/blob/master/src/main/resources/semver-kt.mustache) implements the same static fields and functions as the [Java template](#default-template).
|
||||||
|
|
||||||
Please look at the [examples/kotlin](https://github.com/ethauvin/semver/tree/master/examples/kotlin) project for a [build.gradle.kts](https://github.com/ethauvin/semver/blob/master/examples/kotlin/build.gradle.kts) sample.
|
Please look at the [Example for Kotlin](https://github.com/ethauvin/semver-example-kotlin) project for samples on using Gradle ([build.gradle](https://github.com/ethauvin/semver-example-kotlin/blob/master/build.gradle)) and Kobalt ([Build.kt](https://github.com/ethauvin/semver-example-kotlin/blob/master/kobalt/src/Build.kt)).
|
||||||
|
|
||||||
### Kotlin & Gradle
|
### Auto-Increment
|
||||||
|
|
||||||
To install and run from [Gradle](https://gradle.org/), add the following to [build.gradle.kts](https://github.com/ethauvin/semver/blob/master/examples/kotlin/build.gradle.kts):
|
Incrementing the version is best left to your favorite build system.
|
||||||
|
|
||||||
```kotlin
|
For a solution using [Gradle](https://gradle.org/), please have a look at the [build.gradle](https://github.com/ethauvin/semver/blob/master/example/build.gradle) file in the [example](https://github.com/ethauvin/semver/tree/master/example) module directory. To run the example with patch version auto-incrementing, issue the following command:
|
||||||
var semverProcessor = "net.thauvin.erik:semver:1.2.1"
|
|
||||||
|
|
||||||
dependencies {
|
```
|
||||||
kapt(semverProcessor)
|
gradle release run
|
||||||
compileOnly(semverProcessor)
|
|
||||||
}
|
|
||||||
|
|
||||||
kapt {
|
|
||||||
arguments {
|
|
||||||
arg("semver.project.dir", projectDir.absolutePath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The directory containing the configuration files (`version.properties`, `version.mustache`) must be specified using the `semver.project.dir` processor argument.
|
For a solution using [Kobalt](http://beust.com/kobalt/) look at my [Property File Editor](https://github.com/ethauvin/kobalt-property-file) plug-in.
|
||||||
|
|
||||||
## Auto-Increment
|
|
||||||
|
|
||||||
Incrementing the version is best left to your favorite build system. For a solution using Gradle, please have a look at the [__Semver Version Plugin for Gradle__](https://github.com/ethauvin/semver-gradle).
|
|
||||||
|
|
||||||
There are also full [examples](https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor) in both [Java](https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor/java) and [Kotlin](https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor/kotlin) showing how to use both the plugin and annotation processor concurrently.
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
If you want to contribute to this project, all you have to do is clone the GitHub
|
|
||||||
repository:
|
|
||||||
|
|
||||||
```console
|
|
||||||
git clone git@github.com:ethauvin/semver.git
|
|
||||||
```
|
|
||||||
|
|
||||||
Then use [bld](https://rife2.com/bld) to build:
|
|
||||||
|
|
||||||
```console
|
|
||||||
cd semver
|
|
||||||
./bld compile
|
|
||||||
```
|
|
||||||
|
|
||||||
The project has an [IntelliJ IDEA](https://www.jetbrains.com/idea/) project structure. You can just open it after all
|
|
||||||
the dependencies were downloaded and peruse the code.
|
|
30
appveyor.yml
30
appveyor.yml
|
@ -1,18 +1,26 @@
|
||||||
version: build-{build}.{branch}
|
version: "{branch} {build}"
|
||||||
clone_depth: 3
|
skip_tags: true
|
||||||
|
|
||||||
platform: x64
|
build:
|
||||||
image: Visual Studio 2019
|
verbosity: detailed
|
||||||
|
|
||||||
before_build:
|
|
||||||
- set "JAVA_HOME=C:\Program Files\Java\jdk17"
|
|
||||||
- set "PATH=C:\Program Files\Java\jdk17\bin;%PATH%"
|
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- bld.bat download compile
|
- gradlew.bat assemble --info --no-daemon
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- bld.bat test
|
- gradlew.bat check --info --no-daemon
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
- C:\Users\appveyor\.m2
|
- C:\Users\appveyor\.gradle
|
||||||
|
|
||||||
|
environment:
|
||||||
|
matrix:
|
||||||
|
- JAVA_HOME: C:\Program Files\Java\jdk1.8.0
|
||||||
|
- JAVA_HOME: C:\Program Files (x86)\Java\jdk1.8.0
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
fast_finish: true
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
#
|
|
||||||
# javax.annotation.processing.Processor
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016-2023, 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.
|
|
||||||
#
|
|
||||||
|
|
||||||
net.thauvin.erik.semver.VersionProcessor
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,12 +0,0 @@
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<title>Semantic Version Annotation Processor</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
An annotation processor that automatically generates a <code>GeneratedVersion</code> class containing the semantic
|
|
||||||
version (major, minor, patch, etc.) that is read from a Properties file or defined in the annotation.
|
|
||||||
|
|
||||||
@since 1.0
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,38 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is automatically generated.
|
|
||||||
* Do not modify! -- ALL CHANGES WILL BE ERASED!
|
|
||||||
*/
|
|
||||||
|
|
||||||
package {{packageName}}
|
|
||||||
|
|
||||||
import java.util.Date
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides semantic version information.
|
|
||||||
*
|
|
||||||
* @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a>
|
|
||||||
*/
|
|
||||||
object {{className}} {
|
|
||||||
@JvmField
|
|
||||||
val PROJECT = "{{project}}"
|
|
||||||
@JvmField
|
|
||||||
val BUILDDATE = Date({{epoch}}L)
|
|
||||||
@JvmField
|
|
||||||
val MAJOR = {{major}}
|
|
||||||
@JvmField
|
|
||||||
val MINOR = {{minor}}
|
|
||||||
@JvmField
|
|
||||||
val PATCH = {{patch}}
|
|
||||||
@JvmField
|
|
||||||
val PRERELEASE = "{{preRelease}}"
|
|
||||||
@JvmField
|
|
||||||
val PRERELEASE_PREFIX = "{{preReleasePrefix}}"
|
|
||||||
@JvmField
|
|
||||||
val BUILDMETA = "{{buildMeta}}"
|
|
||||||
@JvmField
|
|
||||||
val BUILDMEATA_PREFIX = "{{buildMetaPrefix}}"
|
|
||||||
@JvmField
|
|
||||||
val SEPARATOR = "{{separator}}"
|
|
||||||
@JvmField
|
|
||||||
val VERSION = "{{version}}"
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is automatically generated.
|
|
||||||
* Do not modify! -- ALL CHANGES WILL BE ERASED!
|
|
||||||
*/
|
|
||||||
|
|
||||||
package {{packageName}};
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides semantic version information.
|
|
||||||
*
|
|
||||||
* @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a>
|
|
||||||
*/
|
|
||||||
public final class {{className}} {
|
|
||||||
public static final String PROJECT = "{{project}}";
|
|
||||||
public static final Date BUILDDATE = new Date({{epoch}}L);
|
|
||||||
public static final int MAJOR = {{major}};
|
|
||||||
public static final int MINOR = {{minor}};
|
|
||||||
public static final int PATCH = {{patch}};
|
|
||||||
public static final String PRERELEASE = "{{preRelease}}";
|
|
||||||
public static final String PRERELEASE_PREFIX = "{{preReleasePrefix}}";
|
|
||||||
public static final String BUILDMETA = "{{buildMeta}}";
|
|
||||||
public static final String BUILDMETA_PREFIX = "{{buildMetaPrefix}}";
|
|
||||||
public static final String SEPARATOR = "{{separator}}";
|
|
||||||
public static final String VERSION = "{{version}}";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disables the default constructor.
|
|
||||||
*/
|
|
||||||
private {{className}}() {
|
|
||||||
throw new UnsupportedOperationException("Illegal constructor call.");
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2
bld
2
bld
|
@ -1,2 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build net.thauvin.erik.semver.SemverBuild "$@"
|
|
4
bld.bat
4
bld.bat
|
@ -1,4 +0,0 @@
|
||||||
@echo off
|
|
||||||
set DIRNAME=%~dp0
|
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
|
||||||
java -jar "%DIRNAME%/lib/bld/bld-wrapper.jar" "%0" --build net.thauvin.erik.semver.SemverBuild %*
|
|
217
build.gradle
Normal file
217
build.gradle
Normal file
|
@ -0,0 +1,217 @@
|
||||||
|
plugins {
|
||||||
|
id "com.jfrog.bintray" version "1.7.3"
|
||||||
|
}
|
||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'idea'
|
||||||
|
apply plugin: 'maven'
|
||||||
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
|
import org.apache.tools.ant.taskdefs.condition.Os
|
||||||
|
|
||||||
|
defaultTasks 'deploy'
|
||||||
|
|
||||||
|
def getVersion(isIncrement = false) {
|
||||||
|
def propsFile = 'version.properties'
|
||||||
|
def majorKey = 'version.major'
|
||||||
|
def minorKey = 'version.minor'
|
||||||
|
def patchKey = 'version.patch'
|
||||||
|
def metaKey = 'version.buildmeta'
|
||||||
|
def preKey = 'version.prerelease'
|
||||||
|
if (isIncrement) {
|
||||||
|
ant.propertyfile(file: propsFile) {
|
||||||
|
entry(key: patchKey,
|
||||||
|
type: 'int',
|
||||||
|
default: '-1',
|
||||||
|
operation: '+')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
def p = new Properties()
|
||||||
|
file(propsFile).withInputStream { stream -> p.load(stream) }
|
||||||
|
def metadata = p.getProperty(metaKey, '')
|
||||||
|
def prerelease = p.getProperty(preKey, '')
|
||||||
|
return (p.getProperty(majorKey, '1') + '.' + p.getProperty(minorKey, '0') + '.' + p.getProperty(patchKey, '0') +
|
||||||
|
(prerelease.length() > 0 ? '-' + prerelease : '') + (metadata.length() > 0 ? '+' + metadata : ''))
|
||||||
|
}
|
||||||
|
|
||||||
|
version = getVersion()
|
||||||
|
|
||||||
|
def deployDir = 'deploy'
|
||||||
|
def isRelease = 'release' in gradle.startParameter.taskNames
|
||||||
|
|
||||||
|
def mavenGroupId = 'net.thauvin.erik'
|
||||||
|
def mavenName = 'SemVer'
|
||||||
|
def mavenDescription = 'Semantic Version Annotation Processor'
|
||||||
|
def mavenUrl = 'https://github.com/ethauvin/semver'
|
||||||
|
def mavenLicense = 'The BSD 3-Clause License'
|
||||||
|
def mavenLicenseUrl = 'http://opensource.org/licenses/BSD-3-Clause'
|
||||||
|
def mavenScmCon = 'https://github.com/ethauvin/semver.git'
|
||||||
|
def mavenScmDevCon = 'git@github.com:ethauvin/semver.git'
|
||||||
|
|
||||||
|
def pkgLicenses = ['BSD 3-Clause']
|
||||||
|
def pkgIssueTrackerUrl = mavenUrl + '/issues'
|
||||||
|
def pkgLabels = ['java', 'annotation', 'processor', 'semantic', 'version']
|
||||||
|
|
||||||
|
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile 'com.github.spullara.mustache.java:compiler:0.9.4'
|
||||||
|
testCompile 'org.testng:testng:6.11'
|
||||||
|
}
|
||||||
|
|
||||||
|
bintray {
|
||||||
|
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
|
||||||
|
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
|
||||||
|
publications = ['MyPublication']
|
||||||
|
dryRun = true
|
||||||
|
pkg {
|
||||||
|
repo = 'maven'
|
||||||
|
name = mavenName
|
||||||
|
licenses = pkgLicenses
|
||||||
|
desc = mavenDescription
|
||||||
|
websiteUrl = mavenUrl
|
||||||
|
issueTrackerUrl = pkgIssueTrackerUrl
|
||||||
|
vcsUrl = mavenScmCon
|
||||||
|
labels = pkgLabels
|
||||||
|
publicDownloadNumbers = true
|
||||||
|
version {
|
||||||
|
name = project.version
|
||||||
|
desc = 'Version ' + project.version
|
||||||
|
vcsTag = project.version
|
||||||
|
gpg {
|
||||||
|
sign = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def pomConfig = {
|
||||||
|
licenses {
|
||||||
|
license {
|
||||||
|
name mavenLicense
|
||||||
|
url mavenLicenseUrl
|
||||||
|
distribution 'repo'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
developers {
|
||||||
|
developer {
|
||||||
|
id 'ethauvin'
|
||||||
|
name 'Erik C. Thauvin'
|
||||||
|
email 'erik@thauvin.net'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scm {
|
||||||
|
connection 'scm:git:' + mavenScmCon
|
||||||
|
developerConnection 'scm:git:' + mavenScmDevCon
|
||||||
|
url mavenScmCon
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
MyPublication(MavenPublication) {
|
||||||
|
from components.java
|
||||||
|
artifact sourcesJar
|
||||||
|
artifact javadocJar
|
||||||
|
groupId mavenGroupId
|
||||||
|
artifactId rootProject.name
|
||||||
|
version project.version
|
||||||
|
|
||||||
|
pom.withXml {
|
||||||
|
def root = asNode()
|
||||||
|
root.appendNode('name', mavenName)
|
||||||
|
root.appendNode('description', mavenDescription)
|
||||||
|
root.appendNode('url', mavenUrl)
|
||||||
|
root.children().last() + pomConfig
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||||
|
group = 'Build'
|
||||||
|
description = 'Builds an archive of the javadoc docs.'
|
||||||
|
classifier = 'javadoc'
|
||||||
|
from javadoc.destinationDir
|
||||||
|
}
|
||||||
|
|
||||||
|
task sourcesJar(type: Jar) {
|
||||||
|
group = 'Build'
|
||||||
|
description = 'Builds an archive of the source code.'
|
||||||
|
classifier = 'sources'
|
||||||
|
from sourceSets.main.allSource
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives javadocJar
|
||||||
|
archives sourcesJar
|
||||||
|
}
|
||||||
|
|
||||||
|
javadoc {
|
||||||
|
title = mavenDescription + ' ' + version
|
||||||
|
options.tags = ['created']
|
||||||
|
options.author = true
|
||||||
|
options.addStringOption('link', 'http://docs.oracle.com/javase/8/docs/api/')
|
||||||
|
//options.addStringOption('sourcepath', project.hasProperty('jdkSrc') ? jdkSrc : "$System.env.JAVA_HOME/src.zip")
|
||||||
|
if (JavaVersion.current().isJava8Compatible()) {
|
||||||
|
options.addStringOption('Xdoclint:none', '-quiet')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useTestNG()
|
||||||
|
}
|
||||||
|
|
||||||
|
compileJava {
|
||||||
|
doFirst {
|
||||||
|
project.version = getVersion(isRelease)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
clean {
|
||||||
|
delete deployDir
|
||||||
|
}
|
||||||
|
|
||||||
|
task copyToDeploy(type: Copy) {
|
||||||
|
from jar
|
||||||
|
into deployDir
|
||||||
|
}
|
||||||
|
|
||||||
|
task deploy(dependsOn: ['build', 'copyToDeploy']) {
|
||||||
|
description = 'Copies all needed files to the ${deployDir} directory.'
|
||||||
|
group = 'Publishing'
|
||||||
|
outputs.dir deployDir
|
||||||
|
inputs.files copyToDeploy
|
||||||
|
mustRunAfter clean
|
||||||
|
}
|
||||||
|
|
||||||
|
task wrapper(type: Wrapper) {
|
||||||
|
gradleVersion = gradle.gradleVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
task release(dependsOn: ['wrapper', 'clean', 'deploy']) {
|
||||||
|
doLast {
|
||||||
|
group = 'Publishing'
|
||||||
|
description = 'Releases new version.'
|
||||||
|
isRelease = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task pandoc(type: Exec) {
|
||||||
|
group = 'Documentation'
|
||||||
|
def pandoc_args = ['--from', 'markdown_github', '--to', 'html5', '-s', '-c', 'github-pandoc.css', '-o', 'README.html', 'README.md']
|
||||||
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||||
|
commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
|
||||||
|
} else {
|
||||||
|
executable 'pandoc'
|
||||||
|
args pandoc_args
|
||||||
|
}
|
||||||
|
standardOutput = new ByteArrayOutputStream()
|
||||||
|
ext.output = {
|
||||||
|
return standardOutput.toString()
|
||||||
|
}
|
||||||
|
}
|
37
clean.sh
Normal file
37
clean.sh
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
DEBUG=false
|
||||||
|
|
||||||
|
rm="rm -rf"
|
||||||
|
|
||||||
|
if [ "$DEBUG" = true ]; then
|
||||||
|
rm="echo rm -rf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
buildkt="kobalt/src/Build.kt"
|
||||||
|
|
||||||
|
name=$(cat $buildkt | grep -m 1 "name = " | cut -d"\"" -f 2)
|
||||||
|
group=$(cat $buildkt | grep -m 1 "group = " | cut -d"\"" -f 2)
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
version=$(cat $buildkt | grep -m 1 "version = " | cut -d"\"" -f 2)
|
||||||
|
else
|
||||||
|
version="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
maven="/k/maven/repository/${group//.//}/${name}/${version}"
|
||||||
|
kobalt="$HOME/.kobalt/cache/${group//.//}/${name}/${version}"
|
||||||
|
localRepo="$HOME/.kobalt/localMavenRepo/${group//.//}/${name}/${version}"
|
||||||
|
|
||||||
|
read -p "Delete version ${version}? " -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
for dir in "$kobalt" "$maven" "$localRepo"; do
|
||||||
|
if [ -d "$dir" ]; then
|
||||||
|
echo -e "Deleting : \e[32;1m$dir\e[0m"
|
||||||
|
$rm "$dir"
|
||||||
|
else
|
||||||
|
echo -e "Not Found: \e[31;1m$dir\e[0m"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
109
config/pmd.xml
109
config/pmd.xml
|
@ -1,109 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<ruleset name="erik"
|
|
||||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
|
||||||
<description>Erik's Ruleset</description>
|
|
||||||
<!-- BEST PRACTICES -->
|
|
||||||
<rule ref="category/java/bestpractices.xml">
|
|
||||||
<exclude name="AvoidPrintStackTrace"/>
|
|
||||||
<exclude name="GuardLogStatement"/>
|
|
||||||
<exclude name="UnitTestContainsTooManyAsserts"/>
|
|
||||||
<exclude name="UnitTestShouldUseTestAnnotation"/>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<rule ref="category/java/bestpractices.xml/MissingOverride">
|
|
||||||
<properties>
|
|
||||||
<property name="violationSuppressXPath"
|
|
||||||
value="//MethodDeclaration[@Name='hashCode' or @Name='equals' or @Name='toString']"/>
|
|
||||||
</properties>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- CODE STYLE -->
|
|
||||||
<rule ref="category/java/codestyle.xml">
|
|
||||||
<exclude name="AtLeastOneConstructor"/>
|
|
||||||
<exclude name="ClassNamingConventions"/>
|
|
||||||
<exclude name="CommentDefaultAccessModifier"/>
|
|
||||||
<exclude name="ConfusingTernary"/>
|
|
||||||
<exclude name="FieldNamingConventions"/>
|
|
||||||
<exclude name="LocalVariableCouldBeFinal"/>
|
|
||||||
<exclude name="LongVariable"/>
|
|
||||||
<exclude name="MethodArgumentCouldBeFinal"/>
|
|
||||||
<exclude name="OnlyOneReturn"/>
|
|
||||||
<exclude name="PackageCase"/>
|
|
||||||
<exclude name="ShortClassName"/>
|
|
||||||
<exclude name="ShortMethodName"/>
|
|
||||||
<exclude name="ShortVariable"/>
|
|
||||||
<exclude name="UseExplicitTypes"/>
|
|
||||||
<exclude name="UseUnderscoresInNumericLiterals"/>
|
|
||||||
<exclude name="UselessParentheses"/>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<rule ref="category/java/codestyle.xml/UnnecessaryImport">
|
|
||||||
<properties>
|
|
||||||
<property name="violationSuppressRegex" value="Unused (static|.*\.\*).*"/>
|
|
||||||
</properties>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- DESIGN -->
|
|
||||||
<rule ref="category/java/design.xml">
|
|
||||||
<exclude name="AvoidCatchingGenericException"/>
|
|
||||||
<exclude name="AvoidDeeplyNestedIfStmts"/>
|
|
||||||
<exclude name="AvoidUncheckedExceptionsInSignatures"/>
|
|
||||||
<exclude name="CognitiveComplexity"/>
|
|
||||||
<exclude name="CyclomaticComplexity"/>
|
|
||||||
<exclude name="ExcessiveParameterList"/>
|
|
||||||
<exclude name="ExcessivePublicCount"/>
|
|
||||||
<exclude name="GodClass"/>
|
|
||||||
<exclude name="LawOfDemeter"/>
|
|
||||||
<exclude name="LoosePackageCoupling"/>
|
|
||||||
<exclude name="NPathComplexity"/>
|
|
||||||
<exclude name="NcssCount"/>
|
|
||||||
<exclude name="TooManyFields"/>
|
|
||||||
<exclude name="TooManyMethods"/>
|
|
||||||
<exclude name="UseObjectForClearerAPI"/>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- DOCUMENTATION -->
|
|
||||||
<rule ref="category/java/documentation.xml">
|
|
||||||
<exclude name="CommentRequired"/>
|
|
||||||
<exclude name="CommentSize"/>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- ERROR PRONE -->
|
|
||||||
<rule ref="category/java/errorprone.xml">
|
|
||||||
<exclude name="AssignmentInOperand"/>
|
|
||||||
<exclude name="AvoidCatchingNPE"/>
|
|
||||||
<exclude name="AvoidDuplicateLiterals"/>
|
|
||||||
<exclude name="AvoidFieldNameMatchingMethodName"/>
|
|
||||||
<exclude name="AvoidFieldNameMatchingTypeName"/>
|
|
||||||
<exclude name="AvoidLiteralsInIfCondition"/>
|
|
||||||
<exclude name="NullAssignment"/>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<rule ref="category/java/errorprone.xml/AssignmentInOperand">
|
|
||||||
<properties>
|
|
||||||
<property name="allowWhile" value="true"/>
|
|
||||||
<property name="allowFor" value="true"/>
|
|
||||||
<property name="allowIf" value="true"/>
|
|
||||||
</properties>
|
|
||||||
</rule>
|
|
||||||
<rule ref="category/java/errorprone.xml/AvoidDuplicateLiterals">
|
|
||||||
<properties>
|
|
||||||
<property name="skipAnnotations" value="true"/>
|
|
||||||
</properties>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- MULTITHREADING -->
|
|
||||||
<rule ref="category/java/multithreading.xml">
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- PERFORMANCE -->
|
|
||||||
<rule ref="category/java/performance.xml">
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<!-- SECURITY -->
|
|
||||||
<rule ref="category/java/security.xml">
|
|
||||||
</rule>
|
|
||||||
</ruleset>
|
|
660
docs/README.html
660
docs/README.html
|
@ -1,660 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="generator" content="pandoc" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
|
|
||||||
<title>Semantic Version Annotation Processor</title>
|
|
||||||
<style>
|
|
||||||
code{white-space: pre-wrap;}
|
|
||||||
span.smallcaps{font-variant: small-caps;}
|
|
||||||
div.columns{display: flex; gap: min(4vw, 1.5em);}
|
|
||||||
div.column{flex: auto; overflow-x: auto;}
|
|
||||||
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
|
||||||
/* The extra [class] is a hack that increases specificity enough to
|
|
||||||
override a similar rule in reveal.js */
|
|
||||||
ul.task-list[class]{list-style: none;}
|
|
||||||
ul.task-list li input[type="checkbox"] {
|
|
||||||
font-size: inherit;
|
|
||||||
width: 0.8em;
|
|
||||||
margin: 0 0.8em 0.2em -1.6em;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
|
|
||||||
/* CSS for syntax highlighting */
|
|
||||||
pre > code.sourceCode { white-space: pre; position: relative; }
|
|
||||||
pre > code.sourceCode > span { line-height: 1.25; }
|
|
||||||
pre > code.sourceCode > span:empty { height: 1.2em; }
|
|
||||||
.sourceCode { overflow: visible; }
|
|
||||||
code.sourceCode > span { color: inherit; text-decoration: inherit; }
|
|
||||||
div.sourceCode { margin: 1em 0; }
|
|
||||||
pre.sourceCode { margin: 0; }
|
|
||||||
@media screen {
|
|
||||||
div.sourceCode { overflow: auto; }
|
|
||||||
}
|
|
||||||
@media print {
|
|
||||||
pre > code.sourceCode { white-space: pre-wrap; }
|
|
||||||
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
|
|
||||||
}
|
|
||||||
pre.numberSource code
|
|
||||||
{ counter-reset: source-line 0; }
|
|
||||||
pre.numberSource code > span
|
|
||||||
{ position: relative; left: -4em; counter-increment: source-line; }
|
|
||||||
pre.numberSource code > span > a:first-child::before
|
|
||||||
{ content: counter(source-line);
|
|
||||||
position: relative; left: -1em; text-align: right; vertical-align: baseline;
|
|
||||||
border: none; display: inline-block;
|
|
||||||
-webkit-touch-callout: none; -webkit-user-select: none;
|
|
||||||
-khtml-user-select: none; -moz-user-select: none;
|
|
||||||
-ms-user-select: none; user-select: none;
|
|
||||||
padding: 0 4px; width: 4em;
|
|
||||||
color: #aaaaaa;
|
|
||||||
}
|
|
||||||
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
|
|
||||||
div.sourceCode
|
|
||||||
{ }
|
|
||||||
@media screen {
|
|
||||||
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
|
|
||||||
}
|
|
||||||
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
|
|
||||||
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
|
|
||||||
code span.at { color: #7d9029; } /* Attribute */
|
|
||||||
code span.bn { color: #40a070; } /* BaseN */
|
|
||||||
code span.bu { color: #008000; } /* BuiltIn */
|
|
||||||
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
|
|
||||||
code span.ch { color: #4070a0; } /* Char */
|
|
||||||
code span.cn { color: #880000; } /* Constant */
|
|
||||||
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
|
|
||||||
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
|
|
||||||
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
|
|
||||||
code span.dt { color: #902000; } /* DataType */
|
|
||||||
code span.dv { color: #40a070; } /* DecVal */
|
|
||||||
code span.er { color: #ff0000; font-weight: bold; } /* Error */
|
|
||||||
code span.ex { } /* Extension */
|
|
||||||
code span.fl { color: #40a070; } /* Float */
|
|
||||||
code span.fu { color: #06287e; } /* Function */
|
|
||||||
code span.im { color: #008000; font-weight: bold; } /* Import */
|
|
||||||
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
|
|
||||||
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
|
|
||||||
code span.op { color: #666666; } /* Operator */
|
|
||||||
code span.ot { color: #007020; } /* Other */
|
|
||||||
code span.pp { color: #bc7a00; } /* Preprocessor */
|
|
||||||
code span.sc { color: #4070a0; } /* SpecialChar */
|
|
||||||
code span.ss { color: #bb6688; } /* SpecialString */
|
|
||||||
code span.st { color: #4070a0; } /* String */
|
|
||||||
code span.va { color: #19177c; } /* Variable */
|
|
||||||
code span.vs { color: #4070a0; } /* VerbatimString */
|
|
||||||
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
|
|
||||||
</style>
|
|
||||||
<link rel="stylesheet" href="docs/github-pandoc.css" />
|
|
||||||
<!--[if lt IE 9]>
|
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
|
||||||
<![endif]-->
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1 id="semantic-version-annotation-processor">Semantic Version
|
|
||||||
Annotation Processor</h1>
|
|
||||||
<p><a href="https://opensource.org/licenses/BSD-3-Clause"><img
|
|
||||||
src="https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square"
|
|
||||||
alt="License (3-Clause BSD)" /></a> <a
|
|
||||||
href="https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html"><img
|
|
||||||
src="https://img.shields.io/badge/java-17%2B-blue" alt="Java" /></a> <a
|
|
||||||
href="https://rife2.com/bld"><img
|
|
||||||
src="https://img.shields.io/badge/1.9.0-FA9052?label=bld&labelColor=2392FF"
|
|
||||||
alt="bld" /></a> <a
|
|
||||||
href="https://github.com/ethauvin/semver/releases/latest"><img
|
|
||||||
src="https://img.shields.io/github/release/ethauvin/semver.svg"
|
|
||||||
alt="release" /></a> <a
|
|
||||||
href="https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/semver/"><img
|
|
||||||
src="https://img.shields.io/nexus/s/net.thauvin.erik/semver?label=snapshot&server=https%3A%2F%2Foss.sonatype.org%2F"
|
|
||||||
alt="Nexus Snapshot" /></a> <a
|
|
||||||
href="https://central.sonatype.com/artifact/net.thauvin.erik/semver"><img
|
|
||||||
src="https://img.shields.io/maven-central/v/net.thauvin.erik/semver.svg"
|
|
||||||
alt="Maven Central" /></a></p>
|
|
||||||
<p><a href="https://sonarcloud.io/dashboard?id=ethauvin_semver"><img
|
|
||||||
src="https://sonarcloud.io/api/project_badges/measure?project=ethauvin_semver&metric=alert_status"
|
|
||||||
alt="Quality Gate Status" /></a> <a
|
|
||||||
href="https://github.com/ethauvin/semver/actions/workflows/gradle.yml"><img
|
|
||||||
src="https://github.com/ethauvin/semver/actions/workflows/gradle.yml/badge.svg"
|
|
||||||
alt="GitHub CI" /></a> <a
|
|
||||||
href="https://ci.appveyor.com/project/ethauvin/semver"><img
|
|
||||||
src="https://ci.appveyor.com/api/projects/status/nbv4mxd1gpxtx69o?svg=true"
|
|
||||||
alt="Build status" /></a> <a
|
|
||||||
href="https://circleci.com/gh/ethauvin/semver/tree/master"><img
|
|
||||||
src="https://circleci.com/gh/ethauvin/semver/tree/master.svg?style=shield"
|
|
||||||
alt="CircleCI" /></a></p>
|
|
||||||
<p>An <a
|
|
||||||
href="https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/Processor.html">annotation
|
|
||||||
processor</a> that automatically generates a
|
|
||||||
<code>GeneratedVersion</code> class based on a <a
|
|
||||||
href="https://mustache.github.io/">Mustache</a> template and containing
|
|
||||||
the <a href="https://semver.org/">semantic version</a> (major, minor,
|
|
||||||
patch, etc.) that is read from a <a
|
|
||||||
href="https://docs.oracle.com/javase/tutorial/essential/environment/properties.html">Properties</a>
|
|
||||||
file or defined in the <a
|
|
||||||
href="https://docs.oracle.com/javase/tutorial/java/annotations/basics.html">annotation</a>.</p>
|
|
||||||
<p>This processor was inspired by Cédric Beust's <a
|
|
||||||
href="https://github.com/cbeust/version-processor">version-processor</a>
|
|
||||||
and works well in conjunction with the <a
|
|
||||||
href="https://github.com/ethauvin/semver-gradle"><strong>Semantic
|
|
||||||
Version Plugin for Gradle</strong></a>.</p>
|
|
||||||
<h2 id="table-of-contents">Table of Contents</h2>
|
|
||||||
<ul>
|
|
||||||
<li><a href="#examples">Examples</a></li>
|
|
||||||
<li><a href="#template">Template</a>
|
|
||||||
<ul>
|
|
||||||
<li><a href="#default-template">Default Template</a></li>
|
|
||||||
<li><a href="#custom-template">Custom Template</a></li>
|
|
||||||
</ul></li>
|
|
||||||
<li><a href="#elements--properties">Elements & Properties</a></li>
|
|
||||||
<li><a href="#maven">Maven</a></li>
|
|
||||||
<li><a href="#bld">bld</a></li>
|
|
||||||
<li><a href="#gradle">Gradle</a>
|
|
||||||
<ul>
|
|
||||||
<li><a href="#class-generation">Class Generation</a></li>
|
|
||||||
<li><a href="#class--source-generation">Class & Source
|
|
||||||
Generation</a></li>
|
|
||||||
</ul></li>
|
|
||||||
<li><a href="#kotlin">Kotlin</a>
|
|
||||||
<ul>
|
|
||||||
<li><a href="#kotlin--gradle">Kotlin & Gradle</a></li>
|
|
||||||
</ul></li>
|
|
||||||
<li><a href="#auto-increment">Auto-Increment</a></li>
|
|
||||||
<li><a href="#contributing">Contributing</a></li>
|
|
||||||
</ul>
|
|
||||||
<h2 id="examples">Examples</h2>
|
|
||||||
<ul>
|
|
||||||
<li>Using annotation elements:</li>
|
|
||||||
</ul>
|
|
||||||
<div class="sourceCode" id="cb1"><pre
|
|
||||||
class="sourceCode java"><code class="sourceCode java"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> <span class="im">net</span><span class="op">.</span><span class="im">thauvin</span><span class="op">.</span><span class="im">erik</span><span class="op">.</span><span class="im">semver</span><span class="op">.</span><span class="im">Version</span><span class="op">;</span></span>
|
|
||||||
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a></span>
|
|
||||||
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="at">@Version</span><span class="op">(</span>major <span class="op">=</span> <span class="dv">2</span><span class="op">,</span> minor <span class="op">=</span> <span class="dv">1</span><span class="op">,</span> patch <span class="op">=</span> <span class="dv">1</span><span class="op">,</span> preRelease <span class="op">=</span> <span class="st">"beta"</span><span class="op">)</span></span>
|
|
||||||
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="kw">public</span> <span class="kw">class</span> A <span class="op">{</span></span>
|
|
||||||
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a> <span class="co">// ...</span></span>
|
|
||||||
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
|
||||||
<ul>
|
|
||||||
<li>Or using a <a
|
|
||||||
href="hhttps://github.com/ethauvin/semver/blob/master/examples/java/version.properties">properties</a>
|
|
||||||
file:</li>
|
|
||||||
</ul>
|
|
||||||
<div class="sourceCode" id="cb2"><pre
|
|
||||||
class="sourceCode java"><code class="sourceCode java"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> <span class="im">net</span><span class="op">.</span><span class="im">thauvin</span><span class="op">.</span><span class="im">erik</span><span class="op">.</span><span class="im">semver</span><span class="op">.</span><span class="im">Version</span><span class="op">;</span></span>
|
|
||||||
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a></span>
|
|
||||||
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="at">@Version</span><span class="op">(</span>properties <span class="op">=</span> <span class="st">"version.properties"</span><span class="op">)</span></span>
|
|
||||||
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a><span class="kw">public</span> <span class="kw">class</span> A <span class="op">{</span></span>
|
|
||||||
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a> <span class="co">// ...</span></span>
|
|
||||||
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
|
||||||
<div class="sourceCode" id="cb3"><pre
|
|
||||||
class="sourceCode ini"><code class="sourceCode ini"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="co"># version.properties</span></span>
|
|
||||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="dt">version.major</span><span class="ot">=</span><span class="dv">1</span></span>
|
|
||||||
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="dt">version.minor</span><span class="ot">=</span><span class="dv">0</span></span>
|
|
||||||
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a><span class="dt">version.patch</span><span class="ot">=</span><span class="dv">0</span></span>
|
|
||||||
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a><span class="dt">version.prerelease</span><span class="ot">=</span><span class="st">beta</span></span></code></pre></div>
|
|
||||||
<p><a
|
|
||||||
href="https://github.com/ethauvin/semver/tree/master/examples">View
|
|
||||||
Examples</a></p>
|
|
||||||
<h2 id="template">Template</h2>
|
|
||||||
<p>Upon running the annotation processor, a source file <a
|
|
||||||
href="https://github.com/ethauvin/semver/blob/master/examples/java/src/generated/java/com/example/GeneratedVersion.java">GeneratedVersion.java</a>
|
|
||||||
is automatically generated with static methods to access the semantic
|
|
||||||
version data. The source is based on a fully customizable Mustache <a
|
|
||||||
href="https://github.com/ethauvin/semver/blob/master/src/main/resources/semver.mustache">template</a>.</p>
|
|
||||||
<p>To use your own template, simply create a
|
|
||||||
<code>version.mustache</code> file in the project's root directory. The
|
|
||||||
processor will automatically look for it.</p>
|
|
||||||
<p>To specify your own template name, use:</p>
|
|
||||||
<div class="sourceCode" id="cb4"><pre
|
|
||||||
class="sourceCode java"><code class="sourceCode java"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="at">@Version</span><span class="op">(</span>template <span class="op">=</span> <span class="st">"version.mustache"</span><span class="op">)</span></span>
|
|
||||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="kw">public</span> <span class="kw">class</span> A <span class="op">{</span></span>
|
|
||||||
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="co">// ...</span></span>
|
|
||||||
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
|
||||||
<h3 id="default-template">Default Template</h3>
|
|
||||||
<p>The <a
|
|
||||||
href="https://github.com/ethauvin/semver/blob/master/src/main/resources/semver.mustache">default
|
|
||||||
template</a> implements the following static variables:</p>
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr class="header">
|
|
||||||
<th style="text-align: left;">Field</th>
|
|
||||||
<th style="text-align: left;">Description</th>
|
|
||||||
<th style="text-align: left;">Example</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>PROJECT</code></td>
|
|
||||||
<td style="text-align: left;">The project name, if any.</td>
|
|
||||||
<td style="text-align: left;"><code>MyProject</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>BUILDDATE</code></td>
|
|
||||||
<td style="text-align: left;">The build date.</td>
|
|
||||||
<td style="text-align: left;"><a
|
|
||||||
href="https://docs.oracle.com/javase/8/docs/api/java/util/Date.html"><code>java.util.Date</code></a></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>VERSION</code></td>
|
|
||||||
<td style="text-align: left;">The full version string.</td>
|
|
||||||
<td style="text-align: left;"><code>1.2.3-alpha+001</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>MAJOR</code></td>
|
|
||||||
<td style="text-align: left;">The major version.</td>
|
|
||||||
<td style="text-align: left;"><code>1</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>MINOR</code></td>
|
|
||||||
<td style="text-align: left;">The minor version.</td>
|
|
||||||
<td style="text-align: left;"><code>2</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>PATCH</code></td>
|
|
||||||
<td style="text-align: left;">The patch version.</td>
|
|
||||||
<td style="text-align: left;"><code>3</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>PRERELEASE</code></td>
|
|
||||||
<td style="text-align: left;">The pre-release version, if any.</td>
|
|
||||||
<td style="text-align: left;"><code>alpha</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>PRERELASE_PREFIX</code></td>
|
|
||||||
<td style="text-align: left;">The pre-release prefix</td>
|
|
||||||
<td style="text-align: left;"><code>-</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>BUILDMETA</code></td>
|
|
||||||
<td style="text-align: left;">The build metadata, if any.</td>
|
|
||||||
<td style="text-align: left;"><code>001</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>BUILDMETA_PREFIX</code></td>
|
|
||||||
<td style="text-align: left;">The metadata prefix.</td>
|
|
||||||
<td style="text-align: left;"><code>+</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>SEPARATOR</code></td>
|
|
||||||
<td style="text-align: left;">The version separator.</td>
|
|
||||||
<td style="text-align: left;"><code>.</code></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<h3 id="custom-template">Custom Template</h3>
|
|
||||||
<p>A very simple custom template might look something like:</p>
|
|
||||||
<div class="sourceCode" id="cb5"><pre
|
|
||||||
class="sourceCode java"><code class="sourceCode java"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="co">/* version.mustache */</span></span>
|
|
||||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="kw">package</span><span class="im"> {{packageName}}</span><span class="op">;</span></span>
|
|
||||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a></span>
|
|
||||||
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> <span class="im">java</span><span class="op">.</span><span class="im">util</span><span class="op">.</span><span class="im">Date</span><span class="op">;</span></span>
|
|
||||||
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a></span>
|
|
||||||
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a><span class="kw">public</span> <span class="dt">final</span> <span class="kw">class</span> <span class="op">{{</span>className<span class="op">}}</span> <span class="op">{</span></span>
|
|
||||||
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a> <span class="kw">public</span> <span class="dt">final</span> <span class="dt">static</span> <span class="bu">String</span> PROJECT <span class="op">=</span> <span class="st">"{{project}}"</span><span class="op">;</span></span>
|
|
||||||
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a> <span class="kw">public</span> <span class="dt">final</span> <span class="dt">static</span> <span class="bu">Date</span> DATE <span class="op">=</span> <span class="kw">new</span> <span class="bu">Date</span><span class="op">({{</span>epoch<span class="op">}}</span>L<span class="op">);</span></span>
|
|
||||||
<span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a> <span class="kw">public</span> <span class="dt">final</span> <span class="dt">static</span> <span class="bu">String</span> VERSION <span class="op">=</span> <span class="st">"{{semver}}"</span><span class="op">;</span></span>
|
|
||||||
<span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
|
||||||
<p>The mustache variables automatically filled in by the processor
|
|
||||||
are:</p>
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr class="header">
|
|
||||||
<th style="text-align: left;">Variable</th>
|
|
||||||
<th style="text-align: left;">Description</th>
|
|
||||||
<th style="text-align: left;">Type</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>{{packageName}}</code></td>
|
|
||||||
<td style="text-align: left;">The package name.</td>
|
|
||||||
<td style="text-align: left;"><code>String</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>{{className}}</code></td>
|
|
||||||
<td style="text-align: left;">The class name.</td>
|
|
||||||
<td style="text-align: left;"><code>String</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>{{project}}</code></td>
|
|
||||||
<td style="text-align: left;">The project name.</td>
|
|
||||||
<td style="text-align: left;"><code>String</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>{{epoch}}</code></td>
|
|
||||||
<td style="text-align: left;">The build epoch/unix time.</td>
|
|
||||||
<td style="text-align: left;"><code>long</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>{{major}}</code></td>
|
|
||||||
<td style="text-align: left;">The major version.</td>
|
|
||||||
<td style="text-align: left;"><code>int</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>{{minor}}</code></td>
|
|
||||||
<td style="text-align: left;">The minor version.</td>
|
|
||||||
<td style="text-align: left;"><code>int</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>{{patch}}</code></td>
|
|
||||||
<td style="text-align: left;">The patch version.</td>
|
|
||||||
<td style="text-align: left;"><code>int</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>{{preRelease}}</code></td>
|
|
||||||
<td style="text-align: left;">The pre-release version.</td>
|
|
||||||
<td style="text-align: left;"><code>String</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>{{preReleasePrefix}}</code></td>
|
|
||||||
<td style="text-align: left;">The pre-release prefix.</td>
|
|
||||||
<td style="text-align: left;"><code>String</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>{{buildMeta}}</code></td>
|
|
||||||
<td style="text-align: left;">The build metadata version.</td>
|
|
||||||
<td style="text-align: left;"><code>String</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>{{buildMetaPrefix}}</code></td>
|
|
||||||
<td style="text-align: left;">The metadata prefix.</td>
|
|
||||||
<td style="text-align: left;"><code>String</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>{{separator}}</code></td>
|
|
||||||
<td style="text-align: left;">The version separator.</td>
|
|
||||||
<td style="text-align: left;"><code>String</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>{{semver}}</code> or
|
|
||||||
<code>{{version}}</code></td>
|
|
||||||
<td style="text-align: left;">The full semantic version.</td>
|
|
||||||
<td style="text-align: left;"><code>String</code></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<h2 id="elements--properties">Elements & Properties</h2>
|
|
||||||
<p>The following annotation elements and properties are available:</p>
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr class="header">
|
|
||||||
<th style="text-align: left;">Element</th>
|
|
||||||
<th style="text-align: left;">Property</th>
|
|
||||||
<th style="text-align: left;">Description</th>
|
|
||||||
<th style="text-align: left;">Default</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>project</code></td>
|
|
||||||
<td style="text-align: left;"><code>version.project</code></td>
|
|
||||||
<td style="text-align: left;">The project name.</td>
|
|
||||||
<td style="text-align: left;"></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>major</code></td>
|
|
||||||
<td style="text-align: left;"><code>version.major</code></td>
|
|
||||||
<td style="text-align: left;">The major version number.</td>
|
|
||||||
<td style="text-align: left;"><code>1</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>minor</code></td>
|
|
||||||
<td style="text-align: left;"><code>version.major</code></td>
|
|
||||||
<td style="text-align: left;">The minor version number.</td>
|
|
||||||
<td style="text-align: left;"><code>0</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>patch</code></td>
|
|
||||||
<td style="text-align: left;"><code>version.patch</code></td>
|
|
||||||
<td style="text-align: left;">The patch version number.</td>
|
|
||||||
<td style="text-align: left;"><code>0</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>preRelease</code></td>
|
|
||||||
<td style="text-align: left;"><code>version.prerelease</code></td>
|
|
||||||
<td style="text-align: left;">The pre-release version.</td>
|
|
||||||
<td style="text-align: left;"></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>preReleasePrefix</code></td>
|
|
||||||
<td
|
|
||||||
style="text-align: left;"><code>version.prerelease.prefix</code></td>
|
|
||||||
<td style="text-align: left;">The pre-release prefix.</td>
|
|
||||||
<td style="text-align: left;"><code>-</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>buildMeta</code></td>
|
|
||||||
<td style="text-align: left;"><code>version.buildmeta</code></td>
|
|
||||||
<td style="text-align: left;">The build metadata version.</td>
|
|
||||||
<td style="text-align: left;"></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>buildMetaPrefix</code></td>
|
|
||||||
<td style="text-align: left;"><code>version.buildmeta.prefix</code></td>
|
|
||||||
<td style="text-align: left;">The metadata prefix.</td>
|
|
||||||
<td style="text-align: left;"><code>+</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>separator</code></td>
|
|
||||||
<td style="text-align: left;"><code>version.separator</code></td>
|
|
||||||
<td style="text-align: left;">The version separator.</td>
|
|
||||||
<td style="text-align: left;"><code>.</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>packageName</code></td>
|
|
||||||
<td style="text-align: left;"></td>
|
|
||||||
<td style="text-align: left;">The package name.</td>
|
|
||||||
<td style="text-align: left;"><em>Same as annotated class</em></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>className</code></td>
|
|
||||||
<td style="text-align: left;"></td>
|
|
||||||
<td style="text-align: left;">The name of the generated class.</td>
|
|
||||||
<td style="text-align: left;"><code>GeneratedVersion</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>properties</code></td>
|
|
||||||
<td style="text-align: left;"></td>
|
|
||||||
<td style="text-align: left;">The properties file.</td>
|
|
||||||
<td style="text-align: left;"></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>template</code></td>
|
|
||||||
<td style="text-align: left;"></td>
|
|
||||||
<td style="text-align: left;">The template file.</td>
|
|
||||||
<td style="text-align: left;"><code>version.mustache</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>type</code></td>
|
|
||||||
<td style="text-align: left;"></td>
|
|
||||||
<td style="text-align: left;">Either <code>java</code> or
|
|
||||||
<code>kt</code> for Kotlin.</td>
|
|
||||||
<td style="text-align: left;"><code>java</code></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>keysPrefix</code></td>
|
|
||||||
<td style="text-align: left;"></td>
|
|
||||||
<td style="text-align: left;">The prefix for all property keys.</td>
|
|
||||||
<td style="text-align: left;"><code>version.</code></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<p>In order to easily incorporate with existing projects, the property
|
|
||||||
keys may be assigned custom values:</p>
|
|
||||||
<div class="sourceCode" id="cb6"><pre
|
|
||||||
class="sourceCode java"><code class="sourceCode java"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="at">@Version</span><span class="op">(</span></span>
|
|
||||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> properties <span class="op">=</span> <span class="st">"example.properties"</span><span class="op">,</span></span>
|
|
||||||
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> keysPrefix <span class="op">=</span> <span class="st">"example."</span><span class="op">,</span></span>
|
|
||||||
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> majorKey <span class="op">=</span> <span class="st">"maj"</span><span class="op">,</span></span>
|
|
||||||
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a> minorKey <span class="op">=</span> <span class="st">"min"</span><span class="op">,</span></span>
|
|
||||||
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a> patchKey <span class="op">=</span> <span class="st">"build"</span><span class="op">,</span></span>
|
|
||||||
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a> preReleaseKey <span class="op">=</span> <span class="st">"rel"</span><span class="op">,</span></span>
|
|
||||||
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a> buildMetaKey <span class="op">=</span> <span class="st">"meta"</span><span class="op">,</span></span>
|
|
||||||
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a> projectKey <span class="op">=</span> <span class="st">"project"</span></span>
|
|
||||||
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a><span class="op">)</span></span>
|
|
||||||
<span id="cb6-11"><a href="#cb6-11" aria-hidden="true" tabindex="-1"></a><span class="kw">public</span> <span class="kw">class</span> Example <span class="op">{</span></span>
|
|
||||||
<span id="cb6-12"><a href="#cb6-12" aria-hidden="true" tabindex="-1"></a> <span class="co">// ...</span></span>
|
|
||||||
<span id="cb6-13"><a href="#cb6-13" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
|
||||||
<div class="sourceCode" id="cb7"><pre
|
|
||||||
class="sourceCode ini"><code class="sourceCode ini"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="co"># example.properties</span></span>
|
|
||||||
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="dt">example.project</span><span class="ot">=</span><span class="st">Example</span></span>
|
|
||||||
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="dt">example.maj</span><span class="ot">=</span><span class="dv">1</span></span>
|
|
||||||
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a><span class="dt">example.min</span><span class="ot">=</span><span class="dv">0</span></span>
|
|
||||||
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a><span class="dt">example.build</span><span class="ot">=</span><span class="dv">0</span></span>
|
|
||||||
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a><span class="dt">example.rel</span><span class="ot">=</span><span class="st">beta</span></span>
|
|
||||||
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a><span class="dt">example.meta</span><span class="ot">=</span></span>
|
|
||||||
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a><span class="co"># ...</span></span></code></pre></div>
|
|
||||||
<blockquote>
|
|
||||||
<p><span class="emoji" data-emoji="warning">⚠️</span>
|
|
||||||
<code>keysPrefix</code> is a new element staring in <code>1.1.0</code>
|
|
||||||
and may break older versions when using custom property keys.<br />
|
|
||||||
<span class="emoji" data-emoji="zap">⚡</span> A quick fix is to include
|
|
||||||
<code>keysPrefix=""</code> in the annotation to remove the default
|
|
||||||
<code>version.</code> prefix.</p>
|
|
||||||
</blockquote>
|
|
||||||
<h2 id="maven">Maven</h2>
|
|
||||||
<p>To install and run from <a
|
|
||||||
href="https://maven.apache.org/">Maven</a>, configure an artifact as
|
|
||||||
follows:</p>
|
|
||||||
<div class="sourceCode" id="cb8"><pre
|
|
||||||
class="sourceCode xml"><code class="sourceCode xml"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><<span class="kw">dependency</span>></span>
|
|
||||||
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a> <<span class="kw">groupId</span>>net.thauvin.erik</<span class="kw">groupId</span>></span>
|
|
||||||
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a> <<span class="kw">artifactId</span>>semver</<span class="kw">artifactId</span>></span>
|
|
||||||
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a> <<span class="kw">version</span>>1.2.1</<span class="kw">version</span>></span>
|
|
||||||
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a></<span class="kw">dependency</span>></span></code></pre></div>
|
|
||||||
<p>Please look at <a
|
|
||||||
href="https://github.com/ethauvin/semver/blob/master/examples/java/pom.xml">pom.xml</a>
|
|
||||||
in the <a
|
|
||||||
href="https://github.com/ethauvin/semver/tree/master/examples/java">examples/java</a>
|
|
||||||
directory for a sample:</p>
|
|
||||||
<div class="sourceCode" id="cb9"><pre
|
|
||||||
class="sourceCode bash"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">mvn</span> verify</span></code></pre></div>
|
|
||||||
<h2 id="bld">bld</h2>
|
|
||||||
<p>To install and run from <a href="https://rife2.com/bld">bld</a>, just
|
|
||||||
add the dependency to your build file:</p>
|
|
||||||
<div class="sourceCode" id="cb10"><pre
|
|
||||||
class="sourceCode java"><code class="sourceCode java"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="kw">public</span> <span class="kw">class</span> ExampleBuild <span class="kw">extends</span> Project <span class="op">{</span></span>
|
|
||||||
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a> <span class="kw">public</span> <span class="fu">ExampleBuild</span><span class="op">()</span> <span class="op">{</span></span>
|
|
||||||
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a> <span class="co">// ...</span></span>
|
|
||||||
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">scope</span><span class="op">(</span>compile<span class="op">)</span></span>
|
|
||||||
<span id="cb10-5"><a href="#cb10-5" aria-hidden="true" tabindex="-1"></a> <span class="op">.</span><span class="fu">include</span><span class="op">(</span><span class="fu">dependency</span><span class="op">(</span><span class="st">"net.thauvin.erik"</span><span class="op">,</span> <span class="st">"semver"</span><span class="op">,</span> <span class="fu">version</span><span class="op">(</span><span class="dv">1</span><span class="op">,</span> <span class="dv">2</span><span class="op">,</span> <span class="dv">1</span><span class="op">)));</span></span>
|
|
||||||
<span id="cb10-6"><a href="#cb10-6" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
|
|
||||||
<span id="cb10-7"><a href="#cb10-7" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
|
||||||
<p>Please look at <a
|
|
||||||
href="https://github.com/ethauvin/semver/blob/master/examples/java/bld/src/bld/java/com/example/ExampleBuild.java">ExampleBuild</a>
|
|
||||||
in the <a
|
|
||||||
href="https://github.com/ethauvin/semver/tree/master/examples/java/bld">examples/java/bld</a>
|
|
||||||
directory for a sample. It also shows how to incorporate the generated
|
|
||||||
code into the <code>source tree</code>, more information is also
|
|
||||||
available <a href="https://forum.uwyn.com/post/36">here</a>.</p>
|
|
||||||
<p>bld also has a <a
|
|
||||||
href="https://github.com/rife2/bld-generated-version">Generated
|
|
||||||
Version</a> extension which provides similar functionalities.</p>
|
|
||||||
<h2 id="gradle">Gradle</h2>
|
|
||||||
<h3 id="class-generation">Class Generation</h3>
|
|
||||||
<p>To install and run from <a href="https://gradle.org/">Gradle</a>, add
|
|
||||||
the following to <a
|
|
||||||
href="https://github.com/ethauvin/semver/blob/master/examples/java/gradle/build.gradle">build.gradle</a>:</p>
|
|
||||||
<div class="sourceCode" id="cb11"><pre
|
|
||||||
class="sourceCode gradle"><code class="sourceCode groovy"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>repositories <span class="op">{</span></span>
|
|
||||||
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">mavenCentral</span><span class="op">()</span></span>
|
|
||||||
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
|
|
||||||
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a></span>
|
|
||||||
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a>dependencies <span class="op">{</span></span>
|
|
||||||
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a> annotationProcessor <span class="st">'net.thauvin.erik:semver:1.2.1'</span></span>
|
|
||||||
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a> compileOnly <span class="st">'net.thauvin.erik:semver:1.2.1'</span></span>
|
|
||||||
<span id="cb11-8"><a href="#cb11-8" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
|
|
||||||
<span id="cb11-9"><a href="#cb11-9" aria-hidden="true" tabindex="-1"></a></span>
|
|
||||||
<span id="cb11-10"><a href="#cb11-10" aria-hidden="true" tabindex="-1"></a>tasks<span class="op">.</span><span class="fu">withType</span><span class="op">(</span>JavaCompile<span class="op">).</span><span class="fu">configureEach</span> <span class="op">{</span></span>
|
|
||||||
<span id="cb11-11"><a href="#cb11-11" aria-hidden="true" tabindex="-1"></a> options<span class="op">.</span>compilerArgs <span class="op">+=</span> <span class="op">[</span> <span class="st">"-Asemver.project.dir=</span><span class="ss">$projectDir</span><span class="st">"</span> <span class="op">]</span></span>
|
|
||||||
<span id="cb11-12"><a href="#cb11-12" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
|
||||||
<p>The directory containing the configuration files
|
|
||||||
(<code>version.properties</code>, <code>version.mustache</code>) must be
|
|
||||||
specified using the <code>semver.project.dir</code> processor
|
|
||||||
argument.</p>
|
|
||||||
<p>The <a
|
|
||||||
href="https://github.com/ethauvin/semver/blob/master/examples/java/src/generated/java/com/example/GeneratedVersion.java"><code>GeneratedVersion.java</code></a>
|
|
||||||
class will be automatically created in the <code>build/generated</code>
|
|
||||||
directory upon compiling.</p>
|
|
||||||
<p>Please look at <a
|
|
||||||
href="https://github.com/ethauvin/semver/blob/master/examples/java/gradle/build.gradle">build.gradle</a>
|
|
||||||
in the <a
|
|
||||||
href="https://github.com/ethauvin/semver/tree/master/examples/java/gradle">examples/java/gradle</a>
|
|
||||||
directory for a sample.</p>
|
|
||||||
<h3 id="class--source-generation">Class & Source Generation</h3>
|
|
||||||
<p>In order to also incorporate the generated source code into the
|
|
||||||
<code>source tree</code>, add the following to <a
|
|
||||||
href="https://github.com/ethauvin/semver/blob/master/examples/java/build.gradle">build.gradle</a>:</p>
|
|
||||||
<div class="sourceCode" id="cb12"><pre
|
|
||||||
class="sourceCode gradle"><code class="sourceCode groovy"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a>tasks<span class="op">.</span><span class="fu">withType</span><span class="op">(</span>JavaCompile<span class="op">).</span><span class="fu">configureEach</span> <span class="op">{</span></span>
|
|
||||||
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a> options<span class="op">.</span>generatedSourceOutputDirectory<span class="op">.</span><span class="fu">set</span><span class="op">(</span><span class="fu">file</span><span class="op">(</span><span class="st">"</span><span class="ss">${</span>projectDir<span class="ss">}</span><span class="st">/src/generated/java"</span><span class="op">))</span></span>
|
|
||||||
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
|
||||||
<p>The <a
|
|
||||||
href="https://github.com/ethauvin/semver/blob/master/examples/java/src/generated/java/com/example/GeneratedVersion.java"><code>GeneratedVersion.java</code></a>
|
|
||||||
file will now be located in <code>src/generated</code>.</p>
|
|
||||||
<h2 id="kotlin">Kotlin</h2>
|
|
||||||
<p>The annotation processor also supports <a
|
|
||||||
href="https://kotlinlang.org/">Kotlin</a>.</p>
|
|
||||||
<p>To generate a Kotlin version file, simply specify the
|
|
||||||
<code>type</code> as follows:</p>
|
|
||||||
<div class="sourceCode" id="cb13"><pre
|
|
||||||
class="sourceCode kotlin"><code class="sourceCode kotlin"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> <span class="im">net</span><span class="op">.</span><span class="im">thauvin</span><span class="op">.</span><span class="im">erik</span><span class="op">.</span><span class="im">semver</span><span class="op">.</span><span class="im">Version</span></span>
|
|
||||||
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a></span>
|
|
||||||
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a><span class="at">@Version</span><span class="op">(</span>properties <span class="op">=</span> <span class="st">"version.properties"</span><span class="op">,</span> type<span class="op">=</span><span class="st">"kt"</span><span class="op">)</span></span>
|
|
||||||
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a><span class="kw">open</span> <span class="kw">class</span> Main <span class="op">{</span></span>
|
|
||||||
<span id="cb13-5"><a href="#cb13-5" aria-hidden="true" tabindex="-1"></a> <span class="co">// ...</span></span>
|
|
||||||
<span id="cb13-6"><a href="#cb13-6" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
|
||||||
<p>The <a
|
|
||||||
href="https://github.com/ethauvin/semver/blob/master/src/main/resources/semver-kt.mustache">Kotlin
|
|
||||||
default template</a> implements the same static fields and functions as
|
|
||||||
the <a href="#default-template">Java template</a>.</p>
|
|
||||||
<p>Please look at the <a
|
|
||||||
href="https://github.com/ethauvin/semver/tree/master/examples/kotlin">examples/kotlin</a>
|
|
||||||
project for a <a
|
|
||||||
href="https://github.com/ethauvin/semver/blob/master/examples/kotlin/build.gradle.kts">build.gradle.kts</a>
|
|
||||||
sample.</p>
|
|
||||||
<h3 id="kotlin--gradle">Kotlin & Gradle</h3>
|
|
||||||
<p>To install and run from <a href="https://gradle.org/">Gradle</a>, add
|
|
||||||
the following to <a
|
|
||||||
href="https://github.com/ethauvin/semver/blob/master/examples/kotlin/build.gradle.kts">build.gradle.kts</a>:</p>
|
|
||||||
<div class="sourceCode" id="cb14"><pre
|
|
||||||
class="sourceCode kotlin"><code class="sourceCode kotlin"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="kw">var</span> <span class="va">semverProcessor</span> <span class="op">=</span> <span class="st">"net.thauvin.erik:semver:1.2.1"</span></span>
|
|
||||||
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a></span>
|
|
||||||
<span id="cb14-3"><a href="#cb14-3" aria-hidden="true" tabindex="-1"></a>dependencies <span class="op">{</span></span>
|
|
||||||
<span id="cb14-4"><a href="#cb14-4" aria-hidden="true" tabindex="-1"></a> kapt<span class="op">(</span>semverProcessor<span class="op">)</span></span>
|
|
||||||
<span id="cb14-5"><a href="#cb14-5" aria-hidden="true" tabindex="-1"></a> compileOnly<span class="op">(</span>semverProcessor<span class="op">)</span></span>
|
|
||||||
<span id="cb14-6"><a href="#cb14-6" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
|
|
||||||
<span id="cb14-7"><a href="#cb14-7" aria-hidden="true" tabindex="-1"></a></span>
|
|
||||||
<span id="cb14-8"><a href="#cb14-8" aria-hidden="true" tabindex="-1"></a>kapt <span class="op">{</span></span>
|
|
||||||
<span id="cb14-9"><a href="#cb14-9" aria-hidden="true" tabindex="-1"></a> arguments <span class="op">{</span></span>
|
|
||||||
<span id="cb14-10"><a href="#cb14-10" aria-hidden="true" tabindex="-1"></a> arg<span class="op">(</span><span class="st">"semver.project.dir"</span><span class="op">,</span> projectDir<span class="op">)</span></span>
|
|
||||||
<span id="cb14-11"><a href="#cb14-11" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
|
|
||||||
<span id="cb14-12"><a href="#cb14-12" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
|
||||||
<p>The directory containing the configuration files
|
|
||||||
(<code>version.properties</code>, <code>version.mustache</code>) must be
|
|
||||||
specified using the <code>semver.project.dir</code> processor
|
|
||||||
argument.</p>
|
|
||||||
<h2 id="auto-increment">Auto-Increment</h2>
|
|
||||||
<p>Incrementing the version is best left to your favorite build system.
|
|
||||||
For a solution using Gradle, please have a look at the <a
|
|
||||||
href="https://github.com/ethauvin/semver-gradle"><strong>Semver Version
|
|
||||||
Plugin for Gradle</strong></a>.</p>
|
|
||||||
<p>There are also full <a
|
|
||||||
href="https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor">examples</a>
|
|
||||||
in both <a
|
|
||||||
href="https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor/java">Java</a>
|
|
||||||
and <a
|
|
||||||
href="https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor/kotlin">Kotlin</a>
|
|
||||||
showing how to use both the plugin and annotation processor
|
|
||||||
concurrently.</p>
|
|
||||||
<h2 id="contributing">Contributing</h2>
|
|
||||||
<p>If you want to contribute to this project, all you have to do is
|
|
||||||
clone the GitHub repository:</p>
|
|
||||||
<pre class="console"><code>git clone git@github.com:ethauvin/semver.git</code></pre>
|
|
||||||
<p>Then use <a href="https://rife2.com/bld">bld</a> to build:</p>
|
|
||||||
<pre class="console"><code>cd semver
|
|
||||||
./bld compile</code></pre>
|
|
||||||
<p>The project has an <a href="https://www.jetbrains.com/idea/">IntelliJ
|
|
||||||
IDEA</a> project structure. You can just open it after all the
|
|
||||||
dependencies were downloaded and peruse the code.</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
28
example/.gitignore
vendored
Normal file
28
example/.gitignore
vendored
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
**/.idea/dictionaries
|
||||||
|
**/.idea/gradle.xml
|
||||||
|
**/.idea/libraries
|
||||||
|
**/.idea/tasks.xml
|
||||||
|
**/.idea/workspace.xml
|
||||||
|
*.iws
|
||||||
|
.DS_Store
|
||||||
|
.classpath
|
||||||
|
.gradle
|
||||||
|
.kobalt
|
||||||
|
.nb-gradle
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
/bin
|
||||||
|
/build
|
||||||
|
/deploy
|
||||||
|
/dist
|
||||||
|
/gen
|
||||||
|
/gradle.properties
|
||||||
|
/libs
|
||||||
|
/local.properties
|
||||||
|
/out
|
||||||
|
/proguard-project.txt
|
||||||
|
/project.properties
|
||||||
|
/test-output
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
kobaltBuild
|
95
example/build.gradle
Normal file
95
example/build.gradle
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
plugins {
|
||||||
|
id "com.ewerk.gradle.plugins.annotation-processor" version "1.0.4"
|
||||||
|
}
|
||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'idea'
|
||||||
|
apply plugin: 'application'
|
||||||
|
|
||||||
|
defaultTasks 'run'
|
||||||
|
|
||||||
|
def isRelease = 'release' in gradle.startParameter.taskNames
|
||||||
|
def deployDir = 'deploy'
|
||||||
|
def processorJar = 'net.thauvin.erik:semver:1.0.0'
|
||||||
|
|
||||||
|
// Get version from properties file. Increment patch if specified.
|
||||||
|
def getVersion(isIncrement = false) {
|
||||||
|
def propsFile = 'version.properties'
|
||||||
|
def majorKey = 'version.major'
|
||||||
|
def minorKey = 'version.minor'
|
||||||
|
def patchKey = 'version.patch'
|
||||||
|
def metaKey = 'version.buildmeta'
|
||||||
|
def preKey = 'version.prerelease'
|
||||||
|
if (isIncrement) {
|
||||||
|
ant.propertyfile(file: propsFile) {
|
||||||
|
entry(key: patchKey,
|
||||||
|
type: 'int',
|
||||||
|
default: '-1',
|
||||||
|
operation: '+')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
def p = new Properties()
|
||||||
|
file(propsFile).withInputStream { stream -> p.load(stream) }
|
||||||
|
def metadata = p.getProperty(metaKey, '')
|
||||||
|
def prerelease = p.getProperty(preKey, '')
|
||||||
|
return (p.getProperty(majorKey, '1') + '.' + p.getProperty(minorKey, '0') + '.' + p.getProperty(patchKey, '0') +
|
||||||
|
(prerelease.length() > 0 ? '-' + prerelease : '') + (metadata.length() > 0 ? '+' + metadata : ''))
|
||||||
|
}
|
||||||
|
|
||||||
|
version = getVersion()
|
||||||
|
|
||||||
|
mainClassName = 'net.thauvin.erik.semver.example.Example'
|
||||||
|
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly processorJar
|
||||||
|
}
|
||||||
|
|
||||||
|
annotationProcessor {
|
||||||
|
// Update version, increment on release.
|
||||||
|
project.version = getVersion(isRelease)
|
||||||
|
library processorJar
|
||||||
|
processor 'net.thauvin.erik.semver.VersionProcessor'
|
||||||
|
// sourcesDir 'src/generated/java'
|
||||||
|
}
|
||||||
|
|
||||||
|
compileJava {
|
||||||
|
options.compilerArgs << '-proc:none'
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
manifest.attributes('Main-Class': mainClassName)
|
||||||
|
}
|
||||||
|
|
||||||
|
clean {
|
||||||
|
delete deployDir
|
||||||
|
}
|
||||||
|
|
||||||
|
task copyToDeploy(type: Copy) {
|
||||||
|
from jar
|
||||||
|
into deployDir
|
||||||
|
}
|
||||||
|
|
||||||
|
task deploy(dependsOn: ['build', 'copyToDeploy']) {
|
||||||
|
description = 'Copies all needed files to the ${deployDir} directory.'
|
||||||
|
group = 'Publishing'
|
||||||
|
outputs.dir deployDir
|
||||||
|
inputs.files copyToDeploy
|
||||||
|
mustRunAfter clean
|
||||||
|
}
|
||||||
|
|
||||||
|
task release(dependsOn: ['wrapper', 'clean', 'deploy']) {
|
||||||
|
doLast {
|
||||||
|
group = 'Publishing'
|
||||||
|
description = 'Releases new version.'
|
||||||
|
isRelease = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task wrapper(type: Wrapper) {
|
||||||
|
gradleVersion = gradle.gradleVersion
|
||||||
|
}
|
BIN
example/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
example/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
|
@ -1,7 +1,6 @@
|
||||||
|
#Mon Jul 18 17:32:58 PDT 2016
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
|
||||||
networkTimeout=10000
|
|
||||||
validateDistributionUrl=true
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
|
164
example/gradlew
vendored
Normal file
164
example/gradlew
vendored
Normal file
|
@ -0,0 +1,164 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
|
function splitJvmOpts() {
|
||||||
|
JVM_OPTS=("$@")
|
||||||
|
}
|
||||||
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
82
examples/test/gradlew.bat → example/gradlew.bat
vendored
82
examples/test/gradlew.bat → example/gradlew.bat
vendored
|
@ -1,20 +1,4 @@
|
||||||
@rem
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem Copyright 2015 the original author or authors.
|
|
||||||
@rem
|
|
||||||
@rem Licensed under the Apache License, Version 2.0 (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
|
|
||||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
@rem
|
|
||||||
@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 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
@rem See the License for the specific language governing permissions and
|
|
||||||
@rem limitations under the License.
|
|
||||||
@rem
|
|
||||||
|
|
||||||
@if "%DEBUG%"=="" @echo off
|
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
|
@ -25,29 +9,25 @@
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%"=="" set DIRNAME=.
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
@rem This is normally unused
|
|
||||||
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=
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
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% equ 0 goto execute
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
echo. 1>&2
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
echo. 1>&2
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation. 1>&2
|
echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
@ -55,36 +35,54 @@ 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 execute
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
echo. 1>&2
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
echo. 1>&2
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation. 1>&2
|
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
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NT_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=%*
|
||||||
|
goto execute
|
||||||
|
|
||||||
|
:4NT_args
|
||||||
|
@rem Get arguments from the 4NT Shell from JP Software
|
||||||
|
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 %*
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
set EXIT_CODE=%ERRORLEVEL%
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
exit /b 1
|
||||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
|
||||||
exit /b %EXIT_CODE%
|
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
70
example/kobalt/src/Build.kt
Normal file
70
example/kobalt/src/Build.kt
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
import com.beust.kobalt.*
|
||||||
|
import com.beust.kobalt.plugin.application.*
|
||||||
|
import com.beust.kobalt.plugin.apt.*
|
||||||
|
import com.beust.kobalt.plugin.publish.*
|
||||||
|
import com.beust.kobalt.plugin.packaging.*
|
||||||
|
import java.io.FileInputStream
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
// .kobaltw run
|
||||||
|
|
||||||
|
val bs = buildScript {
|
||||||
|
repos(localMaven())
|
||||||
|
}
|
||||||
|
|
||||||
|
fun StringBuilder.prepend(s: String): StringBuilder {
|
||||||
|
if (this.isNotEmpty()) {
|
||||||
|
this.insert(0, s)
|
||||||
|
}
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
val example = project {
|
||||||
|
|
||||||
|
name = "example"
|
||||||
|
|
||||||
|
fun versionFor(): String {
|
||||||
|
val propsFile = "version.properties"
|
||||||
|
val majorKey = "version.major"
|
||||||
|
val minorKey = "version.minor"
|
||||||
|
val patchKey = "version.patch"
|
||||||
|
val metaKey = "version.buildmeta"
|
||||||
|
val preKey = "version.prerelease"
|
||||||
|
|
||||||
|
val p = Properties().apply { FileInputStream(propsFile).use { fis -> load(fis) } }
|
||||||
|
|
||||||
|
return (p.getProperty(majorKey, "1") + "." + p.getProperty(minorKey, "0") + "." + p.getProperty(patchKey, "0")
|
||||||
|
+ StringBuilder(p.getProperty(preKey, "")).prepend("-")
|
||||||
|
+ StringBuilder(p.getProperty(metaKey, "")).prepend("+"))
|
||||||
|
}
|
||||||
|
|
||||||
|
version = versionFor()
|
||||||
|
|
||||||
|
val mainClassName = "net.thauvin.erik.semver.example.Example"
|
||||||
|
val processorJar = "net.thauvin.erik:semver:1.0.0"
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
apt(processorJar)
|
||||||
|
compileOnly(processorJar)
|
||||||
|
}
|
||||||
|
|
||||||
|
apt {
|
||||||
|
//outputDir = "../src/generated/java/"
|
||||||
|
}
|
||||||
|
|
||||||
|
install {
|
||||||
|
target = "deploy"
|
||||||
|
}
|
||||||
|
|
||||||
|
assemble {
|
||||||
|
jar {
|
||||||
|
manifest {
|
||||||
|
attributes("Main-Class", mainClassName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
application {
|
||||||
|
mainClass = mainClassName
|
||||||
|
}
|
||||||
|
}
|
BIN
example/kobalt/wrapper/kobalt-wrapper.jar
Normal file
BIN
example/kobalt/wrapper/kobalt-wrapper.jar
Normal file
Binary file not shown.
1
example/kobalt/wrapper/kobalt-wrapper.properties
Normal file
1
example/kobalt/wrapper/kobalt-wrapper.properties
Normal file
|
@ -0,0 +1 @@
|
||||||
|
kobalt.version=1.0.85
|
2
example/kobaltw
Normal file
2
example/kobaltw
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
java -jar "`dirname "$0"`/kobalt/wrapper/kobalt-wrapper.jar" $*
|
4
example/kobaltw.bat
Normal file
4
example/kobaltw.bat
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
@echo off
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
java -jar "%DIRNAME%/kobalt/wrapper/kobalt-wrapper.jar" %*
|
|
@ -16,4 +16,4 @@ include 'api'
|
||||||
include 'services:webservice'
|
include 'services:webservice'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rootProject.name = 'examples-java'
|
rootProject.name = 'example'
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
* This file is automatically generated.
|
||||||
|
* Do not modify! -- ALL CHANGES WILL BE ERASED!
|
||||||
|
*/
|
||||||
|
package net.thauvin.erik.semver.example;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides semantic version information.
|
||||||
|
*
|
||||||
|
* @author <a href="https://github.com/ethauvin/semver">Semantic Version
|
||||||
|
* Annotation Processor</a>
|
||||||
|
*/
|
||||||
|
public final class GeneratedVersion {
|
||||||
|
public final static String PRERELEASE_PREFIX = "-";
|
||||||
|
public final static String BUILDMETA_PREFIX = "+";
|
||||||
|
|
||||||
|
public final static String PROJECT = "Example";
|
||||||
|
public final static Date BUILDDATE = new Date(1493952813608L);
|
||||||
|
public final static int MAJOR = 2;
|
||||||
|
public final static int MINOR = 17;
|
||||||
|
public final static int PATCH = 52;
|
||||||
|
public final static String PRERELEASE = "beta";
|
||||||
|
public final static String BUILDMETA = "007";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The full version string.
|
||||||
|
* <p>
|
||||||
|
* Formatted as:
|
||||||
|
* <blockquote>
|
||||||
|
* <code>MAJOR.MINOR.PATCH[-PRERELEASE][+BUILDMETADATA]</code>
|
||||||
|
* </blockquote>
|
||||||
|
* <p>
|
||||||
|
* For example:
|
||||||
|
* <ul>
|
||||||
|
* <li><code>1.0.0</code></li>
|
||||||
|
* <li><code>1.0.0-beta</code></li>
|
||||||
|
* <li><code>1.0.0+20160124144700</code></li>
|
||||||
|
* <li><code>1.0.0-alpha+001</code></li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
public final static String VERSION = Integer.toString(MAJOR) + '.'
|
||||||
|
+ Integer.toString(MINOR) + '.'
|
||||||
|
+ Integer.toString(PATCH)
|
||||||
|
+ preReleaseWithPrefix() + buildMetaWithPrefix();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables the default constructor.
|
||||||
|
*
|
||||||
|
* @throws UnsupportedOperationException If the constructor is called.
|
||||||
|
*/
|
||||||
|
private GeneratedVersion()
|
||||||
|
throws UnsupportedOperationException {
|
||||||
|
throw new UnsupportedOperationException("Illegal constructor call.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the build metadata with {@value #BUILDMETA_PREFIX} prefix.
|
||||||
|
*
|
||||||
|
* @return The build metadata, if any.
|
||||||
|
*/
|
||||||
|
public static String buildMetaWithPrefix() {
|
||||||
|
return buildMetaWithPrefix(BUILDMETA_PREFIX);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the build metadata.
|
||||||
|
*
|
||||||
|
* @param prefix Prefix to prepend.
|
||||||
|
* @return The build metadata, if any.
|
||||||
|
*/
|
||||||
|
public static String buildMetaWithPrefix(final String prefix) {
|
||||||
|
if (BUILDMETA.length() > 0 && prefix.length() > 0) {
|
||||||
|
return prefix + BUILDMETA;
|
||||||
|
} else {
|
||||||
|
return BUILDMETA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the pre-release version with {@value #PRERELEASE_PREFIX} prefix.
|
||||||
|
*
|
||||||
|
* @return The pre-release version, if any.
|
||||||
|
*/
|
||||||
|
public static String preReleaseWithPrefix() {
|
||||||
|
return preReleaseWithPrefix(PRERELEASE_PREFIX);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the pre-release version.
|
||||||
|
*
|
||||||
|
* @param prefix The prefix to prepend.
|
||||||
|
* @return The pre-release version, if any.
|
||||||
|
*/
|
||||||
|
public static String preReleaseWithPrefix(final String prefix) {
|
||||||
|
if (PRERELEASE.length() > 0 && prefix.length() > 0) {
|
||||||
|
return prefix + PRERELEASE;
|
||||||
|
} else {
|
||||||
|
return PRERELEASE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* ConstantsTest.java
|
* Example.java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016-2024, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright (c) 2016-2017, 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
|
||||||
|
@ -29,45 +29,35 @@
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* 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.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
package net.thauvin.erik.semver.example;
|
||||||
|
|
||||||
package net.thauvin.erik.semver;
|
import net.thauvin.erik.semver.Version;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <code>ConstantsTest</code> class.
|
* The <code>Example</code> class.
|
||||||
*
|
*
|
||||||
* @author <a href="https://erik.thauvin.net/" target="_blank">Erik C. Thauvin</a>
|
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
|
||||||
* @created 2019-04-14
|
* @created 2016-01-13
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class ConstantsTest {
|
@Version(properties = "version.properties")
|
||||||
@Test
|
public class Example {
|
||||||
void testDefaults() {
|
public static void main(final String... args) {
|
||||||
assertEquals(1, Constants.DEFAULT_MAJOR, "major");
|
final SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy 'at' HH:mm:ss z");
|
||||||
assertEquals(0, Constants.DEFAULT_MINOR, "minor");
|
|
||||||
assertEquals(0, Constants.DEFAULT_PATCH, "patch");
|
|
||||||
assertEquals("-", Constants.DEFAULT_PRERELEASE_PREFIX, "preRelease");
|
|
||||||
assertEquals("+", Constants.DEFAULT_BUILDMETA_PREFIX, "buildMeta");
|
|
||||||
assertEquals(".", Constants.DEFAULT_SEPARATOR, "separator");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
System.out.println("-----------------------------------------------------");
|
||||||
void testTemplates() {
|
|
||||||
final List<String> templates = new ArrayList<>();
|
|
||||||
templates.add(Constants.DEFAULT_JAVA_TEMPLATE);
|
|
||||||
templates.add(Constants.DEFAULT_KOTLIN_TEMPLATE);
|
|
||||||
templates.add(Constants.DEFAULT_TEMPLATE_NAME);
|
|
||||||
|
|
||||||
for (final var tp : templates) {
|
System.out.println(" " + GeneratedVersion.PROJECT + ' ' + GeneratedVersion.VERSION);
|
||||||
assertTrue(tp.endsWith(".mustache"), tp);
|
|
||||||
}
|
System.out.println(" Built on: " + sdf.format(GeneratedVersion.BUILDDATE));
|
||||||
|
System.out.println(" Major: " + GeneratedVersion.MAJOR);
|
||||||
|
System.out.println(" Minor: " + GeneratedVersion.MINOR);
|
||||||
|
System.out.println(" Patch: " + GeneratedVersion.PATCH);
|
||||||
|
System.out.println(" PreRelease: " + GeneratedVersion.PRERELEASE);
|
||||||
|
System.out.println(" BuildMetaData: " + GeneratedVersion.BUILDMETA);
|
||||||
|
|
||||||
|
System.out.println("-----------------------------------------------------");
|
||||||
}
|
}
|
||||||
}
|
}
|
7
example/version.properties
Normal file
7
example/version.properties
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#Mon, 18 Jul 2016 17:33:54 -0700
|
||||||
|
version.project=Example
|
||||||
|
version.major=2
|
||||||
|
version.minor=17
|
||||||
|
version.patch=52
|
||||||
|
version.prerelease=beta
|
||||||
|
version.buildmeta=007
|
|
@ -1,34 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Version 1.0
|
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
echo "Usage: $0 <arg ...>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# set the examples directories
|
|
||||||
declare -a examples=(
|
|
||||||
"java/bld"
|
|
||||||
"java/gradle"
|
|
||||||
"kotlin")
|
|
||||||
|
|
||||||
dir=$(dirname "$(readlink -f "$0")")
|
|
||||||
cyan=$(tput setaf 6)
|
|
||||||
normal=$(tput sgr0)
|
|
||||||
|
|
||||||
i=0
|
|
||||||
for ex in "${examples[@]}"; do
|
|
||||||
if [ $i -ne 0 ]; then
|
|
||||||
read -p "Press [Enter] key to continue..."
|
|
||||||
clear
|
|
||||||
fi
|
|
||||||
cd "$dir/$ex" || exit 1
|
|
||||||
echo "> Project: ${cyan}${ex}${normal}"
|
|
||||||
if [ -x "bld" ]; then
|
|
||||||
./bld compile "$@" || exit 1
|
|
||||||
else
|
|
||||||
./gradlew --console=plain --no-build-cache clean "$@" || exit 1
|
|
||||||
fi
|
|
||||||
((i++))
|
|
||||||
done
|
|
56
examples/java/bld/.gitignore
vendored
56
examples/java/bld/.gitignore
vendored
|
@ -1,56 +0,0 @@
|
||||||
.gradle
|
|
||||||
.DS_Store
|
|
||||||
build
|
|
||||||
lib/bld/**
|
|
||||||
!lib/bld/bld-wrapper.jar
|
|
||||||
!lib/bld/bld-wrapper.properties
|
|
||||||
lib/compile/
|
|
||||||
lib/provided/
|
|
||||||
lib/runtime/
|
|
||||||
lib/standalone/
|
|
||||||
lib/test/
|
|
||||||
|
|
||||||
# IDEA ignores
|
|
||||||
|
|
||||||
# User-specific
|
|
||||||
.idea/**/workspace.xml
|
|
||||||
.idea/**/tasks.xml
|
|
||||||
.idea/**/usage.statistics.xml
|
|
||||||
.idea/**/dictionaries
|
|
||||||
.idea/**/shelf
|
|
||||||
|
|
||||||
# AWS User-specific
|
|
||||||
.idea/**/aws.xml
|
|
||||||
|
|
||||||
# Generated files
|
|
||||||
.idea/**/contentModel.xml
|
|
||||||
|
|
||||||
# Sensitive or high-churn files
|
|
||||||
.idea/**/dataSources/
|
|
||||||
.idea/**/dataSources.ids
|
|
||||||
.idea/**/dataSources.local.xml
|
|
||||||
.idea/**/sqlDataSources.xml
|
|
||||||
.idea/**/dynamic.xml
|
|
||||||
.idea/**/uiDesigner.xml
|
|
||||||
.idea/**/dbnavigator.xml
|
|
||||||
|
|
||||||
# Gradle
|
|
||||||
.idea/**/gradle.xml
|
|
||||||
|
|
||||||
# Mongo Explorer plugin
|
|
||||||
.idea/**/mongoSettings.xml
|
|
||||||
|
|
||||||
# mpeltonen/sbt-idea plugin
|
|
||||||
.idea_modules/
|
|
||||||
|
|
||||||
# JIRA plugin
|
|
||||||
atlassian-ide-plugin.xml
|
|
||||||
|
|
||||||
# Cursive Clojure plugin
|
|
||||||
.idea/replstate.xml
|
|
||||||
|
|
||||||
# SonarLint plugin
|
|
||||||
.idea/sonarlint/
|
|
||||||
|
|
||||||
# Editor-based Rest Client
|
|
||||||
.idea/httpRequests
|
|
3
examples/java/bld/.idea/.gitignore
generated
vendored
3
examples/java/bld/.idea/.gitignore
generated
vendored
|
@ -1,3 +0,0 @@
|
||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
1
examples/java/bld/.idea/.name
generated
1
examples/java/bld/.idea/.name
generated
|
@ -1 +0,0 @@
|
||||||
semver-examples-bld
|
|
30
examples/java/bld/.idea/app.iml
generated
30
examples/java/bld/.idea/app.iml
generated
|
@ -1,30 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="JAVA_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<output url="file://$MODULE_DIR$/build/main" />
|
|
||||||
<output-test url="file://$MODULE_DIR$/build/test" />
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated" isTestSource="false" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/src/main/resources/templates" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="module-library" scope="RUNTIME">
|
|
||||||
<library>
|
|
||||||
<CLASSES>
|
|
||||||
<root url="file://$MODULE_DIR$/src/main/resources/templates" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</orderEntry>
|
|
||||||
<orderEntry type="library" name="compile" level="project" />
|
|
||||||
<orderEntry type="library" scope="RUNTIME" name="runtime" level="project" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="test" level="project" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
14
examples/java/bld/.idea/bld.iml
generated
14
examples/java/bld/.idea/bld.iml
generated
|
@ -1,14 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="JAVA_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<output url="file://$MODULE_DIR$/build/bld" />
|
|
||||||
<output-test url="file://$MODULE_DIR$/build/bld" />
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$/src/bld">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/bld/java" isTestSource="false" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="library" name="bld" level="project" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
6
examples/java/bld/.idea/bld.xml
generated
6
examples/java/bld/.idea/bld.xml
generated
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="BldConfiguration">
|
|
||||||
<events />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<profile version="1.0">
|
|
||||||
<option name="myName" value="Project Default" />
|
|
||||||
<inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
|
|
||||||
<option name="ADDITIONAL_TAGS" value="created" />
|
|
||||||
</inspection_tool>
|
|
||||||
</profile>
|
|
||||||
</component>
|
|
204
examples/java/bld/.idea/intellij-javadocs-4.0.1.xml
generated
204
examples/java/bld/.idea/intellij-javadocs-4.0.1.xml
generated
|
@ -1,204 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="JavaDocConfiguration">
|
|
||||||
<GENERAL>
|
|
||||||
<MODE>UPDATE</MODE>
|
|
||||||
<OVERRIDDEN_METHODS>false</OVERRIDDEN_METHODS>
|
|
||||||
<SPLITTED_CLASS_NAME>true</SPLITTED_CLASS_NAME>
|
|
||||||
<LEVELS>
|
|
||||||
<LEVEL>METHOD</LEVEL>
|
|
||||||
<LEVEL>TYPE</LEVEL>
|
|
||||||
<LEVEL>FIELD</LEVEL>
|
|
||||||
</LEVELS>
|
|
||||||
<VISIBILITIES>
|
|
||||||
<VISIBILITY>PUBLIC</VISIBILITY>
|
|
||||||
<VISIBILITY>DEFAULT</VISIBILITY>
|
|
||||||
<VISIBILITY>PROTECTED</VISIBILITY>
|
|
||||||
</VISIBILITIES>
|
|
||||||
</GENERAL>
|
|
||||||
<TEMPLATES>
|
|
||||||
<CLASSES>
|
|
||||||
<CLASS>
|
|
||||||
<KEY>^.*(public|protected|private)*.+interface\s+\w+.*</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The interface ${name}.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</CLASS>
|
|
||||||
<CLASS>
|
|
||||||
<KEY>^.*(public|protected|private)*.+enum\s+\w+.*</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The enum ${name}.\n
|
|
||||||
*/</VALUE>
|
|
||||||
</CLASS>
|
|
||||||
<CLASS>
|
|
||||||
<KEY>^.*(public|protected|private)*.+class\s+\w+.*</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The type ${name}.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</CLASS>
|
|
||||||
<CLASS>
|
|
||||||
<KEY>.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The type ${name}.\n
|
|
||||||
*/</VALUE>
|
|
||||||
</CLASS>
|
|
||||||
</CLASSES>
|
|
||||||
<CONSTRUCTORS>
|
|
||||||
<CONSTRUCTOR>
|
|
||||||
<KEY>.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* Instantiates a new ${name}.\n
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.parameterList.parameters as parameter>
|
|
||||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
|
||||||
</#list>
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</CONSTRUCTOR>
|
|
||||||
</CONSTRUCTORS>
|
|
||||||
<METHODS>
|
|
||||||
<METHOD>
|
|
||||||
<KEY>^.*(public|protected|private)*\s*.*(\w(\s*<.+>)*)+\s+get\w+\s*\(.*\).+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* Gets ${partName}.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.parameterList.parameters as parameter>
|
|
||||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
|
||||||
</#list>
|
|
||||||
<#if isNotVoid>
|
|
||||||
*\n
|
|
||||||
* @return the ${partName}\n
|
|
||||||
</#if>
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</METHOD>
|
|
||||||
<METHOD>
|
|
||||||
<KEY>^.*(public|protected|private)*\s*.*(void|\w(\s*<.+>)*)+\s+set\w+\s*\(.*\).+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* Sets ${partName}.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.parameterList.parameters as parameter>
|
|
||||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
|
||||||
</#list>
|
|
||||||
<#if isNotVoid>
|
|
||||||
*\n
|
|
||||||
* @return the ${partName}\n
|
|
||||||
</#if>
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</METHOD>
|
|
||||||
<METHOD>
|
|
||||||
<KEY>^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The entry point of application.\n
|
|
||||||
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
* @param ${element.parameterList.parameters[0].name} the input arguments\n
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</METHOD>
|
|
||||||
<METHOD>
|
|
||||||
<KEY>.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* ${name}<#if isNotVoid> ${return}</#if>.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.parameterList.parameters as parameter>
|
|
||||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
|
||||||
</#list>
|
|
||||||
<#if isNotVoid>
|
|
||||||
*\n
|
|
||||||
* @return the ${return}\n
|
|
||||||
</#if>
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</METHOD>
|
|
||||||
</METHODS>
|
|
||||||
<FIELDS>
|
|
||||||
<FIELD>
|
|
||||||
<KEY>^.*(public|protected|private)*.+static.*(\w\s\w)+.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The constant ${element.getName()}.\n
|
|
||||||
*/</VALUE>
|
|
||||||
</FIELD>
|
|
||||||
<FIELD>
|
|
||||||
<KEY>^.*(public|protected|private)*.*(\w\s\w)+.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
<#if element.parent.isInterface()>
|
|
||||||
* The constant ${element.getName()}.\n
|
|
||||||
<#else>
|
|
||||||
* The ${name}.\n
|
|
||||||
</#if> */</VALUE>
|
|
||||||
</FIELD>
|
|
||||||
<FIELD>
|
|
||||||
<KEY>.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
<#if element.parent.isEnum()>
|
|
||||||
*${name} ${typeName}.\n
|
|
||||||
<#else>
|
|
||||||
* The ${name}.\n
|
|
||||||
</#if>*/</VALUE>
|
|
||||||
</FIELD>
|
|
||||||
</FIELDS>
|
|
||||||
</TEMPLATES>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
18
examples/java/bld/.idea/libraries/bld.xml
generated
18
examples/java/bld/.idea/libraries/bld.xml
generated
|
@ -1,18 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="bld">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
|
||||||
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES>
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
|
||||||
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
<excluded>
|
|
||||||
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
|
||||||
</excluded>
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" />
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" type="SOURCES" />
|
|
||||||
</library>
|
|
||||||
</component>
|
|
17
examples/java/bld/.idea/libraries/compile.xml
generated
17
examples/java/bld/.idea/libraries/compile.xml
generated
|
@ -1,17 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="compile">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/compile" />
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/provided" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES>
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/compile" />
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/provided" />
|
|
||||||
</SOURCES>
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" />
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
|
|
||||||
</library>
|
|
||||||
</component>
|
|
14
examples/java/bld/.idea/libraries/runtime.xml
generated
14
examples/java/bld/.idea/libraries/runtime.xml
generated
|
@ -1,14 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="runtime">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/runtime" />
|
|
||||||
<root url="file://$PROJECT_DIR$/src/main/resources" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES>
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/runtime" />
|
|
||||||
</SOURCES>
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" />
|
|
||||||
</library>
|
|
||||||
</component>
|
|
18
examples/java/bld/.idea/libraries/test.xml
generated
18
examples/java/bld/.idea/libraries/test.xml
generated
|
@ -1,18 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="test">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/test" />
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/provided" />
|
|
||||||
<root url="file://$PROJECT_DIR$/src/test/resources" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES>
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/test" />
|
|
||||||
<root url="file://$PROJECT_DIR$/lib/provided" />
|
|
||||||
</SOURCES>
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
|
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
|
|
||||||
</library>
|
|
||||||
</component>
|
|
11
examples/java/bld/.idea/misc.xml
generated
11
examples/java/bld/.idea/misc.xml
generated
|
@ -1,11 +0,0 @@
|
||||||
<project version="4">
|
|
||||||
<component name="EntryPointsManager">
|
|
||||||
<pattern value="com.example.ExampleBuild" method="runExample" />
|
|
||||||
</component>
|
|
||||||
<component name="PDMPlugin">
|
|
||||||
<option name="skipTestSources" value="false" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
|
|
||||||
<output url="file://$PROJECT_DIR$/build" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
9
examples/java/bld/.idea/modules.xml
generated
9
examples/java/bld/.idea/modules.xml
generated
|
@ -1,9 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/app.iml" filepath="$PROJECT_DIR$/.idea/app.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/bld.iml" filepath="$PROJECT_DIR$/.idea/bld.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,9 +0,0 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="Run Tests" type="Application" factoryName="Application" nameIsGenerated="true">
|
|
||||||
<option name="MAIN_CLASS_NAME" value="com.example.ExampleTest" />
|
|
||||||
<module name="app" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Make" enabled="true" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
6
examples/java/bld/.idea/vcs.xml
generated
6
examples/java/bld/.idea/vcs.xml
generated
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
11
examples/java/bld/.vscode/launch.json
vendored
11
examples/java/bld/.vscode/launch.json
vendored
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"type": "java",
|
|
||||||
"name": "Run Tests",
|
|
||||||
"request": "launch",
|
|
||||||
"mainClass": "com.example.ExampleTest"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
15
examples/java/bld/.vscode/settings.json
vendored
15
examples/java/bld/.vscode/settings.json
vendored
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
"java.project.sourcePaths": [
|
|
||||||
"src/main/java",
|
|
||||||
"src/main/resources",
|
|
||||||
"src/test/java",
|
|
||||||
"src/test/resources",
|
|
||||||
"src/bld/java",
|
|
||||||
"src/bld/resources"
|
|
||||||
],
|
|
||||||
"java.configuration.updateBuildConfiguration": "automatic",
|
|
||||||
"java.project.referencedLibraries": [
|
|
||||||
"${HOME}/.bld/dist/bld-2.2.1.jar",
|
|
||||||
"lib/**/*.jar"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
## Examples
|
|
||||||
|
|
||||||
To compile & run the examples:
|
|
||||||
|
|
||||||
```console
|
|
||||||
./bld compile
|
|
||||||
|
|
||||||
./bld run
|
|
||||||
./bld run-example
|
|
||||||
```
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build com.example.ExampleBuild "$@"
|
|
|
@ -1,4 +0,0 @@
|
||||||
@echo off
|
|
||||||
set DIRNAME=%~dp0
|
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
|
||||||
java -jar "%DIRNAME%/lib/bld/bld-wrapper.jar" "%0" --build com.example.ExampleBuild %*
|
|
|
@ -1,21 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is automatically generated.
|
|
||||||
* Do not modify! -- ALL CHANGES WILL BE ERASED!
|
|
||||||
*/
|
|
||||||
|
|
||||||
package {{packageName}};
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public final class {{className}} {
|
|
||||||
public static final String PROJECT = "{{project}}";
|
|
||||||
public static final Date BUILDDATE = new Date({{epoch}}L);
|
|
||||||
public static final String VERSION = "{{version}}";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disables the default constructor.
|
|
||||||
*/
|
|
||||||
private {{className}}() {
|
|
||||||
throw new UnsupportedOperationException("Illegal constructor call.");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
#Generated by the Semver Plugin for Gradle
|
|
||||||
#Sat Apr 27 17:04:13 PDT 2019
|
|
||||||
example.buildmeta=T800
|
|
||||||
example.major=8
|
|
||||||
example.minor=4
|
|
||||||
example.patch=97
|
|
||||||
example.prerelease=alpha
|
|
||||||
example.project=Java Example
|
|
||||||
example.semver=8.4.97-alpha+T800
|
|
Binary file not shown.
|
@ -1,7 +0,0 @@
|
||||||
bld.downloadExtensionJavadoc=false
|
|
||||||
bld.downloadExtensionSources=true
|
|
||||||
bld.downloadLocation=
|
|
||||||
bld.extensions=
|
|
||||||
bld.repositories=MAVEN_CENTRAL,RIFE2_RELEASES
|
|
||||||
bld.sourceDirectories=
|
|
||||||
bld.version=2.2.1
|
|
|
@ -1,53 +0,0 @@
|
||||||
package com.example;
|
|
||||||
|
|
||||||
import rife.bld.BuildCommand;
|
|
||||||
import rife.bld.Project;
|
|
||||||
import rife.bld.operations.JavacOptions.Processing;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static rife.bld.dependencies.Repository.*;
|
|
||||||
import static rife.bld.dependencies.Scope.provided;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Example build.
|
|
||||||
*/
|
|
||||||
public class ExampleBuild extends Project {
|
|
||||||
public ExampleBuild() {
|
|
||||||
pkg = "com.example";
|
|
||||||
name = "Example";
|
|
||||||
version = version(0, 1, 0);
|
|
||||||
|
|
||||||
mainClass = "com.example.App";
|
|
||||||
|
|
||||||
testOperation().mainClass("com.example.ExampleTest");
|
|
||||||
|
|
||||||
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY);
|
|
||||||
|
|
||||||
scope(provided).include(dependency("net.thauvin.erik", "semver", version(1, 2, 2, "SNAPSHOT")));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
new ExampleBuild().start(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Saves generated source files in the {@code build/generated} directory.
|
|
||||||
* <p>
|
|
||||||
* To incorporate the generated source code into the source tree, add this directory as an additional source
|
|
||||||
* location in your IDE.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void compile() throws Exception {
|
|
||||||
var generated = new File(buildDirectory(), "generated");
|
|
||||||
var ignore = generated.mkdir();
|
|
||||||
compileOperation().compileOptions().process(Processing.FULL).sourceOutput(generated);
|
|
||||||
super.compile();
|
|
||||||
}
|
|
||||||
|
|
||||||
@BuildCommand(value = "run-example", summary = "Runs the example")
|
|
||||||
public void runExample() throws Exception {
|
|
||||||
runOperation().fromProject(this).mainClass("com.example.Example").execute();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
package com.example;
|
|
||||||
|
|
||||||
import net.thauvin.erik.semver.Version;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
@Version(properties = "version.properties")
|
|
||||||
public final class App {
|
|
||||||
/**
|
|
||||||
* Command line interface.
|
|
||||||
*
|
|
||||||
* @param args The command line parameters.
|
|
||||||
*/
|
|
||||||
public static void main(final String... args) {
|
|
||||||
final var sdf = new SimpleDateFormat("EEE, d MMM yyyy 'at' HH:mm:ss z", Locale.US);
|
|
||||||
|
|
||||||
System.out.println("-----------------------------------------------------");
|
|
||||||
|
|
||||||
System.out.println(" Version: " + GeneratedVersion.PROJECT + ' ' + GeneratedVersion.VERSION);
|
|
||||||
|
|
||||||
System.out.println(" Built on: " + sdf.format(GeneratedVersion.BUILDDATE));
|
|
||||||
System.out.println(" Major: " + GeneratedVersion.MAJOR);
|
|
||||||
System.out.println(" Minor: " + GeneratedVersion.MINOR);
|
|
||||||
System.out.println(" Patch: " + GeneratedVersion.PATCH);
|
|
||||||
System.out.println(" PreRelease: " + GeneratedVersion.PRERELEASE);
|
|
||||||
System.out.println(" BuildMetaData: " + GeneratedVersion.BUILDMETA);
|
|
||||||
|
|
||||||
System.out.println("-----------------------------------------------------");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
package com.example;
|
|
||||||
|
|
||||||
import net.thauvin.erik.semver.Version;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
@Version(properties = "example.properties", template = "example.mustache", className = "ExampleVersion",
|
|
||||||
keysPrefix = "example.")
|
|
||||||
public class Example {
|
|
||||||
public static void main(final String... args) {
|
|
||||||
final var sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);
|
|
||||||
|
|
||||||
System.out.println("-- From Example -------------------------------------");
|
|
||||||
|
|
||||||
System.out.println(" " + ExampleVersion.PROJECT + ' ' + ExampleVersion.VERSION
|
|
||||||
+ " (" + sdf.format(ExampleVersion.BUILDDATE) + ')');
|
|
||||||
|
|
||||||
System.out.println("-----------------------------------------------------");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
package com.example;
|
|
||||||
|
|
||||||
public class ExampleTest {
|
|
||||||
private static final String HELLO = "Hello!";
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
var hello = new ExampleTest().verifyHello();
|
|
||||||
if (HELLO.equals(hello)) {
|
|
||||||
System.out.println("Succeeded");
|
|
||||||
} else {
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String verifyHello() {
|
|
||||||
return HELLO;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
#Generated by the Semver Plugin for Gradle
|
|
||||||
#Sat Apr 27 17:05:34 PDT 2019
|
|
||||||
version.buildmeta=007
|
|
||||||
version.major=11
|
|
||||||
version.minor=11
|
|
||||||
version.patch=20
|
|
||||||
version.prerelease=beta
|
|
||||||
version.project=Java App
|
|
||||||
version.semver=11.11.20-beta+007
|
|
|
@ -1,2 +0,0 @@
|
||||||
[*]
|
|
||||||
insert_final_newline = true
|
|
5
examples/java/gradle/.gitattributes
vendored
5
examples/java/gradle/.gitattributes
vendored
|
@ -1,5 +0,0 @@
|
||||||
# Set the default behavior, in case people don't have core.autocrlf set.
|
|
||||||
* text=auto
|
|
||||||
|
|
||||||
# batch files are specific to windows and always crlf
|
|
||||||
*.bat eol=crlf
|
|
82
examples/java/gradle/.gitignore
vendored
82
examples/java/gradle/.gitignore
vendored
|
@ -1,82 +0,0 @@
|
||||||
!.vscode/extensions.json
|
|
||||||
!.vscode/launch.json
|
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
|
||||||
!gradle-wrapper.jar
|
|
||||||
.classpath
|
|
||||||
.DS_Store
|
|
||||||
.gradle
|
|
||||||
.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
|
|
||||||
.mtj.tmp/
|
|
||||||
.mvn/timing.properties
|
|
||||||
.mvn/wrapper/maven-wrapper.jar
|
|
||||||
.nb-gradle
|
|
||||||
.project
|
|
||||||
.scannerwork
|
|
||||||
.settings
|
|
||||||
.vscode/*
|
|
||||||
*.class
|
|
||||||
*.code-workspace
|
|
||||||
*.ctxt
|
|
||||||
*.ear
|
|
||||||
*.iws
|
|
||||||
*.jar
|
|
||||||
*.log
|
|
||||||
*.nar
|
|
||||||
*.rar
|
|
||||||
*.sublime-*
|
|
||||||
*.tar.gz
|
|
||||||
*.war
|
|
||||||
*.zip
|
|
||||||
atlassian-ide-plugin.xml
|
|
||||||
bin/
|
|
||||||
build/
|
|
||||||
cmake-build-*/
|
|
||||||
com_crashlytics_export_strings.xml
|
|
||||||
crashlytics-build.properties
|
|
||||||
crashlytics.properties
|
|
||||||
dependency-reduced-pom.xml
|
|
||||||
deploy/
|
|
||||||
dist/
|
|
||||||
ehthumbs.db
|
|
||||||
fabric.properties
|
|
||||||
gen/
|
|
||||||
gradle.properties
|
|
||||||
hs_err_pid*
|
|
||||||
kobaltBuild
|
|
||||||
kobaltw*-test
|
|
||||||
lib/kotlin*
|
|
||||||
libs/
|
|
||||||
local.properties
|
|
||||||
out/
|
|
||||||
pom.xml.next
|
|
||||||
pom.xml.releaseBackup
|
|
||||||
pom.xml.tag
|
|
||||||
pom.xml.versionsBackup
|
|
||||||
proguard-project.txt
|
|
||||||
project.properties
|
|
||||||
release.properties
|
|
||||||
target/
|
|
||||||
test-output
|
|
||||||
Thumbs.db
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue