Fixed javadoc.
This commit is contained in:
parent
b183d7bb09
commit
20ebb51070
3 changed files with 76 additions and 49 deletions
36
README.html
36
README.html
|
@ -75,11 +75,12 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
|
|||
<span class="dt">version.minor</span><span class="ot">=</span><span class="dv">0</span>
|
||||
<span class="dt">version.patch</span><span class="ot">=</span><span class="dv">0</span>
|
||||
<span class="dt">version.prerelease</span><span class="ot">=</span><span class="st">beta</span></code></pre></div>
|
||||
<p><a href="https://github.com/ethauvin/semver/tree/master/example">View Example</a></p>
|
||||
<h2 id="template">Template</h2>
|
||||
<p>Upon running the annotation processor, a source file <a href="https://github.com/ethauvin/semver/blob/master/example/src/generated/java/net/thauvin/erik/semver/example/GeneratedVersion.java"><code>GeneratedVersion.java</code></a> is automatically generated with static methods to access the semantic version data. The source is based on a fully customizable <a href="https://mustache.github.io/">Mustache</a> template.</p>
|
||||
<p>To use your own template, simply create a <code>version.mustache</code> file. The processor will automatically look for it.</p>
|
||||
<p>To specify your own template name, use:</p>
|
||||
<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="fu">@Version</span>(template = <span class="st">"myversion.mustache"</span>)
|
||||
<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="fu">@Version</span>(template = <span class="st">"version.mustache"</span>)
|
||||
<span class="kw">public</span> <span class="kw">class</span> A {
|
||||
<span class="co">// ...</span></code></pre></div>
|
||||
<h3 id="default-template">Default Template</h3>
|
||||
|
@ -94,42 +95,42 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
|
|||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><code>project</code></td>
|
||||
<td style="text-align: left;"><code>PROJECT</code></td>
|
||||
<td style="text-align: left;">The project name, if any.</td>
|
||||
<td style="text-align: left;"><code>MyProject</code></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><code>buildDate</code></td>
|
||||
<td style="text-align: left;"><code>BUILDDATE</code></td>
|
||||
<td style="text-align: left;">The build date.</td>
|
||||
<td style="text-align: left;"><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Date.html"><code>java.util.Date</code></a></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><code>version</code></td>
|
||||
<td style="text-align: left;"><code>VERSION</code></td>
|
||||
<td style="text-align: left;">The full version string.</td>
|
||||
<td style="text-align: left;"><code>1.0.0-alpha+001</code></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><code>major</code></td>
|
||||
<td style="text-align: left;"><code>MAJOR</code></td>
|
||||
<td style="text-align: left;">The major version.</td>
|
||||
<td style="text-align: left;"><code>1</code></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><code>minor</code></td>
|
||||
<td style="text-align: left;"><code>MINOR</code></td>
|
||||
<td style="text-align: left;">The minor version.</td>
|
||||
<td style="text-align: left;"><code>0</code></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><code>patch</code></td>
|
||||
<td style="text-align: left;"><code>PATCH</code></td>
|
||||
<td style="text-align: left;">The patch version.</td>
|
||||
<td style="text-align: left;"><code>0</code></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><code>preRelease</code></td>
|
||||
<td style="text-align: left;"><code>PRERELEASE</code></td>
|
||||
<td style="text-align: left;">The pre-release version, if any.</td>
|
||||
<td style="text-align: left;"><code>alpha</code></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><code>buildMeta</code></td>
|
||||
<td style="text-align: left;"><code>BUILDMETA</code></td>
|
||||
<td style="text-align: left;">The build metadata, if any.</td>
|
||||
<td style="text-align: left;"><code>001</code></td>
|
||||
</tr>
|
||||
|
@ -285,24 +286,30 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
|
|||
<td style="text-align: left;"></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><code>packageName</code></td>
|
||||
<td style="text-align: left;"></td>
|
||||
<td style="text-align: left;">The package name.</td>
|
||||
<td style="text-align: left;"><em>Same as annotated class</em></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><code>className</code></td>
|
||||
<td style="text-align: left;"></td>
|
||||
<td style="text-align: left;">The name of the generated class.</td>
|
||||
<td style="text-align: left;"><code>GeneratedVersion</code></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><code>properties</code></td>
|
||||
<td style="text-align: left;"></td>
|
||||
<td style="text-align: left;">The properties file.</td>
|
||||
<td style="text-align: left;"></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><code>template</code></td>
|
||||
<td style="text-align: left;"></td>
|
||||
<td style="text-align: left;">The template file.</td>
|
||||
<td style="text-align: left;"><code>version.mustache</code></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><code>type</code></td>
|
||||
<td style="text-align: left;"></td>
|
||||
<td style="text-align: left;">Either <code>java</code> or <code>kt</code> for Kotlin.</td>
|
||||
|
@ -346,7 +353,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
|
|||
<h4 id="class-source-generation">Class & Source Generation</h4>
|
||||
<p>In order to also incorporate the generated source code into the <code>source tree</code>, use the <a href="https://github.com/ewerk/gradle-plugins/tree/master/annotation-processor-plugin">EWERK Annotation Processor Plugin</a>. Start by adding the following to the very top of the <code>build.gradle</code> file:</p>
|
||||
<pre class="gradle"><code>plugins {
|
||||
id "com.ewerk.gradle.plugins.annotation-processor" version "1.0.3"
|
||||
id "com.ewerk.gradle.plugins.annotation-processor" version "1.0.4"
|
||||
}</code></pre>
|
||||
<p>Then add the following to the <code>build.gradle</code> file:</p>
|
||||
<pre class="gradle"><code>dependencies {
|
||||
|
@ -381,10 +388,11 @@ compileJava {
|
|||
<span class="kw">open</span> <span class="kw">class</span> Main {
|
||||
<span class="co">// ...</span></code></pre></div>
|
||||
<p>The <a href="https://github.com/ethauvin/semver/blob/master/src/main/resources/semver-kt.mustache">Kotlin default template</a> implements the same static fields and functions as the <a href="#default-template">Java template</a>.</p>
|
||||
<p>Please look at the <a href="https://github.com/ethauvin/semver-example-kotlin">Example for Kotlin</a> project for samples on using <a href="https://gradle.org/">Gradle</a> and <a href="http://beust.com/kobalt/">Kobalt</a>.</p>
|
||||
<p>Please look at the <a href="https://github.com/ethauvin/semver-example-kotlin">Example for Kotlin</a> project for samples on using Gradle (<a href="https://github.com/ethauvin/semver-example-kotlin/blob/master/build.gradle">build.gradle</a>) and Kobalt (<a href="https://github.com/ethauvin/semver-example-kotlin/blob/master/kobalt/src/Build.kt">Build.kt</a>).</p>
|
||||
<h3 id="auto-increment">Auto-Increment</h3>
|
||||
<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>
|
||||
<pre><code>gradle release run</code></pre>
|
||||
<p>For a solution using <a href="http://beust.com/kobalt/">Kobalt</a> look at my <a href="https://github.com/ethauvin/kobalt-property-file">Property File Editor</a> plug-in.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import com.beust.kobalt.buildScript
|
||||
import com.beust.kobalt.file
|
||||
import com.beust.kobalt.plugin.java.javadoc
|
||||
import com.beust.kobalt.plugin.packaging.assemble
|
||||
import com.beust.kobalt.plugin.packaging.install
|
||||
import com.beust.kobalt.plugin.publish.autoGitTag
|
||||
|
@ -16,10 +17,10 @@ import java.io.FileInputStream
|
|||
import java.util.*
|
||||
|
||||
val bs = buildScript {
|
||||
//repos(file("K:/maven/repository"))
|
||||
repos(file("K:/maven/repository"))
|
||||
plugins("net.thauvin.erik:kobalt-maven-local:",
|
||||
"net.thauvin.erik:kobalt-exec:",
|
||||
"net.thauvin.erik:kobalt-versioneye:")
|
||||
"net.thauvin.erik:kobalt-exec:",
|
||||
"net.thauvin.erik:kobalt-versioneye:")
|
||||
}
|
||||
|
||||
fun StringBuilder.prepend(s: String): StringBuilder {
|
||||
|
@ -47,12 +48,13 @@ fun versionFor(directory: String = "./"): String {
|
|||
val semver = project {
|
||||
|
||||
name = "semver"
|
||||
description = "Semantic Version Annotation Processor"
|
||||
group = "net.thauvin.erik"
|
||||
artifactId = name
|
||||
version = versionFor()
|
||||
|
||||
pom = Model().apply {
|
||||
description = "Semantic Version Annotation Processor"
|
||||
description = project.description
|
||||
url = "https://github.com/ethauvin/semver"
|
||||
licenses = listOf(License().apply {
|
||||
name = "BSD 3-Clause"
|
||||
|
@ -78,10 +80,6 @@ val semver = project {
|
|||
compile("org.testng:testng:6.11")
|
||||
}
|
||||
|
||||
install {
|
||||
target = "deploy"
|
||||
}
|
||||
|
||||
assemble {
|
||||
jar {
|
||||
//fatJar = true
|
||||
|
@ -91,6 +89,10 @@ val semver = project {
|
|||
}
|
||||
}
|
||||
|
||||
install {
|
||||
target = "deploy"
|
||||
}
|
||||
|
||||
autoGitTag {
|
||||
enabled = true
|
||||
message = "Version $version"
|
||||
|
@ -103,11 +105,25 @@ val semver = project {
|
|||
sign = true
|
||||
}
|
||||
|
||||
javadoc {
|
||||
title = project.description + ' ' + project.version
|
||||
tags("created")
|
||||
author = true
|
||||
//quiet = false
|
||||
//verbose = true
|
||||
links("http://docs.oracle.com/javase/8/docs/api/")
|
||||
}
|
||||
|
||||
exec {
|
||||
val args = listOf("--from", "markdown_github", "--to", "html5", "-s", "-c", "github-pandoc.css", "-o", "README.html", "README.md")
|
||||
commandLine(listOf("pandoc") + args, os = setOf(Os.LINUX))
|
||||
commandLine(listOf("cmd", "/c", "pandoc") + args, os = setOf(Os.WINDOWS))
|
||||
taskName = "pandoc"
|
||||
commandLine("pandoc",
|
||||
"--from", "markdown_github",
|
||||
"--to", "html5",
|
||||
"-s",
|
||||
"-c", "github-pandoc.css",
|
||||
"-o", "README.html",
|
||||
"README.md",
|
||||
os = setOf(Os.LINUX, Os.MINGW, Os.CYGWIN))
|
||||
}
|
||||
|
||||
versionEye {
|
||||
|
|
|
@ -13,38 +13,36 @@ import java.util.*
|
|||
* Annotation Processor</a>
|
||||
*/
|
||||
object {{className}} {
|
||||
@JvmField
|
||||
val PRERELEASE_PREFIX = "-"
|
||||
@JvmField val PRERELEASE_PREFIX = "-"
|
||||
|
||||
@JvmField
|
||||
val BUILDMEATA_PREFIX = "+"
|
||||
@JvmField val BUILDMEATA_PREFIX = "+"
|
||||
|
||||
@JvmField
|
||||
val PROJECT = "{{project}}"
|
||||
@JvmField val PROJECT = "{{project}}"
|
||||
|
||||
@JvmField
|
||||
val BUILDDATE = Date({{epoch}}L)
|
||||
@JvmField val BUILDDATE = Date({{epoch}}L)
|
||||
|
||||
@JvmField
|
||||
val MAJOR = {{major}}
|
||||
@JvmField val MAJOR = {{major}}
|
||||
|
||||
@JvmField
|
||||
val MINOR = {{minor}}
|
||||
@JvmField val MINOR = {{minor}}
|
||||
|
||||
@JvmField
|
||||
val PATCH = {{patch}}
|
||||
@JvmField val PATCH = {{patch}}
|
||||
|
||||
@JvmField
|
||||
val BUILDMETA = "{{buildMeta}}"
|
||||
@JvmField val BUILDMETA = "{{buildMeta}}"
|
||||
|
||||
@JvmField
|
||||
val PRERELEASE = "{{preRelease}}"
|
||||
@JvmField val PRERELEASE = "{{preRelease}}"
|
||||
|
||||
@JvmField
|
||||
val VERSION = "$MAJOR.$MINOR.$PATCH" + preReleaseWithPrefix() + buildMetaWithPrefix()
|
||||
/**
|
||||
* The full version string formatted as [MAJOR].[MINOR].[PATCH]-[PRERELEASE]+[BUILDMETA]
|
||||
*/
|
||||
@JvmField val VERSION = "$MAJOR.$MINOR.$PATCH" + preReleaseWithPrefix() + buildMetaWithPrefix()
|
||||
|
||||
@JvmStatic
|
||||
fun preReleaseWithPrefix(prefix: String = PRERELEASE_PREFIX): String {
|
||||
/**
|
||||
* Returns the pre-release version with prefix.
|
||||
*
|
||||
* @param prefix The prefix, defaults to [PRERELEASE_PREFIX].
|
||||
* @return The pre-release version, if any.
|
||||
*/
|
||||
@JvmStatic fun preReleaseWithPrefix(prefix: String = PRERELEASE_PREFIX): String {
|
||||
return if (PRERELEASE.isNotEmpty() && prefix.isNotEmpty()) {
|
||||
"$prefix$PRERELEASE"
|
||||
} else {
|
||||
|
@ -52,8 +50,13 @@ object {{className}} {
|
|||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun buildMetaWithPrefix(prefix: String = BUILDMEATA_PREFIX): String {
|
||||
/**
|
||||
* Returns the build metadata with prefix.
|
||||
*
|
||||
* @param prefix The prefix, defaults to [BUILDMEATA_PREFIX].
|
||||
* @return The build metadata, if any.
|
||||
*/
|
||||
@JvmStatic fun buildMetaWithPrefix(prefix: String = BUILDMEATA_PREFIX): String {
|
||||
return if (BUILDMETA.isNotEmpty() && prefix.isNotEmpty()) {
|
||||
"$prefix$BUILDMETA"
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue