Compare commits

..

No commits in common. "master" and "1.2.1" have entirely different histories.

93 changed files with 643 additions and 1050 deletions

View file

@ -1,42 +1,41 @@
version: 2.1 inversion: 2
defaults: &defaults
working_directory: ~/repo
environment:
JVM_OPTS: -Xmx3200m
TERM: dumb
CI_NAME: "CircleCI"
commands: defaults_gradle: &defaults_bld
build_and_test:
parameters:
reports-dir:
type: string
default: "build/reports/test_results"
steps: steps:
- checkout - checkout
- run: - run:
name: Download dependencies name: Download the dependencies
command: ./bld download command: ./bld download
- run: - run:
name: Compile source name: Run tests with bld
command: ./bld compile command: ./bld compile test
- run:
name: Run tests
command: ./bld jacoco -reports-dir=<< parameters.reports-dir >>
- store_test_results:
path: << parameters.reports-dir >>
- store_artifacts:
path: build/reports/jacoco/test/html
jobs: jobs:
bld_jdk20:
<<: *defaults
docker:
- image: cimg/openjdk:20.0
<<: *defaults_bld
bld_jdk17: bld_jdk17:
<<: *defaults
docker: docker:
- image: cimg/openjdk:17.0 - image: cimg/openjdk:17.0
steps:
- build_and_test
bld_jdk21: <<: *defaults_bld
docker:
- image: cimg/openjdk:21.0
steps:
- build_and_test
workflows: workflows:
version: 2
bld: bld:
jobs: jobs:
- bld_jdk17 - bld_jdk17
- bld_jdk21 - bld_jdk20

View file

@ -4,73 +4,50 @@ on: [push, pull_request, workflow_dispatch]
jobs: jobs:
build-bld-project: build-bld-project:
runs-on: ubuntu-latest
env: env:
COVERAGE_JDK: "17" COVERAGE_SDK: "17"
strategy: strategy:
matrix: matrix:
java-version: [17, 21, 24] java-version: [ 17, 20 ]
os: [ ubuntu-latest, windows-latest, macos-latest ]
runs-on: ${{ matrix.os }}
steps: steps:
- name: Checkout source repository - name: Checkout source repository
uses: actions/checkout@v4 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up JDK ${{ matrix.java-version }} - name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4 uses: actions/setup-java@v3
with: with:
distribution: "zulu" distribution: 'zulu'
java-version: ${{ matrix.java-version }} java-version: ${{ matrix.java-version }}
- name: Download dependencies [bld example] - name: Grant execute permission for bld
working-directory: examples/java/bld run: chmod +x bld
- name: Download the dependencies
run: ./bld download run: ./bld download
- name: Compile and run [bld example] - name: Run tests with bld
working-directory: examples/java/bld run: ./bld compile jacoco
run: |
./bld compile
./bld run
./bld run-example
- name: Run example [gradle java examples]
working-directory: examples/java/gradle
run: |
./gradlew run
./gradlew runExample
- name: Run example [gradle kotlin examples]
working-directory: examples/kotlin
run: |
./gradlew run
./gradlew runExample
- name: Download dependencies
run: ./bld download
- name: Compile source
run: ./bld compile
- name: Run tests
run: ./bld jacoco
- name: Remove pom.xml - name: Remove pom.xml
if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.os == 'ubuntu-latest' if: success() && matrix.java-version == env.COVERAGE_SDK
run: rm -rf pom.xml run: rm -rf pom.xml
- name: SonarCloud Scan - name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master uses: sonarsource/sonarcloud-github-action@master
if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.os == 'ubuntu-latest' if: success() && matrix.java-version == env.COVERAGE_SDK
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Upload coverage reports to Codecov - name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3 uses: codecov/codecov-action@v3
if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.os == 'ubuntu-latest' if: success() && matrix.java-version == env.COVERAGE_SDK
env: env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

1
.gitignore vendored
View file

@ -55,4 +55,3 @@ atlassian-ide-plugin.xml
.idea/httpRequests .idea/httpRequests
local.properties local.properties
target

3
.idea/app.iml generated
View file

@ -6,9 +6,10 @@
<exclude-output /> <exclude-output />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" relativeOutputPath="resources" /> <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/src/main/resources/templates" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />

6
.idea/bld.xml generated
View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BldConfiguration">
<events />
</component>
</project>

16
.idea/compiler.xml generated Normal file
View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Gradle Imported" enabled="true">
<outputRelativeToContentRoot value="true" />
<option name="semver.project.dir" value="$PROJECT_DIR$/examples/java/gradle" />
<processorPath useClasspath="false">
<entry name="$MAVEN_REPOSITORY$/net/thauvin/erik/semver/1.2.1-SNAPSHOT/semver-1.2.1-SNAPSHOT.jar" />
<entry name="$MAVEN_REPOSITORY$/com/github/spullara/mustache/java/compiler/0.9.10/compiler-0.9.10.jar" />
</processorPath>
<module name="examples-java.main" />
</profile>
</annotationProcessing>
</component>
</project>

View file

@ -1,3 +1,7 @@
<component name="CopyrightManager"> <component name="CopyrightManager">
<settings default="BSD-3 Clause" /> <settings>
<module2copyright>
<element module="Source Code" copyright="BSD-3 Clause" />
</module2copyright>
</settings>
</component> </component>

View file

@ -2,7 +2,8 @@
<profile version="1.0"> <profile version="1.0">
<option name="myName" value="Project Default" /> <option name="myName" value="Project Default" />
<inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true"> <inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ADDITIONAL_TAGS" value="created" /> <option name="ADDITIONAL_TAGS" value="created,created.on" />
</inspection_tool> </inspection_tool>
<inspection_tool class="RedundantExplicitVariableType" enabled="true" level="INFORMATION" enabled_by_default="true" editorAttributes="INFORMATION_ATTRIBUTES" />
</profile> </profile>
</component> </component>

View file

@ -1,204 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaDocConfiguration">
<GENERAL>
<MODE>UPDATE</MODE>
<OVERRIDDEN_METHODS>false</OVERRIDDEN_METHODS>
<SPLITTED_CLASS_NAME>true</SPLITTED_CLASS_NAME>
<LEVELS>
<LEVEL>FIELD</LEVEL>
<LEVEL>TYPE</LEVEL>
<LEVEL>METHOD</LEVEL>
</LEVELS>
<VISIBILITIES>
<VISIBILITY>DEFAULT</VISIBILITY>
<VISIBILITY>PUBLIC</VISIBILITY>
<VISIBILITY>PROTECTED</VISIBILITY>
</VISIBILITIES>
</GENERAL>
<TEMPLATES>
<CLASSES>
<CLASS>
<KEY>^.*(public|protected|private)*.+interface\s+\w+.*</KEY>
<VALUE>/**\n
* The interface ${name}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
*/</VALUE>
</CLASS>
<CLASS>
<KEY>^.*(public|protected|private)*.+enum\s+\w+.*</KEY>
<VALUE>/**\n
* The enum ${name}.\n
*/</VALUE>
</CLASS>
<CLASS>
<KEY>^.*(public|protected|private)*.+class\s+\w+.*</KEY>
<VALUE>/**\n
* The type ${name}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
*/</VALUE>
</CLASS>
<CLASS>
<KEY>.+</KEY>
<VALUE>/**\n
* The type ${name}.\n
*/</VALUE>
</CLASS>
</CLASSES>
<CONSTRUCTORS>
<CONSTRUCTOR>
<KEY>.+</KEY>
<VALUE>/**\n
* Instantiates a new ${name}.\n
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</CONSTRUCTOR>
</CONSTRUCTORS>
<METHODS>
<METHOD>
<KEY>^.*(public|protected|private)*\s*.*(\w(\s*&lt;.+&gt;)*)+\s+get\w+\s*\(.*\).+</KEY>
<VALUE>/**\n
* Gets ${partName}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if isNotVoid&gt;
*\n
* @return the ${partName}\n
&lt;/#if&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
<METHOD>
<KEY>^.*(public|protected|private)*\s*.*(void|\w(\s*&lt;.+&gt;)*)+\s+set\w+\s*\(.*\).+</KEY>
<VALUE>/**\n
* Sets ${partName}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if isNotVoid&gt;
*\n
* @return the ${partName}\n
&lt;/#if&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
<METHOD>
<KEY>^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+</KEY>
<VALUE>/**\n
* The entry point of application.\n
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
* @param ${element.parameterList.parameters[0].name} the input arguments\n
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
<METHOD>
<KEY>.+</KEY>
<VALUE>/**\n
* ${name}&lt;#if isNotVoid&gt; ${return}&lt;/#if&gt;.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if isNotVoid&gt;
*\n
* @return the ${return}\n
&lt;/#if&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
</METHODS>
<FIELDS>
<FIELD>
<KEY>^.*(public|protected|private)*.+static.*(\w\s\w)+.+</KEY>
<VALUE>/**\n
* The constant ${element.getName()}.\n
*/</VALUE>
</FIELD>
<FIELD>
<KEY>^.*(public|protected|private)*.*(\w\s\w)+.+</KEY>
<VALUE>/**\n
&lt;#if element.parent.isInterface()&gt;
* The constant ${element.getName()}.\n
&lt;#else&gt;
* The ${name}.\n
&lt;/#if&gt; */</VALUE>
</FIELD>
<FIELD>
<KEY>.+</KEY>
<VALUE>/**\n
&lt;#if element.parent.isEnum()&gt;
*${name} ${typeName}.\n
&lt;#else&gt;
* The ${name}.\n
&lt;/#if&gt;*/</VALUE>
</FIELD>
</FIELDS>
</TEMPLATES>
</component>
</project>

6
.idea/kotlinc.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.9.10" />
</component>
</project>

View file

@ -2,12 +2,11 @@
<library name="bld"> <library name="bld">
<CLASSES> <CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" /> <root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" /> <root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="file://$PROJECT_DIR$/lib/bld" /> <root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2-sources.jar!/" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-sources.jar!/" />
</SOURCES> </SOURCES>
<excluded> <excluded>
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" /> <root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />

View file

@ -2,16 +2,12 @@
<library name="compile"> <library name="compile">
<CLASSES> <CLASSES>
<root url="file://$PROJECT_DIR$/lib/compile" /> <root url="file://$PROJECT_DIR$/lib/compile" />
<root url="file://$PROJECT_DIR$/lib/provided" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="file://$PROJECT_DIR$/lib/compile" /> <root url="file://$PROJECT_DIR$/lib/compile" />
<root url="file://$PROJECT_DIR$/lib/provided" />
</SOURCES> </SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" /> <jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" /> <jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
</library> </library>
</component> </component>

View file

@ -8,7 +8,7 @@
<SOURCES> <SOURCES>
<root url="file://$PROJECT_DIR$/lib/runtime" /> <root url="file://$PROJECT_DIR$/lib/runtime" />
</SOURCES> </SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" /> <jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" /> <jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
</library> </library>
</component> </component>

View file

@ -2,17 +2,13 @@
<library name="test"> <library name="test">
<CLASSES> <CLASSES>
<root url="file://$PROJECT_DIR$/lib/test" /> <root url="file://$PROJECT_DIR$/lib/test" />
<root url="file://$PROJECT_DIR$/lib/provided" />
<root url="file://$PROJECT_DIR$/src/test/resources" /> <root url="file://$PROJECT_DIR$/src/test/resources" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="file://$PROJECT_DIR$/lib/test" /> <root url="file://$PROJECT_DIR$/lib/test" />
<root url="file://$PROJECT_DIR$/lib/provided" />
</SOURCES> </SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" /> <jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" /> <jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
</library> </library>
</component> </component>

9
.idea/misc.xml generated
View file

@ -2,12 +2,17 @@
<project version="4"> <project version="4">
<component name="EntryPointsManager"> <component name="EntryPointsManager">
<pattern value="net.thauvin.erik.semver.SemverBuild" method="jacoco" /> <pattern value="net.thauvin.erik.semver.SemverBuild" method="jacoco" />
<pattern value="net.thauvin.erik.semver.SemverBuild" method="pandoc" />
<pattern value="net.thauvin.erik.semver.SemverBuild" method="pmd" /> <pattern value="net.thauvin.erik.semver.SemverBuild" method="pmd" />
<pattern value="net.thauvin.erik.semver.SemverBuild" method="pmdCli" /> <pattern value="net.thauvin.erik.semver.SemverBuild" method="pandoc" />
<pattern value="net.thauvin.erik.semver.SemverBuild" /> <pattern value="net.thauvin.erik.semver.SemverBuild" />
</component> </component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="PDMPlugin"> <component name="PDMPlugin">
<option name="customRuleSets">
<list>
<option value="$PROJECT_DIR$/../bld-exec/config/pmd.xml" />
</list>
</option>
<option name="skipTestSources" value="false" /> <option name="skipTestSources" value="false" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">

1
.idea/modules.xml generated
View file

@ -4,6 +4,7 @@
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/.idea/app.iml" filepath="$PROJECT_DIR$/.idea/app.iml" /> <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" /> <module fileurl="file://$PROJECT_DIR$/.idea/bld.iml" filepath="$PROJECT_DIR$/.idea/bld.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/examples-java.main.iml" filepath="$PROJECT_DIR$/.idea/modules/examples-java.main.iml" />
</modules> </modules>
</component> </component>
</project> </project>

8
.idea/modules/examples-java.main.iml generated Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$/../../examples/java/gradle/src/generated/java">
<sourceFolder url="file://$MODULE_DIR$/../../examples/java/gradle/src/generated/java" isTestSource="false" generated="true" />
</content>
</component>
</module>

View file

@ -1,11 +1,7 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Tests" type="JUnit" factoryName="JUnit"> <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" /> <module name="app" />
<option name="PACKAGE_NAME" value="moog" />
<option name="MAIN_CLASS_NAME" value="net.thauvin.erik" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="directory" />
<dir value="$PROJECT_DIR$/src/test/java" />
<method v="2"> <method v="2">
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
</method> </method>

3
.idea/scopes/Source_Code.xml generated Normal file
View file

@ -0,0 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Source Code" pattern="*.java||file[bld]:*/||file[app]:src/main/java//*||file[app]:src/test/java//*" />
</component>

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-1.7.2.jar",
"lib/compile/*.jar",
"lib/runtime/*.jar",
"lib/test/*.jar"
]
}

View file

@ -1,4 +1,4 @@
Copyright (c) 2016-2024, 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

@ -2,13 +2,13 @@
[![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) [![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)
[![Java](https://img.shields.io/badge/java-17%2B-blue)](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) [![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/2.2.1-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld) [![bld](https://img.shields.io/badge/1.7.2-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) [![release](https://img.shields.io/github/release/ethauvin/semver.svg)](https://github.com/ethauvin/semver/releases/latest)
[![Nexus Snapshot](https://img.shields.io/nexus/s/net.thauvin.erik/semver?label=snapshot&server=https%3A%2F%2Foss.sonatype.org%2F)](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/semver/) [![Nexus Snapshot](https://img.shields.io/nexus/s/net.thauvin.erik/semver?label=snapshot&server=https%3A%2F%2Foss.sonatype.org%2F)](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/semver/)
[![Maven Central](https://img.shields.io/maven-central/v/net.thauvin.erik/semver.svg)](https://central.sonatype.com/artifact/net.thauvin.erik/semver) [![Maven Central](https://img.shields.io/maven-central/v/net.thauvin.erik/semver.svg)](https://central.sonatype.com/artifact/net.thauvin.erik/semver)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ethauvin_semver&metric=alert_status)](https://sonarcloud.io/dashboard?id=ethauvin_semver) [![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/bld.yml/badge.svg)](https://github.com/ethauvin/semver/actions/workflows/bld.yml) [![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) [![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) [![CircleCI](https://circleci.com/gh/ethauvin/semver/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/semver/tree/master)
@ -18,22 +18,19 @@ This processor was inspired by Cédric Beust's [version-processor](https://githu
## Table of Contents ## Table of Contents
- [Semantic Version Annotation Processor](#semantic-version-annotation-processor)
- [Table of Contents](#table-of-contents)
- [Examples](#examples) - [Examples](#examples)
- [Template](#template) - [Template](#template)
- [Default Template](#default-template) - [Default Template](#default-template)
- [Custom Template](#custom-template) - [Custom Template](#custom-template)
- [Elements \& Properties](#elements--properties) - [Elements & Properties](#elements--properties)
- [Maven](#maven) - [Maven](#maven)
- [bld](#bld) - [bld](#bld)
- [Gradle](#gradle) - [Gradle](#gradle)
- [Class Generation](#class-generation) - [Class Generation](#class-generation)
- [Class \& Source Generation](#class--source-generation) - [Class & Source Generation](#class--source-generation)
- [Kotlin](#kotlin) - [Kotlin](#kotlin)
- [Kotlin \& Gradle](#kotlin--gradle) - [Kotlin & Gradle](#kotlin--gradle)
- [Auto-Increment](#auto-increment) - [Auto-Increment](#auto-increment)
- [Contributing](#contributing)
## Examples ## Examples
@ -137,6 +134,8 @@ The mustache variables automatically filled in by the processor are:
| `{{separator}}` | The version separator. | `String` | | `{{separator}}` | The version separator. | `String` |
| `{{semver}}` or `{{version}}` | The full semantic version. | `String` | | `{{semver}}` or `{{version}}` | The full semantic version. | `String` |
Please also look at this [example](https://github.com/ethauvin/mobibot/blob/master/version.mustache) using [`java.time`](https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html)
## Elements & Properties ## Elements & Properties
The following annotation elements and properties are available: The following annotation elements and properties are available:
@ -203,13 +202,12 @@ To install and run from [Maven](https://maven.apache.org/), configure an artifac
</dependency> </dependency>
``` ```
```console Please look at [pom.xml](https://github.com/ethauvin/semver/blob/master/examples/java/pom.xml) in the [examples/java](https://github.com/ethauvin/semver/tree/master/examples/java) directory for a sample:
```bash
mvn verify mvn verify
``` ```
Please look at [pom.xml](https://github.com/ethauvin/semver/blob/master/examples/java/gradle/pom.xml) in the [examples/java/gradle](https://github.com/ethauvin/semver/tree/master/examples/java/gradle) directory for a sample:
## bld ## bld
To install and run from [bld](https://rife2.com/bld), just add the dependency to your build file: To install and run from [bld](https://rife2.com/bld), just add the dependency to your build file:
@ -226,8 +224,6 @@ public class ExampleBuild extends Project {
Please look at [ExampleBuild](https://github.com/ethauvin/semver/blob/master/examples/java/bld/src/bld/java/com/example/ExampleBuild.java) in the [examples/java/bld](https://github.com/ethauvin/semver/tree/master/examples/java/bld) directory for a sample. It also shows how to incorporate the generated code into the `source tree`, more information is also available [here](https://forum.uwyn.com/post/36). Please look at [ExampleBuild](https://github.com/ethauvin/semver/blob/master/examples/java/bld/src/bld/java/com/example/ExampleBuild.java) in the [examples/java/bld](https://github.com/ethauvin/semver/tree/master/examples/java/bld) directory for a sample. It also shows how to incorporate the generated code into the `source tree`, more information is also available [here](https://forum.uwyn.com/post/36).
bld also has a [Generated Version](https://github.com/rife2/bld-generated-version) extension which provides similar functionalities.
## Gradle ## Gradle
### Class Generation ### Class Generation
@ -300,7 +296,7 @@ dependencies {
kapt { kapt {
arguments { arguments {
arg("semver.project.dir", projectDir.absolutePath) arg("semver.project.dir", projectDir)
} }
} }
``` ```
@ -312,22 +308,3 @@ The directory containing the configuration files (`version.properties`, `version
Incrementing the version is best left to your favorite build system. For a solution using Gradle, please have a look at the [__Semver Version Plugin for Gradle__](https://github.com/ethauvin/semver-gradle). Incrementing the version is best left to your favorite build system. For a solution using Gradle, please have a look at the [__Semver Version Plugin for Gradle__](https://github.com/ethauvin/semver-gradle).
There are also full [examples](https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor) in both [Java](https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor/java) and [Kotlin](https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor/kotlin) showing how to use both the plugin and annotation processor concurrently. There are also full [examples](https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor) in both [Java](https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor/java) and [Kotlin](https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor/kotlin) showing how to use both the plugin and annotation processor concurrently.
## Contributing
If you want to contribute to this project, all you have to do is clone the GitHub
repository:
```console
git clone git@github.com:ethauvin/semver.git
```
Then use [bld](https://rife2.com/bld) to build:
```console
cd semver
./bld compile
```
The project has an [IntelliJ IDEA](https://www.jetbrains.com/idea/) project structure. You can just open it after all
the dependencies were downloaded and peruse the code.

View file

@ -7,9 +7,8 @@
<!-- BEST PRACTICES --> <!-- BEST PRACTICES -->
<rule ref="category/java/bestpractices.xml"> <rule ref="category/java/bestpractices.xml">
<exclude name="AvoidPrintStackTrace"/> <exclude name="AvoidPrintStackTrace"/>
<exclude name="GuardLogStatement"/> <exclude name="JUnit4TestShouldUseTestAnnotation"/>
<exclude name="UnitTestContainsTooManyAsserts"/> <exclude name="JUnitTestContainsTooManyAsserts"/>
<exclude name="UnitTestShouldUseTestAnnotation"/>
</rule> </rule>
<rule ref="category/java/bestpractices.xml/MissingOverride"> <rule ref="category/java/bestpractices.xml/MissingOverride">
@ -24,20 +23,17 @@
<rule ref="category/java/codestyle.xml"> <rule ref="category/java/codestyle.xml">
<exclude name="AtLeastOneConstructor"/> <exclude name="AtLeastOneConstructor"/>
<exclude name="ClassNamingConventions"/> <exclude name="ClassNamingConventions"/>
<exclude name="CommentDefaultAccessModifier"/>
<exclude name="ConfusingTernary"/> <exclude name="ConfusingTernary"/>
<exclude name="CommentDefaultAccessModifier"/>
<exclude name="FieldNamingConventions"/> <exclude name="FieldNamingConventions"/>
<exclude name="LocalVariableCouldBeFinal"/>
<exclude name="LongVariable"/> <exclude name="LongVariable"/>
<exclude name="MethodArgumentCouldBeFinal"/>
<exclude name="OnlyOneReturn"/> <exclude name="OnlyOneReturn"/>
<exclude name="PackageCase"/> <exclude name="PackageCase"/>
<exclude name="ShortClassName"/> <exclude name="ShortClassName"/>
<exclude name="ShortMethodName"/> <exclude name="ShortMethodName"/>
<exclude name="ShortVariable"/> <exclude name="ShortVariable"/>
<exclude name="UseExplicitTypes"/>
<exclude name="UseUnderscoresInNumericLiterals"/>
<exclude name="UselessParentheses"/> <exclude name="UselessParentheses"/>
<exclude name="UseUnderscoresInNumericLiterals"/>
</rule> </rule>
<rule ref="category/java/codestyle.xml/UnnecessaryImport"> <rule ref="category/java/codestyle.xml/UnnecessaryImport">
@ -53,6 +49,8 @@
<exclude name="AvoidUncheckedExceptionsInSignatures"/> <exclude name="AvoidUncheckedExceptionsInSignatures"/>
<exclude name="CognitiveComplexity"/> <exclude name="CognitiveComplexity"/>
<exclude name="CyclomaticComplexity"/> <exclude name="CyclomaticComplexity"/>
<exclude name="ExcessiveClassLength"/>
<exclude name="ExcessiveMethodLength"/>
<exclude name="ExcessiveParameterList"/> <exclude name="ExcessiveParameterList"/>
<exclude name="ExcessivePublicCount"/> <exclude name="ExcessivePublicCount"/>
<exclude name="GodClass"/> <exclude name="GodClass"/>
@ -79,6 +77,7 @@
<exclude name="AvoidFieldNameMatchingMethodName"/> <exclude name="AvoidFieldNameMatchingMethodName"/>
<exclude name="AvoidFieldNameMatchingTypeName"/> <exclude name="AvoidFieldNameMatchingTypeName"/>
<exclude name="AvoidLiteralsInIfCondition"/> <exclude name="AvoidLiteralsInIfCondition"/>
<exclude name="EmptyCatchBlock"/>
<exclude name="NullAssignment"/> <exclude name="NullAssignment"/>
</rule> </rule>
@ -94,6 +93,13 @@
<property name="skipAnnotations" value="true"/> <property name="skipAnnotations" value="true"/>
</properties> </properties>
</rule> </rule>
<rule ref="category/java/errorprone.xml/EmptyCatchBlock">
<properties>
<property name="allowExceptionNameRegex">
<value>^ignore$</value>
</property>
</properties>
</rule>
<!-- MULTITHREADING --> <!-- MULTITHREADING -->
<rule ref="category/java/multithreading.xml"> <rule ref="category/java/multithreading.xml">

View file

@ -11,11 +11,8 @@
div.columns{display: flex; gap: min(4vw, 1.5em);} div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;} div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
/* The extra [class] is a hack that increases specificity enough to ul.task-list{list-style: none;}
override a similar rule in reveal.js */
ul.task-list[class]{list-style: none;}
ul.task-list li input[type="checkbox"] { ul.task-list li input[type="checkbox"] {
font-size: inherit;
width: 0.8em; width: 0.8em;
margin: 0 0.8em 0.2em -1.6em; margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle; vertical-align: middle;
@ -100,7 +97,7 @@ alt="License (3-Clause BSD)" /></a> <a
href="https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html"><img 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 src="https://img.shields.io/badge/java-17%2B-blue" alt="Java" /></a> <a
href="https://rife2.com/bld"><img href="https://rife2.com/bld"><img
src="https://img.shields.io/badge/1.9.0-FA9052?label=bld&amp;labelColor=2392FF" src="https://img.shields.io/badge/1.7.2-FA9052?label=bld&amp;labelColor=2392FF"
alt="bld" /></a> <a alt="bld" /></a> <a
href="https://github.com/ethauvin/semver/releases/latest"><img href="https://github.com/ethauvin/semver/releases/latest"><img
src="https://img.shields.io/github/release/ethauvin/semver.svg" src="https://img.shields.io/github/release/ethauvin/semver.svg"
@ -160,7 +157,6 @@ Generation</a></li>
<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="#auto-increment">Auto-Increment</a></li> <li><a href="#auto-increment">Auto-Increment</a></li>
<li><a href="#contributing">Contributing</a></li>
</ul> </ul>
<h2 id="examples">Examples</h2> <h2 id="examples">Examples</h2>
<ul> <ul>
@ -372,6 +368,10 @@ are:</p>
</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>
<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>
@ -546,9 +546,6 @@ href="https://github.com/ethauvin/semver/tree/master/examples/java/bld">examples
directory for a sample. It also shows how to incorporate the generated directory for a sample. It also shows how to incorporate the generated
code into the <code>source tree</code>, more information is also code into the <code>source tree</code>, more information is also
available <a href="https://forum.uwyn.com/post/36">here</a>.</p> available <a href="https://forum.uwyn.com/post/36">here</a>.</p>
<p>bld also has a <a
href="https://github.com/rife2/bld-generated-version">Generated
Version</a> extension which provides similar functionalities.</p>
<h2 id="gradle">Gradle</h2> <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 <p>To install and run from <a href="https://gradle.org/">Gradle</a>, add
@ -646,15 +643,5 @@ and <a
href="https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor/kotlin">Kotlin</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 showing how to use both the plugin and annotation processor
concurrently.</p> concurrently.</p>
<h2 id="contributing">Contributing</h2>
<p>If you want to contribute to this project, all you have to do is
clone the GitHub repository:</p>
<pre class="console"><code>git clone git@github.com:ethauvin/semver.git</code></pre>
<p>Then use <a href="https://rife2.com/bld">bld</a> to build:</p>
<pre class="console"><code>cd semver
./bld compile</code></pre>
<p>The project has an <a href="https://www.jetbrains.com/idea/">IntelliJ
IDEA</a> project structure. You can just open it after all the
dependencies were downloaded and peruse the code.</p>
</body> </body>
</html> </html>

View file

@ -5,7 +5,6 @@ lib/bld/**
!lib/bld/bld-wrapper.jar !lib/bld/bld-wrapper.jar
!lib/bld/bld-wrapper.properties !lib/bld/bld-wrapper.properties
lib/compile/ lib/compile/
lib/provided/
lib/runtime/ lib/runtime/
lib/standalone/ lib/standalone/
lib/test/ lib/test/

View file

@ -1 +0,0 @@
semver-examples-bld

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BldConfiguration">
<events />
</component>
</project>

View file

@ -1,204 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaDocConfiguration">
<GENERAL>
<MODE>UPDATE</MODE>
<OVERRIDDEN_METHODS>false</OVERRIDDEN_METHODS>
<SPLITTED_CLASS_NAME>true</SPLITTED_CLASS_NAME>
<LEVELS>
<LEVEL>METHOD</LEVEL>
<LEVEL>TYPE</LEVEL>
<LEVEL>FIELD</LEVEL>
</LEVELS>
<VISIBILITIES>
<VISIBILITY>PUBLIC</VISIBILITY>
<VISIBILITY>DEFAULT</VISIBILITY>
<VISIBILITY>PROTECTED</VISIBILITY>
</VISIBILITIES>
</GENERAL>
<TEMPLATES>
<CLASSES>
<CLASS>
<KEY>^.*(public|protected|private)*.+interface\s+\w+.*</KEY>
<VALUE>/**\n
* The interface ${name}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
*/</VALUE>
</CLASS>
<CLASS>
<KEY>^.*(public|protected|private)*.+enum\s+\w+.*</KEY>
<VALUE>/**\n
* The enum ${name}.\n
*/</VALUE>
</CLASS>
<CLASS>
<KEY>^.*(public|protected|private)*.+class\s+\w+.*</KEY>
<VALUE>/**\n
* The type ${name}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
*/</VALUE>
</CLASS>
<CLASS>
<KEY>.+</KEY>
<VALUE>/**\n
* The type ${name}.\n
*/</VALUE>
</CLASS>
</CLASSES>
<CONSTRUCTORS>
<CONSTRUCTOR>
<KEY>.+</KEY>
<VALUE>/**\n
* Instantiates a new ${name}.\n
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</CONSTRUCTOR>
</CONSTRUCTORS>
<METHODS>
<METHOD>
<KEY>^.*(public|protected|private)*\s*.*(\w(\s*&lt;.+&gt;)*)+\s+get\w+\s*\(.*\).+</KEY>
<VALUE>/**\n
* Gets ${partName}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if isNotVoid&gt;
*\n
* @return the ${partName}\n
&lt;/#if&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
<METHOD>
<KEY>^.*(public|protected|private)*\s*.*(void|\w(\s*&lt;.+&gt;)*)+\s+set\w+\s*\(.*\).+</KEY>
<VALUE>/**\n
* Sets ${partName}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if isNotVoid&gt;
*\n
* @return the ${partName}\n
&lt;/#if&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
<METHOD>
<KEY>^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+</KEY>
<VALUE>/**\n
* The entry point of application.\n
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
* @param ${element.parameterList.parameters[0].name} the input arguments\n
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
<METHOD>
<KEY>.+</KEY>
<VALUE>/**\n
* ${name}&lt;#if isNotVoid&gt; ${return}&lt;/#if&gt;.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if isNotVoid&gt;
*\n
* @return the ${return}\n
&lt;/#if&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
</METHODS>
<FIELDS>
<FIELD>
<KEY>^.*(public|protected|private)*.+static.*(\w\s\w)+.+</KEY>
<VALUE>/**\n
* The constant ${element.getName()}.\n
*/</VALUE>
</FIELD>
<FIELD>
<KEY>^.*(public|protected|private)*.*(\w\s\w)+.+</KEY>
<VALUE>/**\n
&lt;#if element.parent.isInterface()&gt;
* The constant ${element.getName()}.\n
&lt;#else&gt;
* The ${name}.\n
&lt;/#if&gt; */</VALUE>
</FIELD>
<FIELD>
<KEY>.+</KEY>
<VALUE>/**\n
&lt;#if element.parent.isEnum()&gt;
*${name} ${typeName}.\n
&lt;#else&gt;
* The ${name}.\n
&lt;/#if&gt;*/</VALUE>
</FIELD>
</FIELDS>
</TEMPLATES>
</component>
</project>

View file

@ -2,12 +2,11 @@
<library name="bld"> <library name="bld">
<CLASSES> <CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" /> <root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" /> <root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="file://$PROJECT_DIR$/lib/bld" /> <root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2-sources.jar!/" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-sources.jar!/" />
</SOURCES> </SOURCES>
<excluded> <excluded>
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" /> <root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />

View file

@ -2,16 +2,12 @@
<library name="compile"> <library name="compile">
<CLASSES> <CLASSES>
<root url="file://$PROJECT_DIR$/lib/compile" /> <root url="file://$PROJECT_DIR$/lib/compile" />
<root url="file://$PROJECT_DIR$/lib/provided" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="file://$PROJECT_DIR$/lib/compile" /> <root url="file://$PROJECT_DIR$/lib/compile" />
<root url="file://$PROJECT_DIR$/lib/provided" />
</SOURCES> </SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" /> <jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" /> <jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
</library> </library>
</component> </component>

View file

@ -8,7 +8,7 @@
<SOURCES> <SOURCES>
<root url="file://$PROJECT_DIR$/lib/runtime" /> <root url="file://$PROJECT_DIR$/lib/runtime" />
</SOURCES> </SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" /> <jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" /> <jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
</library> </library>
</component> </component>

View file

@ -2,17 +2,13 @@
<library name="test"> <library name="test">
<CLASSES> <CLASSES>
<root url="file://$PROJECT_DIR$/lib/test" /> <root url="file://$PROJECT_DIR$/lib/test" />
<root url="file://$PROJECT_DIR$/lib/provided" />
<root url="file://$PROJECT_DIR$/src/test/resources" /> <root url="file://$PROJECT_DIR$/src/test/resources" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="file://$PROJECT_DIR$/lib/test" /> <root url="file://$PROJECT_DIR$/lib/test" />
<root url="file://$PROJECT_DIR$/lib/provided" />
</SOURCES> </SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" /> <jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" /> <jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
</library> </library>
</component> </component>

View file

@ -3,13 +3,13 @@
"src/main/java", "src/main/java",
"src/main/resources", "src/main/resources",
"src/test/java", "src/test/java",
"src/test/resources", "src/bld/java"
"src/bld/java",
"src/bld/resources"
], ],
"java.configuration.updateBuildConfiguration": "automatic", "java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [ "java.project.referencedLibraries": [
"${HOME}/.bld/dist/bld-2.2.1.jar", "${HOME}bld-1.7.2.jar",
"lib/**/*.jar" "lib/compile/*.jar",
"lib/runtime/*.jar",
"lib/test/*.jar"
] ]
} }

View file

@ -1,10 +0,0 @@
## Examples
To compile & run the examples:
```console
./bld compile
./bld run
./bld run-example
```

View file

@ -1,7 +1,7 @@
bld.downloadExtensionJavadoc=false bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true bld.downloadExtensionSources=true
bld.downloadLocation=
bld.extensions= bld.extensions=
bld.repositories=MAVEN_CENTRAL,RIFE2_RELEASES bld.repositories=MAVEN_CENTRAL,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories= bld.sourceDirectories=
bld.version=2.2.1 bld.version=1.7.2

View file

@ -2,16 +2,20 @@ package com.example;
import rife.bld.BuildCommand; import rife.bld.BuildCommand;
import rife.bld.Project; import rife.bld.Project;
import rife.bld.operations.JavacOptions.Processing;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import static rife.bld.dependencies.Repository.*; import static rife.bld.dependencies.Repository.*;
import static rife.bld.dependencies.Scope.provided; import static rife.bld.dependencies.Scope.compile;
/** /**
* Example build. * Example build.
*
* <ul style="list-style-type:none">
* <li>./bld run</li>
* <li>./bld runExample</li>
* </ul>
*/ */
public class ExampleBuild extends Project { public class ExampleBuild extends Project {
public ExampleBuild() { public ExampleBuild() {
@ -23,9 +27,9 @@ public class ExampleBuild extends Project {
testOperation().mainClass("com.example.ExampleTest"); testOperation().mainClass("com.example.ExampleTest");
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY); repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL);
scope(provided).include(dependency("net.thauvin.erik", "semver", version(1, 2, 2, "SNAPSHOT"))); scope(compile).include(dependency("net.thauvin.erik", "semver", version(1, 2, 1)));
} }
public static void main(String[] args) { public static void main(String[] args) {
@ -42,11 +46,11 @@ public class ExampleBuild extends Project {
public void compile() throws Exception { public void compile() throws Exception {
var generated = new File(buildDirectory(), "generated"); var generated = new File(buildDirectory(), "generated");
var ignore = generated.mkdir(); var ignore = generated.mkdir();
compileOperation().compileOptions().process(Processing.FULL).sourceOutput(generated); compileOperation().compileOptions().addAll(List.of("-s", generated.getAbsolutePath()));
super.compile(); super.compile();
} }
@BuildCommand(value = "run-example", summary = "Runs the example") @BuildCommand(summary = "Run the example")
public void runExample() throws Exception { public void runExample() throws Exception {
runOperation().fromProject(this).mainClass("com.example.Example").execute(); runOperation().fromProject(this).mainClass("com.example.Example").execute();
} }

View file

@ -1 +1 @@
semver-examples-java-gradle examples-java

View file

@ -1,18 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<annotationProcessing> <bytecodeTargetLevel>
<profile name="Gradle Imported" enabled="true">
<outputRelativeToContentRoot value="true" />
<option name="semver.project.dir" value="$PROJECT_DIR$" />
<processorPath useClasspath="false">
<entry name="$USER_HOME$/.gradle/caches/modules-2/files-2.1/net.thauvin.erik/semver/1.2.2-SNAPSHOT/31d53f3e9fdd226343234d13a080d6fd12b58ae6/semver-1.2.2-SNAPSHOT.jar" />
<entry name="$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.spullara.mustache.java/compiler/0.9.13/60666500a7dce7a5d3e17c09b46ea6f037192bd5/compiler-0.9.13.jar" />
</processorPath>
<module name="examples-java.main" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel target="17">
<module name="examples-java_main" target="1.8" /> <module name="examples-java_main" target="1.8" />
<module name="examples-java_test" target="1.8" /> <module name="examples-java_test" target="1.8" />
</bytecodeTargetLevel> </bytecodeTargetLevel>

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -1,13 +1,6 @@
<?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="ProjectRootManager" version="2" languageLevel="JDK_1_6" default="false" project-jdk-name="10" project-jdk-type="JavaSDK">
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="PDMPlugin">
<option name="skipTestSources" value="false" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" /> <output url="file://$PROJECT_DIR$/classes" />
</component> </component>
</project> </project>

View file

@ -2,7 +2,9 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/.idea/gradle.iml" filepath="$PROJECT_DIR$/.idea/gradle.iml" /> <module fileurl="file://$PROJECT_DIR$/.idea/modules/examples-java.iml" filepath="$PROJECT_DIR$/.idea/modules/examples-java.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/examples-java_main.iml" filepath="$PROJECT_DIR$/.idea/modules/examples-java_main.iml" group="examples-java" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/examples-java_test.iml" filepath="$PROJECT_DIR$/.idea/modules/examples-java_test.iml" group="examples-java" />
</modules> </modules>
</component> </component>
</project> </project>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="examples-java" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/../..">
<excludeFolder url="file://$MODULE_DIR$/../../.gradle" />
<excludeFolder url="file://$MODULE_DIR$/../../build" />
<excludeFolder url="file://$MODULE_DIR$/../../out" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$/../../src/generated/java">
<sourceFolder url="file://$MODULE_DIR$/../../src/generated/java" isTestSource="false" generated="true" />
</content>
</component>
</module>

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="examples-java:main" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/../../out/production/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../src/generated">
<sourceFolder url="file://$MODULE_DIR$/../../src/generated" isTestSource="false" />
</content>
<content url="file://$MODULE_DIR$/../../src/main">
<sourceFolder url="file://$MODULE_DIR$/../../src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../src/main/resources" type="java-resource" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Gradle: net.thauvin.erik:semver:1.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Gradle: com.github.spullara.mustache.java:compiler:0.9.4" level="project" />
</component>
</module>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="examples-java:test" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output-test url="file://$MODULE_DIR$/../../out/test/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../src/test">
<sourceFolder url="file://$MODULE_DIR$/../../src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/../../src/test/resources" type="java-test-resource" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="examples-java_main" />
</component>
<component name="TestModuleProperties" production-module="examples-java_main" />
</module>

View file

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

View file

@ -1,9 +0,0 @@
## Examples
To run the examples:
```console
./gradlew run
./gradlew runExample
```

View file

@ -1,12 +1,15 @@
plugins { plugins {
id 'java' id 'java'
id 'application' id 'application'
id 'com.github.ben-manes.versions' version '0.51.0' id 'com.github.ben-manes.versions' version '0.48.0'
} }
// ./gradlew run
// ./gradlew runExample
defaultTasks 'run' defaultTasks 'run'
final def semverProcessor = 'net.thauvin.erik:semver:1.2.2-SNAPSHOT' final def semverProcessor = 'net.thauvin.erik:semver:1.2.1'
repositories { repositories {
mavenLocal() mavenLocal()
@ -25,7 +28,7 @@ java {
} }
application { application {
mainClass = 'com.example.App' mainClassName = 'com.example.App'
} }
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View file

@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@ -57,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@ -86,7 +84,7 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# 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
@ -114,7 +112,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;; NONSTOP* ) nonstop=true ;;
esac esac
CLASSPATH="\\\"\\\"" 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.
@ -147,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045 # shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
@ -155,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045 # shellcheck disable=SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@ -204,16 +202,16 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # 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"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command: # Collect all arguments for the java command;
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# and any embedded shellness will be escaped. # shell script including quotes and variable substitutions, so put them in
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # double quotes to make sure that they get re-expanded; and
# treated as '${Hostname}' itself on the command line. # * put everything else in single quotes, so that it's not re-expanded.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \ -classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ org.gradle.wrapper.GradleWrapperMain \
"$@" "$@"
# Stop when "xargs" is not available. # Stop when "xargs" is not available.

View file

@ -13,8 +13,6 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@ -45,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2 echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo. 1>&2 echo.
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. 1>&2 echo location of your Java installation.
goto fail goto fail
@ -59,22 +57,22 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. 1>&2 echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo. 1>&2 echo.
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. 1>&2 echo location of your Java installation.
goto fail goto fail
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH= 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%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* "%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

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
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>
@ -28,9 +27,10 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.14.0</version> <version>3.8.1</version>
<configuration> <configuration>
<release>17</release> <source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
<generatedSourcesDirectory>src/generated/java</generatedSourcesDirectory> <generatedSourcesDirectory>src/generated/java</generatedSourcesDirectory>
<annotationProcessorPaths> <annotationProcessorPaths>
@ -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>3.5.0</version> <version>3.0.0</version>
<executions> <executions>
<execution> <execution>
<id>run</id> <id>run</id>

View file

@ -9,7 +9,7 @@ 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(1742447853077L); public static final Date BUILDDATE = new Date(1696209996065L);
public static final String VERSION = "8.4.97-alpha+T800"; public static final String VERSION = "8.4.97-alpha+T800";
/** /**

View file

@ -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(1742447853101L); public static final Date BUILDDATE = new Date(1696209996080L);
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

@ -1 +1 @@
semver-examples-kotlin-gradle examples-kotlin

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<bytecodeTargetLevel target="17"> <bytecodeTargetLevel>
<module name="examples-kotlin_main" target="1.8" /> <module name="examples-kotlin_main" target="1.8" />
<module name="examples-kotlin_test" target="1.8" /> <module name="examples-kotlin_test" target="1.8" />
</bytecodeTargetLevel> </bytecodeTargetLevel>

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="MavenLocal" />
<option name="name" value="MavenLocal" />
<option name="url" value="file:$MAVEN_REPOSITORY$/" />
</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="maven" />
<option name="name" value="maven" />
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots" />
</remote-repository>
</component>
</project>

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -4,7 +4,4 @@
<option name="sourceMapEmbedSources" /> <option name="sourceMapEmbedSources" />
<option name="sourceMapPrefix" /> <option name="sourceMapPrefix" />
</component> </component>
<component name="KotlinJpsPluginSettings">
<option name="version" value="2.0.20" />
</component>
</project> </project>

View file

@ -1,13 +1,6 @@
<?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="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="PDMPlugin">
<option name="skipTestSources" value="false" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" /> <output url="file://$PROJECT_DIR$/classes" />
</component> </component>
</project> </project>

View file

@ -2,7 +2,9 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/.idea/kotlin.iml" filepath="$PROJECT_DIR$/.idea/kotlin.iml" /> <module fileurl="file://$PROJECT_DIR$/.idea/modules/examples-kotlin.iml" filepath="$PROJECT_DIR$/.idea/modules/examples-kotlin.iml" group="examples-kotlin" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/examples-kotlin_main.iml" filepath="$PROJECT_DIR$/.idea/modules/examples-kotlin_main.iml" group="examples-kotlin" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/examples-kotlin_test.iml" filepath="$PROJECT_DIR$/.idea/modules/examples-kotlin_test.iml" group="examples-kotlin" />
</modules> </modules>
</component> </component>
</project> </project>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="examples-kotlin" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/../..">
<excludeFolder url="file://$MODULE_DIR$/../../.gradle" />
<excludeFolder url="file://$MODULE_DIR$/../../build" />
<excludeFolder url="file://$MODULE_DIR$/../../out" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="examples-kotlin:main" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="kotlin-language" name="Kotlin">
<configuration version="3" platform="JVM 1.6" useProjectSettings="false">
<compilerSettings />
<compilerArguments>
<option name="destination" value="$MODULE_DIR$/../../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.21/4bcc2012b84840e19e1e28074284cac908be0295/kotlin-stdlib-1.3.21.jar;C:/Users/erik/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.21/f30e4a9897913e53d778f564110bafa1fef46643/kotlin-stdlib-common-1.3.21.jar;C:/Users/erik/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar" />
<option name="noStdlib" value="true" />
<option name="noReflect" value="true" />
<option name="moduleName" value="examples-kotlin" />
<option name="addCompilerBuiltIns" value="true" />
<option name="loadBuiltInsFromDependencies" value="true" />
<option name="languageVersion" value="1.3" />
<option name="apiVersion" value="1.3" />
<option name="pluginOptions">
<array />
</option>
<option name="pluginClasspaths">
<array />
</option>
<option name="errors">
<ArgumentParseErrors />
</option>
</compilerArguments>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/../../build/classes/java/main" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../build/generated/source/kapt/main">
<sourceFolder url="file://$MODULE_DIR$/../../build/generated/source/kapt/main" isTestSource="false" generated="true" />
</content>
<content url="file://$MODULE_DIR$/../../build/generated/source/kaptKotlin/main">
<sourceFolder url="file://$MODULE_DIR$/../../build/generated/source/kaptKotlin/main" isTestSource="false" generated="true" />
</content>
<content url="file://$MODULE_DIR$/../../src/main">
<sourceFolder url="file://$MODULE_DIR$/../../src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../src/main/kotlin" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="Gradle: kaptGeneratedClasses">
<CLASSES>
<root url="file://$MODULE_DIR$/../../build/tmp/kapt3/classes/main" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.3.21" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Gradle: net.thauvin.erik:semver:1.2.0" level="project" />
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:1.3.21" level="project" />
<orderEntry type="library" name="Gradle: org.jetbrains:annotations:13.0" level="project" />
</component>
</module>

View file

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="examples-kotlin:test" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="kotlin-language" name="Kotlin">
<configuration version="3" platform="JVM 1.6" useProjectSettings="false">
<compilerSettings />
<compilerArguments>
<option name="destination" value="$MODULE_DIR$/../../build/classes/kotlin/test" />
<option name="classpath" value="$MODULE_DIR$/../../build/classes/java/main;K:/java/semver/examples/kotlin/build/classes/kotlin/main;K:/java/semver/examples/kotlin/build/tmp/kapt3/classes/main;C:/Users/erik/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.21/4bcc2012b84840e19e1e28074284cac908be0295/kotlin-stdlib-1.3.21.jar;C:/Users/erik/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.21/f30e4a9897913e53d778f564110bafa1fef46643/kotlin-stdlib-common-1.3.21.jar;C:/Users/erik/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar" />
<option name="noStdlib" value="true" />
<option name="noReflect" value="true" />
<option name="moduleName" value="examples-kotlin" />
<option name="addCompilerBuiltIns" value="true" />
<option name="loadBuiltInsFromDependencies" value="true" />
<option name="friendPaths">
<array>
<option value="$MODULE_DIR$/../../build/tmp/kapt3/classes/main" />
<option value="$MODULE_DIR$/../../build/classes/java/main" />
<option value="$MODULE_DIR$/../../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>
<option name="errors">
<ArgumentParseErrors />
</option>
</compilerArguments>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output-test url="file://$MODULE_DIR$/../../build/classes/java/test" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../build/generated/source/kapt/test">
<sourceFolder url="file://$MODULE_DIR$/../../build/generated/source/kapt/test" isTestSource="true" generated="true" />
</content>
<content url="file://$MODULE_DIR$/../../build/generated/source/kaptKotlin/test">
<sourceFolder url="file://$MODULE_DIR$/../../build/generated/source/kaptKotlin/test" isTestSource="true" generated="true" />
</content>
<content url="file://$MODULE_DIR$/../../src/test" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="examples-kotlin_main" />
<orderEntry type="module-library">
<library name="Gradle: kaptGeneratedClasses">
<CLASSES>
<root url="file://$MODULE_DIR$/../../build/tmp/kapt3/classes/test" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.3.21" level="project" />
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:1.3.21" level="project" />
<orderEntry type="library" name="Gradle: org.jetbrains:annotations:13.0" level="project" />
</component>
<component name="TestModuleProperties" production-module="examples-kotlin_main" />
</module>

View file

@ -1,11 +0,0 @@
## Examples
To run the examples:
```console
./gradlew run
./gradlew runJava
./gradlew runExample
./gradlew runJavaExample
```

View file

@ -1,15 +1,19 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins { plugins {
id("application") id("application")
id("com.github.ben-manes.versions") version "0.51.0" id("com.github.ben-manes.versions") version "0.48.0"
kotlin("jvm") version "2.1.20" kotlin("jvm") version "1.9.10"
kotlin("kapt") version "1.9.25" kotlin("kapt") version "1.9.10"
} }
// ./gradlew
// ./gradlew run
// ./gradlew runJava
// ./gradlew runExample
// ./gradlew runJavaExample
defaultTasks(ApplicationPlugin.TASK_RUN_NAME) defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
val semverProcessor = "net.thauvin.erik:semver:1.2.2-SNAPSHOT" val semverProcessor = "net.thauvin.erik:semver:1.2.1"
dependencies { dependencies {
kapt(semverProcessor) kapt(semverProcessor)
@ -20,7 +24,7 @@ dependencies {
kapt { kapt {
arguments { arguments {
arg("semver.project.dir", projectDir.absolutePath) arg("semver.project.dir", projectDir)
} }
} }
@ -30,17 +34,6 @@ repositories {
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") } maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
} }
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}
application { application {
mainClass.set("com.example.App") mainClass.set("com.example.App")
} }

Binary file not shown.

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View file

@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@ -57,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@ -86,7 +84,7 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# 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
@ -114,7 +112,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;; NONSTOP* ) nonstop=true ;;
esac esac
CLASSPATH="\\\"\\\"" 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.
@ -147,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045 # shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
@ -155,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045 # shellcheck disable=SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@ -204,16 +202,16 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # 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"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command: # Collect all arguments for the java command;
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# and any embedded shellness will be escaped. # shell script including quotes and variable substitutions, so put them in
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # double quotes to make sure that they get re-expanded; and
# treated as '${Hostname}' itself on the command line. # * put everything else in single quotes, so that it's not re-expanded.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \ -classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ org.gradle.wrapper.GradleWrapperMain \
"$@" "$@"
# Stop when "xargs" is not available. # Stop when "xargs" is not available.

View file

@ -13,8 +13,6 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@ -45,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2 echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo. 1>&2 echo.
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. 1>&2 echo location of your Java installation.
goto fail goto fail
@ -59,22 +57,22 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. 1>&2 echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo. 1>&2 echo.
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. 1>&2 echo location of your Java installation.
goto fail goto fail
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH= 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%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* "%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

View file

@ -1,7 +1,7 @@
plugins { plugins {
id 'java' id 'java'
id 'application' id 'application'
id 'com.github.ben-manes.versions' version '0.51.0' id 'com.github.ben-manes.versions' version '0.46.0'
} }
// ./gradlew run // ./gradlew run
@ -9,14 +9,12 @@ plugins {
defaultTasks 'run' defaultTasks 'run'
final def semverProcessor = 'net.thauvin.erik:semver:1.2.2-SNAPSHOT' final def semverProcessor = 'net.thauvin.erik:semver:1.2.0'
sourceCompatibility = 1.8 sourceCompatibility = 1.8
targetCompatibility = 1.8 targetCompatibility = 1.8
application { mainClassName = 'com.example.Example'
mainClass = 'com.example.Example'
}
repositories { repositories {
mavenLocal() mavenLocal()

View file

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

17
examples/test/gradlew vendored
View file

@ -83,8 +83,7 @@ done
# This is normally unused # This is normally unused
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# 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
@ -145,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045 # shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
@ -153,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045 # shellcheck disable=SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@ -202,11 +201,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # 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"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command: # Collect all arguments for the java command;
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# and any embedded shellness will be escaped. # shell script including quotes and variable substitutions, so put them in
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # double quotes to make sure that they get re-expanded; and
# treated as '${Hostname}' itself on the command line. # * put everything else in single quotes, so that it's not re-expanded.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \

View file

@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2 echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo. 1>&2 echo.
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. 1>&2 echo location of your Java installation.
goto fail goto fail
@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. 1>&2 echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo. 1>&2 echo.
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. 1>&2 echo location of your Java installation.
goto fail goto fail

View file

@ -9,7 +9,7 @@ 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(1707046879260L); 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";
/** /**

Binary file not shown.

View file

@ -1,9 +1,9 @@
bld.downloadExtensionJavadoc=false bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true bld.downloadExtensionSources=true
bld.extension-exec=com.uwyn.rife2:bld-exec:0.9.0-SNAPSHOT
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.1-SNAPSHOT
bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.3-SNAPSHOT
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation= bld.downloadLocation=
bld.extension-exec=com.uwyn.rife2:bld-exec:1.0.5
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.10
bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.2.3
bld.repositories=MAVEN_CENTRAL,RIFE2_RELEASES,MAVEN_LOCAL,RIFE2_SNAPSHOTS
bld.sourceDirectories= bld.sourceDirectories=
bld.version=2.2.1 bld.version=1.7.3-SNAPSHOT

View file

@ -4,21 +4,21 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>net.thauvin.erik</groupId> <groupId>net.thauvin.erik</groupId>
<artifactId>semver</artifactId> <artifactId>semver</artifactId>
<version>1.2.2-SNAPSHOT</version> <version>1.2.1</version>
<name>SemVer</name> <name>SemVer</name>
<description>Semantic Version Annotation Processor</description> <description>Semantic Version Annotation Processor</description>
<url>https://github.com/ethauvin/semver</url> <url>https://github.com/ethauvin/semver</url>
<licenses> <licenses>
<license> <license>
<name>The BSD 3-Clause License</name> <name>The BSD 3-Clause License</name>
<url>https://opensource.org/licenses/BSD-3-Clause</url> <url>http://opensource.org/licenses/BSD-3-Clause</url>
</license> </license>
</licenses> </licenses>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.github.spullara.mustache.java</groupId> <groupId>com.github.spullara.mustache.java</groupId>
<artifactId>compiler</artifactId> <artifactId>compiler</artifactId>
<version>0.9.14</version> <version>0.9.10</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View file

@ -1,7 +1,7 @@
/* /*
* SemverBuild.java * SemverBuild.java
* *
* Copyright (c) 2016-2024, 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
@ -40,7 +40,8 @@ import rife.bld.extension.PmdOperation;
import rife.bld.publish.*; import rife.bld.publish.*;
import rife.tools.exceptions.FileUtilsErrorException; import rife.tools.exceptions.FileUtilsErrorException;
import java.io.File; import java.io.IOException;
import java.nio.file.Path;
import java.util.List; import java.util.List;
import static rife.bld.dependencies.Repository.*; import static rife.bld.dependencies.Repository.*;
@ -49,15 +50,10 @@ import static rife.bld.dependencies.Scope.test;
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING; import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
public class SemverBuild extends Project { public class SemverBuild extends Project {
final PmdOperation pmdOp = new PmdOperation()
.fromProject(this)
.failOnViolation(true)
.ruleSets("config/pmd.xml");
public SemverBuild() { public SemverBuild() {
pkg = "net.thauvin.erik"; pkg = "net.thauvin.erik";
name = "SemVer"; name = "SemVer";
version = version(1, 2, 2, "SNAPSHOT"); version = version(1, 2, 1);
var description = "Semantic Version Annotation Processor"; var description = "Semantic Version Annotation Processor";
var url = "https://github.com/ethauvin/semver"; var url = "https://github.com/ethauvin/semver";
@ -65,27 +61,26 @@ public class SemverBuild extends Project {
javaRelease = 17; javaRelease = 17;
downloadSources = true; downloadSources = true;
autoDownloadPurge = true;
repositories = List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS); repositories = List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS);
scope(compile) scope(compile)
.include(dependency("com.github.spullara.mustache.java", "compiler", version(0, 9, 14))); .include(dependency("com.github.spullara.mustache.java", "compiler",
version(0, 9, 10)));
scope(test) scope(test)
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 12, 2))) .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 12, 2))); .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0)));
javadocOperation().javadocOptions() javadocOperation().javadocOptions()
.tag("created.on", "a", "Created on:")
.windowTitle(name + ' ' + version.toString() + " API") .windowTitle(name + ' ' + version.toString() + " API")
.docLint(NO_MISSING); .docLint(NO_MISSING);
publishOperation() publishOperation()
.repository(version.isSnapshot() ? repository(SONATYPE_SNAPSHOTS_LEGACY.location()) .repository(version.isSnapshot() ? repository(SONATYPE_SNAPSHOTS_LEGACY.location())
.withCredentials(property("sonatype.user"), property("sonatype.password")) .withCredentials(property("sonatype.user"), property("sonatype.password"))
: repository(SONATYPE_RELEASES_LEGACY.location()) : repository("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
.withCredentials(property("sonatype.user"), property("sonatype.password"))) .withCredentials(property("sonatype.user"), property("sonatype.password")))
.repository(repository("github"))
.info(new PublishInfo() .info(new PublishInfo()
.groupId(pkg) .groupId(pkg)
.artifactId(name.toLowerCase()) .artifactId(name.toLowerCase())
@ -97,17 +92,14 @@ public class SemverBuild extends Project {
.id("ethauvin") .id("ethauvin")
.name("Erik C. Thauvin") .name("Erik C. Thauvin")
.email("erik@thauvin.net") .email("erik@thauvin.net")
.url("https://erik.thauvin.net/") .url("https://erik.thauvin.net/"))
)
.license(new PublishLicense() .license(new PublishLicense()
.name("The BSD 3-Clause License") .name("The BSD 3-Clause License")
.url("https://opensource.org/licenses/BSD-3-Clause") .url("http://opensource.org/licenses/BSD-3-Clause"))
)
.scm(new PublishScm() .scm(new PublishScm()
.connection("scm:git:" + url + ".git") .connection("scm:git:" + url + ".git")
.developerConnection("scm:git:git@github.com:ethauvin/" + name.toLowerCase() + ".git") .developerConnection("scm:git:git@github.com:ethauvin/" + name.toLowerCase() + ".git")
.url(url) .url(url))
)
.signKey(property("sign.key")) .signKey(property("sign.key"))
.signPassphrase(property("sign.passphrase"))); .signPassphrase(property("sign.passphrase")));
} }
@ -117,7 +109,7 @@ public class SemverBuild extends Project {
} }
@BuildCommand(summary = "Generates JaCoCo Reports") @BuildCommand(summary = "Generates JaCoCo Reports")
public void jacoco() throws Exception { public void jacoco() throws IOException {
new JacocoReportOperation().fromProject(this).execute(); new JacocoReportOperation().fromProject(this).execute();
} }
@ -138,30 +130,29 @@ public class SemverBuild extends Project {
} }
@BuildCommand(summary = "Runs PMD analysis") @BuildCommand(summary = "Runs PMD analysis")
public void pmd() throws Exception { public void pmd() {
pmdOp.execute(); new PmdOperation()
} .fromProject(this)
.failOnViolation(true)
@BuildCommand(value = "pmd-cli", summary = "Runs PMD analysis (CLI)") .ruleSets("config/pmd.xml")
public void pmdCli() throws Exception { .execute();
pmdOp.includeLineNumber(false).execute();
}
@BuildCommand(value = "pom-root", summary = "Generates the POM file in the root directory")
public void pomRoot() throws FileUtilsErrorException {
PomBuilder.generateInto(publishOperation().fromProject(this).info(), dependencies(),
new File(workDirectory, "pom.xml"));
} }
@Override @Override
public void publish() throws Exception { public void publish() throws Exception {
super.publish(); super.publish();
pomRoot(); rootPom();
} }
@Override @Override
public void publishLocal() throws Exception { public void publishLocal() throws Exception {
super.publishLocal(); super.publishLocal();
pomRoot(); rootPom();
}
@BuildCommand(value = "pom-root", summary = "Generates the POM file in the root directory")
public void rootPom() throws FileUtilsErrorException {
PomBuilder.generateInto(publishOperation().info(), dependencies(),
Path.of(workDirectory.getPath(), "pom.xml").toFile());
} }
} }

View file

@ -1,7 +1,7 @@
/* /*
* Constants.java * Constants.java
* *
* Copyright (c) 2016-2024, 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>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("PMD.DataClass") @SuppressWarnings("PMD.DataClass")

View file

@ -1,7 +1,7 @@
/* /*
* Version.java * Version.java
* *
* Copyright (c) 2016-2024, 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,7 +41,7 @@ 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") @SuppressWarnings("SameReturnValue")

View file

@ -1,7 +1,7 @@
/* /*
* VersionInfo.java * VersionInfo.java
* *
* Copyright (c) 2016-2024, 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")

View file

@ -1,7 +1,7 @@
/* /*
* VersionProcessor.java * VersionProcessor.java
* *
* Copyright (c) 2016-2024, 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
@ -55,7 +55,7 @@ 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", "PMD.BeanMembersShouldSerialize"}) @SuppressWarnings({"PMD.GuardLogStatement", "PMD.BeanMembersShouldSerialize"})
@ -78,20 +78,9 @@ public class VersionProcessor extends AbstractProcessor {
return template; return template;
} }
private Mustache compileTemplate(final File dir, final String template) throws IOException { private Mustache compileTemplate(final File dir, final String template) {
if (Constants.DEFAULT_JAVA_TEMPLATE.equals(template) || Constants.DEFAULT_KOTLIN_TEMPLATE.equals(template)) { final var mf = new DefaultMustacheFactory(dir);
try (var in = getClass().getResourceAsStream("/" + template)) { return mf.compile(template);
if (in != null) {
try (var reader = new BufferedReader(new InputStreamReader(in))) {
return new DefaultMustacheFactory().compile(reader, template);
}
} else {
throw new IOException("Resource not found: " + template);
}
}
} else {
return new DefaultMustacheFactory(dir).compile(template);
}
} }
private void error(final String s) { private void error(final String s) {
@ -248,7 +237,7 @@ public class VersionProcessor extends AbstractProcessor {
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 var dir = getLocalFile(""); final var dir = getLocalFile("");
final Mustache mustache = compileTemplate(dir, template); final var mustache = compileTemplate(dir, template);
final var templateName = switch (mustache.getName()) { final var templateName = switch (mustache.getName()) {
case Constants.DEFAULT_JAVA_TEMPLATE -> "default (Java)"; case Constants.DEFAULT_JAVA_TEMPLATE -> "default (Java)";

View file

@ -1,7 +1,7 @@
/* /*
* ConstantsTest.java * ConstantsTest.java
* *
* Copyright (c) 2016-2024, 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
@ -45,7 +45,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
* The <code>ConstantsTest</code> class. * The <code>ConstantsTest</code> class.
* *
* @author <a href="https://erik.thauvin.net/" target="_blank">Erik C. Thauvin</a> * @author <a href="https://erik.thauvin.net/" target="_blank">Erik C. Thauvin</a>
* @created 2019-04-14 * @created.on 2019-04-14
* @since 1.0 * @since 1.0
*/ */
class ConstantsTest { class ConstantsTest {

View file

@ -1,7 +1,7 @@
/* /*
* VersionInfoTest.java * VersionInfoTest.java
* *
* Copyright (c) 2016-2024, 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
@ -43,7 +43,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
* The <code>VersionInfoTest</code> class. * The <code>VersionInfoTest</code> class.
* *
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a> * @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
* @created 2016-02-03 * @created.on 2016-02-03
* @since 1.0 * @since 1.0
*/ */
class VersionInfoTest { class VersionInfoTest {

View file

@ -1,7 +1,7 @@
/* /*
* VersionProcessorTest.java * VersionProcessorTest.java
* *
* Copyright (c) 2016-2024, 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
@ -48,37 +48,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
* The <code>VersionProcessorTest</code> class. * The <code>VersionProcessorTest</code> class.
* *
* @author <a href="https://erik.thauvin.net/" target="_blank">Erik C. Thauvin</a> * @author <a href="https://erik.thauvin.net/" target="_blank">Erik C. Thauvin</a>
* @created 2019-04-02 * @created.on 2019-04-02
* @since 1.2.0 * @since 1.2.0
*/ */
class VersionProcessorTest { class VersionProcessorTest {
private final VersionProcessor processor = new VersionProcessor(); private final VersionProcessor processor = new VersionProcessor();
private final VersionTest version = new VersionTest(); private final VersionTest version = new VersionTest();
/**
* Compares two strings by removing all line separators and whitespace.
*
* @param text1 The first text to compare
* @param text2 The second text to compare
* @return true if the texts are equivalent when line separators are ignored, false otherwise
*/
static boolean compareTextIgnoringLineSeparators(String text1, String text2) {
// Handle null cases
if (text1 == null && text2 == null) {
return true;
}
if (text1 == null || text2 == null) {
return false;
}
// Remove all line separators and whitespace
var cleanedText1 = text1.replaceAll("\\r?\\n|\\r|\\s", "");
var cleanedText2 = text2.replaceAll("\\r?\\n|\\r|\\s", "");
// Compare the cleaned strings
return cleanedText1.equals(cleanedText2);
}
@SuppressWarnings("PMD.AvoidAccessibilityAlteration") @SuppressWarnings("PMD.AvoidAccessibilityAlteration")
@Test @Test
void testCompileTemplate() void testCompileTemplate()
@ -93,40 +69,45 @@ class VersionProcessorTest {
try (var writer = new StringWriter()) { try (var writer = new StringWriter()) {
mustache.execute(writer, version).flush(); mustache.execute(writer, version).flush();
assertTrue(compareTextIgnoringLineSeparators( assertEquals(String.format("""
String.format("/*" + /*
" * 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 %s;" +
"import java.util.Date;" + package %s;
"/**" +
" * Provides semantic version information." + import java.util.Date;
" *" +
" * @author <a href=\"https://github.com/ethauvin/semver\">Semantic Version Annotation Processor</a>" + /**
" */" + * Provides semantic version information.
"public final class %s {" + *
" public static final String PROJECT = \"%s\";" + * @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a>
" public static final Date BUILDDATE = new Date(L);" + */
" public static final int MAJOR = %d;" + public final class MyTest {
" public static final int MINOR = %d;" + public static final String PROJECT = "%s";
" public static final int PATCH = %d;" + public static final Date BUILDDATE = new Date(L);
" public static final String PRERELEASE = \"%s\";" + public static final int MAJOR = %d;
" public static final String PRERELEASE_PREFIX = \"%s\";" + public static final int MINOR = %d;
" public static final String BUILDMETA = \"%s\";" + public static final int PATCH = %d;
" public static final String BUILDMETA_PREFIX = \"%s\";" + public static final String PRERELEASE = "%s";
" public static final String SEPARATOR = \"%s\";" + public static final String PRERELEASE_PREFIX = "%s";
" public static final String VERSION = \"\";" + public static final String BUILDMETA = "%s";
" /**" + public static final String BUILDMETA_PREFIX = "%s";
" * Disables the default constructor." + public static final String SEPARATOR = "%s";
" */" + public static final String VERSION = "";
" private %s() {" +
" throw new UnsupportedOperationException(\"Illegal constructor call.\");" + /**
" }" + * Disables the default constructor.
"}", version.packageName(), version.className(), version.project(), version.major(), */
version.minor(), version.patch(), version.preRelease(), version.preReleasePrefix(), private MyTest() {
version.buildMeta(), version.buildMetaPrefix(), version.separator(), version.className()), throw new UnsupportedOperationException("Illegal constructor call.");
writer.toString())); }
}
""", version.packageName(), version.project(), version.major(), version.minor(), version.patch(),
version.preRelease(), version.preReleasePrefix(), version.buildMeta(),
version.buildMetaPrefix(), version.separator()),
writer.toString());
} }
} }

View file

@ -1,7 +1,7 @@
/* /*
* VersionTest.java * VersionTest.java
* *
* Copyright (c) 2016-2024, 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
@ -38,10 +38,10 @@ import java.lang.annotation.Annotation;
* The <code>VersionTest</code> class. * The <code>VersionTest</code> class.
* *
* @author <a href="https://erik.thauvin.net/" target="_blank">Erik C. Thauvin</a> * @author <a href="https://erik.thauvin.net/" target="_blank">Erik C. Thauvin</a>
* @created 2019-04-02 * @created.on 2019-04-02
* @since 1.2.0 * @since 1.2.0
*/ */
@SuppressWarnings({"ClassExplicitlyAnnotation", "PMD.TestClassWithoutTestCases"}) @SuppressWarnings({"ClassExplicitlyAnnotation", "SameReturnValue", "java:S2187", "PMD.TestClassWithoutTestCases"})
class VersionTest implements Version { class VersionTest implements Version {
String template = "myversion.mustache"; String template = "myversion.mustache";