Getting ready for 1.2.0 release.

This commit is contained in:
Erik C. Thauvin 2019-04-01 01:51:57 -07:00
parent 45a90d1353
commit 55d2e9e0d7
11 changed files with 156 additions and 74 deletions

View file

@ -5,6 +5,13 @@
<configuration version="3" platform="JVM 1.6" useProjectSettings="false">
<compilerSettings />
<compilerArguments>
<option name="destination" value="$MODULE_DIR$/../../examples/kotlin/build/classes/kotlin/main" />
<option name="classpath" value="$MAVEN_REPOSITORY$/net/thauvin/erik/semver/1.1.1/semver-1.1.1.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">
@ -13,6 +20,9 @@
<option name="pluginClasspaths">
<array />
</option>
<option name="errors">
<ArgumentParseErrors />
</option>
</compilerArguments>
</configuration>
</facet>

View file

@ -5,6 +5,20 @@
<configuration version="3" platform="JVM 1.6" useProjectSettings="false">
<compilerSettings />
<compilerArguments>
<option name="destination" value="$MODULE_DIR$/../../examples/kotlin/build/classes/kotlin/test" />
<option name="classpath" value="$MODULE_DIR$/../../examples/kotlin/build/classes/java/main;K:/java/semver/examples/kotlin/build/classes/kotlin/main;K:/java/semver/examples/kotlin/build/tmp/kapt3/classes/main;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$/../../examples/kotlin/build/tmp/kapt3/classes/main" />
<option value="$MODULE_DIR$/../../examples/kotlin/build/classes/java/main" />
<option value="$MODULE_DIR$/../../examples/kotlin/build/classes/kotlin/main" />
</array>
</option>
<option name="languageVersion" value="1.3" />
<option name="apiVersion" value="1.3" />
<option name="pluginOptions">
@ -13,6 +27,9 @@
<option name="pluginClasspaths">
<array />
</option>
<option name="errors">
<ArgumentParseErrors />
</option>
</compilerArguments>
</configuration>
</facet>

View file

@ -58,7 +58,7 @@ public class A {
The [default template](https://github.com/ethauvin/semver/blob/master/src/main/resources/semver.mustache ) implements the following static fields:
Field | Description | Example
:--------------|:---------------------------------|:-----------------
:------------------|:---------------------------------|:-----------------
`PROJECT` | The project name, if any. | `MyProject`
`BUILDDATE` | The build date. | [`java.util.Date`](https://docs.oracle.com/javase/8/docs/api/java/util/Date.html)
`VERSION` | The full version string. | `1.2.3-alpha+001`
@ -66,7 +66,10 @@ Field | Description | Example
`MINOR` | The minor version. | `2`
`PATCH` | The patch version. | `3`
`PRERELEASE` | The pre-release version, if any. | `alpha`
`PRERELASE_PREFIX` | The pre-release prefix | `-`
`BUILDMETA` | The build metadata, if any. | `001`
`BUILDMETA_PREFIX` | The metadata prefix. | `+`
`SEPARATOR` | The version separator. | `.`
And the following methods/functions:
@ -98,7 +101,7 @@ public final class {{className}} {
The mustache variables automatically filled in by the processor are:
Variable | Description | Type
:-----------------|:----------------------------|:--------
:----------------------|:----------------------------|:--------
`{{packageName}}` | The package name. | `String`
`{{className}}` | The class name. | `String`
`{{project}}` | The project name. | `String`
@ -106,8 +109,11 @@ Variable | Description | Type
`{{major}}` | The major version. | `int`
`{{minor}}` | The minor version. | `int`
`{{patch}}` | The patch version. | `int`
`{{preRelease}}` | The pre/release version. | `String`
`{{preRelease}}` | The pre-release version. | `String`
`{{preReleasePrefix}}` | The pre-release prefix. | `String`
`{{buildMeta}}` | The build metadata version. | `String`
`{{buildMetaPrefix}}` | The metadata prefix. | `String`
`{{separator}}` | The version separator. | `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)
@ -116,13 +122,16 @@ Please also look at this [example](https://github.com/ethauvin/mobibot/blob/mast
The following annotation elements and properties are available:
Element | Property | Description | Default
:-------------|:---------------------|:----------------------------------|:-------------------------
:------------------|:----------------------------|:----------------------------------|:-------------------------
`project` | `version.project` | The project name. |
`major` | `version.major` | The major version number. | `1`
`minor` | `version.major` | The minor version number. | `0`
`patch` | `version.patch` | The patch version number. | `0`
`preRelease` | `version.prerelease` | The pre-release version. |
`preReleasePrefix` | `version.prerelease.prefix` | The pre-release prefix. | `-`
`buildMeta` | `version.buildmeta` | The build metadata version. |
`buildMetaPrefix` | `version.buildmeta.prefix` | The metadata prefix. | `+`
`separator` | `version.separator` | The version separator. | `.`
`packageName` | | The package name. | _Same as annotated class_
`className` | | The name of the generated class. | `GeneratedVersion`
`properties` | | The properties file. |
@ -171,7 +180,7 @@ To install and run from [Maven](https://maven.apache.org/), configure an artifac
<dependency>
<groupId>net.thauvin.erik</groupId>
<artifactId>semver</artifactId>
<version>1.1.1</version>
<version>1.2.0</version>
</dependency>
```
@ -183,8 +192,8 @@ To install and run from [Gradle](https://gradle.org/), add the following to the
```gradle
dependencies {
annotationProcessor 'net.thauvin.erik:semver:1.1.1'
compileOnly 'net.thauvin.erik:semver:1.1.1'
annotationProcessor 'net.thauvin.erik:semver:1.2.0'
compileOnly 'net.thauvin.erik:semver:1.2.0'
}
```
@ -208,8 +217,8 @@ To install and run from [Kobalt](https://beust.com/kobalt/), add the following t
```gradle
dependencies {
apt("net.thauvin.erik:semver:1.1.1")
compileOnly("net.thauvin.erik:semver:1.1.1")
apt("net.thauvin.erik:semver:1.2.0")
compileOnly("net.thauvin.erik:semver:1.2.0")
}
```

View file

@ -162,10 +162,25 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
<td style="text-align: left;"><code>alpha</code></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>PRERELASE_PREFIX</code></td>
<td style="text-align: left;">The pre-release prefix</td>
<td style="text-align: left;"><code>-</code></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>BUILDMETA</code></td>
<td style="text-align: left;">The build metadata, if any.</td>
<td style="text-align: left;"><code>001</code></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>BUILDMETA_PREFIX</code></td>
<td style="text-align: left;">The metadata prefix.</td>
<td style="text-align: left;"><code>+</code></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>SEPARATOR</code></td>
<td style="text-align: left;">The version separator.</td>
<td style="text-align: left;"><code>.</code></td>
</tr>
</tbody>
</table>
<p>And the following methods/functions:</p>
@ -253,14 +268,29 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
</tr>
<tr class="even">
<td style="text-align: left;"><code>{{preRelease}}</code></td>
<td style="text-align: left;">The pre/release version.</td>
<td style="text-align: left;">The pre-release version.</td>
<td style="text-align: left;"><code>String</code></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>{{preReleasePrefix}}</code></td>
<td style="text-align: left;">The pre-release prefix.</td>
<td style="text-align: left;"><code>String</code></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>{{buildMeta}}</code></td>
<td style="text-align: left;">The build metadata version.</td>
<td style="text-align: left;"><code>String</code></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>{{buildMetaPrefix}}</code></td>
<td style="text-align: left;">The metadata prefix.</td>
<td style="text-align: left;"><code>String</code></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>{{separator}}</code></td>
<td style="text-align: left;">The version separator.</td>
<td style="text-align: left;"><code>String</code></td>
</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>
@ -307,42 +337,60 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
<td style="text-align: left;"></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>preReleasePrefix</code></td>
<td style="text-align: left;"><code>version.prerelease.prefix</code></td>
<td style="text-align: left;">The pre-release prefix.</td>
<td style="text-align: left;"><code>-</code></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>buildMeta</code></td>
<td style="text-align: left;"><code>version.buildmeta</code></td>
<td style="text-align: left;">The build metadata version.</td>
<td style="text-align: left;"></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>buildMetaPrefix</code></td>
<td style="text-align: left;"><code>version.buildmeta.prefix</code></td>
<td style="text-align: left;">The metadata prefix.</td>
<td style="text-align: left;"><code>+</code></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>separator</code></td>
<td style="text-align: left;"><code>version.separator</code></td>
<td style="text-align: left;">The version separator.</td>
<td style="text-align: left;"><code>.</code></td>
</tr>
<tr class="even">
<td style="text-align: left;"><code>packageName</code></td>
<td style="text-align: left;"></td>
<td style="text-align: left;">The package name.</td>
<td style="text-align: left;"><em>Same as annotated class</em></td>
</tr>
<tr class="even">
<tr class="odd">
<td style="text-align: left;"><code>className</code></td>
<td style="text-align: left;"></td>
<td style="text-align: left;">The name of the generated class.</td>
<td style="text-align: left;"><code>GeneratedVersion</code></td>
</tr>
<tr class="odd">
<tr class="even">
<td style="text-align: left;"><code>properties</code></td>
<td style="text-align: left;"></td>
<td style="text-align: left;">The properties file.</td>
<td style="text-align: left;"></td>
</tr>
<tr class="even">
<tr class="odd">
<td style="text-align: left;"><code>template</code></td>
<td style="text-align: left;"></td>
<td style="text-align: left;">The template file.</td>
<td style="text-align: left;"><code>version.mustache</code></td>
</tr>
<tr class="odd">
<tr class="even">
<td style="text-align: left;"><code>type</code></td>
<td style="text-align: left;"></td>
<td style="text-align: left;">Either <code>java</code> or <code>kt</code> for Kotlin.</td>
<td style="text-align: left;"><code>java</code></td>
</tr>
<tr class="even">
<tr class="odd">
<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>
@ -381,14 +429,14 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
<div class="sourceCode" id="cb8"><pre class="sourceCode xml"><code class="sourceCode xml"><a class="sourceLine" id="cb8-1" title="1"><span class="kw">&lt;dependency&gt;</span></a>
<a class="sourceLine" id="cb8-2" title="2"> <span class="kw">&lt;groupId&gt;</span>net.thauvin.erik<span class="kw">&lt;/groupId&gt;</span></a>
<a class="sourceLine" id="cb8-3" title="3"> <span class="kw">&lt;artifactId&gt;</span>semver<span class="kw">&lt;/artifactId&gt;</span></a>
<a class="sourceLine" id="cb8-4" title="4"> <span class="kw">&lt;version&gt;</span>1.1.1<span class="kw">&lt;/version&gt;</span></a>
<a class="sourceLine" id="cb8-4" title="4"> <span class="kw">&lt;version&gt;</span>1.2.0<span class="kw">&lt;/version&gt;</span></a>
<a class="sourceLine" id="cb8-5" title="5"><span class="kw">&lt;/dependency&gt;</span></a></code></pre></div>
<h3 id="gradle">Gradle</h3>
<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>
<pre class="gradle"><code>dependencies {
annotationProcessor &#39;net.thauvin.erik:semver:1.1.1&#39;
compileOnly &#39;net.thauvin.erik:semver:1.1.1&#39;
annotationProcessor &#39;net.thauvin.erik:semver:1.2.0&#39;
compileOnly &#39;net.thauvin.erik:semver:1.2.0&#39;
}
</code></pre>
<p>The <code>GeneratedVersion</code> class will be automatically created in the <code>build/generated</code> directory upon compiling.</p>
@ -401,8 +449,8 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
<h3 id="kobalt">Kobalt</h3>
<p>To install and run from <a href="https://beust.com/kobalt/">Kobalt</a>, add the following to the <code>Build.kt</code> file:</p>
<pre class="gradle"><code>dependencies {
apt(&quot;net.thauvin.erik:semver:1.1.1&quot;)
compileOnly(&quot;net.thauvin.erik:semver:1.1.1&quot;)
apt(&quot;net.thauvin.erik:semver:1.2.0&quot;)
compileOnly(&quot;net.thauvin.erik:semver:1.2.0&quot;)
}
</code></pre>
<p>Please look at the <a href="https://github.com/ethauvin/semver/blob/master/examples/java/kobalt/src/Build.kt">Build.kt</a> file in the <a href="https://github.com/ethauvin/semver/tree/master/examples/java">Java example</a> module directory for a sample.</p>

View file

@ -5,7 +5,7 @@ apply plugin: 'application'
defaultTasks 'run'
def semverProcessor = 'net.thauvin.erik:semver:1.1.1'
def semverProcessor = 'net.thauvin.erik:semver:1.2.0'
sourceCompatibility = 1.8
targetCompatibility = 1.8

View file

@ -12,23 +12,23 @@ import java.util.Date;
* @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a>
*/
public final class GeneratedVersion {
public final static String PRERELEASE_PREFIX = "-";
public final static String BUILDMETA_PREFIX = "+";
public final static String PROJECT = "Example";
public final static Date BUILDDATE = new Date(1554009013319L);
public final static Date BUILDDATE = new Date(1554108013631L);
public final static int MAJOR = 2;
public final static int MINOR = 17;
public final static int MINOR = 0;
public final static int PATCH = 52;
public final static String PRERELEASE = "beta";
public final static String PRERELEASE_PREFIX = "-";
public final static String BUILDMETA = "007";
public final static String BUILDMETA_PREFIX = "+";
public final static String SEPARATOR = "";
/**
* The full version string.
* <p>
* Formatted as:
* <blockquote>
* <code>MAJOR.MINOR.PATCH[-PRERELEASE][+BUILDMETADATA]</code>
* <code>[MAJOR][SEPARATOR][MINOR][SEPARATOR][PATCH][[PRERELEASE_PREFIX][PRERELEASE]][[BUILDMETA_PREFIX][BUILDMETA]]</code>
* </blockquote>
* <p>
* For example:
@ -39,10 +39,8 @@ public final class GeneratedVersion {
* <li><code>1.0.0-alpha+001</code></li>
* </ul>
*/
public final static String VERSION = Integer.toString(MAJOR) + '.'
+ Integer.toString(MINOR) + '.'
+ Integer.toString(PATCH)
+ preReleaseWithPrefix() + buildMetaWithPrefix();
public final static String VERSION = Integer.toString(MAJOR) + SEPARATOR + Integer.toString(MINOR) + SEPARATOR
+ Integer.toString(PATCH) + preReleaseWithPrefix() + buildMetaWithPrefix();
/**
* Disables the default constructor.
@ -70,7 +68,7 @@ public final class GeneratedVersion {
* @return The build metadata, if any.
*/
public static String buildMetaWithPrefix(final String prefix) {
if (BUILDMETA.length() > 0 && prefix.length() > 0) {
if (BUILDMETA.length() > 0) {
return prefix + BUILDMETA;
} else {
return BUILDMETA;
@ -93,7 +91,7 @@ public final class GeneratedVersion {
* @return The pre-release version, if any.
*/
public static String preReleaseWithPrefix(final String prefix) {
if (PRERELEASE.length() > 0 && prefix.length() > 0) {
if (PRERELEASE.length() > 0) {
return prefix + PRERELEASE;
} else {
return PRERELEASE;

View file

@ -2,7 +2,7 @@
#Sat Mar 30 15:48:08 PDT 2019
version.buildmeta=007
version.major=2
version.minor=17
version.minor=0
version.patch=52
version.prerelease=beta
version.project=Example

View file

@ -6,7 +6,7 @@
<compilerSettings />
<compilerArguments>
<option name="destination" value="$MODULE_DIR$/../../build/classes/kotlin/main" />
<option name="classpath" value="$MAVEN_REPOSITORY$/net/thauvin/erik/semver/1.1.1/semver-1.1.1.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="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" />
@ -52,7 +52,7 @@
</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.1.1" 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>

View file

@ -10,7 +10,7 @@ plugins {
defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
var semverProcessor = "net.thauvin.erik:semver:1.1.1"
var semverProcessor = "net.thauvin.erik:semver:1.2.0"
dependencies {
kapt(semverProcessor)

View file

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.thauvin.erik</groupId>
<artifactId>semver</artifactId>
<version>1.1.1</version>
<version>1.2.0</version>
<name>semver</name>
<description>Semantic Version Annotation Processor</description>
<url>https://github.com/ethauvin/semver</url>

View file

@ -2,6 +2,6 @@
#Sat Mar 30 18:10:32 PDT 2019
version.buildmeta=
version.major=1
version.minor=1
version.patch=1
version.minor=2
version.patch=0
version.prerelease=