Merge branch '1.2.1-dev'

This commit is contained in:
Erik C. Thauvin 2023-08-18 19:28:30 -07:00
commit 19e579d4a5
106 changed files with 2034 additions and 2660 deletions

View file

@ -1,44 +1,41 @@
version: 2 inversion: 2
defaults: &defaults defaults: &defaults
working_directory: ~/repo working_directory: ~/repo
docker:
- image: circleci/openjdk:8-jdk
environment: environment:
JVM_OPTS: -Xmx3200m JVM_OPTS: -Xmx3200m
TERM: dumb TERM: dumb
CI_NAME: "CircleCI"
defaults_gradle: &defaults_bld
steps:
- checkout
- run:
name: Download the dependencies
command: ./bld download
- run:
name: Run tests with bld
command: ./bld compile test
jobs: jobs:
build_gradle: bld_jdk20:
<<: *defaults <<: *defaults
steps: docker:
- checkout - image: cimg/openjdk:20.0
- restore_cache:
keys:
- gradle-dependencies-{{ checksum "build.gradle" }}
# fallback to using the latest cache if no exact match is found
- gradle-dependencies-
- run: <<: *defaults_bld
name: Gradle Dependencies
command: ./gradlew dependencies
- save_cache: bld_jdk17:
paths: ~/.m2 <<: *defaults
key: gradle-dependencies-{{ checksum "build.gradle" }}
- run: docker:
name: Run All Checks - image: cimg/openjdk:17.0
command: ./gradlew check
- store_artifacts: <<: *defaults_bld
path: build/reports/
destination: reports
- store_test_results:
path: build/reports/
workflows: workflows:
version: 2 version: 2
build_gradle_jdk8: bld:
jobs: jobs:
- build_gradle - bld_jdk17
- bld_jdk20

View file

@ -1,2 +1,2 @@
[*] [*]
insert_final_newline=true insert_final_newline = true

53
.github/workflows/bld.yml vendored Normal file
View file

@ -0,0 +1,53 @@
name: bld-ci
on: [ push, pull_request, workflow_dispatch ]
jobs:
build-bld-project:
runs-on: ubuntu-latest
env:
COVERAGE_SDK: "17"
strategy:
matrix:
java-version: [ 17, 20 ]
steps:
- name: Checkout source repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}
- name: Grant execute permission for bld
run: chmod +x bld
- name: Download the dependencies
run: ./bld download
- name: Run tests with bld
run: ./bld compile jacoco
- name: Remove pom.xml
if: success() && matrix.java-version == env.COVERAGE_SDK
run: rm -rf pom.xml
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
if: success() && matrix.java-version == env.COVERAGE_SDK
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_SDK
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

137
.gitignore vendored
View file

@ -1,84 +1,57 @@
.vscode/*
!.vscode/extensions.json
!.vscode/launch.json
!.vscode/settings.json
!.vscode/tasks.json
__pycache__
.classpath
.DS_Store
.gradle .gradle
.history .DS_Store
.kobalt build
.mtj.tmp/ lib/bld/**
.mvn/timing.properties !lib/bld/bld-wrapper.properties
.mvn/wrapper/maven-wrapper.jar !lib/bld/bld-wrapper.jar
.nb-gradle lib/compile/
.project lib/runtime/
.scannerwork lib/standalone/
.settings lib/test/
*.class
*.code-workspace # IDEA ignores
*.ctxt
*.iws # User-specific
*.log .idea/**/workspace.xml
*.nar .idea/**/tasks.xml
*.rar .idea/**/usage.statistics.xml
*.sublime-* .idea/**/dictionaries
*.tar.gz .idea/**/shelf
*.zip
/**/.idea_modules/ # AWS User-specific
/**/.idea/**/caches/build_file_checksums.ser .idea/**/aws.xml
/**/.idea/**/contentModel.xml
/**/.idea/**/dataSources.ids # Generated files
/**/.idea/**/dataSources.local.xml .idea/**/contentModel.xml
/**/.idea/**/dataSources/
/**/.idea/**/dbnavigator.xml # Sensitive or high-churn files
/**/.idea/**/dictionaries .idea/**/dataSources/
/**/.idea/**/dynamic.xml .idea/**/dataSources.ids
/**/.idea/**/gradle.xml .idea/**/dataSources.local.xml
/**/.idea/**/httpRequests .idea/**/sqlDataSources.xml
/**/.idea/**/libraries .idea/**/dynamic.xml
/**/.idea/**/mongoSettings.xml .idea/**/uiDesigner.xml
/**/.idea/**/replstate.xml .idea/**/dbnavigator.xml
/**/.idea/**/shelf
/**/.idea/**/shelf/ # Gradle
/**/.idea/**/sqlDataSources.xml .idea/**/gradle.xml
/**/.idea/**/tasks.xml
/**/.idea/**/uiDesigner.xml # Mongo Explorer plugin
/**/.idea/**/usage.statistics.xml .idea/**/mongoSettings.xml
/**/.idea/**/workspace.xml
/**/.idea/$CACHE_FILE$ # mpeltonen/sbt-idea plugin
/**/.idea/$PRODUCT_WORKSPACE_FILE$ .idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml atlassian-ide-plugin.xml
bin/
build/ # Cursive Clojure plugin
cmake-build-*/ .idea/replstate.xml
com_crashlytics_export_strings.xml
crashlytics-build.properties # SonarLint plugin
crashlytics.properties .idea/sonarlint/
dependency-reduced-pom.xml
deploy/ # Editor-based Rest Client
dist/ .idea/httpRequests
ehthumbs.db
fabric.properties local.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
venv

29
.idea/app.iml generated Normal file
View file

@ -0,0 +1,29 @@
<?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" />
<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
.idea/bld.iml generated Normal file
View file

@ -0,0 +1,14 @@
<?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>

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CheckStyle-IDEA">
<option name="configuration">
<map>
<entry key="active-configuration" value="LOCAL_FILE:$PROJECT_DIR$/config/checkstyle/checkstyle.xml:Erik's Checks" />
<entry key="checkstyle-version" value="8.19" />
<entry key="copy-libs" value="true" />
<entry key="location-0" value="BUNDLED:(bundled):Sun Checks" />
<entry key="location-1" value="BUNDLED:(bundled):Google Checks" />
<entry key="location-2" value="LOCAL_FILE:$PROJECT_DIR$/config/checkstyle/checkstyle.xml:Erik's Checks" />
<entry key="scan-before-checkin" value="false" />
<entry key="scanscope" value="JavaOnlyWithTests" />
<entry key="suppress-errors" value="false" />
</map>
</option>
</component>
</project>

View file

@ -1,6 +0,0 @@
This folder contains libraries copied from the "semver" project.
It is managed by the CheckStyle-IDEA IDE plugin.
Do not modify this folder while the IDE is running.
When the IDE is stopped, you may delete this folder at any time. It will be recreated as needed.
In order to prevent the CheckStyle-IDEA IDE plugin from creating this folder,
uncheck the "Copy libraries from project directory" option in the CheckStyle-IDEA settings dialog.

View file

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Erik's Code Style" />
</state>
</component>

10
.idea/compiler.xml generated
View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel>
<module name="example_annotationProcessor" target="1.8" />
<module name="example_main" target="1.8" />
<module name="example_test" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>

6
.idea/copyright/BSD_3_Clause.xml generated Normal file
View file

@ -0,0 +1,6 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="&amp;#36;file.fileName&#10;&#10;Copyright 2016=&amp;#36;today.year Erik C. Thauvin (erik@thauvin.net)&#10;All rights reserved.&#10;&#10;Redistribution and use in source and binary forms, with or without&#10;modification, are permitted provided that the following conditions are met:&#10;&#10; Redistributions of source code must retain the above copyright notice, this&#10; list of conditions and the following disclaimer.&#10;&#10; Redistributions in binary form must reproduce the above copyright notice,&#10; this list of conditions and the following disclaimer in the documentation&#10; and/or other materials provided with the distribution.&#10;&#10; Neither the name of this project nor the names of its contributors may be&#10; used to endorse or promote products derived from this software without&#10; specific prior written permission.&#10;&#10;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;&#10;AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE&#10;IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE&#10;DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE&#10;FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL&#10;DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR&#10;SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER&#10;CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,&#10;OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE&#10;OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." />
<option name="myName" value="BSD-3 Clause" />
</copyright>
</component>

View file

@ -1,6 +0,0 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="&amp;#36;file.fileName&#10;&#10;Copyright (c) 2016-&amp;#36;today.year, Erik C. Thauvin (erik@thauvin.net)&#10;All rights reserved.&#10;&#10;Redistribution and use in source and binary forms, with or without&#10;modification, are permitted provided that the following conditions are met:&#10;&#10; Redistributions of source code must retain the above copyright notice, this&#10; list of conditions and the following disclaimer.&#10;&#10; Redistributions in binary form must reproduce the above copyright notice,&#10; this list of conditions and the following disclaimer in the documentation&#10; and/or other materials provided with the distribution.&#10;&#10; Neither the name of this project nor the names of its contributors may be&#10; used to endorse or promote products derived from this software without&#10; specific prior written permission.&#10;&#10;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;&#10;AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE&#10;IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE&#10;DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE&#10;FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL&#10;DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR&#10;SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER&#10;CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,&#10;OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE&#10;OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." />
<option name="myName" value="Erik's Copyright Notice" />
</copyright>
</component>

View file

@ -1,7 +0,0 @@
<component name="CopyrightManager">
<settings>
<module2copyright>
<element module="Copyright" copyright="Erik's Copyright Notice" />
</module2copyright>
</settings>
</component>

6
.idea/encodings.xml generated
View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View file

@ -0,0 +1,8 @@
<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,created.on" />
</inspection_tool>
</profile>
</component>

View file

@ -1,7 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Erik's Default" />
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

View file

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenLocal" />
<option name="name" value="MavenLocal" />
<option name="url" value="file:/$MAVEN_REPOSITORY$/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
</component>
</project>

7
.idea/kotlinc.xml generated
View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Kotlin2JsCompilerArguments">
<option name="sourceMapEmbedSources" />
<option name="sourceMapPrefix" />
</component>
</project>

17
.idea/libraries/bld.xml generated Normal file
View file

@ -0,0 +1,17 @@
<component name="libraryTable">
<library name="bld">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.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>

13
.idea/libraries/compile.xml generated Normal file
View file

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="compile">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/compile" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/compile" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
</library>
</component>

14
.idea/libraries/runtime.xml generated Normal file
View file

@ -0,0 +1,14 @@
<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="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
</library>
</component>

14
.idea/libraries/test.xml generated Normal file
View file

@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="test">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/test" />
<root url="file://$PROJECT_DIR$/src/test/resources" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/test" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
</library>
</component>

25
.idea/misc.xml generated
View file

@ -1,26 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="EntryPointsManager">
<component name="FrameworkDetectionExcludesConfiguration"> <pattern value="net.thauvin.erik.semver.SemverBuild" method="jacoco" />
<file type="web" url="file://$PROJECT_DIR$" /> <pattern value="net.thauvin.erik.semver.SemverBuild" method="pmd" />
</component>
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component> </component>
<component name="PDMPlugin"> <component name="PDMPlugin">
<option name="customRuleSets"> <option name="skipTestSources" value="false" />
<list>
<option value="K:\java\semver\config\pmd.xml" />
</list>
</option>
<option name="options">
<map>
<entry key="Encoding" value="" />
<entry key="Target JDK" value="1.8" />
</map>
</option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/build" />
</component> </component>
</project> </project>

9
.idea/modules.xml generated Normal file
View file

@ -0,0 +1,9 @@
<?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>

View file

@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="kotlin-language" name="Kotlin">
<configuration version="3" platform="JVM 1.6" allPlatforms="JVM [1.6]" useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-Xallow-no-source-files" />
</compilerSettings>
<compilerArguments>
<option name="destination" value="$MODULE_DIR$/../../examples/kotlin/build/classes/kotlin/main" />
<option name="classpath" value="$MAVEN_REPOSITORY$/net/thauvin/erik/semver/1.2.0/semver-1.2.0.jar;C:/Users/erik/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.41/e24bd38de28a326cce8b1f0d61e809e9a92dad6a/kotlin-stdlib-1.3.41.jar;C:/Users/erik/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.41/2ecf4aa059427d7186312fd1736afedf7972e7f7/kotlin-stdlib-common-1.3.41.jar;K:/maven/repository/org/jetbrains/annotations/13.0/annotations-13.0.jar" />
<option name="noStdlib" value="true" />
<option name="noReflect" value="true" />
<option name="moduleName" value="examples-kotlin" />
<option name="languageVersion" value="1.3" />
<option name="apiVersion" value="1.3" />
<option name="pluginOptions">
<array />
</option>
<option name="pluginClasspaths">
<array>
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-compiler-embeddable/1.3.41/6b1d4385d65894e07a0d14a5949f5417a408f0b7/kotlin-compiler-embeddable-1.3.41.jar" />
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.3.41/8fb58b8954661de666e321478bf4178c18ce8018/kotlin-reflect-1.3.41.jar" />
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-script-runtime/1.3.41/bcc3380041bbba171119c22d7024961b60da69e0/kotlin-script-runtime-1.3.41.jar" />
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-scripting-common/1.3.41/f5200923717f821267ed450728e13680b9065f2e/kotlin-scripting-common-1.3.41.jar" />
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-scripting-jvm/1.3.41/5fe615a9cf0ae74bd99f302c2cdc92556ea960ea/kotlin-scripting-jvm-1.3.41.jar" />
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.41/2ecf4aa059427d7186312fd1736afedf7972e7f7/kotlin-stdlib-common-1.3.41.jar" />
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.41/e24bd38de28a326cce8b1f0d61e809e9a92dad6a/kotlin-stdlib-1.3.41.jar" />
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.1.1/3d2b7321cdef9ebf9cb7729ea4f75a6f6457df86/kotlinx-coroutines-core-1.1.1.jar" />
<option value="$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar" />
<option value="$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/trove4j/1.0.20181211/trove4j-1.0.20181211.jar" />
</array>
</option>
<option name="errors">
<ArgumentParseErrors />
</option>
</compilerArguments>
</configuration>
</facet>
</component>
</module>

View file

@ -1,48 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="kotlin-language" name="Kotlin">
<configuration version="3" platform="JVM 1.6" allPlatforms="JVM [1.6]" useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-Xallow-no-source-files" />
</compilerSettings>
<compilerArguments>
<option name="destination" value="$MODULE_DIR$/../../examples/kotlin/build/classes/kotlin/test" />
<option name="classpath" value="$MODULE_DIR$/../../examples/kotlin/build/classes/java/main;K:/java/semver/examples/kotlin/build/classes/kotlin/main;K:/java/semver/examples/kotlin/build/tmp/kapt3/classes/main;K:/maven/repository/net/thauvin/erik/semver/1.2.0/semver-1.2.0.jar;C:/Users/erik/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.41/e24bd38de28a326cce8b1f0d61e809e9a92dad6a/kotlin-stdlib-1.3.41.jar;C:/Users/erik/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.41/2ecf4aa059427d7186312fd1736afedf7972e7f7/kotlin-stdlib-common-1.3.41.jar;K:/maven/repository/org/jetbrains/annotations/13.0/annotations-13.0.jar" />
<option name="noStdlib" value="true" />
<option name="noReflect" value="true" />
<option name="moduleName" value="examples-kotlin" />
<option name="friendPaths">
<array>
<option value="$MODULE_DIR$/../../examples/kotlin/build/tmp/kapt3/classes/main" />
<option value="$MODULE_DIR$/../../examples/kotlin/build/classes/java/main" />
<option value="$MODULE_DIR$/../../examples/kotlin/build/classes/kotlin/main" />
</array>
</option>
<option name="languageVersion" value="1.3" />
<option name="apiVersion" value="1.3" />
<option name="pluginOptions">
<array />
</option>
<option name="pluginClasspaths">
<array>
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-compiler-embeddable/1.3.41/6b1d4385d65894e07a0d14a5949f5417a408f0b7/kotlin-compiler-embeddable-1.3.41.jar" />
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.3.41/8fb58b8954661de666e321478bf4178c18ce8018/kotlin-reflect-1.3.41.jar" />
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-script-runtime/1.3.41/bcc3380041bbba171119c22d7024961b60da69e0/kotlin-script-runtime-1.3.41.jar" />
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-scripting-common/1.3.41/f5200923717f821267ed450728e13680b9065f2e/kotlin-scripting-common-1.3.41.jar" />
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-scripting-jvm/1.3.41/5fe615a9cf0ae74bd99f302c2cdc92556ea960ea/kotlin-scripting-jvm-1.3.41.jar" />
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.41/2ecf4aa059427d7186312fd1736afedf7972e7f7/kotlin-stdlib-common-1.3.41.jar" />
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.41/e24bd38de28a326cce8b1f0d61e809e9a92dad6a/kotlin-stdlib-1.3.41.jar" />
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.1.1/3d2b7321cdef9ebf9cb7729ea4f75a6f6457df86/kotlinx-coroutines-core-1.1.1.jar" />
<option value="$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar" />
<option value="$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/trove4j/1.0.20181211/trove4j-1.0.20181211.jar" />
</array>
</option>
<option name="errors">
<ArgumentParseErrors />
</option>
</compilerArguments>
</configuration>
</facet>
</component>
</module>

9
.idea/runConfigurations/Run Tests.xml generated Normal file
View file

@ -0,0 +1,9 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Tests" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="net.thauvin.erik.semver.SemVerTest" />
<module name="app" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View file

@ -1,3 +0,0 @@
<component name="DependencyValidationManager">
<scope name="Copyright" pattern="file[semver_main]:*.java/||file[semver_test]:*.java/" />
</component>

2
.idea/semver.iml generated
View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />

2
.idea/vcs.xml generated
View file

@ -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="$PROJECT_DIR$" vcs="Git" /> <mapping directory="" vcs="Git" />
</component> </component>
</project> </project>

View file

@ -1,18 +0,0 @@
language: java
dist: trusty
jdk:
- oraclejdk8
addons:
sonarcloud:
organization: "ethauvin-github"
before_install:
- chmod +x gradlew
after_success:
- |
if [ "${TRAVIS_TEST_RESULT}" == 0 ]; then
./gradlew sonarqube
fi

11
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Run Tests",
"request": "launch",
"mainClass": "net.thauvin.erik.semver.SemverTest"
}
]
}

15
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,15 @@
{
"java.project.sourcePaths": [
"src/main/java",
"src/main/resources",
"src/test/java",
"src/bld/java"
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
"${HOME}/.bld/dist/bld-1.7.1.jar",
"lib/compile/*.jar",
"lib/runtime/*.jar",
"lib/test/*.jar"
]
}

View file

@ -1,6 +1,19 @@
# Change Log # Changelog
## [1.2.1](https://github.com/ethauvin/semver/tree/1.2.1) (2021-04-29)
[Full Changelog](https://github.com/ethauvin/semver/compare/1.2.0...1.2.1)
**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) ## [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) [Full Changelog](https://github.com/ethauvin/semver/compare/1.1.1...1.2.0)
**Implemented enhancements:** **Implemented enhancements:**
@ -12,40 +25,51 @@
**Fixed bugs:** **Fixed bugs:**
- Default template is not found in 1.1.1 [\#5](https://github.com/ethauvin/semver/issues/5) - Default template is not found in 1.1.1 [\#5](https://github.com/ethauvin/semver/issues/5)
- 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)
## [1.1.1](https://github.com/ethauvin/semver/tree/1.1.1) (2019-03-31) ## [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) [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) ## [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) [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) ## [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) [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) ## [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) [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) ## [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) [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) ## [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) [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) ## [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) [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) ## [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) [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) ## [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) [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) ## [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) [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) ## [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 Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*

View file

@ -1,4 +1,4 @@
Copyright (c) 2016-2020, Erik C. Thauvin (erik@thauvin.net) Copyright (c) 2016-2023, 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

View file

@ -1,9 +1,18 @@
# Semantic Version Annotation Processor # Semantic Version Annotation Processor
[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause) [![release](https://img.shields.io/github/release/ethauvin/semver.svg)](https://github.com/ethauvin/semver/releases/latest) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver) [ ![Download](https://api.bintray.com/packages/ethauvin/maven/SemVer/images/download.svg) ](https://bintray.com/ethauvin/maven/SemVer/_latestVersion)\ [![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](https://opensource.org/licenses/BSD-3-Clause)
[![Known Vulnerabilities](https://snyk.io/test/github/ethauvin/semver/badge.svg?targetFile=build.gradle)](https://snyk.io/test/github/ethauvin/semver?targetFile=build.gradle) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ethauvin_semver&metric=alert_status)](https://sonarcloud.io/dashboard?id=ethauvin_semver) [![Build Status](https://travis-ci.com/ethauvin/semver.svg?branch=master)](https://travis-ci.com/ethauvin/semver) [![Build status](https://ci.appveyor.com/api/projects/status/nbv4mxd1gpxtx69o?svg=true)](https://ci.appveyor.com/project/ethauvin/semver) [![CircleCI](https://circleci.com/gh/ethauvin/semver/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/semver/tree/master) [![Java](https://img.shields.io/badge/java-17%2B-blue)](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
[![bld](https://img.shields.io/badge/1.7.1-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld)
[![release](https://img.shields.io/github/release/ethauvin/semver.svg)](https://github.com/ethauvin/semver/releases/latest)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver)
![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/net.thauvin.erik.httpstatus/httpstatus?server=https%3A%2F%2Foss.sonatype.org)
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](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). [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ethauvin_semver&metric=alert_status)](https://sonarcloud.io/dashboard?id=ethauvin_semver)
[![GitHub CI](https://github.com/ethauvin/semver/actions/workflows/gradle.yml/badge.svg)](https://github.com/ethauvin/semver/actions/workflows/gradle.yml)
[![Build status](https://ci.appveyor.com/api/projects/status/nbv4mxd1gpxtx69o?svg=true)](https://ci.appveyor.com/project/ethauvin/semver)
[![CircleCI](https://circleci.com/gh/ethauvin/semver/tree/master.svg?style=shield)](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) and works well in conjunction with the [__Semantic Version Plugin for Gradle__](https://github.com/ethauvin/semver-gradle). 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).
@ -200,6 +209,10 @@ mvn verify
To install and run from [Gradle](https://gradle.org/), add the following to [build.gradle](https://github.com/ethauvin/semver/blob/master/examples/java/build.gradle): To install and run from [Gradle](https://gradle.org/), add the following to [build.gradle](https://github.com/ethauvin/semver/blob/master/examples/java/build.gradle):
```gradle ```gradle
repositories {
mavenCentral()
}
dependencies { dependencies {
annotationProcessor 'net.thauvin.erik:semver:1.2.0' annotationProcessor 'net.thauvin.erik:semver:1.2.0'
compileOnly 'net.thauvin.erik:semver:1.2.0' compileOnly 'net.thauvin.erik:semver:1.2.0'
@ -222,7 +235,7 @@ In order to also incorporate the generated source code into the `source tree`, a
```gradle ```gradle
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java") options.generatedSourceOutputDirectory.set(file("${projectDir}/src/generated/java"))
} }
``` ```

View file

@ -1,3 +1,6 @@
image:
- Visual Studio 2022
version: "{branch} {build}" version: "{branch} {build}"
skip_tags: true skip_tags: true
@ -5,22 +8,20 @@ build:
verbosity: detailed verbosity: detailed
build_script: build_script:
- gradlew.bat assemble --info --no-daemon - bld.bat download compile
test_script: test_script:
- gradlew.bat check --info --no-daemon - bld.bat test
branches: branches:
only: only:
- master - master
- 1.2.1-dev
cache:
- C:\Users\appveyor\.gradle
environment: environment:
matrix: matrix:
- JAVA_HOME: C:\Program Files\Java\jdk1.8.0 - JAVA_HOME: C:\Program Files\Java\jdk17
- JAVA_HOME: C:\Program Files (x86)\Java\jdk1.8.0 - JAVA_HOME: C:\Program Files\Java\jdk20
matrix: matrix:
fast_finish: true fast_finish: true

View file

@ -0,0 +1,33 @@
#
# 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.

View file

@ -0,0 +1,12 @@
<!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>

View file

@ -0,0 +1,38 @@
/*
* 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}}"
}

34
bin/main/semver.mustache Normal file
View file

@ -0,0 +1,34 @@
/*
* 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.

2
bld Executable file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env sh
java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build net.thauvin.erik.semver.SemverBuild "$@"

4
bld.bat Normal file
View file

@ -0,0 +1,4 @@
@echo off
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
java -jar "%DIRNAME%/lib/bld/bld-wrapper.jar" "%0" --build net.thauvin.erik.semver.SemverBuild %*

View file

@ -1,239 +0,0 @@
plugins {
id 'checkstyle'
id 'java'
id 'jacoco'
id 'maven-publish'
id 'pmd'
id 'com.jfrog.bintray' version '1.8.5'
id 'com.github.ben-manes.versions' version '0.28.0'
id 'net.thauvin.erik.gradle.semver' version '1.0.4'
id 'com.github.spotbugs' version '4.4.4'
id 'org.sonarqube' version '3.0'
}
import com.github.spotbugs.snom.SpotBugsTask
import org.apache.tools.ant.taskdefs.condition.Os
defaultTasks 'check'
group = 'net.thauvin.erik'
final def mavenName = 'SemVer'
final def mavenDescription = 'Semantic Version Annotation Processor'
final def mavenUrl = 'https://github.com/ethauvin/semver'
final def mavenLicense = 'The BSD 3-Clause License'
final def mavenLicenseUrl = 'http://opensource.org/licenses/BSD-3-Clause'
final def mavenScmCon = 'https://github.com/ethauvin/semver.git'
final def mavenScmDevCon = 'git@github.com:ethauvin/semver.git'
final def pkgLicenses = ['BSD 3-Clause']
final def pkgIssueTrackerUrl = mavenUrl + '/issues'
final def pkgLabels = ['java', 'kotlin', 'annotation', 'processor', 'semantic', 'version']
ext.versions = [
spotbugs: '4.0.6'
]
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
dependencies {
implementation 'com.github.spullara.mustache.java:compiler:0.9.6'
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.10.1'
spotbugsPlugins 'com.mebigfatguy.sb-contrib:sb-contrib:7.4.7'
compileOnly "com.github.spotbugs:spotbugs-annotations:$versions.spotbugs"
testCompileOnly "com.github.spotbugs:spotbugs-annotations:$versions.spotbugs"
testImplementation 'org.testng:testng:7.2.0'
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
pmd {
ignoreFailures = true
ruleSets = []
ruleSetFiles = files("${projectDir}/config/pmd.xml")
consoleOutput = true
}
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 = false
pkg {
repo = 'maven'
name = mavenName
licenses = pkgLicenses
desc = mavenDescription
//released = new Date()
websiteUrl = mavenUrl
issueTrackerUrl = pkgIssueTrackerUrl
vcsUrl = mavenScmCon
labels = pkgLabels
publicDownloadNumbers = true
version {
gpg { sign = true }
}
}
}
bintrayUpload {
versionName = "$project.version"
versionDesc = "$mavenName $project.version"
versionVcsTag = "$project.version"
versionReleased = new Date()
}
task javadocJar(type: Jar, dependsOn: javadoc) {
group = 'Build'
description = 'Builds an archive of the javadoc docs.'
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}
task sourceJar(type: Jar) {
group = 'Build'
description = 'Builds an archive of the source code.'
archiveClassifier.set('sources')
from sourceSets.main.allSource
}
artifacts {
archives javadocJar
archives sourceJar
}
publishing {
publications {
MyPublication(MavenPublication) {
from components.java
artifact sourceJar
artifact javadocJar
groupId project.group
artifactId rootProject.name
pom {
name = mavenName
description = mavenDescription
url = mavenUrl
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
}
}
}
}
}
javadoc {
doFirst {
title = "$mavenDescription $project.version API"
}
options.with {
tags = ['created']
author = true
//addBooleanOption('html4', true)
links('https://docs.oracle.com/javase/8/docs/api/')
//addStringOption('Xdoclint:none', '-quiet')
}
}
test {
useTestNG()
}
spotbugs {
toolVersion = versions.spotbugs
excludeFilter = file("$projectDir/config/spotbugs/excludeFilter.xml")
}
tasks.withType(SpotBugsTask) {
reports {
xml.enabled = false
html.enabled = true
}
}
tasks.withType(Checkstyle) {
reports {
xml.enabled = false
html.enabled = true
}
}
task release(dependsOn: ['wrapper', 'clean', 'publishToMavenLocal']) {
group = 'Publishing'
description = 'Releases new version to local maven repository.'
doFirst {
println("Version: $version")
}
}
task pandoc(type: Exec) {
group = 'Documentation'
def pandoc_args = ['--from', 'gfm',
'--to', 'html5',
'--metadata', "pagetitle=$mavenDescription",
'-s',
'-c', 'github-pandoc.css',
'-o', 'docs/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()
}
}
jacocoTestReport {
reports {
html.enabled = true
xml.enabled = true
}
}
sonarqube {
properties {
property("sonar.projectKey", "ethauvin_semver")
property("sonar.sourceEncoding", "UTF-8")
}
}
tasks.sonarqube {
dependsOn("jacocoTestReport")
}

View file

@ -1,277 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--
Checkstyle configuration that checks the Google coding conventions from Google Java Style
that can be found at https://google.github.io/styleguide/javaguide.html.
Checkstyle is very configurable. Be sure to read the documentation at
http://checkstyle.sf.net (or in your downloaded distribution).
To completely disable a check, just comment it out or delete it from the file.
Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov.
-->
<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="warning"/>
<property name="fileExtensions" value="java, properties, xml"/>
<!-- Excludes all 'module-info.java' files -->
<!-- See https://checkstyle.org/config_filefilters.html -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="LineLength">
<property name="max" value="120"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="SuppressWarningsFilter"/>
<module name="SuppressWithPlainTextCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE_OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE_ON"/>
<property name="checkFormat"
value="^((?!(FileTabCharacterCheck)).)*$"/>
</module>
<module name="TreeWalker">
<module name="SuppressWarningsHolder"/>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE_OFF: ALMOST_ALL"/>
<property name="onCommentFormat" value="CHECKSTYLE_ON: ALMOST_ALL"/>
<property name="checkFormat" value="^((?!(EqualsHashCode)).)*$"/>
</module>
<module name="OuterTypeFilename"/>
<module name="IllegalTokenText">
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
<property name="format"
value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
<property name="message"
value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
</module>
<module name="AvoidEscapedUnicodeCharacters">
<property name="allowEscapesForControlCharacters" value="true"/>
<property name="allowByTailComment" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<module name="AvoidStarImport"/>
<module name="OneTopLevelClass"/>
<module name="NoLineWrap"/>
<module name="EmptyBlock">
<property name="option" value="TEXT"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module>
<module name="NeedBraces"/>
<module name="LeftCurly"/>
<module name="RightCurly">
<property name="id" value="RightCurlySame"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
LITERAL_DO"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlyAlone"/>
<property name="option" value="alone"/>
<property name="tokens"
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
INSTANCE_INIT"/>
</module>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyLambdas" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
<message key="ws.notFollowed"
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
<message key="ws.notPreceded"
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module>
<module name="OneStatementPerLine"/>
<module name="MultipleVariableDeclarations"/>
<module name="ArrayTypeStyle"/>
<module name="MissingSwitchDefault"/>
<module name="FallThrough"/>
<module name="UpperEll"/>
<module name="ModifierOrder"/>
<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapDot"/>
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapComma"/>
<property name="tokens" value="COMMA"/>
<property name="option" value="EOL"/>
</module>
<module name="SeparatorWrap">
<!-- ELLIPSIS is EOL until https://github.com/google/styleguide/issues/258 -->
<property name="id" value="SeparatorWrapEllipsis"/>
<property name="tokens" value="ELLIPSIS"/>
<property name="option" value="EOL"/>
</module>
<module name="SeparatorWrap">
<!-- ARRAY_DECLARATOR is EOL until https://github.com/google/styleguide/issues/259 -->
<property name="id" value="SeparatorWrapArrayDeclarator"/>
<property name="tokens" value="ARRAY_DECLARATOR"/>
<property name="option" value="EOL"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapMethodRef"/>
<property name="tokens" value="METHOD_REF"/>
<property name="option" value="nl"/>
</module>
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
<message key="name.invalidPattern"
value="Package name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="TypeName">
<message key="name.invalidPattern"
value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MemberName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<message key="name.invalidPattern"
value="Member name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="LambdaParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="CatchParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="LocalVariableName">
<property name="tokens" value="VARIABLE_DEF"/>
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ClassTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Class type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Method type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="InterfaceTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Interface type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="NoFinalizer"/>
<module name="GenericWhitespace">
<message key="ws.followed"
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
<message key="ws.preceded"
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
<message key="ws.illegalFollow"
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
<message key="ws.notPreceded"
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
</module>
<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="braceAdjustment" value="0"/>
<property name="caseIndent" value="4"/>
<property name="throwsIndent" value="4"/>
<property name="lineWrappingIndentation" value="4"/>
<property name="arrayInitIndent" value="4"/>
</module>
<module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="1"/>
</module>
<module name="OverloadMethodsDeclarationOrder"/>
<module name="VariableDeclarationUsageDistance"/>
<module name="CustomImportOrder">
<property name="customImportOrderRules"
value="THIRD_PARTY_PACKAGE###SPECIAL_IMPORTS###STANDARD_JAVA_PACKAGE###STATIC"/>
<property name="specialImportsRegExp" value="^javax\."/>
<property name="standardPackageRegExp" value="^java\."/>
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="separateLineBetweenGroups" value="false"/>
</module>
<module name="MethodParamPad"/>
<module name="NoWhitespaceBefore">
<property name="tokens"
value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, METHOD_REF"/>
<property name="allowLineBreaks" value="true"/>
</module>
<module name="ParenPad"/>
<module name="OperatorWrap">
<property name="option" value="NL"/>
<property name="tokens"
value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR,
LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/>
</module>
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationMostCases"/>
<property name="tokens"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
</module>
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationVariables"/>
<property name="tokens" value="VARIABLE_DEF"/>
<property name="allowSamelineMultipleAnnotations" value="true"/>
</module>
<module name="NonEmptyAtclauseDescription"/>
<module name="JavadocTagContinuationIndentation"/>
<module name="SummaryJavadoc">
<property name="forbiddenSummaryFragments"
value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
</module>
<module name="JavadocParagraph"/>
<module name="AtclauseOrder">
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
<property name="target"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
</module>
<module name="JavadocMethod">
<property name="scope" value="public"/>
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
<property name="allowedAnnotations" value="Override, Test"/>
</module>
<module name="MethodName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
<message key="name.invalidPattern"
value="Method name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="SingleLineJavadoc">
<property name="ignoreInlineTags" value="false"/>
</module>
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="expected"/>
</module>
<!-- <module name="CommentsIndentation"/> -->
</module>
</module>

View file

@ -5,111 +5,76 @@
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd"> xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
<description>Erik's Ruleset</description> <description>Erik's Ruleset</description>
<!-- BEST PRACTICES --> <!-- BEST PRACTICES -->
<!-- <rule ref="category/java/bestpractices.xml/AvoidStringBufferField"/>--> <rule ref="category/java/bestpractices.xml">
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP"/> <exclude name="AvoidPrintStackTrace"/>
<rule ref="category/java/bestpractices.xml/CheckResultSet"/> <exclude name="JUnit4TestShouldUseTestAnnotation"/>
<rule ref="category/java/bestpractices.xml/ConstantsInInterface"/> <exclude name="JUnitTestContainsTooManyAsserts"/>
<rule ref="category/java/bestpractices.xml/DefaultLabelNotLastInSwitchStmt"/> </rule>
<rule ref="category/java/bestpractices.xml/ForLoopCanBeForeach"/>
<rule ref="category/java/bestpractices.xml/GuardLogStatement"/>
<!-- <rule ref="category/java/bestpractices.xml/LooseCoupling"/> -->
<rule ref="category/java/bestpractices.xml/MethodReturnsInternalArray"/>
<rule ref="category/java/bestpractices.xml/MissingOverride"> <rule ref="category/java/bestpractices.xml/MissingOverride">
<properties> <properties>
<property name="violationSuppressXPath" <property name="violationSuppressXPath"
value="./MethodDeclarator[@Image='hashCode' or @Image='equals' or @Image='toString']"/> value="//MethodDeclaration[@Name='hashCode' or @Name='equals' or @Name='toString']"/>
</properties> </properties>
</rule> </rule>
<rule ref="category/java/bestpractices.xml/PositionLiteralsFirstInCaseInsensitiveComparisons"/>
<rule ref="category/java/bestpractices.xml/PositionLiteralsFirstInComparisons"/>
<rule ref="category/java/bestpractices.xml/PreserveStackTrace"/>
<rule ref="category/java/bestpractices.xml/ReplaceEnumerationWithIterator"/>
<!-- <rule ref="category/java/bestpractices.xml/ReplaceHashtableWithMap"/>
<rule ref="category/java/bestpractices.xml/ReplaceVectorWithList"/> -->
<rule ref="category/java/bestpractices.xml/SwitchStmtsShouldHaveDefault"/>
<rule ref="category/java/bestpractices.xml/SystemPrintln"/>
<rule ref="category/java/bestpractices.xml/UnusedFormalParameter"/>
<rule ref="category/java/bestpractices.xml/UnusedImports"/>
<rule ref="category/java/bestpractices.xml/UnusedLocalVariable"/>
<rule ref="category/java/bestpractices.xml/UnusedPrivateField"/>
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod"/>
<rule ref="category/java/bestpractices.xml/UseAssertEqualsInsteadOfAssertTrue"/>
<rule ref="category/java/bestpractices.xml/UseAssertNullInsteadOfAssertTrue"/>
<rule ref="category/java/bestpractices.xml/UseAssertSameInsteadOfAssertTrue"/>
<rule ref="category/java/bestpractices.xml/UseAssertTrueInsteadOfAssertEquals"/>
<rule ref="category/java/bestpractices.xml/UseCollectionIsEmpty"/>
<rule ref="category/java/bestpractices.xml/UseVarargs"/>
<!-- NAMING CONVENTIONS --> <!-- CODE STYLE -->
<rule ref="category/java/codestyle.xml/FormalParameterNamingConventions"/> <rule ref="category/java/codestyle.xml">
<rule ref="category/java/codestyle.xml/GenericsNaming"/> <exclude name="AtLeastOneConstructor"/>
<rule ref="category/java/codestyle.xml/LocalVariableNamingConventions"/> <exclude name="ClassNamingConventions"/>
<rule ref="category/java/codestyle.xml/MethodNamingConventions"/> <exclude name="ConfusingTernary"/>
<!-- <rule ref="category/java/codestyle.xml/PackageCase"/>--> <exclude name="CommentDefaultAccessModifier"/>
<exclude name="FieldNamingConventions"/>
<exclude name="LongVariable"/>
<!-- OTHER --> <exclude name="OnlyOneReturn"/>
<rule ref="category/java/codestyle.xml/AvoidDollarSigns"/> <exclude name="PackageCase"/>
<rule ref="category/java/codestyle.xml/AvoidProtectedFieldInFinalClass"/> <exclude name="ShortClassName"/>
<rule ref="category/java/codestyle.xml/AvoidProtectedMethodInFinalClassNotExtending"/> <exclude name="ShortMethodName"/>
<rule ref="category/java/codestyle.xml/AvoidUsingNativeCode"/> <exclude name="ShortVariable"/>
<rule ref="category/java/codestyle.xml/BooleanGetMethodName"/> <exclude name="UselessParentheses"/>
<rule ref="category/java/codestyle.xml/CallSuperInConstructor"/> <exclude name="UseUnderscoresInNumericLiterals"/>
<rule ref="category/java/codestyle.xml/ControlStatementBraces"/> </rule>
<rule ref="category/java/codestyle.xml/DontImportJavaLang"/>
<rule ref="category/java/codestyle.xml/DuplicateImports"/>
<rule ref="category/java/codestyle.xml/EmptyMethodInAbstractClassShouldBeAbstract"/>
<rule ref="category/java/codestyle.xml/ExtendsObject"/>
<rule ref="category/java/codestyle.xml/FieldDeclarationsShouldBeAtStartOfClass"/>
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop"/>
<rule ref="category/java/codestyle.xml/IdenticalCatchBranches"/>
<rule ref="category/java/codestyle.xml/LocalVariableCouldBeFinal"/>
<rule ref="category/java/codestyle.xml/MethodArgumentCouldBeFinal"/>
<rule ref="category/java/codestyle.xml/NoPackage"/>
<rule ref="category/java/codestyle.xml/PrematureDeclaration"/>
<rule ref="category/java/codestyle.xml/TooManyStaticImports"/>
<rule ref="category/java/codestyle.xml/UnnecessaryAnnotationValueElement"/>
<rule ref="category/java/codestyle.xml/UnnecessaryConstructor"/>
<rule ref="category/java/codestyle.xml/UnnecessaryFullyQualifiedName"/>
<rule ref="category/java/codestyle.xml/UnnecessaryLocalBeforeReturn"/>
<rule ref="category/java/codestyle.xml/UnnecessaryReturn"/>
<rule ref="category/java/codestyle.xml/UselessQualifiedThis"/>
<!-- DESIGN --> <!-- DESIGN -->
<rule ref="category/java/design.xml/AbstractClassWithoutAnyMethod"/> <rule ref="category/java/design.xml">
<rule ref="category/java/design.xml/AvoidRethrowingException"/> <exclude name="AvoidCatchingGenericException"/>
<rule ref="category/java/design.xml/AvoidThrowingNewInstanceOfSameException"/> <exclude name="AvoidDeeplyNestedIfStmts"/>
<rule ref="category/java/design.xml/AvoidThrowingNullPointerException"/> <exclude name="AvoidUncheckedExceptionsInSignatures"/>
<rule ref="category/java/design.xml/AvoidThrowingRawExceptionTypes"/> <exclude name="CognitiveComplexity"/>
<rule ref="category/java/design.xml/ClassWithOnlyPrivateConstructorsShouldBeFinal"/> <exclude name="CyclomaticComplexity"/>
<rule ref="category/java/design.xml/CollapsibleIfStatements"/> <exclude name="ExcessiveClassLength"/>
<rule ref="category/java/design.xml/CouplingBetweenObjects"/> <exclude name="ExcessiveMethodLength"/>
<rule ref="category/java/design.xml/DataClass"/> <exclude name="ExcessiveParameterList"/>
<rule ref="category/java/design.xml/DoNotExtendJavaLangError"/> <exclude name="ExcessivePublicCount"/>
<rule ref="category/java/design.xml/ExceptionAsFlowControl"/> <exclude name="GodClass"/>
<!-- <rule ref="category/java/design.xml/ExcessivePublicCount"/>--> <exclude name="LawOfDemeter"/>
<rule ref="category/java/design.xml/FinalFieldCouldBeStatic"/> <exclude name="LoosePackageCoupling"/>
<rule ref="category/java/design.xml/ImmutableField"/> <exclude name="NPathComplexity"/>
<rule ref="category/java/design.xml/LogicInversion"/> <exclude name="NcssCount"/>
<rule ref="category/java/design.xml/SignatureDeclareThrowsException"/> <exclude name="TooManyFields"/>
<rule ref="category/java/design.xml/SimplifiedTernary"/> <exclude name="TooManyMethods"/>
<rule ref="category/java/design.xml/SimplifyBooleanAssertion"/> <exclude name="UseObjectForClearerAPI"/>
<rule ref="category/java/design.xml/SimplifyBooleanExpressions"/> </rule>
<rule ref="category/java/design.xml/SimplifyBooleanReturns"/>
<rule ref="category/java/design.xml/SimplifyConditional"/>
<rule ref="category/java/design.xml/SingularField"/>
<rule ref="category/java/design.xml/SwitchDensity"/>
<rule ref="category/java/design.xml/UselessOverridingMethod"/>
<rule ref="category/java/design.xml/UseUtilityClass"/>
<!-- DOCUMENTATION --> <!-- DOCUMENTATION -->
<rule ref="category/java/documentation.xml/UncommentedEmptyConstructor"/> <rule ref="category/java/documentation.xml">
<rule ref="category/java/documentation.xml/UncommentedEmptyMethodBody"/> <exclude name="CommentRequired"/>
<exclude name="CommentSize"/>
</rule>
<!-- ERROR PRONE --> <!-- 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="EmptyCatchBlock"/>
<exclude name="NullAssignment"/>
</rule>
<rule ref="category/java/errorprone.xml/AssignmentInOperand"> <rule ref="category/java/errorprone.xml/AssignmentInOperand">
<properties> <properties>
<property name="allowWhile" value="true"/> <property name="allowWhile" value="true"/>
@ -117,86 +82,11 @@
<property name="allowIf" value="true"/> <property name="allowIf" value="true"/>
</properties> </properties>
</rule> </rule>
<rule ref="category/java/errorprone.xml/AssignmentToNonFinalStatic"/>
<rule ref="category/java/errorprone.xml/AvoidAccessibilityAlteration"/>
<rule ref="category/java/errorprone.xml/AvoidAssertAsIdentifier"/>
<rule ref="category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop"/>
<rule ref="category/java/errorprone.xml/AvoidCallingFinalize"/>
<rule ref="category/java/errorprone.xml/AvoidCatchingThrowable"/>
<rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor"/>
<rule ref="category/java/errorprone.xml/AvoidDuplicateLiterals"> <rule ref="category/java/errorprone.xml/AvoidDuplicateLiterals">
<properties> <properties>
<property name="skipAnnotations" value="true"/> <property name="skipAnnotations" value="true"/>
</properties> </properties>
</rule> </rule>
<rule ref="category/java/errorprone.xml/AvoidEnumAsIdentifier"/>
<rule ref="category/java/errorprone.xml/AvoidInstanceofChecksInCatchClause"/>
<rule ref="category/java/errorprone.xml/AvoidLosingExceptionInformation"/>
<rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators"/>
<rule ref="category/java/errorprone.xml/AvoidUsingOctalValues"/>
<rule ref="category/java/errorprone.xml/BadComparison"/>
<rule ref="category/java/errorprone.xml/BrokenNullCheck"/>
<rule ref="category/java/errorprone.xml/CallSuperFirst"/>
<rule ref="category/java/errorprone.xml/CallSuperLast"/>
<rule ref="category/java/errorprone.xml/CheckSkipResult"/>
<rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray"/>
<rule ref="category/java/errorprone.xml/CloneMethodMustBePublic"/>
<rule ref="category/java/errorprone.xml/CloneMethodMustImplementCloneable"/>
<rule ref="category/java/errorprone.xml/CloneMethodReturnTypeMustMatchClassName"/>
<rule ref="category/java/errorprone.xml/CloneThrowsCloneNotSupportedException"/>
<rule ref="category/java/errorprone.xml/CloseResource"/>
<rule ref="category/java/errorprone.xml/CompareObjectsWithEquals"/>
<rule ref="category/java/errorprone.xml/ConstructorCallsOverridableMethod"/>>
<rule ref="category/java/errorprone.xml/DoNotCallGarbageCollectionExplicitly"/>
<rule ref="category/java/errorprone.xml/DoNotExtendJavaLangThrowable"/>
<rule ref="category/java/errorprone.xml/DoNotHardCodeSDCard"/>
<rule ref="category/java/errorprone.xml/DoNotThrowExceptionInFinally"/>
<rule ref="category/java/errorprone.xml/DontImportSun"/>
<rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices"/>
<rule ref="category/java/errorprone.xml/EqualsNull"/>
<rule ref="category/java/errorprone.xml/FinalizeDoesNotCallSuperFinalize"/>
<rule ref="category/java/errorprone.xml/FinalizeOnlyCallsSuperFinalize"/>
<rule ref="category/java/errorprone.xml/FinalizeOverloaded"/>
<rule ref="category/java/errorprone.xml/FinalizeShouldBeProtected"/>
<rule ref="category/java/errorprone.xml/IdempotentOperations"/>
<rule ref="category/java/errorprone.xml/ImportFromSamePackage"/>
<rule ref="category/java/errorprone.xml/InstantiationToGetClass"/>
<rule ref="category/java/errorprone.xml/InvalidLogMessageFormat"/>
<rule ref="category/java/errorprone.xml/JumbledIncrementer"/>
<rule ref="category/java/errorprone.xml/JUnitSpelling"/>
<rule ref="category/java/errorprone.xml/JUnitStaticSuite"/>
<rule ref="category/java/errorprone.xml/MethodWithSameNameAsEnclosingClass"/>
<rule ref="category/java/errorprone.xml/MisplacedNullCheck"/>
<rule ref="category/java/errorprone.xml/MissingBreakInSwitch"/>
<rule ref="category/java/errorprone.xml/MissingSerialVersionUID"/>
<rule ref="category/java/errorprone.xml/MissingStaticMethodInNonInstantiatableClass"/>
<rule ref="category/java/errorprone.xml/MoreThanOneLogger"/>
<rule ref="category/java/errorprone.xml/NonCaseLabelInSwitchStatement"/>
<rule ref="category/java/errorprone.xml/NonStaticInitializer"/>
<!-- <rule ref="category/java/errorprone.xml/NullAssignment"/>-->
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode"/>
<rule ref="category/java/errorprone.xml/ProperCloneImplementation"/>
<rule ref="category/java/errorprone.xml/ProperLogger"/>
<rule ref="category/java/errorprone.xml/ReturnEmptyArrayRatherThanNull"/>
<rule ref="category/java/errorprone.xml/ReturnFromFinallyBlock"/>
<rule ref="category/java/errorprone.xml/SimpleDateFormatNeedsLocale"/>
<rule ref="category/java/errorprone.xml/SingleMethodSingleton"/>
<rule ref="category/java/errorprone.xml/SingletonClassReturningNewInstance"/>
<rule ref="category/java/errorprone.xml/StaticEJBFieldShouldBeFinal"/>
<rule ref="category/java/errorprone.xml/StringBufferInstantiationWithChar"/>
<rule ref="category/java/errorprone.xml/SuspiciousEqualsMethodName"/>
<rule ref="category/java/errorprone.xml/SuspiciousHashcodeMethodName"/>
<rule ref="category/java/errorprone.xml/SuspiciousOctalEscape"/>
<rule ref="category/java/errorprone.xml/TestClassWithoutTestCases"/>
<rule ref="category/java/errorprone.xml/UnconditionalIfStatement"/>
<rule ref="category/java/errorprone.xml/UnnecessaryBooleanAssertion"/>
<rule ref="category/java/errorprone.xml/UnnecessaryCaseChange"/>
<rule ref="category/java/errorprone.xml/UnnecessaryConversionTemporary"/>
<rule ref="category/java/errorprone.xml/UnusedNullCheckInEquals"/>
<rule ref="category/java/errorprone.xml/UseCorrectExceptionLogging"/>
<rule ref="category/java/errorprone.xml/UseEqualsToCompareStrings"/>
<rule ref="category/java/errorprone.xml/UselessOperationOnImmutable"/>
<rule ref="category/java/errorprone.xml/UseLocaleWithCaseConversions"/>
<rule ref="category/java/errorprone.xml/EmptyCatchBlock"> <rule ref="category/java/errorprone.xml/EmptyCatchBlock">
<properties> <properties>
<property name="allowExceptionNameRegex"> <property name="allowExceptionNameRegex">
@ -204,61 +94,16 @@
</property> </property>
</properties> </properties>
</rule> </rule>
<rule ref="category/java/errorprone.xml/EmptyFinalizer"/>
<rule ref="category/java/errorprone.xml/EmptyFinallyBlock"/>
<rule ref="category/java/errorprone.xml/EmptyIfStmt"/>
<rule ref="category/java/errorprone.xml/EmptyInitializer"/>
<rule ref="category/java/errorprone.xml/EmptyStatementBlock"/>
<rule ref="category/java/errorprone.xml/EmptyStatementNotInLoop"/>
<rule ref="category/java/errorprone.xml/EmptySwitchStatements"/>
<rule ref="category/java/errorprone.xml/EmptySynchronizedBlock"/>
<rule ref="category/java/errorprone.xml/EmptyTryBlock"/>
<rule ref="category/java/errorprone.xml/EmptyWhileStmt"/>
<!-- MULTITHREADING --> <!-- MULTITHREADING -->
<rule ref="category/java/multithreading.xml/AvoidSynchronizedAtMethodLevel"/> <rule ref="category/java/multithreading.xml">
<rule ref="category/java/multithreading.xml/AvoidThreadGroup"/> </rule>
<rule ref="category/java/multithreading.xml/AvoidUsingVolatile"/>
<rule ref="category/java/multithreading.xml/DontCallThreadRun"/>
<rule ref="category/java/multithreading.xml/DoubleCheckedLocking"/>
<rule ref="category/java/multithreading.xml/NonThreadSafeSingleton"/>
<rule ref="category/java/multithreading.xml/UseConcurrentHashMap"/>
<rule ref="category/java/multithreading.xml/UseNotifyAllInsteadOfNotify"/>
<!-- PERFORMANCE --> <!-- PERFORMANCE -->
<rule ref="category/java/performance.xml/AddEmptyString"/> <rule ref="category/java/performance.xml">
<rule ref="category/java/performance.xml/AppendCharacterWithChar"/> </rule>
<rule ref="category/java/performance.xml/AvoidArrayLoops"/>
<rule ref="category/java/performance.xml/AvoidFileStream"/>
<rule ref="category/java/performance.xml/AvoidInstantiatingObjectsInLoops"/>
<rule ref="category/java/performance.xml/AvoidUsingShortType"/>
<rule ref="category/java/performance.xml/BigIntegerInstantiation"/>
<rule ref="category/java/performance.xml/BooleanInstantiation"/>
<rule ref="category/java/performance.xml/ByteInstantiation"/>
<rule ref="category/java/performance.xml/ConsecutiveAppendsShouldReuse"/>
<rule ref="category/java/performance.xml/ConsecutiveLiteralAppends"/>
<rule ref="category/java/performance.xml/InefficientEmptyStringCheck"/>
<rule ref="category/java/performance.xml/InefficientStringBuffering"/>
<rule ref="category/java/performance.xml/InsufficientStringBufferDeclaration"/>
<rule ref="category/java/performance.xml/IntegerInstantiation"/>
<rule ref="category/java/performance.xml/LongInstantiation"/>
<rule ref="category/java/performance.xml/OptimizableToArrayCall"/>
<rule ref="category/java/performance.xml/RedundantFieldInitializer"/>
<rule ref="category/java/performance.xml/SimplifyStartsWith"/>
<rule ref="category/java/performance.xml/ShortInstantiation"/>
<rule ref="category/java/performance.xml/StringInstantiation"/>
<rule ref="category/java/performance.xml/StringToString"/>
<rule ref="category/java/performance.xml/TooFewBranchesForASwitchStatement"/>
<rule ref="category/java/performance.xml/UnnecessaryWrapperObjectCreation"/>
<!-- <rule ref="category/java/performance.xml/UseArrayListInsteadOfVector"/> -->
<rule ref="category/java/performance.xml/UseArraysAsList"/>
<rule ref="category/java/performance.xml/UseIndexOfChar"/>
<rule ref="category/java/performance.xml/UselessStringValueOf"/>
<rule ref="category/java/performance.xml/UseStringBufferForStringAppends"/>
<rule ref="category/java/performance.xml/UseStringBufferLength"/>
<!-- SECURITY --> <!-- SECURITY -->
<rule ref="category/java/security.xml/HardCodedCryptoKey"/> <rule ref="category/java/security.xml">
<rule ref="category/java/security.xml/InsecureCryptoIv"/> </rule>
</ruleset> </ruleset>

View file

@ -6,85 +6,134 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>Semantic Version Annotation Processor</title> <title>Semantic Version Annotation Processor</title>
<style> <style>
code{white-space: pre-wrap;} code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;} span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;} div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{display: inline-block; vertical-align: top; width: 50%;} div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
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 { display: inline-block; 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> </style>
<style> <link rel="stylesheet" href="docs/github-pandoc.css" />
a.sourceLine { display: inline-block; line-height: 1.25; }
a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; }
a.sourceLine:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode { white-space: pre; position: relative; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
code.sourceCode { white-space: pre-wrap; }
a.sourceLine { text-indent: -1em; padding-left: 1em; }
}
pre.numberSource a.sourceLine
{ position: relative; left: -4em; }
pre.numberSource a.sourceLine::before
{ content: attr(title);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; pointer-events: all; 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 {
a.sourceLine::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 { } /* 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 { } /* 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="github-pandoc.css" />
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]--> <![endif]-->
</head> </head>
<body> <body>
<h1 id="semantic-version-annotation-processor">Semantic Version Annotation Processor</h1> <h1 id="semantic-version-annotation-processor">Semantic Version
<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://github.com/ethauvin/semver/releases/latest"><img src="https://img.shields.io/github/release/ethauvin/semver.svg" alt="release" /></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><br /> Annotation Processor</h1>
<a href="https://snyk.io/test/github/ethauvin/semver?targetFile=build.gradle"><img src="https://snyk.io/test/github/ethauvin/semver/badge.svg?targetFile=build.gradle" alt="Known Vulnerabilities" /></a> <a href="https://sonarcloud.io/dashboard?id=ethauvin_semver"><img src="https://sonarcloud.io/api/project_badges/measure?project=ethauvin_semver&amp;metric=alert_status" alt="Quality Gate 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://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><a href="https://opensource.org/licenses/BSD-3-Clause"><img
<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 <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> src="https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square"
<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> 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.7.1-FA9052?label=bld&amp;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://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> <img
src="https://img.shields.io/nexus/s/net.thauvin.erik.httpstatus/httpstatus?server=https%3A%2F%2Foss.sonatype.org"
alt="Sonatype Nexus (Snapshots)" /></p>
<p><a href="https://sonarcloud.io/dashboard?id=ethauvin_semver"><img
src="https://sonarcloud.io/api/project_badges/measure?project=ethauvin_semver&amp;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> <h2 id="table-of-contents">Table of Contents</h2>
<ul> <ul>
<li><a href="#examples">Examples</a></li> <li><a href="#examples">Examples</a></li>
@ -98,47 +147,63 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
<li><a href="#gradle">Gradle</a> <li><a href="#gradle">Gradle</a>
<ul> <ul>
<li><a href="#class-generation">Class Generation</a></li> <li><a href="#class-generation">Class Generation</a></li>
<li><a href="#class--source-generation">Class &amp; Source Generation</a></li> <li><a href="#class--source-generation">Class &amp; Source
Generation</a></li>
</ul></li> </ul></li>
<li><a href="#kotlin">Kotlin</a> <li><a href="#kotlin">Kotlin</a>
<ul> <ul>
<li><a href="#kotlin--gradle">Kotlin &amp; Gradle</a></li> <li><a href="#kotlin--gradle">Kotlin &amp; Gradle</a></li>
</ul></li> </ul></li>
<li><a href="#kobalt">Kobalt</a></li>
<li><a href="#auto-increment">Auto-Increment</a></li> <li><a href="#auto-increment">Auto-Increment</a></li>
</ul> </ul>
<h2 id="examples">Examples</h2> <h2 id="examples">Examples</h2>
<ul> <ul>
<li>Using annotation elements:</li> <li>Using annotation elements:</li>
</ul> </ul>
<div class="sourceCode" id="cb1"><pre class="sourceCode java"><code class="sourceCode java"><a class="sourceLine" id="cb1-1" title="1"><span class="kw">import</span><span class="im"> net.thauvin.erik.semver.Version;</span></a> <div class="sourceCode" id="cb1"><pre
<a class="sourceLine" id="cb1-2" title="2"></a> 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>
<a class="sourceLine" id="cb1-3" title="3"><span class="at">@Version</span>(major = <span class="dv">1</span>, minor = <span class="dv">0</span>, patch = <span class="dv">0</span>, preRelease = <span class="st">&quot;beta&quot;</span>)</a> <span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a></span>
<a class="sourceLine" id="cb1-4" title="4"><span class="kw">public</span> <span class="kw">class</span> A {</a> <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">1</span><span class="op">,</span> minor <span class="op">=</span> <span class="dv">0</span><span class="op">,</span> patch <span class="op">=</span> <span class="dv">0</span><span class="op">,</span> preRelease <span class="op">=</span> <span class="st">&quot;beta&quot;</span><span class="op">)</span></span>
<a class="sourceLine" id="cb1-5" title="5"><span class="co">// ...</span></a></code></pre></div> <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></code></pre></div>
<ul> <ul>
<li>Or using a <a href="hhttps://github.com/ethauvin/semver/blob/master/examples/java/version.properties">properties</a> file:</li> <li>Or using a <a
href="hhttps://github.com/ethauvin/semver/blob/master/examples/java/version.properties">properties</a>
file:</li>
</ul> </ul>
<div class="sourceCode" id="cb2"><pre class="sourceCode java"><code class="sourceCode java"><a class="sourceLine" id="cb2-1" title="1"><span class="kw">import</span><span class="im"> net.thauvin.erik.semver.Version;</span></a> <div class="sourceCode" id="cb2"><pre
<a class="sourceLine" id="cb2-2" title="2"></a> 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>
<a class="sourceLine" id="cb2-3" title="3"><span class="at">@Version</span>(properties = <span class="st">&quot;version.properties&quot;</span>)</a> <span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a></span>
<a class="sourceLine" id="cb2-4" title="4"><span class="kw">public</span> <span class="kw">class</span> A {</a> <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">&quot;version.properties&quot;</span><span class="op">)</span></span>
<a class="sourceLine" id="cb2-5" title="5"><span class="co">// ...</span></a></code></pre></div> <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>
<div class="sourceCode" id="cb3"><pre class="sourceCode ini"><code class="sourceCode ini"><a class="sourceLine" id="cb3-1" title="1"><span class="co"># version.properties</span></a> <span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a><span class="co">// ...</span></span></code></pre></div>
<a class="sourceLine" id="cb3-2" title="2"><span class="dt">version.major</span><span class="ot">=</span><span class="dv">1</span></a> <div class="sourceCode" id="cb3"><pre
<a class="sourceLine" id="cb3-3" title="3"><span class="dt">version.minor</span><span class="ot">=</span><span class="dv">0</span></a> 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>
<a class="sourceLine" id="cb3-4" title="4"><span class="dt">version.patch</span><span class="ot">=</span><span class="dv">0</span></a> <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>
<a class="sourceLine" id="cb3-5" title="5"><span class="dt">version.prerelease</span><span class="ot">=</span><span class="st">beta</span></a></code></pre></div> <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>
<p><a href="https://github.com/ethauvin/semver/tree/master/examples">View Examples</a></p> <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> <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>Upon running the annotation processor, a source file <a
<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> 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> <p>To specify your own template name, use:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode java"><code class="sourceCode java"><a class="sourceLine" id="cb4-1" title="1"><span class="at">@Version</span>(template = <span class="st">&quot;version.mustache&quot;</span>)</a> <div class="sourceCode" id="cb4"><pre
<a class="sourceLine" id="cb4-2" title="2"><span class="kw">public</span> <span class="kw">class</span> A {</a> 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">&quot;version.mustache&quot;</span><span class="op">)</span></span>
<a class="sourceLine" id="cb4-3" title="3"><span class="co">// ...</span></a></code></pre></div> <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></code></pre></div>
<h3 id="default-template">Default Template</h3> <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> <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> <table>
<thead> <thead>
<tr class="header"> <tr class="header">
@ -156,7 +221,8 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
<tr class="even"> <tr class="even">
<td style="text-align: left;"><code>BUILDDATE</code></td> <td style="text-align: left;"><code>BUILDDATE</code></td>
<td style="text-align: left;">The build date.</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> <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>
<tr class="odd"> <tr class="odd">
<td style="text-align: left;"><code>VERSION</code></td> <td style="text-align: left;"><code>VERSION</code></td>
@ -207,17 +273,19 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
</table> </table>
<h3 id="custom-template">Custom Template</h3> <h3 id="custom-template">Custom Template</h3>
<p>A very simple custom template might look something like:</p> <p>A very simple custom template might look something like:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode java"><code class="sourceCode java"><a class="sourceLine" id="cb5-1" title="1"><span class="co">/* version.mustache */</span></a> <div class="sourceCode" id="cb5"><pre
<a class="sourceLine" id="cb5-2" title="2"><span class="kw">package</span><span class="im"> {{packageName}};</span></a> 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>
<a class="sourceLine" id="cb5-3" title="3"></a> <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>
<a class="sourceLine" id="cb5-4" title="4"><span class="kw">import</span><span class="im"> java.util.Date;</span></a> <span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a></span>
<a class="sourceLine" id="cb5-5" title="5"></a> <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>
<a class="sourceLine" id="cb5-6" title="6"><span class="kw">public</span> <span class="dt">final</span> <span class="kw">class</span> {{className}} {</a> <span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a></span>
<a class="sourceLine" id="cb5-7" title="7"> <span class="kw">public</span> <span class="dt">final</span> <span class="dt">static</span> <span class="bu">String</span> PROJECT = <span class="st">&quot;{{project}}&quot;</span>;</a> <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>
<a class="sourceLine" id="cb5-8" title="8"> <span class="kw">public</span> <span class="dt">final</span> <span class="dt">static</span> <span class="bu">Date</span> DATE = <span class="kw">new</span> <span class="bu">Date</span>({{epoch}}L);</a> <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">&quot;{{project}}&quot;</span><span class="op">;</span></span>
<a class="sourceLine" id="cb5-9" title="9"> <span class="kw">public</span> <span class="dt">final</span> <span class="dt">static</span> <span class="bu">String</span> VERSION = <span class="st">&quot;{{semver}}&quot;</span>;</a> <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>
<a class="sourceLine" id="cb5-10" title="10">}</a></code></pre></div> <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">&quot;{{semver}}&quot;</span><span class="op">;</span></span>
<p>The mustache variables automatically filled in by the processor are:</p> <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> <table>
<thead> <thead>
<tr class="header"> <tr class="header">
@ -288,13 +356,17 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
<td style="text-align: left;"><code>String</code></td> <td style="text-align: left;"><code>String</code></td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td style="text-align: left;"><code>{{semver}}</code> or <code>{{version}}</code></td> <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;">The full semantic version.</td>
<td style="text-align: left;"><code>String</code></td> <td style="text-align: left;"><code>String</code></td>
</tr> </tr>
</tbody> </tbody>
</table> </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> <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 &amp; Properties</h2> <h2 id="elements--properties">Elements &amp; Properties</h2>
<p>The following annotation elements and properties are available:</p> <p>The following annotation elements and properties are available:</p>
<table> <table>
@ -339,7 +411,8 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
</tr> </tr>
<tr class="even"> <tr class="even">
<td style="text-align: left;"><code>preReleasePrefix</code></td> <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;"><code>version.prerelease.prefix</code></td>
<td style="text-align: left;">The pre-release prefix.</td> <td style="text-align: left;">The pre-release prefix.</td>
<td style="text-align: left;"><code>-</code></td> <td style="text-align: left;"><code>-</code></td>
</tr> </tr>
@ -388,7 +461,8 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
<tr class="even"> <tr class="even">
<td style="text-align: left;"><code>type</code></td> <td style="text-align: left;"><code>type</code></td>
<td style="text-align: left;"></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;">Either <code>java</code> or
<code>kt</code> for Kotlin.</td>
<td style="text-align: left;"><code>java</code></td> <td style="text-align: left;"><code>java</code></td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
@ -399,97 +473,150 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>In order to easily incorporate with existing projects, the property keys may be assigned custom values:</p> <p>In order to easily incorporate with existing projects, the property
<div class="sourceCode" id="cb6"><pre class="sourceCode java"><code class="sourceCode java"><a class="sourceLine" id="cb6-1" title="1"><span class="at">@Version</span>(</a> keys may be assigned custom values:</p>
<a class="sourceLine" id="cb6-2" title="2"> properties = <span class="st">&quot;example.properties&quot;</span>,</a> <div class="sourceCode" id="cb6"><pre
<a class="sourceLine" id="cb6-3" title="3"> keysPrefix = <span class="st">&quot;example.&quot;</span></a> 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>
<a class="sourceLine" id="cb6-4" title="4"> majorKey = <span class="st">&quot;maj&quot;</span>,</a> <span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> properties <span class="op">=</span> <span class="st">&quot;example.properties&quot;</span><span class="op">,</span></span>
<a class="sourceLine" id="cb6-5" title="5"> minorKey = <span class="st">&quot;min&quot;</span>,</a> <span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> keysPrefix <span class="op">=</span> <span class="st">&quot;example.&quot;</span></span>
<a class="sourceLine" id="cb6-6" title="6"> patchKey = <span class="st">&quot;build&quot;</span>,</a> <span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> majorKey <span class="op">=</span> <span class="st">&quot;maj&quot;</span><span class="op">,</span></span>
<a class="sourceLine" id="cb6-7" title="7"> preReleaseKey = <span class="st">&quot;rel&quot;</span>,</a> <span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a> minorKey <span class="op">=</span> <span class="st">&quot;min&quot;</span><span class="op">,</span></span>
<a class="sourceLine" id="cb6-8" title="8"> buildMetaKey = <span class="st">&quot;meta&quot;</span>,</a> <span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a> patchKey <span class="op">=</span> <span class="st">&quot;build&quot;</span><span class="op">,</span></span>
<a class="sourceLine" id="cb6-9" title="9"> projectKey = <span class="st">&quot;project&quot;</span></a> <span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a> preReleaseKey <span class="op">=</span> <span class="st">&quot;rel&quot;</span><span class="op">,</span></span>
<a class="sourceLine" id="cb6-10" title="10">)</a> <span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a> buildMetaKey <span class="op">=</span> <span class="st">&quot;meta&quot;</span><span class="op">,</span></span>
<a class="sourceLine" id="cb6-11" title="11"><span class="kw">public</span> <span class="kw">class</span> Example {</a> <span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a> projectKey <span class="op">=</span> <span class="st">&quot;project&quot;</span></span>
<a class="sourceLine" id="cb6-12" title="12"><span class="co">// ...</span></a></code></pre></div> <span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a><span class="op">)</span></span>
<div class="sourceCode" id="cb7"><pre class="sourceCode ini"><code class="sourceCode ini"><a class="sourceLine" id="cb7-1" title="1"><span class="co"># example.properties</span></a> <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>
<a class="sourceLine" id="cb7-2" title="2"><span class="dt">example.project</span><span class="ot">=</span><span class="st">Example</span></a> <span id="cb6-12"><a href="#cb6-12" aria-hidden="true" tabindex="-1"></a><span class="co">// ...</span></span></code></pre></div>
<a class="sourceLine" id="cb7-3" title="3"><span class="dt">example.maj</span><span class="ot">=</span><span class="dv">1</span></a> <div class="sourceCode" id="cb7"><pre
<a class="sourceLine" id="cb7-4" title="4"><span class="dt">example.min</span><span class="ot">=</span><span class="dv">0</span></a> 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>
<a class="sourceLine" id="cb7-5" title="5"><span class="dt">example.build</span><span class="ot">=</span><span class="dv">0</span></a> <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>
<a class="sourceLine" id="cb7-6" title="6"><span class="dt">example.rel</span><span class="ot">=</span><span class="st">beta</span></a> <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>
<a class="sourceLine" id="cb7-7" title="7"><span class="dt">example.meta</span><span class="ot">=</span></a> <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>
<a class="sourceLine" id="cb7-8" title="8"><span class="co"># ...</span></a></code></pre></div> <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> <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 /> <p><span class="emoji" data-emoji="warning">⚠️</span>
<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> <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> </blockquote>
<h2 id="maven">Maven</h2> <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> <p>To install and run from <a
<div class="sourceCode" id="cb8"><pre class="sourceCode xml"><code class="sourceCode xml"><a class="sourceLine" id="cb8-1" title="1"><span class="kw">&lt;dependency&gt;</span></a> href="https://maven.apache.org/">Maven</a>, configure an artifact as
<a class="sourceLine" id="cb8-2" title="2"> <span class="kw">&lt;groupId&gt;</span>net.thauvin.erik<span class="kw">&lt;/groupId&gt;</span></a> follows:</p>
<a class="sourceLine" id="cb8-3" title="3"> <span class="kw">&lt;artifactId&gt;</span>semver<span class="kw">&lt;/artifactId&gt;</span></a> <div class="sourceCode" id="cb8"><pre
<a class="sourceLine" id="cb8-4" title="4"> <span class="kw">&lt;version&gt;</span>1.2.0<span class="kw">&lt;/version&gt;</span></a> class="sourceCode xml"><code class="sourceCode xml"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a>&lt;<span class="kw">dependency</span>&gt;</span>
<a class="sourceLine" id="cb8-5" title="5"><span class="kw">&lt;/dependency&gt;</span></a></code></pre></div> <span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">groupId</span>&gt;net.thauvin.erik&lt;/<span class="kw">groupId</span>&gt;</span>
<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> <span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">artifactId</span>&gt;semver&lt;/<span class="kw">artifactId</span>&gt;</span>
<div class="sourceCode" id="cb9"><pre class="sourceCode bash"><code class="sourceCode bash"><a class="sourceLine" id="cb9-1" title="1"><span class="ex">mvn</span> verify</a></code></pre></div> <span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">version</span>&gt;1.2.0&lt;/<span class="kw">version</span>&gt;</span>
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a>&lt;/<span class="kw">dependency</span>&gt;</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="gradle">Gradle</h2> <h2 id="gradle">Gradle</h2>
<h3 id="class-generation">Class Generation</h3> <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/build.gradle">build.gradle</a>:</p> <p>To install and run from <a href="https://gradle.org/">Gradle</a>, add
<pre class="gradle"><code>dependencies { the following to <a
annotationProcessor &#39;net.thauvin.erik:semver:1.2.0&#39; href="https://github.com/ethauvin/semver/blob/master/examples/java/build.gradle">build.gradle</a>:</p>
implementation &#39;net.thauvin.erik:semver:1.2.0&#39; <div class="sourceCode" id="cb10"><pre
} class="sourceCode gradle"><code class="sourceCode groovy"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a>repositories <span class="op">{</span></span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">mavenCentral</span><span class="op">()</span></span>
tasks.withType(JavaCompile) { <span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
options.compilerArgs += [ &quot;-Asemver.project.dir=$projectDir&quot; ] <span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a></span>
} <span id="cb10-5"><a href="#cb10-5" aria-hidden="true" tabindex="-1"></a>dependencies <span class="op">{</span></span>
</code></pre> <span id="cb10-6"><a href="#cb10-6" aria-hidden="true" tabindex="-1"></a> annotationProcessor <span class="st">&#39;net.thauvin.erik:semver:1.2.0&#39;</span></span>
<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> <span id="cb10-7"><a href="#cb10-7" aria-hidden="true" tabindex="-1"></a> compileOnly <span class="st">&#39;net.thauvin.erik:semver:1.2.0&#39;</span></span>
<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> <span id="cb10-8"><a href="#cb10-8" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<p>Please look at <a href="https://github.com/ethauvin/semver/blob/master/examples/java/build.gradle">build.gradle</a> in the <a href="https://github.com/ethauvin/semver/tree/master/examples/java">examples/java</a> directory for a sample.</p> <span id="cb10-9"><a href="#cb10-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb10-10"><a href="#cb10-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="op">{</span></span>
<span id="cb10-11"><a href="#cb10-11" aria-hidden="true" tabindex="-1"></a> options<span class="op">.</span>compilerArgs <span class="op">+=</span> <span class="op">[</span> <span class="st">&quot;-Asemver.project.dir=</span><span class="ss">$projectDir</span><span class="st">&quot;</span> <span class="op">]</span></span>
<span id="cb10-12"><a href="#cb10-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/build.gradle">build.gradle</a>
in the <a
href="https://github.com/ethauvin/semver/tree/master/examples/java">examples/java</a>
directory for a sample.</p>
<h3 id="class--source-generation">Class &amp; Source Generation</h3> <h3 id="class--source-generation">Class &amp; 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> <p>In order to also incorporate the generated source code into the
<pre class="gradle"><code>tasks.withType(JavaCompile) { <code>source tree</code>, add the following to <a
options.annotationProcessorGeneratedSourcesDirectory = file(&quot;${projectDir}/src/generated/java&quot;) href="https://github.com/ethauvin/semver/blob/master/examples/java/build.gradle">build.gradle</a>:</p>
} <div class="sourceCode" id="cb11"><pre
</code></pre> class="sourceCode gradle"><code class="sourceCode groovy"><span id="cb11-1"><a href="#cb11-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="op">{</span></span>
<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> <span id="cb11-2"><a href="#cb11-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">&quot;</span><span class="ss">${</span>projectDir<span class="ss">}</span><span class="st">/src/generated/java&quot;</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></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> <h2 id="kotlin">Kotlin</h2>
<p>The annotation processor also supports <a href="https://kotlinlang.org/">Kotlin</a>.</p> <p>The annotation processor also supports <a
<p>To generate a Kotlin version file, simply specify the <code>type</code> as follows:</p> href="https://kotlinlang.org/">Kotlin</a>.</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode kotlin"><code class="sourceCode kotlin"><a class="sourceLine" id="cb12-1" title="1"><span class="kw">import</span> <span class="im">net.thauvin.erik.semver.Version</span></a> <p>To generate a Kotlin version file, simply specify the
<a class="sourceLine" id="cb12-2" title="2"></a> <code>type</code> as follows:</p>
<a class="sourceLine" id="cb12-3" title="3"><span class="at">@Version</span>(properties = <span class="st">&quot;version.properties&quot;</span>, type=<span class="st">&quot;kt&quot;</span>)</a> <div class="sourceCode" id="cb12"><pre
<a class="sourceLine" id="cb12-4" title="4"><span class="kw">open</span> <span class="kw">class</span> Main {</a> class="sourceCode kotlin"><code class="sourceCode kotlin"><span id="cb12-1"><a href="#cb12-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>
<a class="sourceLine" id="cb12-5" title="5"><span class="co">// ...</span></a></code></pre></div> <span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a></span>
<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> <span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a><span class="at">@Version</span><span class="op">(</span>properties <span class="op">=</span> <span class="st">&quot;version.properties&quot;</span><span class="op">,</span> type<span class="op">=</span><span class="st">&quot;kt&quot;</span><span class="op">)</span></span>
<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> <span id="cb12-4"><a href="#cb12-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="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a><span class="co">// ...</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 &amp; Gradle</h3> <h3 id="kotlin--gradle">Kotlin &amp; 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> <p>To install and run from <a href="https://gradle.org/">Gradle</a>, add
<div class="sourceCode" id="cb13"><pre class="sourceCode kotlin"><code class="sourceCode kotlin"><a class="sourceLine" id="cb13-1" title="1"><span class="kw">var</span> <span class="va">semverProcessor</span> = <span class="st">&quot;net.thauvin.erik:semver:1.2.0&quot;</span></a> the following to <a
<a class="sourceLine" id="cb13-2" title="2"></a> href="https://github.com/ethauvin/semver/blob/master/examples/kotlin/build.gradle.kts">build.gradle.kts</a>:</p>
<a class="sourceLine" id="cb13-3" title="3">dependencies {</a> <div class="sourceCode" id="cb13"><pre
<a class="sourceLine" id="cb13-4" title="4"> kapt(semverProcessor)</a> class="sourceCode kotlin"><code class="sourceCode kotlin"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="kw">var</span> <span class="va">semverProcessor</span> <span class="op">=</span> <span class="st">&quot;net.thauvin.erik:semver:1.2.0&quot;</span></span>
<a class="sourceLine" id="cb13-5" title="5"> implementation(semverProcessor)</a> <span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a></span>
<a class="sourceLine" id="cb13-6" title="6">}</a> <span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a>dependencies <span class="op">{</span></span>
<a class="sourceLine" id="cb13-7" title="7"></a> <span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a> kapt<span class="op">(</span>semverProcessor<span class="op">)</span></span>
<a class="sourceLine" id="cb13-8" title="8">kapt {</a> <span id="cb13-5"><a href="#cb13-5" aria-hidden="true" tabindex="-1"></a> compileOnly<span class="op">(</span>semverProcessor<span class="op">)</span></span>
<a class="sourceLine" id="cb13-9" title="9"> arguments {</a> <span id="cb13-6"><a href="#cb13-6" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<a class="sourceLine" id="cb13-10" title="10"> arg(<span class="st">&quot;semver.project.dir&quot;</span>, projectDir)</a> <span id="cb13-7"><a href="#cb13-7" aria-hidden="true" tabindex="-1"></a></span>
<a class="sourceLine" id="cb13-11" title="11"> }</a> <span id="cb13-8"><a href="#cb13-8" aria-hidden="true" tabindex="-1"></a>kapt <span class="op">{</span></span>
<a class="sourceLine" id="cb13-12" title="12">}</a></code></pre></div> <span id="cb13-9"><a href="#cb13-9" aria-hidden="true" tabindex="-1"></a> arguments <span class="op">{</span></span>
<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> <span id="cb13-10"><a href="#cb13-10" aria-hidden="true" tabindex="-1"></a> arg<span class="op">(</span><span class="st">&quot;semver.project.dir&quot;</span><span class="op">,</span> projectDir<span class="op">)</span></span>
<h2 id="kobalt">Kobalt</h2> <span id="cb13-11"><a href="#cb13-11" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<p>To install and run from <a href="https://beust.com/kobalt/">Kobalt</a>, add the following to <a href="https://github.com/ethauvin/semver/blob/master/examples/java/kobalt/src/Build.kt">Build.kt</a>:</p> <span id="cb13-12"><a href="#cb13-12" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<pre class="gradle"><code>dependencies { <p>The directory containing the configuration files
apt(&quot;net.thauvin.erik:semver:1.2.0&quot;) (<code>version.properties</code>, <code>version.mustache</code>) must be
compileOnly(&quot;net.thauvin.erik:semver:1.2.0&quot;) specified using the <code>semver.project.dir</code> processor
} argument.</p>
</code></pre>
<p>Please look at <a href="https://github.com/ethauvin/semver/blob/master/examples/java/kobalt/src/Build.kt">Build.kt</a> in the <a href="https://github.com/ethauvin/semver/tree/master/examples/java">examples/java</a> directory for a sample.</p>
<h2 id="auto-increment">Auto-Increment</h2> <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>Incrementing the version is best left to your favorite build system.
<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> 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>
</body> </body>
</html> </html>

View file

@ -3,14 +3,14 @@
# Version 1.0 # Version 1.0
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echo "Usage: $0 <arg ...>" echo "Usage: $0 <arg ...>"
exit 1 exit 1
fi fi
# set the examples directories # set the examples directories
declare -a examples=( declare -a examples=(
"java" "java"
"kotlin") "kotlin")
dir=$(dirname "$(readlink -f "$0")") dir=$(dirname "$(readlink -f "$0")")
cyan=$(tput setaf 6) cyan=$(tput setaf 6)
@ -18,13 +18,12 @@ normal=$(tput sgr0)
i=0 i=0
for ex in "${examples[@]}"; do for ex in "${examples[@]}"; do
if [ $i -ne 0 ] if [ $i -ne 0 ]; then
then read -p "Press [Enter] key to continue..."
read -p "Press [Enter] key to continue..." clear
clear fi
fi cd "$dir/$ex" || exit 1
cd "$dir/$ex" || exit 1 echo "> Project: ${cyan}${ex}${normal}"
echo "> Project: ${cyan}${ex}${normal}" ./gradlew --console=plain --no-build-cache clean "$@" || exit 1
./gradlew --console=plain --no-build-cache clean "$@" || exit 1 ((i++))
(( i++ ))
done done

View file

@ -1,2 +1,2 @@
[*] [*]
insert_final_newline=true insert_final_newline = true

View file

@ -1,7 +1,7 @@
plugins { plugins {
id 'java' id 'java'
id 'application' id 'application'
id 'com.github.ben-manes.versions' version '0.28.0' id 'com.github.ben-manes.versions' version '0.46.0'
} }
// ./gradlew run // ./gradlew run
@ -9,7 +9,7 @@ plugins {
defaultTasks 'run' defaultTasks 'run'
final def semverProcessor = 'net.thauvin.erik:semver:1.2.0' final def semverProcessor = 'net.thauvin.erik:semver:1.2.1-SNAPSHOT'
sourceCompatibility = 1.8 sourceCompatibility = 1.8
targetCompatibility = 1.8 targetCompatibility = 1.8
@ -19,6 +19,7 @@ mainClassName = 'com.example.App'
repositories { repositories {
mavenLocal() mavenLocal()
mavenCentral() mavenCentral()
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
} }
dependencies { dependencies {
@ -27,13 +28,12 @@ dependencies {
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java") options.generatedSourceOutputDirectory.set(file("${projectDir}/src/generated/java"))
options.compilerArgs += [ "-Asemver.project.dir=$projectDir" ] options.compilerArgs += ["-Asemver.project.dir=$projectDir"]
} }
task runExample(type: JavaExec) { task runExample(type: JavaExec) {
group = 'application' group = 'application'
classpath = sourceSets.main.runtimeClasspath classpath = sourceSets.main.runtimeClasspath
mainClass.set('com.example.Example')
main = 'com.example.Example'
} }

Binary file not shown.

View file

@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

293
examples/java/gradlew vendored
View file

@ -1,7 +1,7 @@
#!/usr/bin/env sh #!/bin/sh
# #
# Copyright 2015 the original author or authors. # Copyright © 2015-2021 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -17,67 +17,98 @@
# #
############################################################################## ##############################################################################
## #
## Gradle start up script for UN*X # Gradle start up script for POSIX generated by Gradle.
## #
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
############################################################################## ##############################################################################
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
PRG="$0" app_path=$0
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do # Need this for daisy-chained symlinks.
ls=`ls -ld "$PRG"` while
link=`expr "$ls" : '.*-> \(.*\)$'` APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
if expr "$link" : '/.*' > /dev/null; then [ -h "$app_path" ]
PRG="$link" do
else ls=$( ls -ld "$app_path" )
PRG=`dirname "$PRG"`"/$link" link=${ls#*' -> '}
fi case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle" # This is normally unused
APP_BASE_NAME=`basename "$0"` # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD=maximum
warn () { warn () {
echo "$*" echo "$*"
} } >&2
die () { die () {
echo echo
echo "$*" echo "$*"
echo echo
exit 1 exit 1
} } >&2
# OS specific support (must be 'true' or 'false'). # OS specific support (must be 'true' or 'false').
cygwin=false cygwin=false
msys=false msys=false
darwin=false darwin=false
nonstop=false nonstop=false
case "`uname`" in case "$( uname )" in #(
CYGWIN* ) CYGWIN* ) cygwin=true ;; #(
cygwin=true Darwin* ) darwin=true ;; #(
;; MSYS* | MINGW* ) msys=true ;; #(
Darwin* ) NONSTOP* ) nonstop=true ;;
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@ -87,9 +118,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java" JAVACMD=$JAVA_HOME/jre/sh/java
else else
JAVACMD="$JAVA_HOME/bin/java" JAVACMD=$JAVA_HOME/bin/java
fi fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@ -98,88 +129,120 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
else else
JAVACMD="java" 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. if ! command -v java >/dev/null 2>&1
then
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 Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
MAX_FD_LIMIT=`ulimit -H -n` case $MAX_FD in #(
if [ $? -eq 0 ] ; then max*)
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
MAX_FD="$MAX_FD_LIMIT" # shellcheck disable=SC3045
fi MAX_FD=$( ulimit -H -n ) ||
ulimit -n $MAX_FD warn "Could not query maximum file descriptor limit"
if [ $? -ne 0 ] ; then esac
warn "Could not set maximum file descriptor limit: $MAX_FD" case $MAX_FD in #(
fi '' | soft) :;; #(
else *)
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
fi # shellcheck disable=SC3045
fi ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
# 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 or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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=`expr $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 esac
fi fi
# Escape application args # Collect all arguments for the java command, stacking in reverse order:
save () { # * args from the command line
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done # * the main class name
echo " " # * -classpath
} # * -D...appname settings
APP_ARGS=`save "$@"` # * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules # For Cygwin or MSYS, switch paths to Windows format before running java
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@" exec "$JAVACMD" "$@"

View file

@ -14,7 +14,7 @@
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@ -25,7 +25,8 @@
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%
@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if %ERRORLEVEL% equ 0 goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -54,7 +55,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto execute
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@ -64,21 +65,6 @@ echo location of your Java installation.
goto fail goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute :execute
@rem Setup the command line @rem Setup the command line
@ -86,17 +72,19 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if %ERRORLEVEL% equ 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!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 set EXIT_CODE=%ERRORLEVEL%
exit /b 1 if %EXIT_CODE% equ 0 set EXIT_CODE=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

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -45,7 +45,7 @@
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId> <artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version> <version>3.0.0</version>
<executions> <executions>
<execution> <execution>
<id>run</id> <id>run</id>

View file

@ -2,14 +2,14 @@
* This file is automatically generated. * This file is automatically generated.
* Do not modify! -- ALL CHANGES WILL BE ERASED! * Do not modify! -- ALL CHANGES WILL BE ERASED!
*/ */
package com.example; package com.example;
import java.util.Date; import java.util.Date;
public final class ExampleVersion { public final class ExampleVersion {
public static final String PROJECT = "Java Example"; public static final String PROJECT = "Java Example";
public static final Date BUILDDATE = new Date(1558820521980L); public static final Date BUILDDATE = new Date(1624066674216L);
public static final String VERSION = "8.4.97-alpha+T800"; public static final String VERSION = "8.4.97-alpha+T800";
/** /**

View file

@ -2,7 +2,7 @@
* This file is automatically generated. * This file is automatically generated.
* Do not modify! -- ALL CHANGES WILL BE ERASED! * Do not modify! -- ALL CHANGES WILL BE ERASED!
*/ */
package com.example; package com.example;
import java.util.Date; import java.util.Date;
@ -14,7 +14,7 @@ import java.util.Date;
*/ */
public final class GeneratedVersion { public final class GeneratedVersion {
public static final String PROJECT = "Java App"; public static final String PROJECT = "Java App";
public static final Date BUILDDATE = new Date(1558820521932L); public static final Date BUILDDATE = new Date(1624066674199L);
public static final int MAJOR = 11; public static final int MAJOR = 11;
public static final int MINOR = 11; public static final int MINOR = 11;
public static final int PATCH = 20; public static final int PATCH = 20;

View file

@ -6,7 +6,7 @@ import java.text.SimpleDateFormat;
import java.util.Locale; import java.util.Locale;
@Version(properties = "example.properties", template = "example.mustache", className = "ExampleVersion", @Version(properties = "example.properties", template = "example.mustache", className = "ExampleVersion",
keysPrefix = "example.") keysPrefix = "example.")
public final class Example { public final class Example {
/** /**
* Command line interface. * Command line interface.
@ -19,7 +19,7 @@ public final class Example {
System.out.println("-- From Example -------------------------------------"); System.out.println("-- From Example -------------------------------------");
System.out.println(" " + ExampleVersion.PROJECT + ' ' + ExampleVersion.VERSION System.out.println(" " + ExampleVersion.PROJECT + ' ' + ExampleVersion.VERSION
+ " (" + sdf.format(ExampleVersion.BUILDDATE) + ')'); + " (" + sdf.format(ExampleVersion.BUILDDATE) + ')');
System.out.println("-----------------------------------------------------"); System.out.println("-----------------------------------------------------");
} }

View file

@ -1,2 +1,2 @@
[*] [*]
insert_final_newline=true insert_final_newline = true

View file

@ -1,8 +1,8 @@
plugins { plugins {
kotlin("jvm").version("1.3.72") id("application")
application id("com.github.ben-manes.versions") version "0.46.0"
id("org.jetbrains.kotlin.kapt").version("1.3.72") kotlin("jvm") version "1.7.22"
id("com.github.ben-manes.versions").version("0.28.0") kotlin("kapt") version "1.7.22"
} }
// ./gradlew // ./gradlew
@ -13,7 +13,7 @@ plugins {
defaultTasks(ApplicationPlugin.TASK_RUN_NAME) defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
val semverProcessor = "net.thauvin.erik:semver:1.2.0" val semverProcessor = "net.thauvin.erik:semver:1.2.1-SNAPSHOT"
dependencies { dependencies {
kapt(semverProcessor) kapt(semverProcessor)
@ -30,30 +30,31 @@ kapt {
repositories { repositories {
mavenLocal() mavenLocal()
jcenter() mavenCentral()
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
} }
application { application {
mainClassName = "com.example.App" mainClass.set("com.example.App")
} }
tasks { tasks {
register("runJava", JavaExec::class) { register("runJava", JavaExec::class) {
group = "application" group = "application"
main = "com.example.JavaApp" mainClass.set("com.example.JavaApp")
classpath = sourceSets["main"].runtimeClasspath classpath = sourceSets.main.get().runtimeClasspath
} }
register("runJavaExample", JavaExec::class) { register("runJavaExample", JavaExec::class) {
group = "application" group = "application"
main = "com.example.JavaExample" mainClass.set("com.example.JavaExample")
classpath = sourceSets["main"].runtimeClasspath classpath = sourceSets.main.get().runtimeClasspath
} }
register("runExample", JavaExec::class) { register("runExample", JavaExec::class) {
group = "application" group = "application"
main = "com.example.Example" mainClass.set("com.example.Example")
classpath = sourceSets["main"].runtimeClasspath classpath = sourceSets.main.get().runtimeClasspath
} }
} }

Binary file not shown.

View file

@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View file

@ -1,7 +1,7 @@
#!/usr/bin/env sh #!/bin/sh
# #
# Copyright 2015 the original author or authors. # Copyright © 2015-2021 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -17,67 +17,98 @@
# #
############################################################################## ##############################################################################
## #
## Gradle start up script for UN*X # Gradle start up script for POSIX generated by Gradle.
## #
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
############################################################################## ##############################################################################
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
PRG="$0" app_path=$0
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do # Need this for daisy-chained symlinks.
ls=`ls -ld "$PRG"` while
link=`expr "$ls" : '.*-> \(.*\)$'` APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
if expr "$link" : '/.*' > /dev/null; then [ -h "$app_path" ]
PRG="$link" do
else ls=$( ls -ld "$app_path" )
PRG=`dirname "$PRG"`"/$link" link=${ls#*' -> '}
fi case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle" # This is normally unused
APP_BASE_NAME=`basename "$0"` # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD=maximum
warn () { warn () {
echo "$*" echo "$*"
} } >&2
die () { die () {
echo echo
echo "$*" echo "$*"
echo echo
exit 1 exit 1
} } >&2
# OS specific support (must be 'true' or 'false'). # OS specific support (must be 'true' or 'false').
cygwin=false cygwin=false
msys=false msys=false
darwin=false darwin=false
nonstop=false nonstop=false
case "`uname`" in case "$( uname )" in #(
CYGWIN* ) CYGWIN* ) cygwin=true ;; #(
cygwin=true Darwin* ) darwin=true ;; #(
;; MSYS* | MINGW* ) msys=true ;; #(
Darwin* ) NONSTOP* ) nonstop=true ;;
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@ -87,9 +118,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java" JAVACMD=$JAVA_HOME/jre/sh/java
else else
JAVACMD="$JAVA_HOME/bin/java" JAVACMD=$JAVA_HOME/bin/java
fi fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@ -98,88 +129,120 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
else else
JAVACMD="java" 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. if ! command -v java >/dev/null 2>&1
then
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 Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
MAX_FD_LIMIT=`ulimit -H -n` case $MAX_FD in #(
if [ $? -eq 0 ] ; then max*)
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
MAX_FD="$MAX_FD_LIMIT" # shellcheck disable=SC3045
fi MAX_FD=$( ulimit -H -n ) ||
ulimit -n $MAX_FD warn "Could not query maximum file descriptor limit"
if [ $? -ne 0 ] ; then esac
warn "Could not set maximum file descriptor limit: $MAX_FD" case $MAX_FD in #(
fi '' | soft) :;; #(
else *)
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
fi # shellcheck disable=SC3045
fi ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
# 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 or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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=`expr $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 esac
fi fi
# Escape application args # Collect all arguments for the java command, stacking in reverse order:
save () { # * args from the command line
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done # * the main class name
echo " " # * -classpath
} # * -D...appname settings
APP_ARGS=`save "$@"` # * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules # For Cygwin or MSYS, switch paths to Windows format before running java
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@" exec "$JAVACMD" "$@"

View file

@ -14,7 +14,7 @@
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@ -25,7 +25,8 @@
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%
@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if %ERRORLEVEL% equ 0 goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -54,7 +55,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto execute
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@ -64,21 +65,6 @@ echo location of your Java installation.
goto fail goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute :execute
@rem Setup the command line @rem Setup the command line
@ -86,17 +72,19 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if %ERRORLEVEL% equ 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!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 set EXIT_CODE=%ERRORLEVEL%
exit /b 1 if %EXIT_CODE% equ 0 set EXIT_CODE=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

View file

@ -15,7 +15,7 @@ public final class JavaExample {
System.out.println("-- From JavaExample -----------------------------------"); System.out.println("-- From JavaExample -----------------------------------");
System.out.println(" " + ExampleVersion.PROJECT + ' ' + ExampleVersion.VERSION System.out.println(" " + ExampleVersion.PROJECT + ' ' + ExampleVersion.VERSION
+ " (" + sdf.format(ExampleVersion.BUILDDATE) + ')'); + " (" + sdf.format(ExampleVersion.BUILDDATE) + ')');
System.out.println("-------------------------------------------------------"); System.out.println("-------------------------------------------------------");
} }

View file

@ -5,7 +5,7 @@ import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
@Version(properties = "example.properties", type = "kt", template = "example.mustache", className = "ExampleVersion", @Version(properties = "example.properties", type = "kt", template = "example.mustache", className = "ExampleVersion",
keysPrefix = "example.") keysPrefix = "example.")
class Example { class Example {
companion object { companion object {
@JvmStatic @JvmStatic
@ -15,7 +15,7 @@ class Example {
println("-------------------------------------------------------") println("-------------------------------------------------------")
println(" ${ExampleVersion.PROJECT} ${ExampleVersion.VERSION} (" println(" ${ExampleVersion.PROJECT} ${ExampleVersion.VERSION} ("
+ sdf.format(ExampleVersion.BUILDDATE) + ')') + sdf.format(ExampleVersion.BUILDDATE) + ')')
println("-------------------------------------------------------") println("-------------------------------------------------------")
} }

View file

@ -1,2 +1,2 @@
[*] [*]
insert_final_newline=true insert_final_newline = true

View file

@ -1,7 +1,7 @@
plugins { plugins {
id 'java' id 'java'
id 'application' id 'application'
id 'com.github.ben-manes.versions' version '0.21.0' id 'com.github.ben-manes.versions' version '0.46.0'
} }
// ./gradlew run // ./gradlew run
@ -14,8 +14,6 @@ final def semverProcessor = 'net.thauvin.erik:semver:1.2.0'
sourceCompatibility = 1.8 sourceCompatibility = 1.8
targetCompatibility = 1.8 targetCompatibility = 1.8
compileJava.
mainClassName = 'com.example.Example' mainClassName = 'com.example.Example'
repositories { repositories {
@ -29,6 +27,6 @@ dependencies {
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java") options.generatedSourceOutputDirectory.set(file("${projectDir}/src/generated/java"))
options.compilerArgs += [ "-Asemver.project.dir=${projectDir}/example" ] options.compilerArgs += ["-Asemver.project.dir=${projectDir}/example"]
} }

View file

@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

296
examples/test/gradlew vendored Normal file → Executable file
View file

@ -1,13 +1,13 @@
#!/usr/bin/env sh #!/bin/sh
# #
# Copyright 2015 the original author or authors. # Copyright © 2015-2021 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # https://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
@ -17,78 +17,110 @@
# #
############################################################################## ##############################################################################
## #
## Gradle start up script for UN*X # Gradle start up script for POSIX generated by Gradle.
## #
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
############################################################################## ##############################################################################
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
PRG="$0" app_path=$0
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do # Need this for daisy-chained symlinks.
ls=`ls -ld "$PRG"` while
link=`expr "$ls" : '.*-> \(.*\)$'` APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
if expr "$link" : '/.*' > /dev/null; then [ -h "$app_path" ]
PRG="$link" do
else ls=$( ls -ld "$app_path" )
PRG=`dirname "$PRG"`"/$link" link=${ls#*' -> '}
fi case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle" # This is normally unused
APP_BASE_NAME=`basename "$0"` # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD=maximum
warn () { warn () {
echo "$*" echo "$*"
} } >&2
die () { die () {
echo echo
echo "$*" echo "$*"
echo echo
exit 1 exit 1
} } >&2
# OS specific support (must be 'true' or 'false'). # OS specific support (must be 'true' or 'false').
cygwin=false cygwin=false
msys=false msys=false
darwin=false darwin=false
nonstop=false nonstop=false
case "`uname`" in case "$( uname )" in #(
CYGWIN* ) CYGWIN* ) cygwin=true ;; #(
cygwin=true Darwin* ) darwin=true ;; #(
;; MSYS* | MINGW* ) msys=true ;; #(
Darwin* ) NONSTOP* ) nonstop=true ;;
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java" JAVACMD=$JAVA_HOME/jre/sh/java
else else
JAVACMD="$JAVA_HOME/bin/java" JAVACMD=$JAVA_HOME/bin/java
fi fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@ -97,92 +129,120 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
else else
JAVACMD="java" 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. if ! command -v java >/dev/null 2>&1
then
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 Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
MAX_FD_LIMIT=`ulimit -H -n` case $MAX_FD in #(
if [ $? -eq 0 ] ; then max*)
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
MAX_FD="$MAX_FD_LIMIT" # shellcheck disable=SC3045
fi MAX_FD=$( ulimit -H -n ) ||
ulimit -n $MAX_FD warn "Could not query maximum file descriptor limit"
if [ $? -ne 0 ] ; then esac
warn "Could not set maximum file descriptor limit: $MAX_FD" case $MAX_FD in #(
fi '' | soft) :;; #(
else *)
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
fi # shellcheck disable=SC3045
fi ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
# 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 esac
fi fi
# Escape application args # Collect all arguments for the java command, stacking in reverse order:
save () { # * args from the command line
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done # * the main class name
echo " " # * -classpath
} # * -D...appname settings
APP_ARGS=$(save "$@") # * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules # For Cygwin or MSYS, switch paths to Windows format before running java
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong JAVACMD=$( cygpath --unix "$JAVACMD" )
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")" # Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@" exec "$JAVACMD" "$@"

View file

@ -5,7 +5,7 @@
@rem you may not use this file except in compliance with the License. @rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at @rem You may obtain a copy of the License at
@rem @rem
@rem http://www.apache.org/licenses/LICENSE-2.0 @rem https://www.apache.org/licenses/LICENSE-2.0
@rem @rem
@rem Unless required by applicable law or agreed to in writing, software @rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS, @rem distributed under the License is distributed on an "AS IS" BASIS,
@ -14,7 +14,7 @@
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@ -25,10 +25,14 @@
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="-Xmx64m" "-Xms64m"
@ -37,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if %ERRORLEVEL% equ 0 goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -51,7 +55,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto execute
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@ -61,38 +65,26 @@ echo location of your Java installation.
goto fail goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if %ERRORLEVEL% equ 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!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 set EXIT_CODE=%ERRORLEVEL%
exit /b 1 if %EXIT_CODE% equ 0 set EXIT_CODE=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

View file

@ -2,14 +2,14 @@
* This file is automatically generated. * This file is automatically generated.
* Do not modify! -- ALL CHANGES WILL BE ERASED! * Do not modify! -- ALL CHANGES WILL BE ERASED!
*/ */
package com.example; package com.example;
import java.util.Date; import java.util.Date;
public final class ExampleVersion { public final class ExampleVersion {
public static final String PROJECT = "Java Example"; public static final String PROJECT = "Java Example";
public static final Date BUILDDATE = new Date(1558820496856L); public static final Date BUILDDATE = new Date(1619673811155L);
public static final String VERSION = "8.4.97-alpha+T800"; public static final String VERSION = "8.4.97-alpha+T800";
/** /**

View file

@ -6,7 +6,7 @@ import java.text.SimpleDateFormat;
import java.util.Locale; import java.util.Locale;
@Version(properties = "example.properties", template = "example.mustache", className = "ExampleVersion", @Version(properties = "example.properties", template = "example.mustache", className = "ExampleVersion",
keysPrefix = "example.") keysPrefix = "example.")
public final class Example { public final class Example {
/** /**
* Command line interface. * Command line interface.
@ -19,7 +19,7 @@ public final class Example {
System.out.println("-- From Example -------------------------------------"); System.out.println("-- From Example -------------------------------------");
System.out.println(" " + ExampleVersion.PROJECT + ' ' + ExampleVersion.VERSION System.out.println(" " + ExampleVersion.PROJECT + ' ' + ExampleVersion.VERSION
+ " (" + sdf.format(ExampleVersion.BUILDDATE) + ')'); + " (" + sdf.format(ExampleVersion.BUILDDATE) + ')');
System.out.println("-----------------------------------------------------"); System.out.println("-----------------------------------------------------");
} }

Binary file not shown.

View file

@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

185
gradlew vendored
View file

@ -1,185 +0,0 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## 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='"-Xmx64m" "-Xms64m"'
# 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 or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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=`expr $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
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

104
gradlew.bat vendored
View file

@ -1,104 +0,0 @@
@rem
@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 Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
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.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

BIN
lib/bld/bld-wrapper.jar Normal file

Binary file not shown.

View file

@ -0,0 +1,9 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.2
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.0
bld.extensions-testng=com.uwyn.rife2:bld-testng:0.9.1-SNAPSHOT
bld.repositories=MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories=
bld.version=1.7.1

9
pandoc.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
pandoc --from gfm \
--to html5 \
--metadata "pagetitle=Semantic Version Annotation Processor" \
-s \
-c docs/github-pandoc.css \
-o docs/README.html \
README.md

38
pom.xml Normal file
View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>net.thauvin.erik.semver</groupId>
<artifactId>semver</artifactId>
<version>1.2.1-SNAPSHOT</version>
<name>SemVer</name>
<description>Semantic Version Annotation Processor</description>
<url>https://github.com/ethauvin/semver</url>
<licenses>
<license>
<name>The BSD 3-Clause License</name>
<url>http://opensource.org/licenses/BSD-3-Clause</url>
</license>
</licenses>
<dependencies>
<dependency>
<groupId>com.github.spullara.mustache.java</groupId>
<artifactId>compiler</artifactId>
<version>0.9.10</version>
<scope>compile</scope>
</dependency>
</dependencies>
<developers>
<developer>
<id>ethauvin</id>
<name>Erik C. Thauvin</name>
<email>erik@thauvin.net</email>
<url>https://erik.thauvin.net/</url>
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/ethauvin/semver.git</connection>
<developerConnection>scm:git:git@github.com:ethauvin/semver.git</developerConnection>
<url>https://github.com/ethauvin/semver</url>
</scm>
</project>

View file

@ -1,210 +0,0 @@
#!/bin/bash
# set source and test locations
src="src/main/java/net/thauvin/erik/semver"
test="src/test/java/net/thauvin/erik/semver"
# e.g: .java, .kt, etc.
ext=".java"
java8=true
# e.g: <example directory> <gradle args...>
declare -a examples=(
"examples/java run runExample"
"examples/kotlin run runJava runExample runJavaExample")
# e.g: empty or javadoc, etc.
gradle_doc="javadoc pandoc"
# e.g. empty or sonarqube
gradle_sonar="sonarqube"
# gradle options for examples
gradle_opts="--console=plain --no-build-cache --no-daemon"
# maven arguments for examples
maven_args="compile exec:java"
#
# Version: 1.1.3
#
if [ "$java8" = true ]
then
export JAVA_HOME="$JAVA8_HOME"
export PATH="$(cygpath "$JAVA_HOME")/bin:$PATH"
fi
pwd=$PWD
red=$(tput setaf 1)
cyan=$(tput setaf 6)
std=$(tput sgr0)
date=$(date +%Y)
pause() {
read -p "Press [Enter] key to continue..."
}
checkCopyright() {
if [ "$(grep -c "$date" "$1")" -eq 0 ]
then
echo -e " Invalid: ${red}$f${std}"
else
echo -e " Checked: $1"
fi
}
runGradle() {
cd "$1" || exit 1
clear
reset
echo -e "> Project: ${cyan}${1}${std} [Gradle]"
shift
./gradlew $@ || exit 1
pause
cd "$pwd"
}
runKobalt() {
cd "$1" || exit 1
if [ -f kobalt/src/Build.kt ]
then
clear
reset
echo -e "> Project: ${cyan}${1}${std} [Kobalt]"
shift
./kobaltw $@ || exit 1
pause
fi
cd "$pwd"
}
runMaven() {
cd "$1" || exit 1
if [ -f pom.xml ]
then
clear
reset
echo -e "> Project: ${cyan}${1}${std} [Maven]"
shift
mvn $@ || exit 1
pause
fi
cd "$pwd"
}
updateWrappers() {
clear
./updatewrappers.sh
pause
}
checkDeps() {
clear
echo -e "${cyan}Checking depencencies...${std}"
gradle --console=plain dU || exit 1
read -p "Check Examples depencencies? [y/n] " cont
clear
case $cont in
[Nn] ) return ;;
* ) for ex in "${!examples[@]}"
do
runGradle $(echo "${examples[ex]}" | cut -d " " -f 1) dU
runKobalt $(echo "${examples[ex]}" | cut -d " " -f 1) checkVersions
runMaven $(echo "${examples[ex]}" | cut -d " " -f 1) versions:display-dependency-updates
if [ "$ex" -eq "${#examples}" ]
then
read -p "Continue? [y/n]: " cont
clear
case $cont in
* ) continue ;;
[Nn] ) return ;;
esac
fi
done ;;
esac
}
gradleCheck() {
clear
echo -e "${cyan}Checking Gradle build....${std}"
gradle $gradle_opts clean check $gradle_doc $gradle_sonar || exit 1
pause
}
runExamples() {
for ex in "${!examples[@]}"
do
runGradle ${examples[ex]} clean $gradle_opts
runKobalt ${examples[ex]} clean
runMaven $(echo "${examples[ex]}" | cut -d " " -f 1) clean $maven_args
done
}
examplesMenu() {
clear
echo -e "${cyan}Examples${std}"
for ex in "${!examples[@]}"
do
printf ' %d. %s\n' $(($ex + 1)) $(echo "${examples[ex]}" | cut -d " " -f 1)
done
echo " $((${#examples[@]} + 1)). Run All Examples"
read -p "Enter choice [1-${#examples[@]}]: " choice
clear
case $choice in
[0-9] ) if [ "$choice" -gt "${#examples[@]}" ]
then
runExamples
examplesMenu
else
runGradle ${examples[$(($choice - 1))]}
runKobalt ${examples[$(($choice - 1))]}
runMaven $(echo "${examples[$(($choice - 1))]}" | cut -d " " -f 1) $maven_args
examplesMenu
fi ;;
* ) return ;;
esac
}
validateCopyrights() {
clear
echo -e "${cyan}Validating copyrights...${std}"
for f in LICENSE.TXT ${src}/*${ext} ${test}/*${ext}
do
checkCopyright "$f"
done
pause
}
everything() {
updateWrappers
checkDeps
gradleCheck
runExamples
validateCopyrights
}
showMenu() {
clear
echo "${cyan}Preflight Check${std}"
echo " 1. Update Wrappers"
echo " 2. Check Dependencies"
echo " 3. Check Gradle Build"
echo " 4. Run Examples"
echo " 5. Validate Copyrights"
echo " 6. Check Everything"
}
readOptions(){
local choice
read -p "Enter choice [1-6]: " choice
case $choice in
1) updateWrappers ;;
2) checkDeps ;;
3) gradleCheck ;;
4) examplesMenu ;;
5) validateCopyrights ;;
6) everything ;;
*) exit 0 ;;
esac
}
while true
do
showMenu
readOptions
done

View file

@ -1,19 +0,0 @@
/*
* This settings file was auto generated by the Gradle buildInit task
* by 'erik' at '1/13/16 1:03 PM' with Gradle 2.10
*
* The settings file is used to specify which projects to include in your build.
* In a single project build this file can be empty or even removed.
*
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user guide at https://docs.gradle.org/2.10/userguide/multi_project_builds.html
*/
/*
// To declare projects as part of a multi-project build use the 'include' method
include 'shared'
include 'api'
include 'services:webservice'
*/
rootProject.name = 'semver'

7
sonar-project.properties Normal file
View file

@ -0,0 +1,7 @@
sonar.organization=ethauvin-github
sonar.projectKey=ethauvin_semver
sonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/test/jacocoTestReport.xml
sonar.sources=src/main/java/
sonar.tests=src/test/java/
sonar.java.binaries=build/main,build/test
sonar.java.libraries=lib/compile/*.jar

View file

@ -0,0 +1,142 @@
/*
* SemverBuild.java
*
* 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.
*/
package net.thauvin.erik.semver;
import rife.bld.BuildCommand;
import rife.bld.Project;
import rife.bld.extension.JacocoReportOperation;
import rife.bld.extension.PmdOperation;
import rife.bld.extension.TestNgOperation;
import rife.bld.publish.*;
import rife.tools.exceptions.FileUtilsErrorException;
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import static rife.bld.dependencies.Repository.*;
import static rife.bld.dependencies.Scope.compile;
import static rife.bld.dependencies.Scope.test;
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
public class SemverBuild extends Project {
public SemverBuild() {
pkg = "net.thauvin.erik.semver";
name = "SemVer";
version = version(1, 2, 1, "SNAPSHOT");
var description = "Semantic Version Annotation Processor";
var url = "https://github.com/ethauvin/semver";
javaRelease = 17;
downloadSources = true;
repositories = List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS);
scope(compile)
.include(dependency("com.github.spullara.mustache.java", "compiler",
version(0, 9, 10)));
scope(test)
.include(dependency("org.assertj", "assertj-joda-time", version(2, 2, 0)))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0)));
javadocOperation().javadocOptions()
.tag("created.on", "a", "Created on:")
.windowTitle(name + ' ' + version.toString() + " API")
.docLint(NO_MISSING);
publishOperation()
.repository(version.isSnapshot() ? repository(SONATYPE_SNAPSHOTS_LEGACY.location())
.withCredentials(property("sonatype.user"), property("sonatype.password"))
: repository(SONATYPE_RELEASES.location())
.withCredentials(property("sonatype.user"), property("sonatype.password")))
.repository(MAVEN_LOCAL)
.info(new PublishInfo()
.groupId(pkg)
.artifactId(name.toLowerCase())
.name(name).version(version)
.description(description)
.url(url)
.developer(new PublishDeveloper()
.id("ethauvin")
.name("Erik C. Thauvin")
.email("erik@thauvin.net")
.url("https://erik.thauvin.net/"))
.license(new PublishLicense()
.name("The BSD 3-Clause License")
.url("http://opensource.org/licenses/BSD-3-Clause"))
.scm(new PublishScm()
.connection("scm:git:" + url + ".git")
.developerConnection("scm:git:git@github.com:ethauvin/" + name.toLowerCase() + ".git")
.url(url))
.signKey(property("sign.key"))
.signPassphrase(property("sign.passphrase")));
}
public static void main(String[] args) {
new SemverBuild().start(args);
}
@BuildCommand(summary = "Generates JaCoCo Reports")
public void jacoco() throws IOException {
new JacocoReportOperation().fromProject(this).execute();
}
@BuildCommand(summary = "Runs PMD analysis")
public void pmd() {
new PmdOperation()
.fromProject(this)
.failOnViolation(true)
.ruleSets("config/pmd.xml")
.execute();
}
private void rootPom() throws FileUtilsErrorException {
PomBuilder.generateInto(publishOperation().info(), publishOperation().dependencies(),
Path.of(workDirectory.getPath(), "pom.xml").toFile());
}
@Override
public void publish() throws Exception {
super.publish();
rootPom();
}
@Override
public void publishLocal() throws Exception {
super.publishLocal();
rootPom();
}
}

View file

@ -1,7 +1,7 @@
/* /*
* Constants.java * Constants.java
* *
* Copyright (c) 2016-2020, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -36,10 +36,10 @@ package net.thauvin.erik.semver;
* The <code>Constants</code> class holds the constant variables used throughout this project. * The <code>Constants</code> class holds the constant variables used throughout this project.
* *
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a> * @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
* @created 2016-01-13 * @created.on 2016-01-13
* @since 1.0 * @since 1.0
*/ */
@SuppressWarnings("WeakerAccess") @SuppressWarnings("PMD.DataClass")
public final class Constants { public final class Constants {
/** /**
* The default metadata prefix. * The default metadata prefix.

View file

@ -1,7 +1,7 @@
/* /*
* Version.java * Version.java
* *
* Copyright (c) 2016-2020, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2016-2023, 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
@ -41,9 +41,10 @@ import java.lang.annotation.Target;
* The <code>Version</code> class implements the annotation interface. * The <code>Version</code> class implements the annotation interface.
* *
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a> * @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
* @created 2016-01-13 * @created.on 2016-01-13
* @since 1.0 * @since 1.0
*/ */
@SuppressWarnings("SameReturnValue")
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
public @interface Version { public @interface Version {

View file

@ -1,7 +1,7 @@
/* /*
* VersionInfo.java * VersionInfo.java
* *
* Copyright (c) 2016-2020, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -36,7 +36,7 @@ package net.thauvin.erik.semver;
* The <code>VersionInfo</code> class is used to hold and retrieve the semantic version values. * The <code>VersionInfo</code> class is used to hold and retrieve the semantic version values.
* *
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a> * @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
* @created 2016-01-16 * @created.on 2016-01-16
* @since 1.0 * @since 1.0
*/ */
@SuppressWarnings("PMD.DataClass") @SuppressWarnings("PMD.DataClass")
@ -101,15 +101,6 @@ public class VersionInfo {
return buildMeta; return buildMeta;
} }
/**
* Sets the build meta-data.
*
* @param buildMeta The new build meta-data.
*/
public void setBuildMeta(final String buildMeta) {
this.buildMeta = buildMeta;
}
/** /**
* Returns the meta-data prefix. * Returns the meta-data prefix.
* *
@ -119,15 +110,6 @@ public class VersionInfo {
return buildMetaPrefix; return buildMetaPrefix;
} }
/**
* Sets the meta-data prefix.
*
* @param buildMetaPrefix The meta-data prefix.
*/
public void setBuildMetaPrefix(final String buildMetaPrefix) {
this.buildMetaPrefix = buildMetaPrefix;
}
/** /**
* Returns the class name. * Returns the class name.
* *
@ -137,15 +119,6 @@ public class VersionInfo {
return className; return className;
} }
/**
* Sets the class name.
*
* @param className The new class name.
*/
public void setClassName(final String className) {
this.className = className;
}
/** /**
* Returns the build epoch/Unix timestamp. * Returns the build epoch/Unix timestamp.
* *
@ -164,15 +137,6 @@ public class VersionInfo {
return major; return major;
} }
/**
* Sets the major version.
*
* @param major The new major version.
*/
public void setMajor(final int major) {
this.major = major;
}
/** /**
* Returns the major version. * Returns the major version.
* *
@ -182,15 +146,6 @@ public class VersionInfo {
return minor; return minor;
} }
/**
* Sets the minor version.
*
* @param minor The new minor version.
*/
public void setMinor(final int minor) {
this.minor = minor;
}
/** /**
* Returns the package name. * Returns the package name.
* *
@ -200,15 +155,6 @@ public class VersionInfo {
return packageName; return packageName;
} }
/**
* Sets the package name.
*
* @param packageName The new package name.
*/
public void setPackageName(final String packageName) {
this.packageName = packageName;
}
/** /**
* Returns the patch version. * Returns the patch version.
* *
@ -218,15 +164,6 @@ public class VersionInfo {
return patch; return patch;
} }
/**
* Sets the patch version.
*
* @param patch The new patch version.
*/
public void setPatch(final int patch) {
this.patch = patch;
}
/** /**
* Returns the pre-release version. * Returns the pre-release version.
* *
@ -236,15 +173,6 @@ public class VersionInfo {
return preRelease; return preRelease;
} }
/**
* Sets the pre-release version.
*
* @param preRelease The new pre-release version.
*/
public void setPreRelease(final String preRelease) {
this.preRelease = preRelease;
}
/** /**
* Returns the pre-release prefix. * Returns the pre-release prefix.
* *
@ -254,15 +182,6 @@ public class VersionInfo {
return preReleasePrefix; return preReleasePrefix;
} }
/**
* Sets the pre-release prefix.
*
* @param preReleasePrefix The new pre-release prefix.
*/
public void setPreReleasePrefix(final String preReleasePrefix) {
this.preReleasePrefix = preReleasePrefix;
}
/** /**
* Returns the project name. * Returns the project name.
* *
@ -272,15 +191,6 @@ public class VersionInfo {
return project; return project;
} }
/**
* Sets the project name.
*
* @param project The new project name.
*/
public void setProject(final String project) {
this.project = project;
}
/** /**
* Sames as {@link #getVersion()}. * Sames as {@link #getVersion()}.
* *
@ -299,15 +209,6 @@ public class VersionInfo {
return separator; return separator;
} }
/**
* Sets the version separator.
*
* @param separator The new version separator.
*/
public void setSeparator(final String separator) {
this.separator = separator;
}
/** /**
* Returns the full version string. * Returns the full version string.
* *
@ -330,11 +231,110 @@ public class VersionInfo {
*/ */
public String getVersion() { public String getVersion() {
return major return major
+ separator + separator
+ minor + minor
+ separator + separator
+ patch + patch
+ (preRelease.length() > 0 ? preReleasePrefix + preRelease : "") + (!preRelease.isEmpty() ? preReleasePrefix + preRelease : "")
+ (buildMeta.length() > 0 ? buildMetaPrefix + buildMeta : ""); + (!buildMeta.isEmpty() ? buildMetaPrefix + buildMeta : "");
}
/**
* Sets the build meta-data.
*
* @param buildMeta The new build meta-data.
*/
public void setBuildMeta(final String buildMeta) {
this.buildMeta = buildMeta;
}
/**
* Sets the meta-data prefix.
*
* @param buildMetaPrefix The meta-data prefix.
*/
public void setBuildMetaPrefix(final String buildMetaPrefix) {
this.buildMetaPrefix = buildMetaPrefix;
}
/**
* Sets the class name.
*
* @param className The new class name.
*/
public void setClassName(final String className) {
this.className = className;
}
/**
* Sets the major version.
*
* @param major The new major version.
*/
public void setMajor(final int major) {
this.major = major;
}
/**
* Sets the minor version.
*
* @param minor The new minor version.
*/
public void setMinor(final int minor) {
this.minor = minor;
}
/**
* Sets the package name.
*
* @param packageName The new package name.
*/
public void setPackageName(final String packageName) {
this.packageName = packageName;
}
/**
* Sets the patch version.
*
* @param patch The new patch version.
*/
public void setPatch(final int patch) {
this.patch = patch;
}
/**
* Sets the pre-release version.
*
* @param preRelease The new pre-release version.
*/
public void setPreRelease(final String preRelease) {
this.preRelease = preRelease;
}
/**
* Sets the pre-release prefix.
*
* @param preReleasePrefix The new pre-release prefix.
*/
public void setPreReleasePrefix(final String preReleasePrefix) {
this.preReleasePrefix = preReleasePrefix;
}
/**
* Sets the project name.
*
* @param project The new project name.
*/
public void setProject(final String project) {
this.project = project;
}
/**
* Sets the version separator.
*
* @param separator The new version separator.
*/
public void setSeparator(final String separator) {
this.separator = separator;
} }
} }

View file

@ -1,7 +1,7 @@
/* /*
* VersionProcessor.java * VersionProcessor.java
* *
* Copyright (c) 2016-2020, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -36,14 +36,8 @@ import com.github.mustachejava.DefaultMustacheFactory;
import com.github.mustachejava.Mustache; import com.github.mustachejava.Mustache;
import com.github.mustachejava.MustacheFactory; import com.github.mustachejava.MustacheFactory;
import com.github.mustachejava.MustacheNotFoundException; import com.github.mustachejava.MustacheNotFoundException;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.*;
import javax.annotation.processing.Filer;
import javax.annotation.processing.Messager;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedOptions;
import javax.lang.model.SourceVersion; import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element; import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind; import javax.lang.model.element.ElementKind;
@ -51,12 +45,7 @@ import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement; import javax.lang.model.element.TypeElement;
import javax.tools.Diagnostic; import javax.tools.Diagnostic;
import javax.tools.FileObject; import javax.tools.FileObject;
import java.io.File; import java.io.*;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.HashSet; import java.util.HashSet;
@ -67,57 +56,70 @@ import java.util.Set;
* The <code>VersionProcessor</code> class implements a semantic version annotation processor. * The <code>VersionProcessor</code> class implements a semantic version annotation processor.
* *
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a> * @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
* @created 2016-01-13 * @created.on 2016-01-13
* @since 1.0 * @since 1.0
*/ */
@SuppressWarnings("PMD.GuardLogStatement") @SuppressWarnings({"PMD.GuardLogStatement", "PMD.BeanMembersShouldSerialize"})
@SupportedOptions({Constants.KAPT_KOTLIN_GENERATED_OPTION_NAME, Constants.SEMVER_PROJECT_DIR_ARG}) @SupportedOptions({Constants.KAPT_KOTLIN_GENERATED_OPTION_NAME, Constants.SEMVER_PROJECT_DIR_ARG})
public class VersionProcessor extends AbstractProcessor { public class VersionProcessor extends AbstractProcessor {
private Filer filer; private Filer filer;
private Messager messager; private Messager messager;
private static String getTemplate(final boolean isLocalTemplate, final Version version) {
final String template;
if (isLocalTemplate && Constants.DEFAULT_JAVA_TEMPLATE.equals(version.template())) {
template = Constants.DEFAULT_TEMPLATE_NAME;
} else if (Constants.DEFAULT_JAVA_TEMPLATE.equals(version.template()) && Constants.KOTLIN_TYPE
.equals(version.type())) {
template = Constants.DEFAULT_KOTLIN_TEMPLATE;
} else {
template = version.template();
}
return template;
}
private void error(final String s) { private void error(final String s) {
log(Diagnostic.Kind.ERROR, s); log(Diagnostic.Kind.ERROR, s);
} }
@SuppressWarnings("PMD.UnusedPrivateMethod")
private void error(final String s, final Throwable t) { private void error(final String s, final Throwable t) {
log(Diagnostic.Kind.ERROR, (t != null ? t.toString() : s)); log(Diagnostic.Kind.ERROR, t != null ? t.toString() : s);
} }
@SuppressFBWarnings({"PATH_TRAVERSAL_IN", "UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH"})
private VersionInfo findValues(final Version version) throws IOException { private VersionInfo findValues(final Version version) throws IOException {
final VersionInfo versionInfo = new VersionInfo(version); final VersionInfo versionInfo = new VersionInfo(version);
if (version.properties().length() > 0) { if (!version.properties().isEmpty()) {
final File propsFile = getLocalFile(version.properties()); final File propsFile = getLocalFile(version.properties());
if (propsFile.isFile() && propsFile.canRead()) { if (propsFile.isFile() && propsFile.canRead()) {
note("Found properties: " + propsFile.getName() + " (" + propsFile.getAbsoluteFile().getParent() + ')'); note("Found properties: " + propsFile.getName() + " (" + propsFile.getAbsoluteFile().getParent() + ')');
final Properties p = new Properties(); final Properties p = new Properties();
try (final InputStreamReader reader = new InputStreamReader( try (InputStreamReader reader = new InputStreamReader(
Files.newInputStream(propsFile.toPath()), StandardCharsets.UTF_8)) { Files.newInputStream(propsFile.toPath()), StandardCharsets.UTF_8)) {
p.load(reader); p.load(reader);
versionInfo.setProject( versionInfo.setProject(
p.getProperty(version.keysPrefix() + version.projectKey(), version.project())); p.getProperty(version.keysPrefix() + version.projectKey(), version.project()));
versionInfo.setMajor( versionInfo.setMajor(
parseIntProperty(p, version.keysPrefix() + version.majorKey(), version.major())); parseIntProperty(p, version.keysPrefix() + version.majorKey(), version.major()));
versionInfo.setMinor( versionInfo.setMinor(
parseIntProperty(p, version.keysPrefix() + version.minorKey(), version.minor())); parseIntProperty(p, version.keysPrefix() + version.minorKey(), version.minor()));
versionInfo.setPatch( versionInfo.setPatch(
parseIntProperty(p, version.keysPrefix() + version.patchKey(), version.patch())); parseIntProperty(p, version.keysPrefix() + version.patchKey(), version.patch()));
versionInfo.setBuildMeta( versionInfo.setBuildMeta(
p.getProperty(version.keysPrefix() + version.buildMetaKey(), version.buildMeta())); p.getProperty(version.keysPrefix() + version.buildMetaKey(), version.buildMeta()));
versionInfo.setBuildMetaPrefix( versionInfo.setBuildMetaPrefix(
p.getProperty(version.keysPrefix() + version.buildMetaPrefixKey(), version.buildMetaPrefix())); p.getProperty(version.keysPrefix() + version.buildMetaPrefixKey(), version.buildMetaPrefix()));
versionInfo.setPreRelease( versionInfo.setPreRelease(
p.getProperty(version.keysPrefix() + version.preReleaseKey(), version.preRelease())); p.getProperty(version.keysPrefix() + version.preReleaseKey(), version.preRelease()));
versionInfo.setPreReleasePrefix(p.getProperty(version.keysPrefix() + version.preReleasePrefixKey(), versionInfo.setPreReleasePrefix(p.getProperty(version.keysPrefix() + version.preReleasePrefixKey(),
version.preReleasePrefix())); version.preReleasePrefix()));
versionInfo.setSeparator( versionInfo.setSeparator(
p.getProperty(version.keysPrefix() + version.separatorKey(), version.separator())); p.getProperty(version.keysPrefix() + version.separatorKey(), version.separator()));
} }
} else { } else {
final String findOrRead; final String findOrRead;
@ -128,14 +130,13 @@ public class VersionProcessor extends AbstractProcessor {
} }
error("Could not " + findOrRead + ": " + propsFile); error("Could not " + findOrRead + ": " + propsFile);
throw new FileNotFoundException( throw new FileNotFoundException(
"Could not " + findOrRead + " the specified file: `" + propsFile.getAbsolutePath() + '`'); "Could not " + findOrRead + " the specified file: `" + propsFile.getAbsolutePath() + '`');
} }
} }
return versionInfo; return versionInfo;
} }
@SuppressFBWarnings("PATH_TRAVERSAL_IN")
private File getLocalFile(final String fileName) { private File getLocalFile(final String fileName) {
if (processingEnv != null) { // null when testing. if (processingEnv != null) { // null when testing.
final String prop = processingEnv.getOptions().get(Constants.SEMVER_PROJECT_DIR_ARG); final String prop = processingEnv.getOptions().get(Constants.SEMVER_PROJECT_DIR_ARG);
@ -193,15 +194,7 @@ public class VersionProcessor extends AbstractProcessor {
versionInfo.setPackageName(packageElement.getQualifiedName().toString()); versionInfo.setPackageName(packageElement.getQualifiedName().toString());
} }
note("Found version: " + versionInfo.getVersion()); note("Found version: " + versionInfo.getVersion());
final String template; final String template = getTemplate(isLocalTemplate, version);
if (isLocalTemplate && Constants.DEFAULT_JAVA_TEMPLATE.equals(version.template())) {
template = Constants.DEFAULT_TEMPLATE_NAME;
} else if (Constants.DEFAULT_JAVA_TEMPLATE.equals(version.template()) && Constants.KOTLIN_TYPE
.equals(version.type())) {
template = Constants.DEFAULT_KOTLIN_TEMPLATE;
} else {
template = version.template();
}
writeTemplate(version.type(), versionInfo, template); writeTemplate(version.type(), versionInfo, template);
} catch (IOException | MustacheNotFoundException e) { } catch (IOException | MustacheNotFoundException e) {
@ -216,7 +209,7 @@ public class VersionProcessor extends AbstractProcessor {
private void log(final Diagnostic.Kind kind, final String s) { private void log(final Diagnostic.Kind kind, final String s) {
if (messager != null) { if (messager != null) {
messager.printMessage(kind, messager.printMessage(kind,
'[' + VersionProcessor.class.getSimpleName() + "] " + s + System.lineSeparator()); '[' + VersionProcessor.class.getSimpleName() + "] " + s + System.lineSeparator());
} }
} }
@ -237,25 +230,17 @@ public class VersionProcessor extends AbstractProcessor {
log(Diagnostic.Kind.WARNING, s); log(Diagnostic.Kind.WARNING, s);
} }
@SuppressFBWarnings({"PATH_TRAVERSAL_IN", "UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH"})
private void writeTemplate(final String type, final VersionInfo versionInfo, final String template) private void writeTemplate(final String type, final VersionInfo versionInfo, final String template)
throws IOException { throws IOException {
final File dir = getLocalFile(""); final File dir = getLocalFile("");
final MustacheFactory mf = new DefaultMustacheFactory(dir); final MustacheFactory mf = new DefaultMustacheFactory(dir);
final Mustache mustache = mf.compile(template); final Mustache mustache = mf.compile(template);
final String templateName; final String templateName = switch (mustache.getName()) {
switch (mustache.getName()) { case Constants.DEFAULT_JAVA_TEMPLATE -> "default (Java)";
case Constants.DEFAULT_JAVA_TEMPLATE: case Constants.DEFAULT_KOTLIN_TEMPLATE -> "default (Kotlin)";
templateName = "default (Java)"; default -> mustache.getName() + " (" + dir.getAbsolutePath() + ')';
break; };
case Constants.DEFAULT_KOTLIN_TEMPLATE:
templateName = "default (Kotlin)";
break;
default:
templateName = mustache.getName() + " (" + dir.getAbsolutePath() + ')';
break;
}
note("Loaded template: " + templateName); note("Loaded template: " + templateName);
final String fileName = versionInfo.getClassName() + '.' + type; final String fileName = versionInfo.getClassName() + '.' + type;
@ -268,15 +253,15 @@ public class VersionProcessor extends AbstractProcessor {
if (!ktFile.getParentFile().exists() && !ktFile.getParentFile().mkdirs()) { if (!ktFile.getParentFile().exists() && !ktFile.getParentFile().mkdirs()) {
note("Could not create target directory: " + ktFile.getParentFile().getAbsolutePath()); note("Could not create target directory: " + ktFile.getParentFile().getAbsolutePath());
} }
try (final OutputStreamWriter osw = new OutputStreamWriter(Files.newOutputStream(ktFile.toPath()), try (OutputStreamWriter osw = new OutputStreamWriter(Files.newOutputStream(ktFile.toPath()),
StandardCharsets.UTF_8)) { StandardCharsets.UTF_8)) {
mustache.execute(osw, versionInfo).flush(); mustache.execute(osw, versionInfo).flush();
} }
note("Generated source: " + fileName + " (" + ktFile.getParentFile().getAbsolutePath() + ')'); note("Generated source: " + fileName + " (" + ktFile.getParentFile().getAbsolutePath() + ')');
} else { } else {
final FileObject jfo = filer.createSourceFile( final FileObject jfo = filer.createSourceFile(
versionInfo.getPackageName() + '.' + versionInfo.getClassName()); versionInfo.getPackageName() + '.' + versionInfo.getClassName());
try (final Writer writer = jfo.openWriter()) { try (Writer writer = jfo.openWriter()) {
mustache.execute(writer, versionInfo).flush(); mustache.execute(writer, versionInfo).flush();
} }
note("Generated source: " + fileName + " (" + new File(jfo.getName()).getAbsoluteFile().getParent() + ')'); note("Generated source: " + fileName + " (" + new File(jfo.getName()).getAbsoluteFile().getParent() + ')');

View file

@ -1 +1,33 @@
#
# 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 net.thauvin.erik.semver.VersionProcessor

View file

@ -1,38 +1,38 @@
/* /*
* This file is automatically generated. * This file is automatically generated.
* Do not modify! -- ALL CHANGES WILL BE ERASED! * Do not modify! -- ALL CHANGES WILL BE ERASED!
*/ */
package {{packageName}} package {{packageName}}
import java.util.Date import java.util.Date
/** /**
* Provides semantic version information. * Provides semantic version information.
* *
* @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a> * @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a>
*/ */
object {{className}} { object {{className}} {
@JvmField @JvmField
val PROJECT = "{{project}}" val PROJECT = "{{project}}"
@JvmField @JvmField
val BUILDDATE = Date({{epoch}}L) val BUILDDATE = Date({{epoch}}L)
@JvmField @JvmField
val MAJOR = {{major}} val MAJOR = {{major}}
@JvmField @JvmField
val MINOR = {{minor}} val MINOR = {{minor}}
@JvmField @JvmField
val PATCH = {{patch}} val PATCH = {{patch}}
@JvmField @JvmField
val PRERELEASE = "{{preRelease}}" val PRERELEASE = "{{preRelease}}"
@JvmField @JvmField
val PRERELEASE_PREFIX = "{{preReleasePrefix}}" val PRERELEASE_PREFIX = "{{preReleasePrefix}}"
@JvmField @JvmField
val BUILDMETA = "{{buildMeta}}" val BUILDMETA = "{{buildMeta}}"
@JvmField @JvmField
val BUILDMEATA_PREFIX = "{{buildMetaPrefix}}" val BUILDMEATA_PREFIX = "{{buildMetaPrefix}}"
@JvmField @JvmField
val SEPARATOR = "{{separator}}" val SEPARATOR = "{{separator}}"
@JvmField @JvmField
val VERSION = "{{version}}" val VERSION = "{{version}}"
} }

View file

@ -1,34 +1,34 @@
/* /*
* This file is automatically generated. * This file is automatically generated.
* Do not modify! -- ALL CHANGES WILL BE ERASED! * Do not modify! -- ALL CHANGES WILL BE ERASED!
*/ */
package {{packageName}}; package {{packageName}};
import java.util.Date; import java.util.Date;
/** /**
* Provides semantic version information. * Provides semantic version information.
* *
* @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a> * @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a>
*/ */
public final class {{className}} { public final class {{className}} {
public static final String PROJECT = "{{project}}"; public static final String PROJECT = "{{project}}";
public static final Date BUILDDATE = new Date({{epoch}}L); public static final Date BUILDDATE = new Date({{epoch}}L);
public static final int MAJOR = {{major}}; public static final int MAJOR = {{major}};
public static final int MINOR = {{minor}}; public static final int MINOR = {{minor}};
public static final int PATCH = {{patch}}; public static final int PATCH = {{patch}};
public static final String PRERELEASE = "{{preRelease}}"; public static final String PRERELEASE = "{{preRelease}}";
public static final String PRERELEASE_PREFIX = "{{preReleasePrefix}}"; public static final String PRERELEASE_PREFIX = "{{preReleasePrefix}}";
public static final String BUILDMETA = "{{buildMeta}}"; public static final String BUILDMETA = "{{buildMeta}}";
public static final String BUILDMETA_PREFIX = "{{buildMetaPrefix}}"; public static final String BUILDMETA_PREFIX = "{{buildMetaPrefix}}";
public static final String SEPARATOR = "{{separator}}"; public static final String SEPARATOR = "{{separator}}";
public static final String VERSION = "{{version}}"; public static final String VERSION = "{{version}}";
/** /**
* Disables the default constructor. * Disables the default constructor.
*/ */
private {{className}}() { private {{className}}() {
throw new UnsupportedOperationException("Illegal constructor call."); throw new UnsupportedOperationException("Illegal constructor call.");
} }
} }

Some files were not shown because too many files have changed in this diff Show more