parent
4da4f15e67
commit
65ee533952
3 changed files with 52 additions and 48 deletions
16
README.md
16
README.md
|
@ -37,11 +37,11 @@ version.patch=0
|
||||||
version.prerelease=beta
|
version.prerelease=beta
|
||||||
```
|
```
|
||||||
|
|
||||||
[View Example](tree/master/examples)
|
[View Example](https://github.com/ethauvin/semver/tree/master/example)
|
||||||
|
|
||||||
## Template
|
## Template
|
||||||
|
|
||||||
Upon running the annotation processor, a source file [`GeneratedVersion.java`](blob/master/example/src/generated/java/net/thauvin/erik/semver/example/GeneratedVersion.java) is automatically generated with static methods to access the semantic version data. The source is based on a fully customizable [Mustache](https://mustache.github.io/) template.
|
Upon running the annotation processor, a source file [`GeneratedVersion.java`](https://github.com/ethauvin/semver/blob/master/example/src/generated/java/net/thauvin/erik/semver/example/GeneratedVersion.java) is automatically generated with static methods to access the semantic version data. The source is based on a fully customizable [Mustache](https://mustache.github.io/) template.
|
||||||
|
|
||||||
To use your own template, simply create a `version.mustache` file. The processor will automatically look for it.
|
To use your own template, simply create a `version.mustache` file. The processor will automatically look for it.
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class A {
|
||||||
|
|
||||||
### Default Template
|
### Default Template
|
||||||
|
|
||||||
The [default template](blob/master/src/main/resources/semver.mustache) implements the following static fields:
|
The [default template](https://github.com/ethauvin/semver/blob/master/src/main/resources/semver.mustache) implements the following static fields:
|
||||||
|
|
||||||
Field | Description | Example
|
Field | Description | Example
|
||||||
:--------------|:---------------------------------|:-----------------
|
:--------------|:---------------------------------|:-----------------
|
||||||
|
@ -158,7 +158,7 @@ example.meta=
|
||||||
# ...
|
# ...
|
||||||
```
|
```
|
||||||
|
|
||||||
> :warning: `keysPrefix` is a new element in `1.1.0` and may break older versions when using custom property keys.
|
> :warning: `keysPrefix` is a new element in `1.0.0` and may break older versions when using custom property keys.
|
||||||
> :zap: A quick fix is to include `keysPrefix=""` in the annotation to remove the default `version.` prefix.
|
> :zap: A quick fix is to include `keysPrefix=""` in the annotation to remove the default `version.` prefix.
|
||||||
|
|
||||||
## Usage with Maven, Grail, Kobalt and Kotlin
|
## Usage with Maven, Grail, Kobalt and Kotlin
|
||||||
|
@ -200,7 +200,7 @@ compileJava.options.annotationProcessorGeneratedSourcesDirectory = file("${proje
|
||||||
|
|
||||||
The `GeneratedVersion.java` file will now be located in `src/generated`.
|
The `GeneratedVersion.java` file will now be located in `src/generated`.
|
||||||
|
|
||||||
Please look at the [build.gradle](blob/master/examples/java/build.gradle) file in the [Java example](tree/master/example/java) module directory for a sample.
|
Please look at the [build.gradle](https://github.com/ethauvin/semver/blob/master/example/build.gradle) file in the [example](https://github.com/ethauvin/semver/tree/master/example) module directory for a sample.
|
||||||
|
|
||||||
### Kobalt
|
### Kobalt
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ dependencies {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Please look at the [Build.kt](blob/master/examples/kotlin/kobalt/src/Build.kt) file in the [Kotlin example](tree/master/example/kotlin) module directory for a sample.
|
Please look at the [Build.kt](https://github.com/ethauvin/semver/blob/master/example/kobalt/src/Build.kt) file in the [example](https://github.com/ethauvin/semver/tree/master/example) module directory for a sample.
|
||||||
|
|
||||||
### Kotlin
|
### Kotlin
|
||||||
|
|
||||||
|
@ -228,9 +228,9 @@ import net.thauvin.erik.semver.Version
|
||||||
open class Main {
|
open class Main {
|
||||||
// ...
|
// ...
|
||||||
```
|
```
|
||||||
The [Kotlin default template](blob/master/src/main/resources/semver-kt.mustache) implements the same static fields and functions as the [Java template](#default-template).
|
The [Kotlin default template](https://github.com/ethauvin/semver/blob/master/src/main/resources/semver-kt.mustache) implements the same static fields and functions as the [Java template](#default-template).
|
||||||
|
|
||||||
Please look at the [Kotlin example](tree/master/examples/Kotlin) project for samples on using Gradle ([build.gradle.kts](blob/master/examples/kotlin/build.gradle.kts)) and Kobalt ([Build.kt](blob/master/examples/kotlin/kobalt/src/Build.kt)).
|
Please look at the [Example for Kotlin](https://github.com/ethauvin/semver-example-kotlin) project for samples on using Gradle ([build.gradle](https://github.com/ethauvin/semver-example-kotlin/blob/master/build.gradle)) and Kobalt ([Build.kt](https://github.com/ethauvin/semver-example-kotlin/blob/master/kobalt/src/Build.kt)).
|
||||||
|
|
||||||
## Auto-Increment
|
## Auto-Increment
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,6 @@ task pandoc(type: Exec) {
|
||||||
'-s',
|
'-s',
|
||||||
'-c', 'github-pandoc.css',
|
'-c', 'github-pandoc.css',
|
||||||
'-o', 'docs/README.html',
|
'-o', 'docs/README.html',
|
||||||
'-H', 'docs/header.inc',
|
|
||||||
'README.md']
|
'README.md']
|
||||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||||
commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
|
commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
|
||||||
|
|
|
@ -47,14 +47,13 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<base href="https://github.com/ethauvin/semver/">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1 id="semantic-version-annotation-processor">Semantic Version Annotation Processor</h1>
|
<h1 id="semantic-version-annotation-processor">Semantic Version Annotation Processor</h1>
|
||||||
<p><a href="http://opensource.org/licenses/BSD-3-Clause"><img src="https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square" alt="License (3-Clause BSD)" /></a> <a href="https://github.com/ethauvin/semver/releases/latest"><img src="https://img.shields.io/github/release/ethauvin/semver.svg" alt="release" /></a> <a href="https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver"><img src="https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver/badge.svg" alt="Maven Central" /></a> <a href="https://bintray.com/ethauvin/maven/SemVer/_latestVersion"><img src="https://api.bintray.com/packages/ethauvin/maven/SemVer/images/download.svg" alt="Download" /></a><br />
|
<p><a href="http://opensource.org/licenses/BSD-3-Clause"><img src="https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square" alt="License (3-Clause BSD)" /></a> <a href="https://github.com/ethauvin/semver/releases/latest"><img src="http://github-release-version.herokuapp.com/github/ethauvin/semver/release.svg?style=flat&1" alt="release" /></a> <a href="https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver"><img src="https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver/badge.svg" alt="Maven Central" /></a> <a href="https://bintray.com/ethauvin/maven/SemVer/_latestVersion"><img src="https://api.bintray.com/packages/ethauvin/maven/SemVer/images/download.svg" alt="Download" /></a><br />
|
||||||
<a href="https://snyk.io/test/github/ethauvin/semver?targetFile=build.gradle"><img src="https://snyk.io/test/github/ethauvin/semver/badge.svg?targetFile=build.gradle" alt="Known Vulnerabilities" /></a> <a href="https://travis-ci.org/ethauvin/semver"><img src="https://travis-ci.org/ethauvin/semver.svg?branch=master" alt="Build Status" /></a> <a href="https://ci.appveyor.com/project/ethauvin/semver"><img src="https://ci.appveyor.com/api/projects/status/nbv4mxd1gpxtx69o?svg=true" alt="Build status" /></a> <a href="https://circleci.com/gh/ethauvin/semver/tree/master"><img src="https://circleci.com/gh/ethauvin/semver/tree/master.svg?style=shield" alt="CircleCI" /></a></p>
|
<a href="https://www.versioneye.com/user/projects/56a680101b78fd00390001d2"><img src="https://www.versioneye.com/user/projects/56a680101b78fd00390001d2/badge.svg?style=flat" alt="Dependency Status" /></a> <a href="https://travis-ci.org/ethauvin/semver"><img src="https://travis-ci.org/ethauvin/semver.svg?branch=master" alt="Build Status" /></a> <a href="https://ci.appveyor.com/project/ethauvin/semver"><img src="https://ci.appveyor.com/api/projects/status/nbv4mxd1gpxtx69o?svg=true" alt="Build status" /></a> <a href="https://circleci.com/gh/ethauvin/semver/tree/master"><img src="https://circleci.com/gh/ethauvin/semver/tree/master.svg?style=shield" alt="CircleCI" /></a></p>
|
||||||
<p>An <a href="https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/Processor.html">annotation processor</a> that automatically generates a <code>GeneratedVersion</code> class based on a <a href="https://mustache.github.io/">Mustache</a> template and containing the <a href="http://semver.org/">semantic version</a> (major, minor, patch, etc.) that is read from a <code>Properties</code> file or defined in the <a href="https://docs.oracle.com/javase/tutorial/java/annotations/basics.html">annotation</a>.</p>
|
<p>An <a href="https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/Processor.html">annotation processor</a> that automatically generates a <code>GeneratedVersion</code> class based on a <a href="https://mustache.github.io/">Mustache</a> template and containing the <a href="http://semver.org/">semantic version</a> (major, minor, patch, etc.) that is read from a <code>Properties</code> file or defined in the <a href="https://docs.oracle.com/javase/tutorial/java/annotations/basics.html">annotation</a>.</p>
|
||||||
<p>This processor was inspired by Cédric Beust's <a href="https://github.com/cbeust/version-processor">version-processor</a> and works well in conjunction with the <a href="https://github.com/ethauvin/semver-gradle">Semantic Version Plugin for Gralde</a>.</p>
|
<p>This processor was inspired by Cédric Beust's <a href="https://github.com/cbeust/version-processor">version-processor</a>.</p>
|
||||||
<h2 id="examples">Examples</h2>
|
<h2 id="examples">Examples</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Using annotation elements:</li>
|
<li>Using annotation elements:</li>
|
||||||
|
@ -77,16 +76,16 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
|
||||||
<span class="dt">version.minor</span><span class="ot">=</span><span class="dv">0</span>
|
<span class="dt">version.minor</span><span class="ot">=</span><span class="dv">0</span>
|
||||||
<span class="dt">version.patch</span><span class="ot">=</span><span class="dv">0</span>
|
<span class="dt">version.patch</span><span class="ot">=</span><span class="dv">0</span>
|
||||||
<span class="dt">version.prerelease</span><span class="ot">=</span><span class="st">beta</span></code></pre></div>
|
<span class="dt">version.prerelease</span><span class="ot">=</span><span class="st">beta</span></code></pre></div>
|
||||||
<p><a href="tree/master/examples">View Example</a></p>
|
<p><a href="https://github.com/ethauvin/semver/tree/master/example">View Example</a></p>
|
||||||
<h2 id="template">Template</h2>
|
<h2 id="template">Template</h2>
|
||||||
<p>Upon running the annotation processor, a source file <a href="blob/master/example/src/generated/java/net/thauvin/erik/semver/example/GeneratedVersion.java"><code>GeneratedVersion.java</code></a> is automatically generated with static methods to access the semantic version data. The source is based on a fully customizable <a href="https://mustache.github.io/">Mustache</a> template.</p>
|
<p>Upon running the annotation processor, a source file <a href="https://github.com/ethauvin/semver/blob/master/example/src/generated/java/net/thauvin/erik/semver/example/GeneratedVersion.java"><code>GeneratedVersion.java</code></a> is automatically generated with static methods to access the semantic version data. The source is based on a fully customizable <a href="https://mustache.github.io/">Mustache</a> template.</p>
|
||||||
<p>To use your own template, simply create a <code>version.mustache</code> file. The processor will automatically look for it.</p>
|
<p>To use your own template, simply create a <code>version.mustache</code> file. The processor will automatically look for it.</p>
|
||||||
<p>To specify your own template name, use:</p>
|
<p>To specify your own template name, use:</p>
|
||||||
<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="fu">@Version</span>(template = <span class="st">"version.mustache"</span>)
|
<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="fu">@Version</span>(template = <span class="st">"version.mustache"</span>)
|
||||||
<span class="kw">public</span> <span class="kw">class</span> A {
|
<span class="kw">public</span> <span class="kw">class</span> A {
|
||||||
<span class="co">// ...</span></code></pre></div>
|
<span class="co">// ...</span></code></pre></div>
|
||||||
<h3 id="default-template">Default Template</h3>
|
<h3 id="default-template">Default Template</h3>
|
||||||
<p>The <a href="blob/master/src/main/resources/semver.mustache">default template</a> implements the following static fields:</p>
|
<p>The <a href="https://github.com/ethauvin/semver/blob/master/src/main/resources/semver.mustache">default template</a> implements the following static fields:</p>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="header">
|
<tr class="header">
|
||||||
|
@ -317,39 +316,26 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
|
||||||
<td style="text-align: left;">Either <code>java</code> or <code>kt</code> for Kotlin.</td>
|
<td style="text-align: left;">Either <code>java</code> or <code>kt</code> for Kotlin.</td>
|
||||||
<td style="text-align: left;"><code>java</code></td>
|
<td style="text-align: left;"><code>java</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>keysPrefix</code></td>
|
|
||||||
<td style="text-align: left;"></td>
|
|
||||||
<td style="text-align: left;">The prefix for all property keys.</td>
|
|
||||||
<td style="text-align: left;"><code>version.</code></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<p>In order to easily incorporate with existing projects, the property keys may be assigned custom values:</p>
|
<p>In order to easily incorporate with existing projects, the property keys may be assigned custom values:</p>
|
||||||
<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="fu">@Version</span>(
|
<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="fu">@Version</span>(
|
||||||
properties = <span class="st">"example.properties"</span>,
|
properties = <span class="st">"example.properties"</span>,
|
||||||
keysPrefix = <span class="st">"example."</span>
|
majorKey = <span class="st">"example.major"</span>,
|
||||||
majorKey = <span class="st">"maj"</span>,
|
minorKey = <span class="st">"example.minor"</span>,
|
||||||
minorKey = <span class="st">"min"</span>,
|
patchKey = <span class="st">"example.patch"</span>,
|
||||||
patchKey = <span class="st">"build"</span>,
|
preReleaseKey = <span class="st">"example.prerelease"</span>,
|
||||||
preReleaseKey = <span class="st">"rel"</span>,
|
buildMetaKey = <span class="st">"example.buildmeta"</span>,
|
||||||
buildMetaKey = <span class="st">"meta"</span>,
|
projectKey = <span class="st">"example.project"</span>
|
||||||
projectKey = <span class="st">"project"</span>
|
|
||||||
)
|
)
|
||||||
<span class="kw">public</span> <span class="kw">class</span> Example {
|
<span class="kw">public</span> <span class="kw">class</span> Example {
|
||||||
<span class="co">// ...</span></code></pre></div>
|
<span class="co">// ...</span></code></pre></div>
|
||||||
<div class="sourceCode"><pre class="sourceCode ini"><code class="sourceCode ini"><span class="co"># example.properties</span>
|
<div class="sourceCode"><pre class="sourceCode ini"><code class="sourceCode ini"><span class="co"># example.properties</span>
|
||||||
<span class="dt">example.project</span><span class="ot">=</span><span class="st">Example</span>
|
<span class="dt">example.project</span><span class="ot">=</span><span class="st">Example</span>
|
||||||
<span class="dt">example.maj</span><span class="ot">=</span><span class="dv">1</span>
|
<span class="dt">example.major</span><span class="ot">=</span><span class="dv">1</span>
|
||||||
<span class="dt">example.min</span><span class="ot">=</span><span class="dv">0</span>
|
<span class="dt">example.minor</span><span class="ot">=</span><span class="dv">0</span>
|
||||||
<span class="dt">example.build</span><span class="ot">=</span><span class="dv">0</span>
|
<span class="dt">example.patch</span><span class="ot">=</span><span class="dv">0</span>
|
||||||
<span class="dt">example.rel</span><span class="ot">=</span><span class="st">beta</span>
|
|
||||||
<span class="dt">example.meta</span><span class="ot">=</span>
|
|
||||||
<span class="co"># ...</span></code></pre></div>
|
<span class="co"># ...</span></code></pre></div>
|
||||||
<blockquote>
|
|
||||||
<p>⚠️ <code>keysPrefix</code> is a new element in <code>1.1.0</code> and may break older versions when using custom property keys.<br />
|
|
||||||
⚡ A quick fix is to include <code>keysPrefix=""</code> in the annotation to remove the default <code>version.</code> prefix.</p>
|
|
||||||
</blockquote>
|
|
||||||
<h2 id="usage-with-maven-grail-kobalt-and-kotlin">Usage with Maven, Grail, Kobalt and Kotlin</h2>
|
<h2 id="usage-with-maven-grail-kobalt-and-kotlin">Usage with Maven, Grail, Kobalt and Kotlin</h2>
|
||||||
<h3 id="maven">Maven</h3>
|
<h3 id="maven">Maven</h3>
|
||||||
<p>To install and run from <a href="http://maven.apache.org/">Maven</a>, configure an artifact as follows:</p>
|
<p>To install and run from <a href="http://maven.apache.org/">Maven</a>, configure an artifact as follows:</p>
|
||||||
|
@ -362,22 +348,38 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
|
||||||
<h4 id="class-generation">Class Generation</h4>
|
<h4 id="class-generation">Class Generation</h4>
|
||||||
<p>To install and run from <a href="https://gradle.org/">Gradle</a>, add the following to the <code>build.gradle</code> file:</p>
|
<p>To install and run from <a href="https://gradle.org/">Gradle</a>, add the following to the <code>build.gradle</code> file:</p>
|
||||||
<pre class="gradle"><code>dependencies {
|
<pre class="gradle"><code>dependencies {
|
||||||
annotationProcessor 'net.thauvin.erik:semver:1.0.1'
|
|
||||||
compileOnly 'net.thauvin.erik:semver:1.0.1'
|
compileOnly 'net.thauvin.erik:semver:1.0.1'
|
||||||
}</code></pre>
|
}</code></pre>
|
||||||
<p>The <code>GeneratedVersion</code> class will be automatically created in the <code>build/generated</code> directory upon compiling.</p>
|
<p>The <code>GeneratedVersion</code> class will be automatically created in the <code>build/generated</code> directory upon compiling.</p>
|
||||||
<h4 id="class-source-generation">Class & Source Generation</h4>
|
<h4 id="class-source-generation">Class & Source Generation</h4>
|
||||||
<p>In order to also incorporate the generated source code into the <code>source tree</code>, add the following to the very top of the <code>build.gradle</code> file:</p>
|
<p>In order to also incorporate the generated source code into the <code>source tree</code>, use the <a href="https://github.com/ewerk/gradle-plugins/tree/master/annotation-processor-plugin">EWERK Annotation Processor Plugin</a>. Start by adding the following to the very top of the <code>build.gradle</code> file:</p>
|
||||||
<pre class="gradle"><code>compileJava.options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated")</code></pre>
|
<pre class="gradle"><code>plugins {
|
||||||
<p>The <code>GeneratedVersion.java</code> file will now be located in <code>src/generated</code>.</p>
|
id "com.ewerk.gradle.plugins.annotation-processor" version "1.0.4"
|
||||||
<p>Please look at the <a href="blob/master/examples/java/build.gradle">build.gradle</a> file in the <a href="tree/master/example/java">Java example</a> module directory for a sample.</p>
|
}</code></pre>
|
||||||
|
<p>Then add the following to the <code>build.gradle</code> file:</p>
|
||||||
|
<pre class="gradle"><code>dependencies {
|
||||||
|
compileOnly 'net.thauvin.erik:semver:1.0.1'
|
||||||
|
}
|
||||||
|
|
||||||
|
annotationProcessor {
|
||||||
|
library 'net.thauvin.erik:semver:1.0.1'
|
||||||
|
processor 'net.thauvin.erik.semver.VersionProcessor'
|
||||||
|
// sourcesDir 'src/generated/java'
|
||||||
|
}
|
||||||
|
|
||||||
|
compileJava {
|
||||||
|
// Disable the classpath processor
|
||||||
|
options.compilerArgs << '-proc:none'
|
||||||
|
}</code></pre>
|
||||||
|
<p>The plugin implements a separate compile task that only runs the annotation processor and is executed during the build phase.</p>
|
||||||
|
<p>Please look at the <a href="https://github.com/ethauvin/semver/blob/master/example/build.gradle">build.gradle</a> file in the <a href="https://github.com/ethauvin/semver/tree/master/example">example</a> module directory for a sample.</p>
|
||||||
<h3 id="kobalt">Kobalt</h3>
|
<h3 id="kobalt">Kobalt</h3>
|
||||||
<p>To install and run from <a href="http://beust.com/kobalt/">Kobalt</a>, add the following to the <code>Build.kt</code> file:</p>
|
<p>To install and run from <a href="http://beust.com/kobalt/">Kobalt</a>, add the following to the <code>Build.kt</code> file:</p>
|
||||||
<pre class="gradle"><code>dependencies {
|
<pre class="gradle"><code>dependencies {
|
||||||
apt("net.thauvin.erik:semver:1.0.1")
|
apt("net.thauvin.erik:semver:1.0.1")
|
||||||
compileOnly("net.thauvin.erik:semver:1.0.1")
|
compileOnly("net.thauvin.erik:semver:1.0.1")
|
||||||
}</code></pre>
|
}</code></pre>
|
||||||
<p>Please look at the <a href="blob/master/examples/kotlin/kobalt/src/Build.kt">Build.kt</a> file in the <a href="tree/master/example/kotlin">Kotlin example</a> module directory for a sample.</p>
|
<p>Please look at the <a href="https://github.com/ethauvin/semver/blob/master/example/kobalt/src/Build.kt">Build.kt</a> file in the <a href="https://github.com/ethauvin/semver/tree/master/example">example</a> module directory for a sample.</p>
|
||||||
<h3 id="kotlin">Kotlin</h3>
|
<h3 id="kotlin">Kotlin</h3>
|
||||||
<p>The annotation processor also supports <a href="https://kotlinlang.org/">Kotlin</a>.</p>
|
<p>The annotation processor also supports <a href="https://kotlinlang.org/">Kotlin</a>.</p>
|
||||||
<p>To generate a Kotlin version file, simply specify the <code>type</code> as follows:</p>
|
<p>To generate a Kotlin version file, simply specify the <code>type</code> as follows:</p>
|
||||||
|
@ -386,9 +388,12 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
|
||||||
@<span class="fu">Version</span>(properties = <span class="st">"version.properties"</span>, type=<span class="st">"kt"</span>)
|
@<span class="fu">Version</span>(properties = <span class="st">"version.properties"</span>, type=<span class="st">"kt"</span>)
|
||||||
<span class="kw">open</span> <span class="kw">class</span> Main {
|
<span class="kw">open</span> <span class="kw">class</span> Main {
|
||||||
<span class="co">// ...</span></code></pre></div>
|
<span class="co">// ...</span></code></pre></div>
|
||||||
<p>The <a href="blob/master/src/main/resources/semver-kt.mustache">Kotlin default template</a> implements the same static fields and functions as the <a href="#default-template">Java template</a>.</p>
|
<p>The <a href="https://github.com/ethauvin/semver/blob/master/src/main/resources/semver-kt.mustache">Kotlin default template</a> implements the same static fields and functions as the <a href="#default-template">Java template</a>.</p>
|
||||||
<p>Please look at the <a href="tree/master/examples/Kotlin">Kotlin example</a> project for samples on using Gradle (<a href="blob/master/examples/kotlin/build.gradle.kts">build.gradle.kts</a>) and Kobalt (<a href="blob/master/examples/kotlin/kobalt/src/Build.kt">Build.kt</a>).</p>
|
<p>Please look at the <a href="https://github.com/ethauvin/semver-example-kotlin">Example for Kotlin</a> project for samples on using Gradle (<a href="https://github.com/ethauvin/semver-example-kotlin/blob/master/build.gradle">build.gradle</a>) and Kobalt (<a href="https://github.com/ethauvin/semver-example-kotlin/blob/master/kobalt/src/Build.kt">Build.kt</a>).</p>
|
||||||
<h2 id="auto-increment">Auto-Increment</h2>
|
<h3 id="auto-increment">Auto-Increment</h3>
|
||||||
<p>Incrementing the version is best left to your favorite build system. For a solution using Gradle, please have a look at the <a href="https://github.com/ethauvin/semver-gradle">Semver Version Plugin for Gradle</a>.</p>
|
<p>Incrementing the version is best left to your favorite build system.</p>
|
||||||
|
<p>For a solution using <a href="https://gradle.org/">Gradle</a>, please have a look at the <a href="https://github.com/ethauvin/semver/blob/master/example/build.gradle">build.gradle</a> file in the <a href="https://github.com/ethauvin/semver/tree/master/example">example</a> module directory. To run the example with patch version auto-incrementing, issue the following command:</p>
|
||||||
|
<pre><code>gradle release run</code></pre>
|
||||||
|
<p>For a solution using <a href="http://beust.com/kobalt/">Kobalt</a> look at my <a href="https://github.com/ethauvin/kobalt-property-file">Property File Editor</a> plug-in.</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue