Compare commits

...

54 commits

Author SHA1 Message Date
78a35dea31
Set JVM compatibility to version 17 2025-04-25 11:43:00 -07:00
03c749de68
Set Java language version to 17 2025-04-25 11:33:04 -07:00
5fa475a726
fixup! Bump Gradle to version 8.14 2025-04-25 11:12:51 -07:00
a2f08edcbe
Bump PMD extension to version 1.2.3 2025-04-25 09:30:17 -07:00
7028182522
Bump Gradle to version 8.14 2025-04-25 09:29:45 -07:00
5c2373ff8b
Update extensions
Bump Exec to version 1.0.5
Bump JaCoCo Report to version 0.9.10
Bump PMD to version 1.2.2
2025-04-13 13:41:13 -07:00
2a7cacc945
Bump JUnit to version 5.12.2 2025-04-13 13:40:13 -07:00
2770d4a75e
Fix GitHub CI badge 2025-03-26 15:16:47 -07:00
8ecb70758b
Add method to compare text ignoring line separators and whitespaces 2025-03-26 15:11:27 -07:00
90e584c0f1
Fix run-example commands 2025-03-26 14:40:01 -07:00
c904f4a7a2
Fix snapshot repository 2025-03-26 14:36:24 -07:00
a82c416af5
Fixed repositories import 2025-03-26 13:45:30 -07:00
4596e71a55
Add snapshot repository 2025-03-26 13:42:26 -07:00
ed7a6ff9da
Add OS matrix for Ubuntu, Windows and macOS 2025-03-26 13:37:14 -07:00
fc785581ba
Bump Kotlin to version 2.1.20 2025-03-26 13:36:55 -07:00
8274798be5
Remove unused warnings 2025-03-19 22:16:41 -07:00
3a767ddcb2
Fix templates indentation 2025-03-19 21:54:15 -07:00
4961829fcd
Minor cleanups 2025-03-19 02:19:38 -07:00
da20cf6fa1
Set release to version 17
Update plugins to current versions
2025-03-19 02:13:00 -07:00
14d38fa0da
Fix Maven POM location and URL 2025-03-19 01:45:05 -07:00
0857cb00a6
Update Unit test rules syntax 2025-03-19 01:30:31 -07:00
1694e6f665
Update compile options to new syntax 2025-03-19 01:29:56 -07:00
028e173274
JDK 24 2025-03-19 01:28:03 -07:00
f8d708ffc8
Bump JUnit to version 5.12.1 2025-03-19 01:27:31 -07:00
c9d9e4695c
Bump Kotlin to version 2.1.10 2025-03-19 01:26:45 -07:00
b235ad4240
Updated extensions
Bump Exec to version 1.0.3
Bump Jacoco Report to version 0.9.9
Bump PMD to version 1.1.6
2025-03-19 01:25:59 -07:00
5b5bd56077
Bump Gradle to version 8.13 2025-03-19 01:25:49 -07:00
050fd5d3a6
Bump bld to version 2.2.1 2025-03-19 01:22:40 -07:00
e6316c70a2
Added javac option to explicitly request annotation processing, as required by Java 23 2024-10-01 15:16:16 -07:00
7f2141044f
Updated dependencies
Bumped JUnit to version 5.11.1
Bumped Kapt to version 1.9.24
Bumped PMD extension to version 1.1.6
Bumped Gradle to version 8.10.2
2024-10-01 15:10:51 -07:00
8ee5ac7867
Minor cleanups 2024-09-21 13:22:11 -07:00
9d67f126b0
Fixed CircleCI OpenJDK images aliases 2024-09-09 11:57:38 -07:00
3b18ff1612
Updated dependencies
Bumped Gradle to version 8.10.1
Bumped Kotlin to version 2.0.20
Bumped bld to version 2.1.0
2024-09-09 11:49:35 -07:00
94254cd590
Bumped Kotlin to version 1.9.24 2024-05-09 23:08:06 -07:00
6f738cee9e
Bumped Mustache Compiler to version 0.9.13 2024-05-03 19:18:05 -07:00
bf75fb0faa
Bumped bld to version 1.9.1 2024-05-03 19:17:41 -07:00
c918b9ffa1
Changes CircleCI pipeline to use Java 17 and 21 (LTS) 2024-04-29 19:06:20 -07:00
0c10b9aeba
Updated examples to use SNAPSHOT 2024-04-29 19:06:20 -07:00
47ffb6e12b
Load template resources from JAR manually. Close #8 2024-04-29 19:05:57 -07:00
d11420dae3
Bumped Mustache Compiler to version 0.9.12 2024-04-29 18:26:09 -07:00
6e4307cb61
Updated copyright 2024-04-29 15:09:44 -07:00
02ee7eaf8b
Bumped Gradle to version 8.7 2024-04-29 15:08:49 -07:00
01f543ba8d
Bumped Kotlin to version 1.9.23 2024-04-29 14:32:04 -07:00
1b153851fc
Bumped JaCoCo extension to version 0.9.5 2024-04-29 14:16:26 -07:00
b84ab29602
Bumped Exec extension to version 1.0.0 2024-04-29 14:12:09 -07:00
f71bc5c8ba
Bumped PMD extension version to 0.9.9 2024-04-29 10:43:21 -07:00
81d415fb8a
Bumped worflow actiosn to the latest versions. 2024-04-29 10:41:29 -07:00
d62f8b591c Bumped bld to 1.9.0 2024-02-26 17:48:47 -08:00
86c0dff26e Added contributing section 2024-01-31 17:26:30 -08:00
119818193d Bumped bld to 1.8.0 2024-01-31 15:43:42 -08:00
fd5746f007 Updated dependencies 2023-11-10 23:26:41 -08:00
1f9664cb7f Remove link to java.time example. 2023-11-10 23:24:10 -08:00
4a6fa98d46 Updated dependencies 2023-10-20 16:32:36 -07:00
65d2eb0c7c Added Generated Version bld extension reference 2023-10-02 14:11:42 -07:00
93 changed files with 1050 additions and 643 deletions

View file

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

View file

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

1
.gitignore vendored
View file

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

3
.idea/app.iml generated
View file

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

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

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

16
.idea/compiler.xml generated
View file

@ -1,16 +0,0 @@
<?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,7 +1,3 @@
<component name="CopyrightManager">
<settings>
<module2copyright>
<element module="Source Code" copyright="BSD-3 Clause" />
</module2copyright>
</settings>
<settings default="BSD-3 Clause" />
</component>

View file

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

204
.idea/intellij-javadocs-4.0.1.xml generated Normal file
View file

@ -0,0 +1,204 @@
<?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
View file

@ -1,6 +0,0 @@
<?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,11 +2,12 @@
<library name="bld">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2.jar!/" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2-sources.jar!/" />
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-sources.jar!/" />
</SOURCES>
<excluded>
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />

View file

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

View file

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

View file

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

9
.idea/misc.xml generated
View file

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

1
.idea/modules.xml generated
View file

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

View file

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

View file

@ -1,3 +0,0 @@
<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
View file

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

15
.vscode/settings.json vendored
View file

@ -1,15 +0,0 @@
{
"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-2023, Erik C. Thauvin (erik@thauvin.net)
Copyright (c) 2016-2024, Erik C. Thauvin (erik@thauvin.net)
All rights reserved.
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)
[![Java](https://img.shields.io/badge/java-17%2B-blue)](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
[![bld](https://img.shields.io/badge/1.7.2-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld)
[![bld](https://img.shields.io/badge/2.2.1-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld)
[![release](https://img.shields.io/github/release/ethauvin/semver.svg)](https://github.com/ethauvin/semver/releases/latest)
[![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)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ethauvin_semver&metric=alert_status)](https://sonarcloud.io/dashboard?id=ethauvin_semver)
[![GitHub CI](https://github.com/ethauvin/semver/actions/workflows/gradle.yml/badge.svg)](https://github.com/ethauvin/semver/actions/workflows/gradle.yml)
[![GitHub CI](https://github.com/ethauvin/semver/actions/workflows/bld.yml/badge.svg)](https://github.com/ethauvin/semver/actions/workflows/bld.yml)
[![Build status](https://ci.appveyor.com/api/projects/status/nbv4mxd1gpxtx69o?svg=true)](https://ci.appveyor.com/project/ethauvin/semver)
[![CircleCI](https://circleci.com/gh/ethauvin/semver/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/semver/tree/master)
@ -18,19 +18,22 @@ This processor was inspired by Cédric Beust's [version-processor](https://githu
## Table of Contents
- [Examples](#examples)
- [Template](#template)
- [Semantic Version Annotation Processor](#semantic-version-annotation-processor)
- [Table of Contents](#table-of-contents)
- [Examples](#examples)
- [Template](#template)
- [Default Template](#default-template)
- [Custom Template](#custom-template)
- [Elements & Properties](#elements--properties)
- [Maven](#maven)
- [bld](#bld)
- [Gradle](#gradle)
- [Elements \& Properties](#elements--properties)
- [Maven](#maven)
- [bld](#bld)
- [Gradle](#gradle)
- [Class Generation](#class-generation)
- [Class & Source Generation](#class--source-generation)
- [Kotlin](#kotlin)
- [Kotlin & Gradle](#kotlin--gradle)
- [Auto-Increment](#auto-increment)
- [Class \& Source Generation](#class--source-generation)
- [Kotlin](#kotlin)
- [Kotlin \& Gradle](#kotlin--gradle)
- [Auto-Increment](#auto-increment)
- [Contributing](#contributing)
## Examples
@ -134,8 +137,6 @@ The mustache variables automatically filled in by the processor are:
| `{{separator}}` | The version separator. | `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
The following annotation elements and properties are available:
@ -202,12 +203,13 @@ To install and run from [Maven](https://maven.apache.org/), configure an artifac
</dependency>
```
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
```console
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
To install and run from [bld](https://rife2.com/bld), just add the dependency to your build file:
@ -224,6 +226,8 @@ 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).
bld also has a [Generated Version](https://github.com/rife2/bld-generated-version) extension which provides similar functionalities.
## Gradle
### Class Generation
@ -296,7 +300,7 @@ dependencies {
kapt {
arguments {
arg("semver.project.dir", projectDir)
arg("semver.project.dir", projectDir.absolutePath)
}
}
```
@ -308,3 +312,22 @@ 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).
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,8 +7,9 @@
<!-- BEST PRACTICES -->
<rule ref="category/java/bestpractices.xml">
<exclude name="AvoidPrintStackTrace"/>
<exclude name="JUnit4TestShouldUseTestAnnotation"/>
<exclude name="JUnitTestContainsTooManyAsserts"/>
<exclude name="GuardLogStatement"/>
<exclude name="UnitTestContainsTooManyAsserts"/>
<exclude name="UnitTestShouldUseTestAnnotation"/>
</rule>
<rule ref="category/java/bestpractices.xml/MissingOverride">
@ -23,17 +24,20 @@
<rule ref="category/java/codestyle.xml">
<exclude name="AtLeastOneConstructor"/>
<exclude name="ClassNamingConventions"/>
<exclude name="ConfusingTernary"/>
<exclude name="CommentDefaultAccessModifier"/>
<exclude name="ConfusingTernary"/>
<exclude name="FieldNamingConventions"/>
<exclude name="LocalVariableCouldBeFinal"/>
<exclude name="LongVariable"/>
<exclude name="MethodArgumentCouldBeFinal"/>
<exclude name="OnlyOneReturn"/>
<exclude name="PackageCase"/>
<exclude name="ShortClassName"/>
<exclude name="ShortMethodName"/>
<exclude name="ShortVariable"/>
<exclude name="UselessParentheses"/>
<exclude name="UseExplicitTypes"/>
<exclude name="UseUnderscoresInNumericLiterals"/>
<exclude name="UselessParentheses"/>
</rule>
<rule ref="category/java/codestyle.xml/UnnecessaryImport">
@ -49,8 +53,6 @@
<exclude name="AvoidUncheckedExceptionsInSignatures"/>
<exclude name="CognitiveComplexity"/>
<exclude name="CyclomaticComplexity"/>
<exclude name="ExcessiveClassLength"/>
<exclude name="ExcessiveMethodLength"/>
<exclude name="ExcessiveParameterList"/>
<exclude name="ExcessivePublicCount"/>
<exclude name="GodClass"/>
@ -77,7 +79,6 @@
<exclude name="AvoidFieldNameMatchingMethodName"/>
<exclude name="AvoidFieldNameMatchingTypeName"/>
<exclude name="AvoidLiteralsInIfCondition"/>
<exclude name="EmptyCatchBlock"/>
<exclude name="NullAssignment"/>
</rule>
@ -93,13 +94,6 @@
<property name="skipAnnotations" value="true"/>
</properties>
</rule>
<rule ref="category/java/errorprone.xml/EmptyCatchBlock">
<properties>
<property name="allowExceptionNameRegex">
<value>^ignore$</value>
</property>
</properties>
</rule>
<!-- MULTITHREADING -->
<rule ref="category/java/multithreading.xml">

View file

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

View file

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

1
examples/java/bld/.idea/.name generated Normal file
View file

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

6
examples/java/bld/.idea/bld.xml generated Normal file
View file

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

View file

@ -0,0 +1,204 @@
<?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,11 +2,12 @@
<library name="bld">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2.jar!/" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2-sources.jar!/" />
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-sources.jar!/" />
</SOURCES>
<excluded>
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel>
<annotationProcessing>
<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_test" target="1.8" />
</bytecodeTargetLevel>

9
examples/java/gradle/.idea/gradle.iml generated Normal file
View file

@ -0,0 +1,9 @@
<?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,6 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" default="false" project-jdk-name="10" project-jdk-type="JavaSDK">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<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" />
</component>
</project>

View file

@ -2,9 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<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" />
<module fileurl="file://$PROJECT_DIR$/.idea/gradle.iml" filepath="$PROJECT_DIR$/.idea/gradle.iml" />
</modules>
</component>
</project>

View file

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

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

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

@ -1,15 +0,0 @@
<?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,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>

View file

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

View file

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

View file

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

View file

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

View file

@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@ -57,22 +59,22 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell

View file

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

View file

@ -9,7 +9,7 @@ import java.util.Date;
public final class ExampleVersion {
public static final String PROJECT = "Java Example";
public static final Date BUILDDATE = new Date(1696209996065L);
public static final Date BUILDDATE = new Date(1742447853077L);
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 static final String PROJECT = "Java App";
public static final Date BUILDDATE = new Date(1696209996080L);
public static final Date BUILDDATE = new Date(1742447853101L);
public static final int MAJOR = 11;
public static final int MINOR = 11;
public static final int PATCH = 20;

View file

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

View file

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

View file

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

9
examples/kotlin/.idea/kotlin.iml generated Normal file
View file

@ -0,0 +1,9 @@
<?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,4 +4,7 @@
<option name="sourceMapEmbedSources" />
<option name="sourceMapPrefix" />
</component>
<component name="KotlinJpsPluginSettings">
<option name="version" value="2.0.20" />
</component>
</project>

View file

@ -1,6 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<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" />
</component>
</project>

View file

@ -2,9 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<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" />
<module fileurl="file://$PROJECT_DIR$/.idea/kotlin.iml" filepath="$PROJECT_DIR$/.idea/kotlin.iml" />
</modules>
</component>
</project>

View file

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

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

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

11
examples/kotlin/README.md Normal file
View file

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

View file

@ -1,19 +1,15 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
id("application")
id("com.github.ben-manes.versions") version "0.48.0"
kotlin("jvm") version "1.9.10"
kotlin("kapt") version "1.9.10"
id("com.github.ben-manes.versions") version "0.51.0"
kotlin("jvm") version "2.1.20"
kotlin("kapt") version "1.9.25"
}
// ./gradlew
// ./gradlew run
// ./gradlew runJava
// ./gradlew runExample
// ./gradlew runJavaExample
defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
val semverProcessor = "net.thauvin.erik:semver:1.2.1"
val semverProcessor = "net.thauvin.erik:semver:1.2.2-SNAPSHOT"
dependencies {
kapt(semverProcessor)
@ -24,7 +20,7 @@ dependencies {
kapt {
arguments {
arg("semver.project.dir", projectDir)
arg("semver.project.dir", projectDir.absolutePath)
}
}
@ -34,6 +30,17 @@ repositories {
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 {
mainClass.set("com.example.App")
}

Binary file not shown.

View file

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

View file

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

View file

@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@ -57,22 +59,22 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell

View file

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

View file

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

17
examples/test/gradlew vendored
View file

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

View file

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

View file

@ -9,7 +9,7 @@ import java.util.Date;
public final class ExampleVersion {
public static final String PROJECT = "Java Example";
public static final Date BUILDDATE = new Date(1619673811155L);
public static final Date BUILDDATE = new Date(1707046879260L);
public static final String VERSION = "8.4.97-alpha+T800";
/**

Binary file not shown.

View file

@ -1,9 +1,9 @@
bld.downloadExtensionJavadoc=false
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.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.version=1.7.3-SNAPSHOT
bld.version=2.2.1

View file

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

View file

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

View file

@ -1,7 +1,7 @@
/*
* Constants.java
*
* Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2016-2024, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* 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.
*
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
* @created.on 2016-01-13
* @created 2016-01-13
* @since 1.0
*/
@SuppressWarnings("PMD.DataClass")

View file

@ -1,7 +1,7 @@
/*
* Version.java
*
* Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2016-2024, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* 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.
*
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
* @created.on 2016-01-13
* @created 2016-01-13
* @since 1.0
*/
@SuppressWarnings("SameReturnValue")

View file

@ -1,7 +1,7 @@
/*
* VersionInfo.java
*
* Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2016-2024, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* 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.
*
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
* @created.on 2016-01-16
* @created 2016-01-16
* @since 1.0
*/
@SuppressWarnings("PMD.DataClass")

View file

@ -1,7 +1,7 @@
/*
* VersionProcessor.java
*
* Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2016-2024, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* 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.
*
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
* @created.on 2016-01-13
* @created 2016-01-13
* @since 1.0
*/
@SuppressWarnings({"PMD.GuardLogStatement", "PMD.BeanMembersShouldSerialize"})
@ -78,9 +78,20 @@ public class VersionProcessor extends AbstractProcessor {
return template;
}
private Mustache compileTemplate(final File dir, final String template) {
final var mf = new DefaultMustacheFactory(dir);
return mf.compile(template);
private Mustache compileTemplate(final File dir, final String template) throws IOException {
if (Constants.DEFAULT_JAVA_TEMPLATE.equals(template) || Constants.DEFAULT_KOTLIN_TEMPLATE.equals(template)) {
try (var in = getClass().getResourceAsStream("/" + 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) {
@ -237,7 +248,7 @@ public class VersionProcessor extends AbstractProcessor {
private void writeTemplate(final String type, final VersionInfo versionInfo, final String template)
throws IOException {
final var dir = getLocalFile("");
final var mustache = compileTemplate(dir, template);
final Mustache mustache = compileTemplate(dir, template);
final var templateName = switch (mustache.getName()) {
case Constants.DEFAULT_JAVA_TEMPLATE -> "default (Java)";

View file

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

View file

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

View file

@ -1,7 +1,7 @@
/*
* ConstantsTest.java
*
* Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2016-2024, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* 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.
*
* @author <a href="https://erik.thauvin.net/" target="_blank">Erik C. Thauvin</a>
* @created.on 2019-04-14
* @created 2019-04-14
* @since 1.0
*/
class ConstantsTest {

View file

@ -1,7 +1,7 @@
/*
* VersionInfoTest.java
*
* Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2016-2024, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* 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.
*
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
* @created.on 2016-02-03
* @created 2016-02-03
* @since 1.0
*/
class VersionInfoTest {

View file

@ -1,7 +1,7 @@
/*
* VersionProcessorTest.java
*
* Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2016-2024, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -48,13 +48,37 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
* The <code>VersionProcessorTest</code> class.
*
* @author <a href="https://erik.thauvin.net/" target="_blank">Erik C. Thauvin</a>
* @created.on 2019-04-02
* @created 2019-04-02
* @since 1.2.0
*/
class VersionProcessorTest {
private final VersionProcessor processor = new VersionProcessor();
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")
@Test
void testCompileTemplate()
@ -69,45 +93,40 @@ class VersionProcessorTest {
try (var writer = new StringWriter()) {
mustache.execute(writer, version).flush();
assertEquals(String.format("""
/*
* This file is automatically generated.
* Do not modify! -- ALL CHANGES WILL BE ERASED!
*/
package %s;
import java.util.Date;
/**
* Provides semantic version information.
*
* @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a>
*/
public final class MyTest {
public static final String PROJECT = "%s";
public static final Date BUILDDATE = new Date(L);
public static final int MAJOR = %d;
public static final int MINOR = %d;
public static final int PATCH = %d;
public static final String PRERELEASE = "%s";
public static final String PRERELEASE_PREFIX = "%s";
public static final String BUILDMETA = "%s";
public static final String BUILDMETA_PREFIX = "%s";
public static final String SEPARATOR = "%s";
public static final String VERSION = "";
/**
* Disables the default constructor.
*/
private MyTest() {
throw new UnsupportedOperationException("Illegal constructor call.");
}
}
""", version.packageName(), version.project(), version.major(), version.minor(), version.patch(),
version.preRelease(), version.preReleasePrefix(), version.buildMeta(),
version.buildMetaPrefix(), version.separator()),
writer.toString());
assertTrue(compareTextIgnoringLineSeparators(
String.format("/*" +
" * This file is automatically generated." +
" * Do not modify! -- ALL CHANGES WILL BE ERASED!" +
" */" +
"package %s;" +
"import java.util.Date;" +
"/**" +
" * Provides semantic version information." +
" *" +
" * @author <a href=\"https://github.com/ethauvin/semver\">Semantic Version Annotation Processor</a>" +
" */" +
"public final class %s {" +
" public static final String PROJECT = \"%s\";" +
" public static final Date BUILDDATE = new Date(L);" +
" public static final int MAJOR = %d;" +
" public static final int MINOR = %d;" +
" public static final int PATCH = %d;" +
" public static final String PRERELEASE = \"%s\";" +
" public static final String PRERELEASE_PREFIX = \"%s\";" +
" public static final String BUILDMETA = \"%s\";" +
" public static final String BUILDMETA_PREFIX = \"%s\";" +
" public static final String SEPARATOR = \"%s\";" +
" public static final String VERSION = \"\";" +
" /**" +
" * Disables the default constructor." +
" */" +
" private %s() {" +
" throw new UnsupportedOperationException(\"Illegal constructor call.\");" +
" }" +
"}", version.packageName(), version.className(), version.project(), version.major(),
version.minor(), version.patch(), version.preRelease(), version.preReleasePrefix(),
version.buildMeta(), version.buildMetaPrefix(), version.separator(), version.className()),
writer.toString()));
}
}

View file

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