Added test.
This commit is contained in:
parent
f9dd17da1f
commit
ac2088aa54
10 changed files with 274 additions and 211 deletions
10
README.html
10
README.html
|
@ -244,13 +244,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.4-beta<span class="kw"></version></span>
|
<span class="kw"><version></span>0.9.5-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.4-beta'
|
compile 'net.thauvin.erik:semver:0.9.5-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>
|
||||||
|
@ -260,11 +260,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 {
|
||||||
compile 'net.thauvin.erik:semver:0.9.4-beta'
|
compile 'net.thauvin.erik:semver:0.9.5-beta'
|
||||||
}
|
}
|
||||||
|
|
||||||
annotationProcessor {
|
annotationProcessor {
|
||||||
library 'net.thauvin.erik:semver:0.9.4-beta'
|
library 'net.thauvin.erik:semver:0.9.5-beta'
|
||||||
processor 'net.thauvin.erik.semver.VersionProcessor'
|
processor 'net.thauvin.erik.semver.VersionProcessor'
|
||||||
// sourcesDir 'src/generated/java'
|
// sourcesDir 'src/generated/java'
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ 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.4-beta")
|
apt("net.thauvin.erik:semver:0.9.5-beta")
|
||||||
}</code></pre>
|
}</code></pre>
|
||||||
<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>
|
||||||
|
|
10
README.md
10
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.4-beta</version>
|
<version>0.9.5-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.4-beta'
|
compile 'net.thauvin.erik:semver:0.9.5-beta'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -161,11 +161,11 @@ Then add the following to the `build.gradle` file:
|
||||||
|
|
||||||
```gradle
|
```gradle
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'net.thauvin.erik:semver:0.9.4-beta'
|
compile 'net.thauvin.erik:semver:0.9.5-beta'
|
||||||
}
|
}
|
||||||
|
|
||||||
annotationProcessor {
|
annotationProcessor {
|
||||||
library 'net.thauvin.erik:semver:0.9.4-beta'
|
library 'net.thauvin.erik:semver:0.9.5-beta'
|
||||||
processor 'net.thauvin.erik.semver.VersionProcessor'
|
processor 'net.thauvin.erik.semver.VersionProcessor'
|
||||||
// sourcesDir 'src/generated/java'
|
// sourcesDir 'src/generated/java'
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ 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.4-beta")
|
apt("net.thauvin.erik:semver:0.9.5-beta")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
264
build.gradle
264
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'
|
||||||
|
@ -11,26 +11,26 @@ 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 propsFile = 'version.properties'
|
||||||
def majorKey = 'version.major'
|
def majorKey = 'version.major'
|
||||||
def minorKey = 'version.minor'
|
def minorKey = 'version.minor'
|
||||||
def patchKey = 'version.patch'
|
def patchKey = 'version.patch'
|
||||||
def metaKey = 'version.buildmeta'
|
def metaKey = 'version.buildmeta'
|
||||||
def preKey = 'version.prerelease'
|
def preKey = 'version.prerelease'
|
||||||
if (isIncrement) {
|
if (isIncrement) {
|
||||||
ant.propertyfile(file: propsFile) {
|
ant.propertyfile(file: propsFile) {
|
||||||
entry(key: patchKey,
|
entry(key: patchKey,
|
||||||
type: 'int',
|
type: 'int',
|
||||||
default: '-1',
|
default: '-1',
|
||||||
operation: '+')
|
operation: '+')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def p = new Properties()
|
def p = new Properties()
|
||||||
file(propsFile).withInputStream { stream -> p.load(stream) }
|
file(propsFile).withInputStream { stream -> p.load(stream) }
|
||||||
def metadata = p.getProperty(metaKey, '')
|
def metadata = p.getProperty(metaKey, '')
|
||||||
def prerelease = p.getProperty(preKey, '')
|
def prerelease = p.getProperty(preKey, '')
|
||||||
return (p.getProperty(majorKey, '1') + '.' + p.getProperty(minorKey, '0') + '.' + p.getProperty(patchKey, '0') +
|
return (p.getProperty(majorKey, '1') + '.' + p.getProperty(minorKey, '0') + '.' + p.getProperty(patchKey, '0') +
|
||||||
(prerelease.length() > 0 ? '-' + prerelease : '') + (metadata.length() > 0 ? '+' + metadata : ''))
|
(prerelease.length() > 0 ? '-' + prerelease : '') + (metadata.length() > 0 ? '+' + metadata : ''))
|
||||||
}
|
}
|
||||||
|
|
||||||
version = getVersion()
|
version = getVersion()
|
||||||
|
@ -54,167 +54,163 @@ 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()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'org.apache.velocity:velocity:1.7'
|
compile 'org.apache.velocity:velocity:1.7'
|
||||||
testCompile 'org.testng:testng:6.9.10'
|
testCompile 'org.testng:testng:6.9.10'
|
||||||
}
|
}
|
||||||
|
|
||||||
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: ['deploy', 'wrapper']) << {
|
||||||
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', '-o', 'README.html', 'README.md']
|
def pandoc_args = ['--from', 'markdown_github', '--to', 'html5', '-s', '-o', 'README.html', '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)
|
} else {
|
||||||
}
|
executable '/usr/local/bin/pandoc'
|
||||||
else
|
args pandoc_args
|
||||||
{
|
}
|
||||||
executable '/usr/local/bin/pandoc'
|
standardOutput = new ByteArrayOutputStream()
|
||||||
args pandoc_args
|
ext.output = {
|
||||||
}
|
return standardOutput.toString()
|
||||||
standardOutput = new ByteArrayOutputStream()
|
}
|
||||||
ext.output = {
|
|
||||||
return standardOutput.toString()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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'
|
||||||
|
@ -12,26 +12,26 @@ 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 propsFile = 'version.properties'
|
||||||
def majorKey = 'version.major'
|
def majorKey = 'version.major'
|
||||||
def minorKey = 'version.minor'
|
def minorKey = 'version.minor'
|
||||||
def patchKey = 'version.patch'
|
def patchKey = 'version.patch'
|
||||||
def metaKey = 'version.buildmeta'
|
def metaKey = 'version.buildmeta'
|
||||||
def preKey = 'version.prerelease'
|
def preKey = 'version.prerelease'
|
||||||
if (isIncrement) {
|
if (isIncrement) {
|
||||||
ant.propertyfile(file: propsFile) {
|
ant.propertyfile(file: propsFile) {
|
||||||
entry(key: patchKey,
|
entry(key: patchKey,
|
||||||
type: 'int',
|
type: 'int',
|
||||||
default: '-1',
|
default: '-1',
|
||||||
operation: '+')
|
operation: '+')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def p = new Properties()
|
def p = new Properties()
|
||||||
file(propsFile).withInputStream { stream -> p.load(stream) }
|
file(propsFile).withInputStream { stream -> p.load(stream) }
|
||||||
def metadata = p.getProperty(metaKey, '')
|
def metadata = p.getProperty(metaKey, '')
|
||||||
def prerelease = p.getProperty(preKey, '')
|
def prerelease = p.getProperty(preKey, '')
|
||||||
return (p.getProperty(majorKey, '1') + '.' + p.getProperty(minorKey, '0') + '.' + p.getProperty(patchKey, '0') +
|
return (p.getProperty(majorKey, '1') + '.' + p.getProperty(minorKey, '0') + '.' + p.getProperty(patchKey, '0') +
|
||||||
(prerelease.length() > 0 ? '-' + prerelease : '') + (metadata.length() > 0 ? '+' + metadata : ''))
|
(prerelease.length() > 0 ? '-' + prerelease : '') + (metadata.length() > 0 ? '+' + metadata : ''))
|
||||||
}
|
}
|
||||||
|
|
||||||
version = getVersion()
|
version = getVersion()
|
||||||
|
@ -40,55 +40,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 {
|
||||||
compile 'net.thauvin.erik:semver:0.9.4-beta'
|
compile 'net.thauvin.erik:semver:0.9.5-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.4-beta'
|
library 'net.thauvin.erik:semver:0.9.5-beta'
|
||||||
processor 'net.thauvin.erik.semver.VersionProcessor'
|
processor 'net.thauvin.erik.semver.VersionProcessor'
|
||||||
}
|
}
|
||||||
|
|
||||||
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: ['deploy', 'wrapper']) << {
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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.37-beta" type="JAVA_MODULE" version="4">
|
<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.38-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" />
|
||||||
|
@ -16,10 +16,6 @@
|
||||||
</content>
|
</content>
|
||||||
<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: 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" name="Gradle: net.thauvin.erik:semver:0.9.4-beta" level="project" />
|
|
||||||
</component>
|
</component>
|
||||||
<component name="org.twodividedbyzero.idea.findbugs">
|
<component name="org.twodividedbyzero.idea.findbugs">
|
||||||
<option name="_basePreferences">
|
<option name="_basePreferences">
|
||||||
|
|
|
@ -1,22 +1,23 @@
|
||||||
/*
|
/*
|
||||||
* This file is automatically generated by the Semantic Version Annotation Processor.
|
* This file is automatically generated.
|
||||||
* Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
* Do not modify! -- ALL CHANGES WILL BE ERASED!
|
||||||
*/
|
*/
|
||||||
package net.thauvin.erik.semver.example;
|
package net.thauvin.erik.semver.example;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This <code>GeneratedVersion</code> class provides semantic version information.
|
* Provides semantic version information.
|
||||||
*
|
*
|
||||||
* @author Semantic Version Annotation Processor
|
* @author <a href="https://github.com/ethauvin/semver">Semantic Version
|
||||||
|
* 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(1454031375359L);
|
private final static Date date = new Date(1454533811647L);
|
||||||
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 = 37;
|
private final static int patch = 39;
|
||||||
private final static String prerelease = "beta";
|
private final static String prerelease = "beta";
|
||||||
private final static String project = "Example";
|
private final static String project = "Example";
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#Sat, 23 Jan 2016 18:16:26 -0800
|
#Wed, 03 Feb 2016 13:10:11 -0800
|
||||||
version.project=Example
|
version.project=Example
|
||||||
version.major=3
|
version.major=3
|
||||||
version.minor=1
|
version.minor=1
|
||||||
version.patch=37
|
version.patch=39
|
||||||
version.buildmeta=
|
version.buildmeta=
|
||||||
version.prerelease=beta
|
version.prerelease=beta
|
||||||
|
|
13
semver.ipr
13
semver.ipr
|
@ -72,7 +72,7 @@
|
||||||
</LanguageOptions>
|
</LanguageOptions>
|
||||||
</component>
|
</component>
|
||||||
<component name="DependencyValidationManager">
|
<component name="DependencyValidationManager">
|
||||||
<scope name="Source" pattern="file[example]:src/main/java/*.java||file[semver]:src/main/java/*.java" />
|
<scope name="Source" pattern="file[example]:src/main/java/*.java||file[semver]:src/main/java/*.java||file[semver]:src/test/java/*.java" />
|
||||||
</component>
|
</component>
|
||||||
<component name="Encoding">
|
<component name="Encoding">
|
||||||
<file url="PROJECT" charset="UTF-8" />
|
<file url="PROJECT" charset="UTF-8" />
|
||||||
|
@ -305,7 +305,7 @@
|
||||||
</XML>
|
</XML>
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Erik's Code Style" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||||
<OptionsSetting value="true" id="Add" />
|
<OptionsSetting value="true" id="Add" />
|
||||||
|
@ -357,15 +357,6 @@
|
||||||
<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.4-beta">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/thauvin/erik/semver/0.9.4-beta/semver-0.9.4-beta.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/net/thauvin/erik/semver/0.9.4-beta/semver-0.9.4-beta-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
<library name="Gradle: org.apache.velocity:velocity:1.7">
|
<library name="Gradle: org.apache.velocity:velocity:1.7">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.velocity/velocity/1.7/2ceb567b8f3f21118ecdec129fe1271dbc09aa7a/velocity-1.7.jar!/" />
|
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.velocity/velocity/1.7/2ceb567b8f3f21118ecdec129fe1271dbc09aa7a/velocity-1.7.jar!/" />
|
||||||
|
|
79
src/test/java/net/thauvin/erik/semver/VersionInfoTest.java
Normal file
79
src/test/java/net/thauvin/erik/semver/VersionInfoTest.java
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
/*
|
||||||
|
* VersionInfoTest.java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016, Erik C. Thauvin (erik@thauvin.net)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* Neither the name of this project nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software without
|
||||||
|
* specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.thauvin.erik.semver;
|
||||||
|
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The <code>VersionInfoTest</code> class.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||||
|
* @created 2016-02-03
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public class VersionInfoTest
|
||||||
|
{
|
||||||
|
@Test
|
||||||
|
public void testGetVersion()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
final VersionInfo version = new VersionInfo();
|
||||||
|
|
||||||
|
Assert.assertEquals(version.getVersion(), "1.0.0");
|
||||||
|
|
||||||
|
version.setMajor(3);
|
||||||
|
|
||||||
|
Assert.assertEquals(version.getVersion(), "3.0.0");
|
||||||
|
|
||||||
|
version.setMinor(2);
|
||||||
|
|
||||||
|
Assert.assertEquals(version.getVersion(), "3.2.0");
|
||||||
|
|
||||||
|
version.setPatch(1);
|
||||||
|
|
||||||
|
Assert.assertEquals(version.getVersion(), "3.2.1");
|
||||||
|
|
||||||
|
version.setPreRelease("beta");
|
||||||
|
|
||||||
|
Assert.assertEquals(version.getVersion(), "3.2.1-beta");
|
||||||
|
|
||||||
|
version.setBuildMetadata("001");
|
||||||
|
|
||||||
|
Assert.assertEquals(version.getVersion(), "3.2.1-beta+001");
|
||||||
|
|
||||||
|
version.setPreRelease("");
|
||||||
|
|
||||||
|
Assert.assertEquals(version.getVersion(), "3.2.1+001");
|
||||||
|
}
|
||||||
|
}
|
|
@ -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=4
|
version.patch=5
|
||||||
version.buildmeta=
|
version.buildmeta=
|
||||||
version.prerelease=beta
|
version.prerelease=beta
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue