diff --git a/.circleci/config.yml b/.circleci/config.yml
index 4690865..65723f0 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,44 +1,41 @@
-version: 2
+inversion: 2
defaults: &defaults
working_directory: ~/repo
- docker:
- - image: circleci/openjdk:8-jdk
environment:
JVM_OPTS: -Xmx3200m
TERM: dumb
+ CI_NAME: "CircleCI"
+
+defaults_gradle: &defaults_bld
+ steps:
+ - checkout
+ - run:
+ name: Download the dependencies
+ command: ./bld download
+ - run:
+ name: Run tests with bld
+ command: ./bld compile test
jobs:
- build_gradle:
+ bld_jdk20:
<<: *defaults
- steps:
- - checkout
- - restore_cache:
- keys:
- - gradle-dependencies-{{ checksum "build.gradle" }}
- # fallback to using the latest cache if no exact match is found
- - gradle-dependencies-
+ docker:
+ - image: cimg/openjdk:20.0
- - run:
- name: Gradle Dependencies
- command: ./gradlew dependencies
+ <<: *defaults_bld
- - save_cache:
- paths: ~/.m2
- key: gradle-dependencies-{{ checksum "build.gradle" }}
+ bld_jdk17:
+ <<: *defaults
- - run:
- name: Run All Checks
- command: ./gradlew check
+ docker:
+ - image: cimg/openjdk:17.0
- - store_artifacts:
- path: build/reports/
- destination: reports
- - store_test_results:
- path: build/reports/
+ <<: *defaults_bld
workflows:
version: 2
- build_gradle_jdk8:
+ bld:
jobs:
- - build_gradle
+ - bld_jdk17
+ - bld_jdk20
diff --git a/.editorconfig b/.editorconfig
index a6971e1..1f808de 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,2 +1,2 @@
[*]
-insert_final_newline=true
+insert_final_newline = true
diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml
new file mode 100644
index 0000000..79093d1
--- /dev/null
+++ b/.github/workflows/bld.yml
@@ -0,0 +1,53 @@
+name: bld-ci
+
+on: [ push, pull_request, workflow_dispatch ]
+
+jobs:
+ build-bld-project:
+ runs-on: ubuntu-latest
+
+ env:
+ COVERAGE_SDK: "17"
+
+ strategy:
+ matrix:
+ java-version: [ 17, 20 ]
+
+ steps:
+ - name: Checkout source repository
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Set up JDK ${{ matrix.java-version }}
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'zulu'
+ java-version: ${{ matrix.java-version }}
+
+ - name: Grant execute permission for bld
+ run: chmod +x bld
+
+ - name: Download the dependencies
+ run: ./bld download
+
+ - name: Run tests with bld
+ run: ./bld compile jacoco
+
+ - name: Remove pom.xml
+ if: success() && matrix.java-version == env.COVERAGE_SDK
+ run: rm -rf pom.xml
+
+ - name: SonarCloud Scan
+ uses: sonarsource/sonarcloud-github-action@master
+ if: success() && matrix.java-version == env.COVERAGE_SDK
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+
+ - name: Upload coverage reports to Codecov
+ uses: codecov/codecov-action@v3
+ if: success() && matrix.java-version == env.COVERAGE_SDK
+ env:
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
+
diff --git a/.gitignore b/.gitignore
index f007981..091e664 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,84 +1,57 @@
-.vscode/*
-!.vscode/extensions.json
-!.vscode/launch.json
-!.vscode/settings.json
-!.vscode/tasks.json
-
-__pycache__
-.classpath
-.DS_Store
.gradle
-.history
-.kobalt
-.mtj.tmp/
-.mvn/timing.properties
-.mvn/wrapper/maven-wrapper.jar
-.nb-gradle
-.project
-.scannerwork
-.settings
-*.class
-*.code-workspace
-*.ctxt
-*.iws
-*.log
-*.nar
-*.rar
-*.sublime-*
-*.tar.gz
-*.zip
-/**/.idea_modules/
-/**/.idea/**/caches/build_file_checksums.ser
-/**/.idea/**/contentModel.xml
-/**/.idea/**/dataSources.ids
-/**/.idea/**/dataSources.local.xml
-/**/.idea/**/dataSources/
-/**/.idea/**/dbnavigator.xml
-/**/.idea/**/dictionaries
-/**/.idea/**/dynamic.xml
-/**/.idea/**/gradle.xml
-/**/.idea/**/httpRequests
-/**/.idea/**/libraries
-/**/.idea/**/mongoSettings.xml
-/**/.idea/**/replstate.xml
-/**/.idea/**/shelf
-/**/.idea/**/shelf/
-/**/.idea/**/sqlDataSources.xml
-/**/.idea/**/tasks.xml
-/**/.idea/**/uiDesigner.xml
-/**/.idea/**/usage.statistics.xml
-/**/.idea/**/workspace.xml
-/**/.idea/$CACHE_FILE$
-/**/.idea/$PRODUCT_WORKSPACE_FILE$
+.DS_Store
+build
+lib/bld/**
+!lib/bld/bld-wrapper.properties
+!lib/bld/bld-wrapper.jar
+lib/compile/
+lib/runtime/
+lib/standalone/
+lib/test/
+
+# IDEA ignores
+
+# User-specific
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/**/usage.statistics.xml
+.idea/**/dictionaries
+.idea/**/shelf
+
+# AWS User-specific
+.idea/**/aws.xml
+
+# Generated files
+.idea/**/contentModel.xml
+
+# Sensitive or high-churn files
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+.idea/**/dbnavigator.xml
+
+# Gradle
+.idea/**/gradle.xml
+
+# Mongo Explorer plugin
+.idea/**/mongoSettings.xml
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
atlassian-ide-plugin.xml
-bin/
-build/
-cmake-build-*/
-com_crashlytics_export_strings.xml
-crashlytics-build.properties
-crashlytics.properties
-dependency-reduced-pom.xml
-deploy/
-dist/
-ehthumbs.db
-fabric.properties
-gen/
-gradle.properties
-hs_err_pid*
-kobaltBuild
-kobaltw*-test
-lib/kotlin*
-libs/
-local.properties
-out/
-pom.xml.next
-pom.xml.releaseBackup
-pom.xml.tag
-pom.xml.versionsBackup
-proguard-project.txt
-project.properties
-release.properties
-target/
-test-output
-Thumbs.db
-venv
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# SonarLint plugin
+.idea/sonarlint/
+
+# Editor-based Rest Client
+.idea/httpRequests
+
+local.properties
\ No newline at end of file
diff --git a/.idea/app.iml b/.idea/app.iml
new file mode 100644
index 0000000..787b59b
--- /dev/null
+++ b/.idea/app.iml
@@ -0,0 +1,29 @@
+
+
GeneratedVersion
class containing the semantic
+version (major, minor, patch, etc.) that is read from a Properties file or defined in the annotation.
+
+@since 1.0
+
+
diff --git a/bin/main/semver-kt.mustache b/bin/main/semver-kt.mustache
new file mode 100644
index 0000000..0a58f86
--- /dev/null
+++ b/bin/main/semver-kt.mustache
@@ -0,0 +1,38 @@
+/*
+* This file is automatically generated.
+* Do not modify! -- ALL CHANGES WILL BE ERASED!
+*/
+
+package {{packageName}}
+
+import java.util.Date
+
+/**
+* Provides semantic version information.
+*
+* @author Semantic Version Annotation Processor
+*/
+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}}"
+}
diff --git a/bin/main/semver.mustache b/bin/main/semver.mustache
new file mode 100644
index 0000000..cd7c567
--- /dev/null
+++ b/bin/main/semver.mustache
@@ -0,0 +1,34 @@
+/*
+* This file is automatically generated.
+* Do not modify! -- ALL CHANGES WILL BE ERASED!
+*/
+
+package {{packageName}};
+
+import java.util.Date;
+
+/**
+* Provides semantic version information.
+*
+* @author Semantic Version Annotation Processor
+*/
+public final class {{className}} {
+public static final String PROJECT = "{{project}}";
+public static final Date BUILDDATE = new Date({{epoch}}L);
+public static final int MAJOR = {{major}};
+public static final int MINOR = {{minor}};
+public static final int PATCH = {{patch}};
+public static final String PRERELEASE = "{{preRelease}}";
+public static final String PRERELEASE_PREFIX = "{{preReleasePrefix}}";
+public static final String BUILDMETA = "{{buildMeta}}";
+public static final String BUILDMETA_PREFIX = "{{buildMetaPrefix}}";
+public static final String SEPARATOR = "{{separator}}";
+public static final String VERSION = "{{version}}";
+
+/**
+* Disables the default constructor.
+*/
+private {{className}}() {
+throw new UnsupportedOperationException("Illegal constructor call.");
+}
+}
diff --git a/bin/test/net/thauvin/erik/semver/ConstantsTest.class b/bin/test/net/thauvin/erik/semver/ConstantsTest.class
new file mode 100644
index 0000000..c8c9fde
Binary files /dev/null and b/bin/test/net/thauvin/erik/semver/ConstantsTest.class differ
diff --git a/bin/test/net/thauvin/erik/semver/VersionInfoTest.class b/bin/test/net/thauvin/erik/semver/VersionInfoTest.class
new file mode 100644
index 0000000..8c5f8b4
Binary files /dev/null and b/bin/test/net/thauvin/erik/semver/VersionInfoTest.class differ
diff --git a/bin/test/net/thauvin/erik/semver/VersionProcessorTest.class b/bin/test/net/thauvin/erik/semver/VersionProcessorTest.class
new file mode 100644
index 0000000..5166fb7
Binary files /dev/null and b/bin/test/net/thauvin/erik/semver/VersionProcessorTest.class differ
diff --git a/bin/test/net/thauvin/erik/semver/VersionTest.class b/bin/test/net/thauvin/erik/semver/VersionTest.class
new file mode 100644
index 0000000..0047ff2
Binary files /dev/null and b/bin/test/net/thauvin/erik/semver/VersionTest.class differ
diff --git a/bld b/bld
new file mode 100755
index 0000000..824b742
--- /dev/null
+++ b/bld
@@ -0,0 +1,2 @@
+#!/usr/bin/env sh
+java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build net.thauvin.erik.semver.SemverBuild "$@"
\ No newline at end of file
diff --git a/bld.bat b/bld.bat
new file mode 100644
index 0000000..ab43bcd
--- /dev/null
+++ b/bld.bat
@@ -0,0 +1,4 @@
+@echo off
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+java -jar "%DIRNAME%/lib/bld/bld-wrapper.jar" "%0" --build net.thauvin.erik.semver.SemverBuild %*
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
deleted file mode 100644
index 0910c36..0000000
--- a/build.gradle
+++ /dev/null
@@ -1,239 +0,0 @@
-plugins {
- id 'checkstyle'
- id 'java'
- id 'jacoco'
- id 'maven-publish'
- id 'pmd'
- id 'com.jfrog.bintray' version '1.8.5'
- id 'com.github.ben-manes.versions' version '0.28.0'
- id 'net.thauvin.erik.gradle.semver' version '1.0.4'
- id 'com.github.spotbugs' version '4.4.4'
- id 'org.sonarqube' version '3.0'
-}
-
-import com.github.spotbugs.snom.SpotBugsTask
-import org.apache.tools.ant.taskdefs.condition.Os
-
-defaultTasks 'check'
-
-group = 'net.thauvin.erik'
-
-final def mavenName = 'SemVer'
-final def mavenDescription = 'Semantic Version Annotation Processor'
-final def mavenUrl = 'https://github.com/ethauvin/semver'
-final def mavenLicense = 'The BSD 3-Clause License'
-final def mavenLicenseUrl = 'http://opensource.org/licenses/BSD-3-Clause'
-final def mavenScmCon = 'https://github.com/ethauvin/semver.git'
-final def mavenScmDevCon = 'git@github.com:ethauvin/semver.git'
-
-final def pkgLicenses = ['BSD 3-Clause']
-final def pkgIssueTrackerUrl = mavenUrl + '/issues'
-final def pkgLabels = ['java', 'kotlin', 'annotation', 'processor', 'semantic', 'version']
-
-ext.versions = [
- spotbugs: '4.0.6'
-]
-
-repositories {
- mavenLocal()
- jcenter()
- mavenCentral()
-}
-
-dependencies {
- implementation 'com.github.spullara.mustache.java:compiler:0.9.6'
-
- spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.10.1'
- spotbugsPlugins 'com.mebigfatguy.sb-contrib:sb-contrib:7.4.7'
-
- compileOnly "com.github.spotbugs:spotbugs-annotations:$versions.spotbugs"
- testCompileOnly "com.github.spotbugs:spotbugs-annotations:$versions.spotbugs"
-
- testImplementation 'org.testng:testng:7.2.0'
-}
-
-
-tasks.withType(JavaCompile) {
- options.encoding = 'UTF-8'
-}
-
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
-}
-
-pmd {
- ignoreFailures = true
- ruleSets = []
- ruleSetFiles = files("${projectDir}/config/pmd.xml")
- consoleOutput = true
-}
-
-bintray {
- user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
- key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
- publications = ['MyPublication']
- dryRun = false
- pkg {
- repo = 'maven'
- name = mavenName
- licenses = pkgLicenses
- desc = mavenDescription
- //released = new Date()
- websiteUrl = mavenUrl
- issueTrackerUrl = pkgIssueTrackerUrl
- vcsUrl = mavenScmCon
- labels = pkgLabels
- publicDownloadNumbers = true
- version {
- gpg { sign = true }
- }
- }
-}
-
-bintrayUpload {
- versionName = "$project.version"
- versionDesc = "$mavenName $project.version"
- versionVcsTag = "$project.version"
- versionReleased = new Date()
-}
-
-task javadocJar(type: Jar, dependsOn: javadoc) {
- group = 'Build'
- description = 'Builds an archive of the javadoc docs.'
- archiveClassifier.set('javadoc')
- from javadoc.destinationDir
-}
-
-task sourceJar(type: Jar) {
- group = 'Build'
- description = 'Builds an archive of the source code.'
- archiveClassifier.set('sources')
- from sourceSets.main.allSource
-}
-
-artifacts {
- archives javadocJar
- archives sourceJar
-}
-
-publishing {
- publications {
- MyPublication(MavenPublication) {
- from components.java
- artifact sourceJar
- artifact javadocJar
- groupId project.group
- artifactId rootProject.name
-
- pom {
- name = mavenName
- description = mavenDescription
- url = mavenUrl
- licenses {
- license {
- name = mavenLicense
- url = mavenLicenseUrl
- distribution = 'repo'
- }
- }
- developers {
- developer {
- id = 'ethauvin'
- name = 'Erik C. Thauvin'
- email = 'erik@thauvin.net'
- }
- }
- scm {
- connection = "scm:git:" + mavenScmCon
- developerConnection = "scm:git:" + mavenScmDevCon
- url = mavenScmCon
- }
- }
- }
- }
-}
-
-javadoc {
- doFirst {
- title = "$mavenDescription $project.version API"
- }
- options.with {
- tags = ['created']
- author = true
- //addBooleanOption('html4', true)
- links('https://docs.oracle.com/javase/8/docs/api/')
- //addStringOption('Xdoclint:none', '-quiet')
- }
-}
-
-test {
- useTestNG()
-}
-
-spotbugs {
- toolVersion = versions.spotbugs
- excludeFilter = file("$projectDir/config/spotbugs/excludeFilter.xml")
-}
-
-tasks.withType(SpotBugsTask) {
- reports {
- xml.enabled = false
- html.enabled = true
- }
-}
-
-tasks.withType(Checkstyle) {
- reports {
- xml.enabled = false
- html.enabled = true
- }
-}
-
-task release(dependsOn: ['wrapper', 'clean', 'publishToMavenLocal']) {
- group = 'Publishing'
- description = 'Releases new version to local maven repository.'
- doFirst {
- println("Version: $version")
- }
-}
-
-task pandoc(type: Exec) {
- group = 'Documentation'
- def pandoc_args = ['--from', 'gfm',
- '--to', 'html5',
- '--metadata', "pagetitle=$mavenDescription",
- '-s',
- '-c', 'github-pandoc.css',
- '-o', 'docs/README.html',
- 'README.md']
- if (Os.isFamily(Os.FAMILY_WINDOWS)) {
- commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
- } else {
- executable 'pandoc'
- args pandoc_args
- }
- standardOutput = new ByteArrayOutputStream()
- ext.output = {
- return standardOutput.toString()
- }
-}
-
-jacocoTestReport {
- reports {
- html.enabled = true
- xml.enabled = true
- }
-
-}
-
-sonarqube {
- properties {
- property("sonar.projectKey", "ethauvin_semver")
- property("sonar.sourceEncoding", "UTF-8")
- }
-}
-
-tasks.sonarqube {
- dependsOn("jacocoTestReport")
-}
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
deleted file mode 100644
index c5f6465..0000000
--- a/config/checkstyle/checkstyle.xml
+++ /dev/null
@@ -1,277 +0,0 @@
-
-
-
-
-
-An annotation processor that automatically generates a GeneratedVersion
class based on a Mustache template and containing the semantic version (major, minor, patch, etc.) that is read from a Properties file or defined in the annotation.
This processor was inspired by Cédric Beust's version-processor and works well in conjunction with the Semantic Version Plugin for Gradle.
+An annotation
+processor that automatically generates a
+GeneratedVersion
class based on a Mustache template and containing
+the semantic version (major, minor,
+patch, etc.) that is read from a Properties
+file or defined in the annotation.
This processor was inspired by Cédric Beust's version-processor +and works well in conjunction with the Semantic +Version Plugin for Gradle.
import net.thauvin.erik.semver.Version;
-
-@Version(major = 1, minor = 0, patch = 0, preRelease = "beta")
-public class A {
-// ...
import net.thauvin.erik.semver.Version;
+
+@Version(major = 1, minor = 0, patch = 0, preRelease = "beta")
+public class A {
+// ...
import net.thauvin.erik.semver.Version;
-
-@Version(properties = "version.properties")
-public class A {
-// ...
import net.thauvin.erik.semver.Version;
+
+@Version(properties = "version.properties")
+public class A {
+// ...
# version.properties
+version.major=1
+version.minor=0
+version.patch=0
+version.prerelease=beta
Upon running the annotation processor, a source file GeneratedVersion.java is automatically generated with static methods to access the semantic version data. The source is based on a fully customizable Mustache template.
-To use your own template, simply create a version.mustache
file in the project's root directory. The processor will automatically look for it.
Upon running the annotation processor, a source file GeneratedVersion.java +is automatically generated with static methods to access the semantic +version data. The source is based on a fully customizable Mustache template.
+To use your own template, simply create a
+version.mustache
file in the project's root directory. The
+processor will automatically look for it.
To specify your own template name, use:
- +@Version(template = "version.mustache")
+public class A {
+// ...
The default template implements the following static variables:
+The default +template implements the following static variables:
BUILDDATE |
The build date. | -java.util.Date |
+java.util.Date |
VERSION |
@@ -207,17 +273,19 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
A very simple custom template might look something like:
-/* version.mustache */
-package {{packageName}};
-
-import java.util.Date;
-
-public final class {{className}} {
- public final static String PROJECT = "{{project}}";
- public final static Date DATE = new Date({{epoch}}L);
- public final static String VERSION = "{{semver}}";
-}
The mustache variables automatically filled in by the processor are:
+/* version.mustache */
+package {{packageName}};
+
+import java.util.Date;
+
+public final class {{className}} {
+public final static String PROJECT = "{{project}}";
+ public final static Date DATE = new Date({{epoch}}L);
+ public final static String VERSION = "{{semver}}";
+ }
The mustache variables automatically filled in by the processor +are:
String |
|||
{{semver}} or {{version}} |
+{{semver}} or
+{{version}} |
The full semantic version. | String |
Please also look at this example using java.time
Please also look at this example
+using java.time
The following annotation elements and properties are available:
preReleasePrefix |
-version.prerelease.prefix |
+version.prerelease.prefix |
The pre-release prefix. | - |
type |
- | Either java or kt for Kotlin. |
+Either java or
+kt for Kotlin. |
java |
In order to easily incorporate with existing projects, the property keys may be assigned custom values:
-@Version(
- properties = "example.properties",
- keysPrefix = "example."
- majorKey = "maj",
- minorKey = "min",
- patchKey = "build",
- preReleaseKey = "rel",
- buildMetaKey = "meta",
- projectKey = "project"
-)
-public class Example {
-// ...
# example.properties
-example.project=Example
-example.maj=1
-example.min=0
-example.build=0
-example.rel=beta
-example.meta=
-# ...
In order to easily incorporate with existing projects, the property +keys may be assigned custom values:
+@Version(
+= "example.properties",
+ properties = "example."
+ keysPrefix = "maj",
+ majorKey = "min",
+ minorKey = "build",
+ patchKey = "rel",
+ preReleaseKey = "meta",
+ buildMetaKey = "project"
+ projectKey )
+public class Example {
+// ...
# example.properties
+example.project=Example
+example.maj=1
+example.min=0
+example.build=0
+example.rel=beta
+example.meta=
+# ...
-⚠️
+keysPrefix
is a new element staring in1.1.0
and may break older versions when using custom property keys.
-⚡ A quick fix is to includekeysPrefix=""
in the annotation to remove the defaultversion.
prefix.⚠️ +
keysPrefix
is a new element staring in1.1.0
+and may break older versions when using custom property keys.
+⚡ A quick fix is to include +keysPrefix=""
in the annotation to remove the default +version.
prefix.
To install and run from Maven, configure an artifact as follows:
-<dependency>
- <groupId>net.thauvin.erik</groupId>
- <artifactId>semver</artifactId>
- <version>1.2.0</version>
-</dependency>
Please look at pom.xml in the examples/java directory for a sample:
- +To install and run from Maven, configure an artifact as +follows:
+dependency>
+ <groupId>net.thauvin.erik</groupId>
+ <artifactId>semver</artifactId>
+ <version>1.2.0</version>
+ <dependency> </
Please look at pom.xml +in the examples/java +directory for a sample:
+mvn verify
To install and run from Gradle, add the following to build.gradle:
-dependencies {
- annotationProcessor 'net.thauvin.erik:semver:1.2.0'
- implementation 'net.thauvin.erik:semver:1.2.0'
-}
-
-tasks.withType(JavaCompile) {
- options.compilerArgs += [ "-Asemver.project.dir=$projectDir" ]
-}
-
-The directory containing the configuration files (version.properties
, version.mustache
) must be specified using the semver.project.dir
processor argument.
The GeneratedVersion.java
class will be automatically created in the build/generated
directory upon compiling.
Please look at build.gradle in the examples/java directory for a sample.
+To install and run from Gradle, add +the following to build.gradle:
+{
+ repositories mavenCentral()
+ }
+
+{
+ dependencies 'net.thauvin.erik:semver:1.2.0'
+ annotationProcessor 'net.thauvin.erik:semver:1.2.0'
+ compileOnly }
+
+.withType(JavaCompile) {
+ tasks.compilerArgs += [ "-Asemver.project.dir=$projectDir" ]
+ options}
The directory containing the configuration files
+(version.properties
, version.mustache
) must be
+specified using the semver.project.dir
processor
+argument.
The GeneratedVersion.java
+class will be automatically created in the build/generated
+directory upon compiling.
Please look at build.gradle +in the examples/java +directory for a sample.
In order to also incorporate the generated source code into the source tree
, add the following to build.gradle:
tasks.withType(JavaCompile) {
- options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java")
-}
-
-The GeneratedVersion.java
file will now be located in src/generated
.
In order to also incorporate the generated source code into the
+source tree
, add the following to build.gradle:
.withType(JavaCompile) {
+ tasks.generatedSourceOutputDirectory.set(file("${projectDir}/src/generated/java"))
+ options}
The GeneratedVersion.java
+file will now be located in src/generated
.
The annotation processor also supports Kotlin.
-To generate a Kotlin version file, simply specify the type
as follows:
import net.thauvin.erik.semver.Version
-
-@Version(properties = "version.properties", type="kt")
-open class Main {
-// ...
The Kotlin default template implements the same static fields and functions as the Java template.
-Please look at the examples/kotlin project for a build.gradle.kts sample.
+The annotation processor also supports Kotlin.
+To generate a Kotlin version file, simply specify the
+type
as follows:
import net.thauvin.erik.semver.Version
+
+@Version(properties = "version.properties", type="kt")
+open class Main {
+// ...
The Kotlin +default template implements the same static fields and functions as +the Java template.
+Please look at the examples/kotlin +project for a build.gradle.kts +sample.
To install and run from Gradle, add the following to build.gradle.kts:
-var semverProcessor = "net.thauvin.erik:semver:1.2.0"
-
-dependencies {
- kapt(semverProcessor)
- implementation(semverProcessor)
-}
-
-kapt {
- arguments {
- arg("semver.project.dir", projectDir)
- }
-}
The directory containing the configuration files (version.properties
, version.mustache
) must be specified using the semver.project.dir
processor argument.
To install and run from Kobalt, add the following to Build.kt:
-dependencies {
- apt("net.thauvin.erik:semver:1.2.0")
- compileOnly("net.thauvin.erik:semver:1.2.0")
-}
-
-Please look at Build.kt in the examples/java directory for a sample.
+To install and run from Gradle, add +the following to build.gradle.kts:
+var semverProcessor = "net.thauvin.erik:semver:1.2.0"
+
+{
+ dependencies (semverProcessor)
+ kapt(semverProcessor)
+ compileOnly}
+
+{
+ kapt {
+ arguments ("semver.project.dir", projectDir)
+ arg}
+ }
The directory containing the configuration files
+(version.properties
, version.mustache
) must be
+specified using the semver.project.dir
processor
+argument.
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.
-There are also full examples in both Java and Kotlin showing how to use both the plugin and annotation processor concurrently.
+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.
+There are also full examples +in both Java +and Kotlin +showing how to use both the plugin and annotation processor +concurrently.