Added bintray tasks.

Added more javadoc options and comments.
This commit is contained in:
Erik C. Thauvin 2016-01-24 01:29:38 -08:00
parent 0b44504fb0
commit e3706639f0
9 changed files with 260 additions and 22 deletions

1
.gitignore vendored
View file

@ -15,6 +15,7 @@
/deploy /deploy
/dist /dist
/gen /gen
/gradle.properties
/local.properties /local.properties
/out /out
/proguard-project.txt /proguard-project.txt

View file

@ -1,6 +1,10 @@
plugins {
id "com.jfrog.bintray" version "1.5"
}
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'idea' apply plugin: 'idea'
apply plugin: 'maven' apply plugin: 'maven'
apply plugin: 'maven-publish'
import org.apache.tools.ant.taskdefs.condition.Os import org.apache.tools.ant.taskdefs.condition.Os
@ -35,7 +39,20 @@ version = getVersion()
def deployDir = 'deploy' def deployDir = 'deploy'
def isRelease = 'release' in gradle.startParameter.taskNames def isRelease = 'release' in gradle.startParameter.taskNames
def mavenGroupId = 'net.thauvin.erik' def mavenGroupId = 'net.thauvin.erik'
def mavenName = 'SemVer'
def mavenDescription = 'Semantic Version Annotation Processor'
def mavenUrl = 'https://github.com/ethauvin/sermver'
def mavenLicense = 'The BSD 3-Clause License'
def mavenLicenseUrl = 'http://opensource.org/licenses/BSD-3-Clause'
def mavenScmCon = 'https://github.com/ethauvin/semver.git'
def mavenScmDevCon = 'git@github.com:ethauvin/semver.git'
def pkgLicenses = ['BSD 3-Clause']
def pkgIssueTrackerUrl = mavenUrl + '/issues'
def pkgLabels = ['java', 'annotation', 'processor', 'semantic', 'version']
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
@ -49,6 +66,106 @@ dependencies {
testCompile 'org.testng:testng:+' testCompile 'org.testng:testng:+'
} }
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
publications = ['MyPublication']
dryRun = true
pkg {
repo = 'maven'
name = mavenName
licenses = pkgLicenses
desc = mavenDescription
websiteUrl = mavenUrl
issueTrackerUrl = pkgIssueTrackerUrl
vcsUrl = mavenScmCon
labels = pkgLabels
publicDownloadNumbers = true
version {
name = project.version
desc = 'Version ' + project.version
vcsTag = project.version
gpg {
sign = true
}
}
}
}
def pomConfig = {
licenses {
license {
name mavenLicense
url mavenLicenseUrl
distribution 'repo'
}
}
developers {
developer {
id 'ethauvin'
name 'Erik C. Thauvin'
email 'erik@thauvin.net'
}
}
scm {
connection 'scm:git:' + mavenScmCon
developerConnection 'scm:git:' + mavenScmDevCon
url mavenScmCon
}
}
publishing {
publications {
MyPublication(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
groupId mavenGroupId
artifactId rootProject.name
version project.version
pom.withXml {
def root = asNode()
root.appendNode('name', mavenName)
root.appendNode('description', mavenDescription)
root.appendNode('url', mavenUrl)
root.children().last() + pomConfig
}
}
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
group = 'Build'
description = 'Builds an archive of the javadoc docs.'
classifier = 'javadoc'
from javadoc.destinationDir
}
task sourcesJar(type: Jar) {
group = 'Build'
description = 'Builds an archive of the source code.'
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar
archives sourcesJar
}
javadoc {
options.tags = ['created']
options.author = true
options.addStringOption('link', 'http://docs.oracle.com/javase/8/docs/api/')
options.addStringOption('sourcepath', project.hasProperty('jdkSrc') ? jdkSrc : "$System.env.JAVA_HOME/src.zip")
if (JavaVersion.current().isJava8Compatible())
{
options.addStringOption('Xdoclint:none', '-quiet')
}
}
test { test {
useTestNG() useTestNG()
} }
@ -76,21 +193,11 @@ task deploy(dependsOn: ['build', 'copyToDeploy']) {
mustRunAfter clean mustRunAfter clean
} }
uploadArchives {
repositories {
mavenDeployer {
repository(url: mavenLocal().url)
pom.artifactId = rootProject.name
pom.groupId = mavenGroupId
}
}
}
task wrapper(type: Wrapper) { task wrapper(type: Wrapper) {
gradleVersion = gradle.gradleVersion gradleVersion = gradle.gradleVersion
} }
task release(dependsOn: ['deploy', 'wrapper', 'uploadArchives']) << { task release(dependsOn: ['deploy', 'wrapper']) << {
group = 'Publishing' group = 'Publishing'
description = 'Releases new version.' description = 'Releases new version.'
isRelease = true isRelease = true

View file

@ -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.35-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.37-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" />
@ -19,7 +19,7 @@
<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" 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" name="Gradle: commons-lang:commons-lang:2.4" level="project" />
<orderEntry type="library" name="Gradle: net.thauvin.erik:semver:1.0.1-beta" level="project" /> <orderEntry type="library" name="Gradle: net.thauvin.erik:semver:0.9.0-beta" level="project" />
</component> </component>
<component name="org.twodividedbyzero.idea.findbugs"> <component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences"> <option name="_basePreferences">

View file

@ -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="1.0.1-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.0-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" />

View file

@ -357,12 +357,14 @@
<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:1.0.1-beta"> <library name="Gradle: net.thauvin.erik:semver:0.9.0-beta">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/net/thauvin/erik/semver/1.0.1-beta/semver-1.0.1-beta.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/net/thauvin/erik/semver/0.9.0-beta/semver-0.9.0-beta.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES /> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/net/thauvin/erik/semver/0.9.0-beta/semver-0.9.0-beta-sources.jar!/" />
</SOURCES>
</library> </library>
<library name="Gradle: org.apache.velocity:velocity:1.7"> <library name="Gradle: org.apache.velocity:velocity:1.7">
<CLASSES> <CLASSES>

View file

@ -34,7 +34,7 @@
package net.thauvin.erik.semver; package net.thauvin.erik.semver;
/** /**
* The <code>Constants</code> class. * The <code>Constants</code> class holds the constant variables used throughout this project.
* *
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a> * @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
* @created 2016-01-13 * @created 2016-01-13
@ -42,30 +42,69 @@ package net.thauvin.erik.semver;
*/ */
public final class Constants public final class Constants
{ {
/**
* The default class name.
*/
public static final String DEFAULT_CLASS_NAME = "GeneratedVersion"; public static final String DEFAULT_CLASS_NAME = "GeneratedVersion";
/**
* The default major version.
*/
public static final int DEFAULT_MAJOR = 1; public static final int DEFAULT_MAJOR = 1;
/**
* The default minor version.
*/
public static final int DEFAULT_MINOR = 0; public static final int DEFAULT_MINOR = 0;
/**
* The default patch version.
*/
public static final int DEFAULT_PATCH = 0; public static final int DEFAULT_PATCH = 0;
/**
* The default Velocity template.
*/
public static final String DEFAULT_TEMPLATE = "version.vm"; public static final String DEFAULT_TEMPLATE = "version.vm";
/**
* The empty string.
*/
public static final String EMPTY = ""; public static final String EMPTY = "";
/**
* The build metadata property key.
*/
public static final String KEY_VERSION_BUILDMETA = "version.buildmeta"; public static final String KEY_VERSION_BUILDMETA = "version.buildmeta";
/**
* The major version property key.
*/
public static final String KEY_VERSION_MAJOR = "version.major"; public static final String KEY_VERSION_MAJOR = "version.major";
/**
* The minor version property key.
*/
public static final String KEY_VERSION_MINOR = "version.minor"; public static final String KEY_VERSION_MINOR = "version.minor";
/**
* The patch version property key.
*/
public static final String KEY_VERSION_PATCH = "version.patch"; public static final String KEY_VERSION_PATCH = "version.patch";
/**
* The pre-release version property key.
*/
public static final String KEY_VERSION_PRERELEASE = "version.prerelease"; public static final String KEY_VERSION_PRERELEASE = "version.prerelease";
/**
* The project property key.
*/
public static final String KEY_VERSION_PROJECT = "version.project"; public static final String KEY_VERSION_PROJECT = "version.project";
/**
* The velocity properties name.
*/
public static final String VELOCITY_PROPERTIES = "velocity.properties"; public static final String VELOCITY_PROPERTIES = "velocity.properties";
/** /**

View file

@ -39,7 +39,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
/** /**
* The <code>Version</code> class. * The <code>Version</code> class implements the annotation interface.
* *
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a> * @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
* @created 2016-01-13 * @created 2016-01-13

View file

@ -34,7 +34,7 @@
package net.thauvin.erik.semver; package net.thauvin.erik.semver;
/** /**
* The <code>VersionInfo</code> class. * The <code>VersionInfo</code> class is used to hold and retrieve the semantic version values.
* *
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a> * @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
* @created 2016-01-16 * @created 2016-01-16
@ -56,6 +56,9 @@ public class VersionInfo
private String project; private String project;
/**
* Creates a new object with default values
*/
public VersionInfo() public VersionInfo()
{ {
major = Constants.DEFAULT_MAJOR; major = Constants.DEFAULT_MAJOR;
@ -66,6 +69,11 @@ public class VersionInfo
project = Constants.EMPTY; project = Constants.EMPTY;
} }
/**
* Creates a new object with values from a {@link net.thauvin.erik.semver.Version Version} object.
*
* @param version The version object.
*/
public VersionInfo(final Version version) public VersionInfo(final Version version)
{ {
major = version.major(); major = version.major();
@ -76,71 +84,152 @@ public class VersionInfo
project = version.project(); project = version.project();
} }
/**
* Returns the build metadata.
*
* @return The build metadata.
*/
public String getBuildMetadata() public String getBuildMetadata()
{ {
return buildmeta; return buildmeta;
} }
/**
* Sets the build metadata.
*
* @param buildmeta The new build metadata.
*/
public void setBuildMetadata(final String buildmeta) public void setBuildMetadata(final String buildmeta)
{ {
this.buildmeta = buildmeta; this.buildmeta = buildmeta;
} }
/**
* Returns the build epoch/Unix timestamp.
*
* @return The build epoch.
*/
public long getEpoch() public long getEpoch()
{ {
return epoch; return epoch;
} }
/**
* Returns the major version.
*
* @return The major version.
*/
public int getMajor() public int getMajor()
{ {
return major; return major;
} }
/**
* Sets the major version.
*
* @param major The new major version.
*/
public void setMajor(final int major) public void setMajor(final int major)
{ {
this.major = major; this.major = major;
} }
/**
* Returns the major version.
*
* @return The major version.
*/
public int getMinor() public int getMinor()
{ {
return minor; return minor;
} }
/**
* Sets the minor version.
*
* @param minor The new minor version.
*/
public void setMinor(final int minor) public void setMinor(final int minor)
{ {
this.minor = minor; this.minor = minor;
} }
/**
* Returns the patch version.
*
* @return The patch version.
*/
public int getPatch() public int getPatch()
{ {
return patch; return patch;
} }
/**
* Sets the patch version.
*
* @param patch The new patch version.
*/
public void setPatch(final int patch) public void setPatch(final int patch)
{ {
this.patch = patch; this.patch = patch;
} }
/**
* Returns the pre-release version.
*
* @return The pre-release version.
*/
public String getPreRelease() public String getPreRelease()
{ {
return prerelease; return prerelease;
} }
/**
* Sets the pre-release version.
*
* @param prerelease The new pre-release version.
*/
public void setPreRelease(final String prerelease) public void setPreRelease(final String prerelease)
{ {
this.prerelease = prerelease; this.prerelease = prerelease;
} }
/**
* Returns the project name.
*
* @return The project name.
*/
public String getProject() public String getProject()
{ {
return project; return project;
} }
/**
* Sets the project name.
*
* @param project The new project name.
*/
public void setProject(String project) public void setProject(String project)
{ {
this.project = project; this.project = project;
} }
/**
* Returns the full version string.
* <p>
* Formatted as:
* <blockquote><code>MAJOR.MINOR.PATCH[-PRERELEASE][+BUILDMETADATA]</code></blockquote>
* <p>
* For example:
* <ul>
* <li><code>1.0.0</code></li>
* <li><code>1.0.0-beta</code></li>
* <li><code>1.0.0+20160124144700</code></li>
* <li><code>1.0.0-alpha+001</code></li>
* </ul>
*
* @return The version string.
*/
public String getVersion() public String getVersion()
{ {
return "" + major + '.' + minor + '.' + patch + (prerelease.length() > 0 ? '-' + prerelease : "") + ( return "" + major + '.' + minor + '.' + patch + (prerelease.length() > 0 ? '-' + prerelease : "") + (

View file

@ -52,7 +52,7 @@ import java.util.Properties;
import java.util.Set; import java.util.Set;
/** /**
* The <code>VersionProcessor</code> class. * The <code>VersionProcessor</code> class implements a semantic version annotation processor.
* *
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a> * @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
* @created 2016-01-13 * @created 2016-01-13