Reworked default velocity template.
Improved example kobalt build.
This commit is contained in:
parent
b763de695c
commit
62fe418522
18 changed files with 389 additions and 268 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -7,6 +7,7 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.classpath
|
.classpath
|
||||||
.gradle
|
.gradle
|
||||||
|
.kobalt
|
||||||
.nb-gradle
|
.nb-gradle
|
||||||
.project
|
.project
|
||||||
.settings
|
.settings
|
||||||
|
|
4
.idea/modules/example.iml
generated
4
.idea/modules/example.iml
generated
|
@ -16,9 +16,9 @@
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Gradle: net.thauvin.erik:semver:0.9.5-beta" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Gradle: commons-lang:commons-lang:2.4" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Gradle: commons-lang:commons-lang:2.4" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Gradle: commons-collections:commons-collections:3.2.1" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Gradle: net.thauvin.erik:semver:0.9.6-beta" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Gradle: org.apache.velocity:velocity:1.7" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Gradle: org.apache.velocity:velocity:1.7" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Gradle: commons-collections:commons-collections:3.2.1" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
14
.idea/modules/semver.iml
generated
14
.idea/modules/semver.iml
generated
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module external.linked.project.id="semver" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.version="0.9.5-beta" type="JAVA_MODULE" version="4">
|
<module external.linked.project.id="semver" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.version="0.9.6-beta" type="JAVA_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||||
<output url="file://$MODULE_DIR$/../../build/classes/main" />
|
<output url="file://$MODULE_DIR$/../../build/classes/main" />
|
||||||
<output-test url="file://$MODULE_DIR$/../../build/classes/test" />
|
<output-test url="file://$MODULE_DIR$/../../build/classes/test" />
|
||||||
|
@ -15,12 +15,12 @@
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" name="Gradle: org.apache.velocity:velocity:1.7" level="project" />
|
<orderEntry type="library" name="Gradle: org.apache.velocity:velocity:1.7" level="project" />
|
||||||
<orderEntry type="library" scope="TEST" name="Gradle: org.apache.ant:ant-launcher:1.7.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="Gradle: org.apache.ant:ant:1.7.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="Gradle: com.beust:jcommander:1.48" level="project" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="Gradle: org.beanshell:bsh:2.0b4" level="project" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="Gradle: org.testng:testng:6.9.12" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: commons-lang:commons-lang:2.4" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: commons-collections:commons-collections:3.2.1" level="project" />
|
<orderEntry type="library" name="Gradle: commons-collections:commons-collections:3.2.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Gradle: commons-lang:commons-lang:2.4" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Gradle: org.testng:testng:6.9.12" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Gradle: org.beanshell:bsh:2.0b4" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Gradle: com.beust:jcommander:1.48" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Gradle: org.apache.ant:ant:1.7.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Gradle: org.apache.ant:ant-launcher:1.7.0" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
|
@ -1 +0,0 @@
|
||||||
2016-07-07T05:15:22.444Z
|
|
14
README.html
14
README.html
|
@ -238,13 +238,13 @@ 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"><dependency></span>
|
<div class="sourceCode"><pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><dependency></span>
|
||||||
<span class="kw"><groupId></span>net.thauvin.erik<span class="kw"></groupId></span>
|
<span class="kw"><groupId></span>net.thauvin.erik<span class="kw"></groupId></span>
|
||||||
<span class="kw"><artifactId></span>semver<span class="kw"></artifactId></span>
|
<span class="kw"><artifactId></span>semver<span class="kw"></artifactId></span>
|
||||||
<span class="kw"><version></span>0.9.5-beta<span class="kw"></version></span>
|
<span class="kw"><version></span>0.9.6-beta<span class="kw"></version></span>
|
||||||
<span class="kw"></dependency></span></code></pre></div>
|
<span class="kw"></dependency></span></code></pre></div>
|
||||||
<h3 id="gradle">Gradle</h3>
|
<h3 id="gradle">Gradle</h3>
|
||||||
<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 {
|
||||||
compile 'net.thauvin.erik:semver:0.9.5-beta'
|
compile 'net.thauvin.erik:semver:0.9.6-beta'
|
||||||
}</code></pre>
|
}</code></pre>
|
||||||
<p>The <code>GeneratedVersion</code> class will be automatically created in the <code>build</code> directory upon compiling.</p>
|
<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 & Source Generation</h4>
|
<h4 id="class-source-generation">Class & Source Generation</h4>
|
||||||
|
@ -254,11 +254,11 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
|
||||||
}</code></pre>
|
}</code></pre>
|
||||||
<p>Then add the following to the <code>build.gradle</code> file:</p>
|
<p>Then add the following to the <code>build.gradle</code> file:</p>
|
||||||
<pre class="gradle"><code>dependencies {
|
<pre class="gradle"><code>dependencies {
|
||||||
compileOnly 'net.thauvin.erik:semver:0.9.5-beta'
|
compileOnly 'net.thauvin.erik:semver:0.9.6-beta'
|
||||||
}
|
}
|
||||||
|
|
||||||
annotationProcessor {
|
annotationProcessor {
|
||||||
library 'net.thauvin.erik:semver:0.9.5-beta'
|
library 'net.thauvin.erik:semver:0.9.6-beta'
|
||||||
processor 'net.thauvin.erik.semver.VersionProcessor'
|
processor 'net.thauvin.erik.semver.VersionProcessor'
|
||||||
// sourcesDir 'src/generated/java'
|
// sourcesDir 'src/generated/java'
|
||||||
}
|
}
|
||||||
|
@ -272,13 +272,13 @@ compileJava {
|
||||||
<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:0.9.5-beta")
|
apt("net.thauvin.erik:semver:0.9.6-beta")
|
||||||
compile("net.thauvin.erik:semver:0.9.5-beta")
|
compile("net.thauvin.erik:semver:0.9.6-beta")
|
||||||
}</code></pre>
|
}</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>
|
<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>
|
<h3 id="auto-increment">Auto-Increment</h3>
|
||||||
<p>Incrementing the version is best left to your favorite build system.</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>
|
<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 clean release run</code></pre>
|
<pre><code>gradle release run</code></pre>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
14
README.md
14
README.md
|
@ -129,7 +129,7 @@ To install and run from [Maven](http://maven.apache.org/), configure an artifact
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.thauvin.erik</groupId>
|
<groupId>net.thauvin.erik</groupId>
|
||||||
<artifactId>semver</artifactId>
|
<artifactId>semver</artifactId>
|
||||||
<version>0.9.5-beta</version>
|
<version>0.9.6-beta</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ To install and run from [Gradle](https://gradle.org/), add the following to the
|
||||||
|
|
||||||
```gradle
|
```gradle
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'net.thauvin.erik:semver:0.9.5-beta'
|
compile 'net.thauvin.erik:semver:0.9.6-beta'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -161,11 +161,11 @@ Then add the following to the `build.gradle` file:
|
||||||
|
|
||||||
```gradle
|
```gradle
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly 'net.thauvin.erik:semver:0.9.5-beta'
|
compileOnly 'net.thauvin.erik:semver:0.9.6-beta'
|
||||||
}
|
}
|
||||||
|
|
||||||
annotationProcessor {
|
annotationProcessor {
|
||||||
library 'net.thauvin.erik:semver:0.9.5-beta'
|
library 'net.thauvin.erik:semver:0.9.6-beta'
|
||||||
processor 'net.thauvin.erik.semver.VersionProcessor'
|
processor 'net.thauvin.erik.semver.VersionProcessor'
|
||||||
// sourcesDir 'src/generated/java'
|
// sourcesDir 'src/generated/java'
|
||||||
}
|
}
|
||||||
|
@ -186,8 +186,8 @@ To install and run from [Kobalt](http://beust.com/kobalt/), add the following to
|
||||||
|
|
||||||
```gradle
|
```gradle
|
||||||
dependencies {
|
dependencies {
|
||||||
apt("net.thauvin.erik:semver:0.9.5-beta")
|
apt("net.thauvin.erik:semver:0.9.6-beta")
|
||||||
compile("net.thauvin.erik:semver:0.9.5-beta")
|
compile("net.thauvin.erik:semver:0.9.6-beta")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -200,5 +200,5 @@ Incrementing the version is best left to your favorite build system.
|
||||||
For a solution using [Gradle](https://gradle.org/), please have a 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. To run the example with patch version auto-incrementing, issue the following command:
|
For a solution using [Gradle](https://gradle.org/), please have a 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. To run the example with patch version auto-incrementing, issue the following command:
|
||||||
|
|
||||||
```
|
```
|
||||||
gradle clean release run
|
gradle release run
|
||||||
```
|
```
|
270
build.gradle
270
build.gradle
|
@ -1,5 +1,5 @@
|
||||||
plugins {
|
plugins {
|
||||||
id "com.jfrog.bintray" version "1.5"
|
id "com.jfrog.bintray" version "1.5"
|
||||||
}
|
}
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'idea'
|
apply plugin: 'idea'
|
||||||
|
@ -10,27 +10,29 @@ import org.apache.tools.ant.taskdefs.condition.Os
|
||||||
|
|
||||||
defaultTasks 'deploy'
|
defaultTasks 'deploy'
|
||||||
|
|
||||||
def getVersion(isIncrement = false) {
|
def getVersion(isIncrement = false)
|
||||||
def propsFile = 'version.properties'
|
{
|
||||||
def majorKey = 'version.major'
|
def propsFile = 'version.properties'
|
||||||
def minorKey = 'version.minor'
|
def majorKey = 'version.major'
|
||||||
def patchKey = 'version.patch'
|
def minorKey = 'version.minor'
|
||||||
def metaKey = 'version.buildmeta'
|
def patchKey = 'version.patch'
|
||||||
def preKey = 'version.prerelease'
|
def metaKey = 'version.buildmeta'
|
||||||
if (isIncrement) {
|
def preKey = 'version.prerelease'
|
||||||
ant.propertyfile(file: propsFile) {
|
if (isIncrement)
|
||||||
entry(key: patchKey,
|
{
|
||||||
type: 'int',
|
ant.propertyfile(file: propsFile) {
|
||||||
default: '-1',
|
entry(key: patchKey,
|
||||||
operation: '+')
|
type: 'int',
|
||||||
}
|
default: '-1',
|
||||||
}
|
operation: '+')
|
||||||
def p = new Properties()
|
}
|
||||||
file(propsFile).withInputStream { stream -> p.load(stream) }
|
}
|
||||||
def metadata = p.getProperty(metaKey, '')
|
def p = new Properties()
|
||||||
def prerelease = p.getProperty(preKey, '')
|
file(propsFile).withInputStream { stream -> p.load(stream) }
|
||||||
return (p.getProperty(majorKey, '1') + '.' + p.getProperty(minorKey, '0') + '.' + p.getProperty(patchKey, '0') +
|
def metadata = p.getProperty(metaKey, '')
|
||||||
(prerelease.length() > 0 ? '-' + prerelease : '') + (metadata.length() > 0 ? '+' + metadata : ''))
|
def prerelease = p.getProperty(preKey, '')
|
||||||
|
return (p.getProperty(majorKey, '1') + '.' + p.getProperty(minorKey, '0') + '.' + p.getProperty(patchKey, '0') +
|
||||||
|
(prerelease.length() > 0 ? '-' + prerelease : '') + (metadata.length() > 0 ? '+' + metadata : ''))
|
||||||
}
|
}
|
||||||
|
|
||||||
version = getVersion()
|
version = getVersion()
|
||||||
|
@ -54,164 +56,168 @@ def pkgLabels = ['java', 'annotation', 'processor', 'semantic', 'version']
|
||||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'org.apache.velocity:velocity:1.7'
|
compile 'org.apache.velocity:velocity:1.7'
|
||||||
testCompile 'org.testng:testng:6.9.12'
|
testCompile 'org.testng:testng:6.9.12'
|
||||||
}
|
}
|
||||||
|
|
||||||
bintray {
|
bintray {
|
||||||
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
|
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
|
||||||
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
|
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
|
||||||
publications = ['MyPublication']
|
publications = ['MyPublication']
|
||||||
dryRun = true
|
dryRun = true
|
||||||
pkg {
|
pkg {
|
||||||
repo = 'maven'
|
repo = 'maven'
|
||||||
name = mavenName
|
name = mavenName
|
||||||
licenses = pkgLicenses
|
licenses = pkgLicenses
|
||||||
desc = mavenDescription
|
desc = mavenDescription
|
||||||
websiteUrl = mavenUrl
|
websiteUrl = mavenUrl
|
||||||
issueTrackerUrl = pkgIssueTrackerUrl
|
issueTrackerUrl = pkgIssueTrackerUrl
|
||||||
vcsUrl = mavenScmCon
|
vcsUrl = mavenScmCon
|
||||||
labels = pkgLabels
|
labels = pkgLabels
|
||||||
publicDownloadNumbers = true
|
publicDownloadNumbers = true
|
||||||
version {
|
version {
|
||||||
name = project.version
|
name = project.version
|
||||||
desc = 'Version ' + project.version
|
desc = 'Version ' + project.version
|
||||||
vcsTag = project.version
|
vcsTag = project.version
|
||||||
gpg {
|
gpg {
|
||||||
sign = true
|
sign = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def pomConfig = {
|
def pomConfig = {
|
||||||
licenses {
|
licenses {
|
||||||
license {
|
license {
|
||||||
name mavenLicense
|
name mavenLicense
|
||||||
url mavenLicenseUrl
|
url mavenLicenseUrl
|
||||||
distribution 'repo'
|
distribution 'repo'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
developers {
|
developers {
|
||||||
developer {
|
developer {
|
||||||
id 'ethauvin'
|
id 'ethauvin'
|
||||||
name 'Erik C. Thauvin'
|
name 'Erik C. Thauvin'
|
||||||
email 'erik@thauvin.net'
|
email 'erik@thauvin.net'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scm {
|
scm {
|
||||||
connection 'scm:git:' + mavenScmCon
|
connection 'scm:git:' + mavenScmCon
|
||||||
developerConnection 'scm:git:' + mavenScmDevCon
|
developerConnection 'scm:git:' + mavenScmDevCon
|
||||||
url mavenScmCon
|
url mavenScmCon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
MyPublication(MavenPublication) {
|
MyPublication(MavenPublication) {
|
||||||
from components.java
|
from components.java
|
||||||
artifact sourcesJar
|
artifact sourcesJar
|
||||||
artifact javadocJar
|
artifact javadocJar
|
||||||
groupId mavenGroupId
|
groupId mavenGroupId
|
||||||
artifactId rootProject.name
|
artifactId rootProject.name
|
||||||
version project.version
|
version project.version
|
||||||
|
|
||||||
pom.withXml {
|
pom.withXml {
|
||||||
def root = asNode()
|
def root = asNode()
|
||||||
root.appendNode('name', mavenName)
|
root.appendNode('name', mavenName)
|
||||||
root.appendNode('description', mavenDescription)
|
root.appendNode('description', mavenDescription)
|
||||||
root.appendNode('url', mavenUrl)
|
root.appendNode('url', mavenUrl)
|
||||||
root.children().last() + pomConfig
|
root.children().last() + pomConfig
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||||
group = 'Build'
|
group = 'Build'
|
||||||
description = 'Builds an archive of the javadoc docs.'
|
description = 'Builds an archive of the javadoc docs.'
|
||||||
classifier = 'javadoc'
|
classifier = 'javadoc'
|
||||||
from javadoc.destinationDir
|
from javadoc.destinationDir
|
||||||
}
|
}
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
task sourcesJar(type: Jar) {
|
||||||
group = 'Build'
|
group = 'Build'
|
||||||
description = 'Builds an archive of the source code.'
|
description = 'Builds an archive of the source code.'
|
||||||
classifier = 'sources'
|
classifier = 'sources'
|
||||||
from sourceSets.main.allSource
|
from sourceSets.main.allSource
|
||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
archives javadocJar
|
archives javadocJar
|
||||||
archives sourcesJar
|
archives sourcesJar
|
||||||
}
|
}
|
||||||
|
|
||||||
javadoc {
|
javadoc {
|
||||||
title = mavenDescription + ' ' + version
|
title = mavenDescription + ' ' + version
|
||||||
options.tags = ['created']
|
options.tags = ['created']
|
||||||
options.author = true
|
options.author = true
|
||||||
options.addStringOption('link', 'http://docs.oracle.com/javase/8/docs/api/')
|
options.addStringOption('link', 'http://docs.oracle.com/javase/8/docs/api/')
|
||||||
options.addStringOption('sourcepath', project.hasProperty('jdkSrc') ? jdkSrc : "$System.env.JAVA_HOME/src.zip")
|
options.addStringOption('sourcepath', project.hasProperty('jdkSrc') ? jdkSrc : "$System.env.JAVA_HOME/src.zip")
|
||||||
if (JavaVersion.current().isJava8Compatible()) {
|
if (JavaVersion.current().isJava8Compatible())
|
||||||
options.addStringOption('Xdoclint:none', '-quiet')
|
{
|
||||||
}
|
options.addStringOption('Xdoclint:none', '-quiet')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
useTestNG()
|
useTestNG()
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava {
|
compileJava {
|
||||||
doFirst {
|
doFirst {
|
||||||
project.version = getVersion(isRelease)
|
project.version = getVersion(isRelease)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clean {
|
clean {
|
||||||
delete deployDir
|
delete deployDir
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyToDeploy(type: Copy) {
|
task copyToDeploy(type: Copy) {
|
||||||
from jar
|
from jar
|
||||||
into deployDir
|
into deployDir
|
||||||
}
|
}
|
||||||
|
|
||||||
task deploy(dependsOn: ['build', 'copyToDeploy']) {
|
task deploy(dependsOn: ['build', 'copyToDeploy']) {
|
||||||
description = 'Copies all needed files to the ${deployDir} directory.'
|
description = 'Copies all needed files to the ${deployDir} directory.'
|
||||||
group = 'Publishing'
|
group = 'Publishing'
|
||||||
outputs.dir deployDir
|
outputs.dir deployDir
|
||||||
inputs.files copyToDeploy
|
inputs.files copyToDeploy
|
||||||
mustRunAfter clean
|
mustRunAfter clean
|
||||||
}
|
}
|
||||||
|
|
||||||
task wrapper(type: Wrapper) {
|
task wrapper(type: Wrapper) {
|
||||||
gradleVersion = gradle.gradleVersion
|
gradleVersion = gradle.gradleVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
task release(dependsOn: ['deploy', 'wrapper']) << {
|
task release(dependsOn: ['wrapper', 'clean', 'deploy']) << {
|
||||||
group = 'Publishing'
|
group = 'Publishing'
|
||||||
description = 'Releases new version.'
|
description = 'Releases new version.'
|
||||||
isRelease = true
|
isRelease = true
|
||||||
}
|
}
|
||||||
|
|
||||||
task pandoc(type: Exec) {
|
task pandoc(type: Exec) {
|
||||||
group = 'Documentation'
|
group = 'Documentation'
|
||||||
def pandoc_args = ['--from', 'markdown_github', '--to', 'html5', '-s', '-c', 'github-pandoc.css', '-o', 'README.html', 'README.md']
|
def pandoc_args = ['--from', 'markdown_github', '--to', 'html5', '-s', '-c', 'github-pandoc.css', '-o', 'README.html', 'README.md']
|
||||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
if (Os.isFamily(Os.FAMILY_WINDOWS))
|
||||||
commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
|
{
|
||||||
} else {
|
commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
|
||||||
executable 'pandoc'
|
}
|
||||||
args pandoc_args
|
else
|
||||||
}
|
{
|
||||||
standardOutput = new ByteArrayOutputStream()
|
executable 'pandoc'
|
||||||
ext.output = {
|
args pandoc_args
|
||||||
return standardOutput.toString()
|
}
|
||||||
}
|
standardOutput = new ByteArrayOutputStream()
|
||||||
|
ext.output = {
|
||||||
|
return standardOutput.toString()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
24
example/.idea/modules/example.iml
generated
24
example/.idea/modules/example.iml
generated
|
@ -1,24 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module external.linked.project.id="example" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.version="3.1.45-beta" type="JAVA_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
|
||||||
<output url="file://$MODULE_DIR$/../../build/classes/main" />
|
|
||||||
<output-test url="file://$MODULE_DIR$/../../build/classes/test" />
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$/../..">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../src/generated/java" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../src/main/java" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../src/test/java" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../src/annotationProcessor/resources" type="java-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../src/main/resources" type="java-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../src/test/resources" type="java-test-resource" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../.gradle" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/../../build" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Gradle: net.thauvin.erik:semver:0.9.5-beta" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Gradle: commons-lang:commons-lang:2.4" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Gradle: commons-collections:commons-collections:3.2.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Gradle: org.apache.velocity:velocity:1.7" level="project" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -1,5 +1,5 @@
|
||||||
plugins {
|
plugins {
|
||||||
id "com.ewerk.gradle.plugins.annotation-processor" version "1.0.2"
|
id "com.ewerk.gradle.plugins.annotation-processor" version "1.0.2"
|
||||||
}
|
}
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'idea'
|
apply plugin: 'idea'
|
||||||
|
@ -11,27 +11,29 @@ def isRelease = 'release' in gradle.startParameter.taskNames
|
||||||
def deployDir = 'deploy'
|
def deployDir = 'deploy'
|
||||||
|
|
||||||
// Get version from properties file. Increment patch if specified.
|
// Get version from properties file. Increment patch if specified.
|
||||||
def getVersion(isIncrement = false) {
|
def getVersion(isIncrement = false)
|
||||||
def propsFile = 'version.properties'
|
{
|
||||||
def majorKey = 'version.major'
|
def propsFile = 'version.properties'
|
||||||
def minorKey = 'version.minor'
|
def majorKey = 'version.major'
|
||||||
def patchKey = 'version.patch'
|
def minorKey = 'version.minor'
|
||||||
def metaKey = 'version.buildmeta'
|
def patchKey = 'version.patch'
|
||||||
def preKey = 'version.prerelease'
|
def metaKey = 'version.buildmeta'
|
||||||
if (isIncrement) {
|
def preKey = 'version.prerelease'
|
||||||
ant.propertyfile(file: propsFile) {
|
if (isIncrement)
|
||||||
entry(key: patchKey,
|
{
|
||||||
type: 'int',
|
ant.propertyfile(file: propsFile) {
|
||||||
default: '-1',
|
entry(key: patchKey,
|
||||||
operation: '+')
|
type: 'int',
|
||||||
}
|
default: '-1',
|
||||||
}
|
operation: '+')
|
||||||
def p = new Properties()
|
}
|
||||||
file(propsFile).withInputStream { stream -> p.load(stream) }
|
}
|
||||||
def metadata = p.getProperty(metaKey, '')
|
def p = new Properties()
|
||||||
def prerelease = p.getProperty(preKey, '')
|
file(propsFile).withInputStream { stream -> p.load(stream) }
|
||||||
return (p.getProperty(majorKey, '1') + '.' + p.getProperty(minorKey, '0') + '.' + p.getProperty(patchKey, '0') +
|
def metadata = p.getProperty(metaKey, '')
|
||||||
(prerelease.length() > 0 ? '-' + prerelease : '') + (metadata.length() > 0 ? '+' + metadata : ''))
|
def prerelease = p.getProperty(preKey, '')
|
||||||
|
return (p.getProperty(majorKey, '1') + '.' + p.getProperty(minorKey, '0') + '.' + p.getProperty(patchKey, '0') +
|
||||||
|
(prerelease.length() > 0 ? '-' + prerelease : '') + (metadata.length() > 0 ? '+' + metadata : ''))
|
||||||
}
|
}
|
||||||
|
|
||||||
version = getVersion()
|
version = getVersion()
|
||||||
|
@ -40,55 +42,55 @@ mainClassName = 'net.thauvin.erik.semver.example.Example'
|
||||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly 'net.thauvin.erik:semver:0.9.5-beta'
|
compileOnly 'net.thauvin.erik:semver:0.9.6-beta'
|
||||||
}
|
}
|
||||||
|
|
||||||
annotationProcessor {
|
annotationProcessor {
|
||||||
// Update version, increment on release.
|
// Update version, increment on release.
|
||||||
project.version = getVersion(isRelease)
|
project.version = getVersion(isRelease)
|
||||||
library 'net.thauvin.erik:semver:0.9.5-beta'
|
library 'net.thauvin.erik:semver:0.9.6-beta'
|
||||||
processor 'net.thauvin.erik.semver.VersionProcessor'
|
processor 'net.thauvin.erik.semver.VersionProcessor'
|
||||||
// sourcesDir 'src/generated/java'
|
// sourcesDir 'src/generated/java'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava {
|
compileJava {
|
||||||
options.compilerArgs << '-proc:none'
|
options.compilerArgs << '-proc:none'
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest.attributes('Main-Class': mainClassName)
|
manifest.attributes('Main-Class': mainClassName)
|
||||||
}
|
}
|
||||||
|
|
||||||
clean {
|
clean {
|
||||||
delete deployDir
|
delete deployDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
task copyToDeploy(type: Copy) {
|
task copyToDeploy(type: Copy) {
|
||||||
from jar
|
from jar
|
||||||
into deployDir
|
into deployDir
|
||||||
}
|
}
|
||||||
|
|
||||||
task deploy(dependsOn: ['build', 'copyToDeploy']) {
|
task deploy(dependsOn: ['build', 'copyToDeploy']) {
|
||||||
description = 'Copies all needed files to the ${deployDir} directory.'
|
description = 'Copies all needed files to the ${deployDir} directory.'
|
||||||
group = 'Publishing'
|
group = 'Publishing'
|
||||||
outputs.dir deployDir
|
outputs.dir deployDir
|
||||||
inputs.files copyToDeploy
|
inputs.files copyToDeploy
|
||||||
mustRunAfter clean
|
mustRunAfter clean
|
||||||
}
|
}
|
||||||
|
|
||||||
task release(dependsOn: ['deploy', 'wrapper']) << {
|
task release(dependsOn: ['clean', 'wrapper', 'deploy']) << {
|
||||||
group = 'Publishing'
|
group = 'Publishing'
|
||||||
description = 'Releases new version.'
|
description = 'Releases new version.'
|
||||||
isRelease = true
|
isRelease = true
|
||||||
}
|
}
|
||||||
|
|
||||||
task wrapper(type: Wrapper) {
|
task wrapper(type: Wrapper) {
|
||||||
gradleVersion = gradle.gradleVersion
|
gradleVersion = gradle.gradleVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
56
example/example.iml
Normal file
56
example/example.iml
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module external.linked.project.id="example" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="KOBALT" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||||
|
<output url="file://$MODULE_DIR$/kobaltBuild/classes" />
|
||||||
|
<output-test url="file://$MODULE_DIR$/kobaltBuild/test-classes" />
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/kotlin" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/kotlin" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/generated/java" isTestSource="false" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/kobaltBuild" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library name="Kobalt: net.thauvin.erik:semver:jar:0.9.6-beta">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$USER_HOME$/.kobalt/repository/net/thauvin/erik/semver/0.9.6-beta/semver-0.9.6-beta.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library name="Kobalt: org.apache.velocity:velocity:jar:1.7">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$USER_HOME$/.kobalt/repository/org/apache/velocity/velocity/1.7/velocity-1.7.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library name="Kobalt: commons-lang:commons-lang:jar:2.4">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$USER_HOME$/.kobalt/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library name="Kobalt: commons-collections:commons-collections:jar:3.2.1">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$USER_HOME$/.kobalt/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
</component>
|
||||||
|
</module>
|
|
@ -166,7 +166,7 @@
|
||||||
<KobaltProjectSettings>
|
<KobaltProjectSettings>
|
||||||
<option name="autoDownloadKobalt" value="true" />
|
<option name="autoDownloadKobalt" value="true" />
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="kobaltHome" value="$USER_HOME$/.kobalt/wrapper/dist/kobalt-0.841" />
|
<option name="kobaltHome" value="$USER_HOME$/.kobalt/wrapper/dist/kobalt-0.842" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
|
@ -182,6 +182,12 @@
|
||||||
</MavenGeneralSettings>
|
</MavenGeneralSettings>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
<component name="ProjectCodeStyleSettingsManager">
|
||||||
|
<option name="PER_PROJECT_SETTINGS">
|
||||||
|
<value />
|
||||||
|
</option>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Erik's Code Style" />
|
||||||
|
</component>
|
||||||
<component name="ProjectInspectionProfilesVisibleTreeState">
|
<component name="ProjectInspectionProfilesVisibleTreeState">
|
||||||
<entry key="Project Default">
|
<entry key="Project Default">
|
||||||
<profile-state>
|
<profile-state>
|
||||||
|
@ -215,7 +221,7 @@
|
||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/kobalt/Build.kt.iml" filepath="$PROJECT_DIR$/kobalt/Build.kt.iml" />
|
<module fileurl="file://$PROJECT_DIR$/kobalt/Build.kt.iml" filepath="$PROJECT_DIR$/kobalt/Build.kt.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/example.iml" filepath="$PROJECT_DIR$/.idea/modules/example.iml" />
|
<module fileurl="file://$PROJECT_DIR$/example.iml" filepath="$PROJECT_DIR$/example.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" assert-keyword="true" jdk-15="true" project-jdk-name="1.8.x" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" assert-keyword="true" jdk-15="true" project-jdk-name="1.8.x" project-jdk-type="JavaSDK">
|
||||||
|
@ -363,7 +369,7 @@
|
||||||
</library>
|
</library>
|
||||||
<library name="kobalt.jar">
|
<library name="kobalt.jar">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-0.841/kobalt/wrapper/kobalt-0.841.jar!/" />
|
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-0.842/kobalt/wrapper/kobalt-0.842.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
|
@ -374,6 +380,12 @@
|
||||||
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-0.840/kobalt/wrapper/kobalt-0.840.jar!/" />
|
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-0.840/kobalt/wrapper/kobalt-0.840.jar!/" />
|
||||||
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-0.841/kobalt/wrapper/kobalt-0.841.jar!/" />
|
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-0.841/kobalt/wrapper/kobalt-0.841.jar!/" />
|
||||||
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-0.841/kobalt/wrapper/kobalt-0.841.jar!/" />
|
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-0.841/kobalt/wrapper/kobalt-0.841.jar!/" />
|
||||||
|
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-0.841/kobalt/wrapper/kobalt-0.841.jar!/" />
|
||||||
|
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-0.842/kobalt/wrapper/kobalt-0.842.jar!/" />
|
||||||
|
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-0.842/kobalt/wrapper/kobalt-0.842.jar!/" />
|
||||||
|
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-0.842/kobalt/wrapper/kobalt-0.842.jar!/" />
|
||||||
|
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-0.842/kobalt/wrapper/kobalt-0.842.jar!/" />
|
||||||
|
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-0.842/kobalt/wrapper/kobalt-0.842.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -34,7 +34,7 @@ val p = project {
|
||||||
version = versionFor()
|
version = versionFor()
|
||||||
|
|
||||||
val mainClassName = "net.thauvin.erik.semver.example.Example"
|
val mainClassName = "net.thauvin.erik.semver.example.Example"
|
||||||
val processorJar = "net.thauvin.erik:semver:0.9.5-beta"
|
val processorJar = "net.thauvin.erik:semver:0.9.6-beta"
|
||||||
|
|
||||||
sourceDirectories {
|
sourceDirectories {
|
||||||
path("src/main/java")
|
path("src/main/java")
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
kobalt.version=0.841
|
kobalt.version=0.842
|
|
@ -13,15 +13,15 @@ import java.util.Date;
|
||||||
* Annotation Processor</a>
|
* Annotation Processor</a>
|
||||||
*/
|
*/
|
||||||
public final class GeneratedVersion {
|
public final class GeneratedVersion {
|
||||||
private final static String buildmeta = "";
|
private final static String buildmeta = "";
|
||||||
private final static Date date = new Date(1467521680486L);
|
private final static Date date = new Date(1467959174599L);
|
||||||
private final static int major = 3;
|
private final static int major = 3;
|
||||||
private final static int minor = 1;
|
private final static int minor = 1;
|
||||||
private final static int patch = 39;
|
private final static int patch = 45;
|
||||||
private final static String prerelease = "beta";
|
private final static String prerelease = "beta";
|
||||||
private final static String project = "Example";
|
private final static String project = "Example";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables the default constructor.
|
* Disables the default constructor.
|
||||||
*
|
*
|
||||||
* @throws UnsupportedOperationException If the constructor is called.
|
* @throws UnsupportedOperationException If the constructor is called.
|
||||||
|
@ -71,7 +71,7 @@ public final class GeneratedVersion {
|
||||||
return Integer.toString(getMajor()) + '.'
|
return Integer.toString(getMajor()) + '.'
|
||||||
+ Integer.toString(getMinor()) + '.'
|
+ Integer.toString(getMinor()) + '.'
|
||||||
+ Integer.toString(getPatch())
|
+ Integer.toString(getPatch())
|
||||||
+ getPreRelease() + getBuildMetadata();
|
+ getPreRelease(true) + getBuildMetadata(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,14 +101,46 @@ public final class GeneratedVersion {
|
||||||
return patch;
|
return patch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the pre-release version.
|
||||||
|
*
|
||||||
|
* @param isHyphen Prepend a hyphen, if <code>true</code>.
|
||||||
|
* @return The pre-release version, if any.
|
||||||
|
*/
|
||||||
|
public static String getPreRelease(final boolean isHyphen) {
|
||||||
|
if (prerelease.length() > 0) {
|
||||||
|
if (isHyphen) {
|
||||||
|
return '-' + prerelease;
|
||||||
|
} else {
|
||||||
|
return prerelease;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the pre-release version.
|
* Returns the pre-release version.
|
||||||
*
|
*
|
||||||
* @return The pre-release version, if any.
|
* @return The pre-release version, if any.
|
||||||
*/
|
*/
|
||||||
public static String getPreRelease() {
|
public static String getPreRelease() {
|
||||||
if (prerelease.length() > 0) {
|
return getPreRelease(false);
|
||||||
return '-' + prerelease;
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the build metadata.
|
||||||
|
*
|
||||||
|
* @param isPlus Prepend a plus sign, if <code>true</code>.
|
||||||
|
* @return The build metadata, if any.
|
||||||
|
*/
|
||||||
|
public static String getBuildMetadata(final boolean isPlus) {
|
||||||
|
if (buildmeta.length() > 0) {
|
||||||
|
if (isPlus) {
|
||||||
|
return '+' + buildmeta;
|
||||||
|
} else {
|
||||||
|
return buildmeta;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
@ -120,10 +152,6 @@ public final class GeneratedVersion {
|
||||||
* @return The build metadata, if any.
|
* @return The build metadata, if any.
|
||||||
*/
|
*/
|
||||||
public static String getBuildMetadata() {
|
public static String getBuildMetadata() {
|
||||||
if (buildmeta.length() > 0) {
|
return getBuildMetadata(false);
|
||||||
return '+' + buildmeta;
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -47,9 +47,19 @@ public class Example
|
||||||
{
|
{
|
||||||
public static void main(final String... args)
|
public static void main(final String... args)
|
||||||
{
|
{
|
||||||
final SimpleDateFormat sdf = new SimpleDateFormat("'Built on' EEE, d MMM yyyy 'at' HH:mm:ss z");
|
final SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy 'at' HH:mm:ss z");
|
||||||
|
|
||||||
System.out.println(GeneratedVersion.getProject() + ' ' + GeneratedVersion.getVersion());
|
System.out.println("-----------------------------------------------------");
|
||||||
System.out.println(sdf.format(GeneratedVersion.getBuildDate()));
|
|
||||||
|
System.out.println(" " + GeneratedVersion.getProject() + ' ' + GeneratedVersion.getVersion());
|
||||||
|
|
||||||
|
System.out.println(" Built on: " + sdf.format(GeneratedVersion.getBuildDate()));
|
||||||
|
System.out.println(" Major: " + GeneratedVersion.getMajor());
|
||||||
|
System.out.println(" Minor: " + GeneratedVersion.getMinor());
|
||||||
|
System.out.println(" Patch: " + GeneratedVersion.getPatch());
|
||||||
|
System.out.println(" PreRelease: " + GeneratedVersion.getPreRelease());
|
||||||
|
System.out.println(" BuildMetaData: " + GeneratedVersion.getBuildMetadata());
|
||||||
|
|
||||||
|
System.out.println("-----------------------------------------------------");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -24,6 +24,9 @@
|
||||||
<component name="Encoding">
|
<component name="Encoding">
|
||||||
<file url="PROJECT" charset="UTF-8" />
|
<file url="PROJECT" charset="UTF-8" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="EntryPointsManager">
|
||||||
|
<entry_points version="2.0" />
|
||||||
|
</component>
|
||||||
<component name="GradleLocalSettings">
|
<component name="GradleLocalSettings">
|
||||||
<option name="modificationStamps">
|
<option name="modificationStamps">
|
||||||
<map>
|
<map>
|
||||||
|
@ -308,13 +311,13 @@
|
||||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-lang/commons-lang/2.4/2b8c4b3035e45520ef42033e823c7d33e4b4402c/commons-lang-2.4-sources.jar!/" />
|
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-lang/commons-lang/2.4/2b8c4b3035e45520ef42033e823c7d33e4b4402c/commons-lang-2.4-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
</library>
|
</library>
|
||||||
<library name="Gradle: net.thauvin.erik:semver:0.9.5-beta">
|
<library name="Gradle: net.thauvin.erik:semver:0.9.6-beta">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/thauvin/erik/semver/0.9.5-beta/semver-0.9.5-beta.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/net/thauvin/erik/semver/0.9.6-beta/semver-0.9.6-beta.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/thauvin/erik/semver/0.9.5-beta/semver-0.9.5-beta-sources.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/net/thauvin/erik/semver/0.9.6-beta/semver-0.9.6-beta-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
</library>
|
</library>
|
||||||
<library name="Gradle: org.apache.ant:ant-launcher:1.7.0">
|
<library name="Gradle: org.apache.ant:ant-launcher:1.7.0">
|
||||||
|
|
|
@ -28,15 +28,15 @@ import java.util.Date;
|
||||||
* Annotation Processor</a>
|
* Annotation Processor</a>
|
||||||
*/
|
*/
|
||||||
public final class ${className} {
|
public final class ${className} {
|
||||||
private final static String buildmeta = "${buildmeta}";
|
private final static String buildmeta = "${buildmeta}";
|
||||||
private final static Date date = new Date(${epoch}L);
|
private final static Date date = new Date(${epoch}L);
|
||||||
private final static int major = ${major};
|
private final static int major = ${major};
|
||||||
private final static int minor = ${minor};
|
private final static int minor = ${minor};
|
||||||
private final static int patch = ${patch};
|
private final static int patch = ${patch};
|
||||||
private final static String prerelease = "${prerelease}";
|
private final static String prerelease = "${prerelease}";
|
||||||
private final static String project = "${project}";
|
private final static String project = "${project}";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables the default constructor.
|
* Disables the default constructor.
|
||||||
*
|
*
|
||||||
* @throws UnsupportedOperationException If the constructor is called.
|
* @throws UnsupportedOperationException If the constructor is called.
|
||||||
|
@ -86,7 +86,7 @@ public final class ${className} {
|
||||||
return Integer.toString(getMajor()) + '.'
|
return Integer.toString(getMajor()) + '.'
|
||||||
+ Integer.toString(getMinor()) + '.'
|
+ Integer.toString(getMinor()) + '.'
|
||||||
+ Integer.toString(getPatch())
|
+ Integer.toString(getPatch())
|
||||||
+ getPreRelease() + getBuildMetadata();
|
+ getPreRelease(true) + getBuildMetadata(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,14 +116,46 @@ public final class ${className} {
|
||||||
return patch;
|
return patch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the pre-release version.
|
||||||
|
*
|
||||||
|
* @param isHyphen Prepend a hyphen, if <code>true</code>.
|
||||||
|
* @return The pre-release version, if any.
|
||||||
|
*/
|
||||||
|
public static String getPreRelease(final boolean isHyphen) {
|
||||||
|
if (prerelease.length() > 0) {
|
||||||
|
if (isHyphen) {
|
||||||
|
return '-' + prerelease;
|
||||||
|
} else {
|
||||||
|
return prerelease;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the pre-release version.
|
* Returns the pre-release version.
|
||||||
*
|
*
|
||||||
* @return The pre-release version, if any.
|
* @return The pre-release version, if any.
|
||||||
*/
|
*/
|
||||||
public static String getPreRelease() {
|
public static String getPreRelease() {
|
||||||
if (prerelease.length() > 0) {
|
return getPreRelease(false);
|
||||||
return '-' + prerelease;
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the build metadata.
|
||||||
|
*
|
||||||
|
* @param isPlus Prepend a plus sign, if <code>true</code>.
|
||||||
|
* @return The build metadata, if any.
|
||||||
|
*/
|
||||||
|
public static String getBuildMetadata(final boolean isPlus) {
|
||||||
|
if (buildmeta.length() > 0) {
|
||||||
|
if (isPlus) {
|
||||||
|
return '+' + buildmeta;
|
||||||
|
} else {
|
||||||
|
return buildmeta;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
@ -135,10 +167,6 @@ public final class ${className} {
|
||||||
* @return The build metadata, if any.
|
* @return The build metadata, if any.
|
||||||
*/
|
*/
|
||||||
public static String getBuildMetadata() {
|
public static String getBuildMetadata() {
|
||||||
if (buildmeta.length() > 0) {
|
return getBuildMetadata(false);
|
||||||
return '+' + buildmeta;
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
#Thu, 28 Jan 2016 17:33:17 -0800
|
#Thu, 28 Jan 2016 17:33:17 -0800
|
||||||
version.major=0
|
version.major=0
|
||||||
version.minor=9
|
version.minor=9
|
||||||
version.patch=5
|
version.patch=6
|
||||||
version.buildmeta=
|
version.buildmeta=
|
||||||
version.prerelease=beta
|
version.prerelease=beta
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue