Added test.
This commit is contained in:
parent
f9dd17da1f
commit
ac2088aa54
10 changed files with 274 additions and 211 deletions
|
@ -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.2"
|
||||
}
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'idea'
|
||||
|
@ -12,26 +12,26 @@ def deployDir = 'deploy'
|
|||
|
||||
// Get version from properties file. Increment patch if specified.
|
||||
def getVersion(isIncrement = false) {
|
||||
def propsFile = 'version.properties'
|
||||
def majorKey = 'version.major'
|
||||
def minorKey = 'version.minor'
|
||||
def patchKey = 'version.patch'
|
||||
def metaKey = 'version.buildmeta'
|
||||
def preKey = 'version.prerelease'
|
||||
if (isIncrement) {
|
||||
ant.propertyfile(file: propsFile) {
|
||||
entry(key: patchKey,
|
||||
type: 'int',
|
||||
default: '-1',
|
||||
operation: '+')
|
||||
}
|
||||
}
|
||||
def p = new Properties()
|
||||
file(propsFile).withInputStream { stream -> p.load(stream) }
|
||||
def metadata = p.getProperty(metaKey, '')
|
||||
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 : ''))
|
||||
def propsFile = 'version.properties'
|
||||
def majorKey = 'version.major'
|
||||
def minorKey = 'version.minor'
|
||||
def patchKey = 'version.patch'
|
||||
def metaKey = 'version.buildmeta'
|
||||
def preKey = 'version.prerelease'
|
||||
if (isIncrement) {
|
||||
ant.propertyfile(file: propsFile) {
|
||||
entry(key: patchKey,
|
||||
type: 'int',
|
||||
default: '-1',
|
||||
operation: '+')
|
||||
}
|
||||
}
|
||||
def p = new Properties()
|
||||
file(propsFile).withInputStream { stream -> p.load(stream) }
|
||||
def metadata = p.getProperty(metaKey, '')
|
||||
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()
|
||||
|
@ -40,55 +40,55 @@ mainClassName = 'net.thauvin.erik.semver.example.Example'
|
|||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'net.thauvin.erik:semver:0.9.4-beta'
|
||||
compile 'net.thauvin.erik:semver:0.9.5-beta'
|
||||
}
|
||||
|
||||
annotationProcessor {
|
||||
// Update version, increment on release.
|
||||
project.version = getVersion(isRelease)
|
||||
library 'net.thauvin.erik:semver:0.9.4-beta'
|
||||
processor 'net.thauvin.erik.semver.VersionProcessor'
|
||||
// Update version, increment on release.
|
||||
project.version = getVersion(isRelease)
|
||||
library 'net.thauvin.erik:semver:0.9.5-beta'
|
||||
processor 'net.thauvin.erik.semver.VersionProcessor'
|
||||
}
|
||||
|
||||
compileJava {
|
||||
options.compilerArgs << '-proc:none'
|
||||
options.compilerArgs << '-proc:none'
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest.attributes('Main-Class': mainClassName)
|
||||
manifest.attributes('Main-Class': mainClassName)
|
||||
}
|
||||
|
||||
clean {
|
||||
delete deployDir
|
||||
delete deployDir
|
||||
}
|
||||
|
||||
|
||||
task copyToDeploy(type: Copy) {
|
||||
from jar
|
||||
into deployDir
|
||||
from jar
|
||||
into deployDir
|
||||
}
|
||||
|
||||
task deploy(dependsOn: ['build', 'copyToDeploy']) {
|
||||
description = 'Copies all needed files to the ${deployDir} directory.'
|
||||
group = 'Publishing'
|
||||
outputs.dir deployDir
|
||||
inputs.files copyToDeploy
|
||||
mustRunAfter clean
|
||||
description = 'Copies all needed files to the ${deployDir} directory.'
|
||||
group = 'Publishing'
|
||||
outputs.dir deployDir
|
||||
inputs.files copyToDeploy
|
||||
mustRunAfter clean
|
||||
}
|
||||
|
||||
|
||||
task release(dependsOn: ['deploy', 'wrapper']) << {
|
||||
group = 'Publishing'
|
||||
description = 'Releases new version.'
|
||||
isRelease = true
|
||||
group = 'Publishing'
|
||||
description = 'Releases new version.'
|
||||
isRelease = true
|
||||
}
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion = gradle.gradleVersion
|
||||
gradleVersion = gradle.gradleVersion
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?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">
|
||||
<output url="file://$MODULE_DIR$/build/classes/main" />
|
||||
<output-test url="file://$MODULE_DIR$/build/classes/test" />
|
||||
|
@ -16,10 +16,6 @@
|
|||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<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 name="org.twodividedbyzero.idea.findbugs">
|
||||
<option name="_basePreferences">
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
/*
|
||||
* This file is automatically generated by the Semantic Version Annotation Processor.
|
||||
* Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
* This file is automatically generated.
|
||||
* Do not modify! -- ALL CHANGES WILL BE ERASED!
|
||||
*/
|
||||
package net.thauvin.erik.semver.example;
|
||||
|
||||
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 {
|
||||
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 minor = 1;
|
||||
private final static int patch = 37;
|
||||
private final static int patch = 39;
|
||||
private final static String prerelease = "beta";
|
||||
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.major=3
|
||||
version.minor=1
|
||||
version.patch=37
|
||||
version.patch=39
|
||||
version.buildmeta=
|
||||
version.prerelease=beta
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue