Updated gradle build files with new syntax, etc.

This commit is contained in:
Erik C. Thauvin 2017-03-24 16:23:14 -07:00
parent 5562a693a9
commit 3001a4f8f0
5 changed files with 34 additions and 30 deletions

View file

@ -217,7 +217,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
</table>
<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>(
properties = <span class="st">&quot;example.properties&quot;</span>,
properties = <span class="st">&quot;example.properties&quot;</span>,
majorKey = <span class="st">&quot;example.major&quot;</span>,
minorKey = <span class="st">&quot;example.minor&quot;</span>,
patchKey = <span class="st">&quot;example.patch&quot;</span>,
@ -239,27 +239,27 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
<div class="sourceCode"><pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw">&lt;dependency&gt;</span>
<span class="kw">&lt;groupId&gt;</span>net.thauvin.erik<span class="kw">&lt;/groupId&gt;</span>
<span class="kw">&lt;artifactId&gt;</span>semver<span class="kw">&lt;/artifactId&gt;</span>
<span class="kw">&lt;version&gt;</span>0.9.7<span class="kw">&lt;/version&gt;</span>
<span class="kw">&lt;version&gt;</span>0.9.6-beta<span class="kw">&lt;/version&gt;</span>
<span class="kw">&lt;/dependency&gt;</span></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 {
compile &#39;net.thauvin.erik:semver:0.9.7&#39;
compile &#39;net.thauvin.erik:semver:0.9.6-beta&#39;
}</code></pre>
<p>The <code>GeneratedVersion</code> class will be automatically created in the <code>build</code> directory upon compiling.</p>
<h4 id="class-source-generation">Class &amp; Source Generation</h4>
<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/plugins/annotation-processor-plugin">EWERK Annotation Processor Plugin</a>. Start by addding the following to the very top of the <code>build.gradle</code> file:</p>
<pre class="gradle"><code>plugins {
id &quot;com.ewerk.gradle.plugins.annotation-processor&quot; version &quot;1.0.2&quot;
id &quot;com.ewerk.gradle.plugins.annotation-processor&quot; version &quot;1.0.3&quot;
}</code></pre>
<p>Then add the following to the <code>build.gradle</code> file:</p>
<pre class="gradle"><code>dependencies {
compileOnly &#39;net.thauvin.erik:semver:0.9.7&#39;
compileOnly &#39;net.thauvin.erik:semver:0.9.6-beta&#39;
}
annotationProcessor {
library &#39;net.thauvin.erik:semver:0.9.7&#39;
library &#39;net.thauvin.erik:semver:0.9.6-beta&#39;
processor &#39;net.thauvin.erik.semver.VersionProcessor&#39;
// sourcesDir &#39;src/generated/java&#39;
}
@ -273,8 +273,8 @@ compileJava {
<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>
<pre class="gradle"><code>dependencies {
apt(&quot;net.thauvin.erik:semver:0.9.7&quot;)
compile(&quot;net.thauvin.erik:semver:0.9.7&quot;)
apt(&quot;net.thauvin.erik:semver:0.9.6-beta&quot;)
compile(&quot;net.thauvin.erik:semver:0.9.6-beta&quot;)
}</code></pre>
<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="auto-increment">Auto-Increment</h3>

View file

@ -7,7 +7,7 @@ An [annotation processor](https://docs.oracle.com/javase/8/docs/api/javax/annota
This processor was inspired by Cédric Beust's [version-processor](https://github.com/cbeust/version-processor).
## Examples
* Using annotation elements:
```java
@ -80,7 +80,7 @@ public final class ${className} {
The Velocity variables are automatically filled in by the processor.
Please also look at this [example](https://github.com/ethauvin/mobibot/blob/master/version.vm) 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:
@ -101,7 +101,7 @@ In order to easily incorporate with existing projects, the property keys may be
```java
@Version(
properties = "example.properties",
properties = "example.properties",
majorKey = "example.major",
minorKey = "example.minor",
patchKey = "example.patch",
@ -131,7 +131,7 @@ To install and run from [Maven](http://maven.apache.org/), configure an artifact
<dependency>
<groupId>net.thauvin.erik</groupId>
<artifactId>semver</artifactId>
<version>0.9.7</version>
<version>0.9.6-beta</version>
</dependency>
```
@ -143,7 +143,7 @@ To install and run from [Gradle](https://gradle.org/), add the following to the
```gradle
dependencies {
compile 'net.thauvin.erik:semver:0.9.7'
compile 'net.thauvin.erik:semver:0.9.6-beta'
}
```
@ -155,7 +155,7 @@ In order to also incorporate the generated source code into the `source tree`, u
```gradle
plugins {
id "com.ewerk.gradle.plugins.annotation-processor" version "1.0.2"
id "com.ewerk.gradle.plugins.annotation-processor" version "1.0.3"
}
```
@ -163,11 +163,11 @@ Then add the following to the `build.gradle` file:
```gradle
dependencies {
compileOnly 'net.thauvin.erik:semver:0.9.7'
compileOnly 'net.thauvin.erik:semver:0.9.6-beta'
}
annotationProcessor {
library 'net.thauvin.erik:semver:0.9.7'
library 'net.thauvin.erik:semver:0.9.6-beta'
processor 'net.thauvin.erik.semver.VersionProcessor'
// sourcesDir 'src/generated/java'
}
@ -188,8 +188,8 @@ To install and run from [Kobalt](http://beust.com/kobalt/), add the following to
```gradle
dependencies {
apt("net.thauvin.erik:semver:0.9.7")
compile("net.thauvin.erik:semver:0.9.7")
apt("net.thauvin.erik:semver:0.9.6-beta")
compile("net.thauvin.erik:semver:0.9.6-beta")
}
```

View file

@ -193,10 +193,12 @@ task wrapper(type: Wrapper) {
gradleVersion = gradle.gradleVersion
}
task release(dependsOn: ['wrapper', 'clean', 'deploy']) << {
group = 'Publishing'
description = 'Releases new version.'
isRelease = true
task release(dependsOn: ['wrapper', 'clean', 'deploy']) {
doLast {
group = 'Publishing'
description = 'Releases new version.'
isRelease = true
}
}
task pandoc(type: Exec) {

View file

@ -1,5 +1,5 @@
plugins {
id "com.ewerk.gradle.plugins.annotation-processor" version "1.0.2"
id "com.ewerk.gradle.plugins.annotation-processor" version "1.0.3"
}
apply plugin: 'java'
apply plugin: 'idea'
@ -45,13 +45,13 @@ repositories {
}
dependencies {
compileOnly 'net.thauvin.erik:semver:0.9.7'
compileOnly 'net.thauvin.erik:semver:+'
}
annotationProcessor {
// Update version, increment on release.
project.version = getVersion(isRelease)
library 'net.thauvin.erik:semver:0.9.7'
library 'net.thauvin.erik:semver:+'
processor 'net.thauvin.erik.semver.VersionProcessor'
// sourcesDir 'src/generated/java'
}
@ -81,10 +81,12 @@ task deploy(dependsOn: ['build', 'copyToDeploy']) {
mustRunAfter clean
}
task release(dependsOn: ['wrapper', 'clean', 'deploy']) << {
group = 'Publishing'
description = 'Releases new version.'
isRelease = true
task release(dependsOn: ['wrapper', 'clean', 'deploy']) {
doLast {
group = 'Publishing'
description = 'Releases new version.'
isRelease = true
}
}
task wrapper(type: Wrapper) {

View file

@ -14,7 +14,7 @@ import java.util.Date;
*/
public final class GeneratedVersion {
private final static String buildmeta = "";
private final static Date date = new Date(1468888435317L);
private final static Date date = new Date(1490396459441L);
private final static int major = 3;
private final static int minor = 1;
private final static int patch = 49;