From b8a1d3e14f1a8df69af3af6326e9714e3bad3c8b Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 21 Mar 2017 15:12:00 -0700 Subject: [PATCH 1/7] Tested with Kobalt 1.0.19 --- kobalt/wrapper/kobalt-wrapper.properties | 2 +- kobaltw | 3 +-- kobaltw-test | 3 +++ kobaltw.bat | 4 ++++ 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 kobaltw-test create mode 100644 kobaltw.bat diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index bb9154b..51854da 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=1.0.18 +kobalt.version=1.0.19 \ No newline at end of file diff --git a/kobaltw b/kobaltw index 3636641..c5186d5 100644 --- a/kobaltw +++ b/kobaltw @@ -1,3 +1,2 @@ #!/usr/bin/env sh -JAR=$(ls -1 -t /k/GitHub/kobalt/kobaltBuild/libs/*.jar | grep -v javadoc | grep -v sources | head -1) -java -jar $JAR $* +java -jar "`dirname "$0"`/kobalt/wrapper/kobalt-wrapper.jar" $* diff --git a/kobaltw-test b/kobaltw-test new file mode 100644 index 0000000..3636641 --- /dev/null +++ b/kobaltw-test @@ -0,0 +1,3 @@ +#!/usr/bin/env sh +JAR=$(ls -1 -t /k/GitHub/kobalt/kobaltBuild/libs/*.jar | grep -v javadoc | grep -v sources | head -1) +java -jar $JAR $* diff --git a/kobaltw.bat b/kobaltw.bat new file mode 100644 index 0000000..d578071 --- /dev/null +++ b/kobaltw.bat @@ -0,0 +1,4 @@ +@echo off +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +java -jar "%DIRNAME%/kobalt/wrapper/kobalt-wrapper.jar" %* From 7596e735df498d72ea6ea919afaa08498b7cd954 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 4 Apr 2017 20:15:03 -0700 Subject: [PATCH 2/7] collect() testing. --- kobalt/src/Build.kt | 15 ++++++++++++--- kobalt/wrapper/kobalt-wrapper.properties | 2 +- libs/kobalt-test-0.1.jar | Bin 0 -> 614 bytes 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 libs/kobalt-test-0.1.jar diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt index f7a7e50..13f0492 100644 --- a/kobalt/src/Build.kt +++ b/kobalt/src/Build.kt @@ -1,4 +1,5 @@ import com.beust.kobalt.* +import com.beust.kobalt.plugin.apt.* import com.beust.kobalt.plugin.packaging.* import com.beust.kobalt.plugin.publish.* import com.beust.kobalt.plugin.application.* @@ -9,6 +10,8 @@ val bs = buildScript { repos() } +val processorJar = file("K:\\java\\semver\\deploy\\semver-0.9.7.jar") + val p = project { @@ -43,11 +46,12 @@ val p = project { } dependencies { -// compile("com.beust:jcommander:1.48") + apt(processorJar) + compile("org.apache.velocity:velocity:1.7", processorJar) } dependenciesTest { - compile("org.testng:testng:6.10") + compile("org.testng:testng:6.11") } @@ -56,6 +60,11 @@ val p = project { } } + install { + libDir = "deploy" + println(collect(compileDependencies)) + } + application { mainClass = "com.example.Main" } @@ -69,4 +78,4 @@ val p = project { bintray { publish = false } -} +} \ No newline at end of file diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index 51854da..e8e88ab 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=1.0.19 \ No newline at end of file +kobalt.version=1.0.44 \ No newline at end of file diff --git a/libs/kobalt-test-0.1.jar b/libs/kobalt-test-0.1.jar new file mode 100644 index 0000000000000000000000000000000000000000..d75442d0104b1eb679dcb156d8189994a0dbbbd4 GIT binary patch literal 614 zcmWIWW@Zs#;Nak3Xs)U8Vn6~S3@i-3t|5-Po_=onzK(vLZmz*0dcJP|PBAb%e#*oU z;LXmlrgf1B3s4Ue5C`BiNen2PoS&&4Q5-w&381~GTRsYa_JG#4HVJie;EtzFIeW57`@+oTg)%kw2Z9WT?6)QS~7 z-Mz9irASxF*W(_CsIkfI?RPg;2rLx)sPSfbXP3L|^b^0!X7N1fEP7JZf8uxF^TW<3 z56|i^%`sq^Gv8}%Zh_mz2N%_t1u%7bj!Y6I9texgh(o5!r>IQ^P z-!WyS&VO*&=g;Yov0!9i*ayS`-i%Bl42XC{ju%ioq5@p8if#(B4WKwg08m1~9-{%? TtZX24OhDKLq>lkz$G`vp=V{eL literal 0 HcmV?d00001 From 615b4578a518a97d02dea8012c31e659464c1122 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 4 Apr 2017 21:54:53 -0700 Subject: [PATCH 3/7] Kobalt the destroyer --- kobalt/src/Build.kt | 2 +- kobalt/wrapper/kobalt-wrapper.properties | 2 +- libs/kobalt-test-0.1.jar | Bin 614 -> 0 bytes 3 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 libs/kobalt-test-0.1.jar diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt index 13f0492..338b748 100644 --- a/kobalt/src/Build.kt +++ b/kobalt/src/Build.kt @@ -62,7 +62,7 @@ val p = project { install { libDir = "deploy" - println(collect(compileDependencies)) + collect(compileDependencies).map { include(it) } } application { diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index e8e88ab..33af601 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=1.0.44 \ No newline at end of file +kobalt.version=1.0.49 \ No newline at end of file diff --git a/libs/kobalt-test-0.1.jar b/libs/kobalt-test-0.1.jar deleted file mode 100644 index d75442d0104b1eb679dcb156d8189994a0dbbbd4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 614 zcmWIWW@Zs#;Nak3Xs)U8Vn6~S3@i-3t|5-Po_=onzK(vLZmz*0dcJP|PBAb%e#*oU z;LXmlrgf1B3s4Ue5C`BiNen2PoS&&4Q5-w&381~GTRsYa_JG#4HVJie;EtzFIeW57`@+oTg)%kw2Z9WT?6)QS~7 z-Mz9irASxF*W(_CsIkfI?RPg;2rLx)sPSfbXP3L|^b^0!X7N1fEP7JZf8uxF^TW<3 z56|i^%`sq^Gv8}%Zh_mz2N%_t1u%7bj!Y6I9texgh(o5!r>IQ^P z-!WyS&VO*&=g;Yov0!9i*ayS`-i%Bl42XC{ju%ioq5@p8if#(B4WKwg08m1~9-{%? TtZX24OhDKLq>lkz$G`vp=V{eL From 7af5fe0893171434b12d80ade771396d41ef461b Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 5 Apr 2017 18:56:04 -0700 Subject: [PATCH 4/7] copy() not working quite right. --- kobalt/src/Build.kt | 4 +++- kobalt/wrapper/kobalt-wrapper.properties | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt index 338b748..fcb87df 100644 --- a/kobalt/src/Build.kt +++ b/kobalt/src/Build.kt @@ -62,7 +62,9 @@ val p = project { install { libDir = "deploy" - collect(compileDependencies).map { include(it) } + collect(compileDependencies).forEach { + copy(it.absolutePath, to("${libDir}/lib")) + } } application { diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index 33af601..48ffa7f 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=1.0.49 \ No newline at end of file +kobalt.version=1.0.51 \ No newline at end of file From a3e59d91cd8ce93089a52d2b41308406e561b904 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 12 Apr 2017 19:28:08 -0700 Subject: [PATCH 5/7] Switched to egrep. --- kobaltw-test | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kobaltw-test b/kobaltw-test index 3636641..06230ec 100644 --- a/kobaltw-test +++ b/kobaltw-test @@ -1,3 +1,4 @@ #!/usr/bin/env sh -JAR=$(ls -1 -t /k/GitHub/kobalt/kobaltBuild/libs/*.jar | grep -v javadoc | grep -v sources | head -1) +JAR=$(ls -1 -t /k/GitHub/kobalt/kobaltBuild/libs/*.jar | egrep -v "(sources|javadoc)" | head -1) +export KOBALT_JAR=$JAR java -jar $JAR $* From fbede2207ccf6ad68eb3adf82831a3582c7c0e1b Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 12 Apr 2017 19:28:59 -0700 Subject: [PATCH 6/7] Added semver annotation processor. --- kobalt/src/Build.kt | 58 ++++--- .../java/com/example/GeneratedVersion.java | 157 ++++++++++++++++++ src/main/java/com/example/Main.java | 5 +- 3 files changed, 196 insertions(+), 24 deletions(-) create mode 100644 src/generated/java/com/example/GeneratedVersion.java diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt index fcb87df..723b234 100644 --- a/kobalt/src/Build.kt +++ b/kobalt/src/Build.kt @@ -1,17 +1,20 @@ import com.beust.kobalt.* -import com.beust.kobalt.plugin.apt.* -import com.beust.kobalt.plugin.packaging.* -import com.beust.kobalt.plugin.publish.* -import com.beust.kobalt.plugin.application.* -import com.beust.kobalt.plugin.java.* +import com.beust.kobalt.plugin.application.application +import com.beust.kobalt.plugin.apt.apt +import com.beust.kobalt.plugin.packaging.assemble +import com.beust.kobalt.plugin.packaging.install +import com.beust.kobalt.plugin.publish.autoGitTag +import com.beust.kobalt.plugin.publish.bintray import org.apache.maven.model.* val bs = buildScript { repos() } -val processorJar = file("K:\\java\\semver\\deploy\\semver-0.9.7.jar") +val processorJar = "net.thauvin.erik:semver:0.9.6-beta" +val mainClassName = "com.example.Main" +val lib = "lib" val p = project { @@ -37,17 +40,10 @@ val p = project { }) } - sourceDirectories { - path("src/main/java") - } - - sourceDirectoriesTest { - path("src/test/java") - } - dependencies { - apt(processorJar) - compile("org.apache.velocity:velocity:1.7", processorJar) + apt(processorJar) + compile("org.twitter4j:twitter4j-core:4.0.6") + compileOnly(processorJar) } dependenciesTest { @@ -57,13 +53,13 @@ val p = project { assemble { jar { - } - } - - install { - libDir = "deploy" - collect(compileDependencies).forEach { - copy(it.absolutePath, to("${libDir}/lib")) + manifest { + attributes("Main-Class", mainClassName) + attributes("Class-Path", + collect(compileDependencies) + .map { it.file.name } + .joinToString(" ./$lib/", prefix = ". ./$lib/")) + } } } @@ -71,6 +67,22 @@ val p = project { mainClass = "com.example.Main" } + install { + target = "deploy" + include(from("kobaltBuild/libs"), to(target), glob("**/*")) + collect(compileDependencies).forEach { + copy(from(it.file.absolutePath), to("$target/$lib")) + } + } + + apt { + outputDir = "src/generated/java/" + } + + application { + mainClass = mainClassName + } + autoGitTag { enabled = true message = "Version $version" diff --git a/src/generated/java/com/example/GeneratedVersion.java b/src/generated/java/com/example/GeneratedVersion.java new file mode 100644 index 0000000..75d2688 --- /dev/null +++ b/src/generated/java/com/example/GeneratedVersion.java @@ -0,0 +1,157 @@ +/* + * This file is automatically generated. + * Do not modify! -- ALL CHANGES WILL BE ERASED! + */ +package com.example; + +import java.util.Date; + +/** + * Provides semantic version information. + * + * @author Semantic Version + * Annotation Processor + */ +public final class GeneratedVersion { + private final static String buildmeta = ""; + private final static Date date = new Date(1492033276280L); + private final static int major = 1; + private final static int minor = 0; + private final static int patch = 0; + private final static String prerelease = "beta"; + private final static String project = ""; + + /** + * Disables the default constructor. + * + * @throws UnsupportedOperationException If the constructor is called. + */ + private GeneratedVersion() + throws UnsupportedOperationException { + throw new UnsupportedOperationException("Illegal constructor call."); + } + + /** + * Returns the build date. + * + * @return The build date. + */ + public static Date getBuildDate() { + return date; + } + + /** + * Returns the project name. + * + * @return The project name, if any. + */ + public static String getProject() { + return project; + } + + /** + * Returns the full version string. + *

+ * Formatted as: + *

+ * MAJOR.MINOR.PATCH[-PRERELEASE][+BUILDMETADATA] + *
+ *

+ * For example: + *

    + *
  • 1.0.0
  • + *
  • 1.0.0-beta
  • + *
  • 1.0.0+20160124144700
  • + *
  • 1.0.0-alpha+001
  • + *
+ * + * @return The version string. + */ + public static String getVersion() { + return Integer.toString(getMajor()) + '.' + + Integer.toString(getMinor()) + '.' + + Integer.toString(getPatch()) + + getPreRelease(true) + getBuildMetadata(true); + } + + /** + * Returns the major version. + * + * @return The major version. + */ + public static int getMajor() { + return major; + } + + /** + * Returns the minor version. + * + * @return The minor version. + */ + public static int getMinor() { + return minor; + } + + /** + * Returns the patch version. + * + * @return The patch version. + */ + public static int getPatch() { + return patch; + } + + /** + * Returns the pre-release version. + * + * @param isHyphen Prepend a hyphen, if true. + * @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. + * + * @return The pre-release version, if any. + */ + public static String getPreRelease() { + return getPreRelease(false); + } + + /** + * Returns the build metadata. + * + * @param isPlus Prepend a plus sign, if true. + * @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 ""; + } + + /** + * Returns the build metadata. + * + * @return The build metadata, if any. + */ + public static String getBuildMetadata() { + return getBuildMetadata(false); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/Main.java b/src/main/java/com/example/Main.java index c07945d..9ad5eeb 100644 --- a/src/main/java/com/example/Main.java +++ b/src/main/java/com/example/Main.java @@ -1,7 +1,10 @@ package com.example; +import net.thauvin.erik.semver.Version; + +@Version(major = 1, minor = 0, patch = 0, prerelease = "beta") class Main { public static void main(String[] argv) { - System.out.println("\n\nHello Java world from Kobalt\n\n"); + System.out.println(GeneratedVersion.getVersion()); } } \ No newline at end of file From 9cbe98d479d0699e71ae7b3f866231746d3f1fda Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 12 Apr 2017 19:29:24 -0700 Subject: [PATCH 7/7] IDEA files updates. --- .gitignore | 7 +- .idea/encodings.xml | 6 ++ .idea/inspectionProfiles/Project_Default.xml | 53 +++++++++++++ .idea/kobalt-test.iml | 78 ++++++++++++++++++++ .idea/kobalt.xml | 19 +++++ .idea/kotlinc.xml | 7 ++ .idea/misc.xml | 77 +++++++++++++++++++ .idea/modules.xml | 9 +++ .idea/vcs.xml | 7 ++ kobalt/Build.kt.iml | 24 ++++++ kobalt/wrapper/kobalt-wrapper.properties | 2 +- 11 files changed, 285 insertions(+), 4 deletions(-) create mode 100644 .idea/encodings.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/kobalt-test.iml create mode 100644 .idea/kobalt.xml create mode 100644 .idea/kotlinc.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 kobalt/Build.kt.iml diff --git a/.gitignore b/.gitignore index 24f188e..ba3d3ee 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,8 @@ **/.idea/tasks.xml **/.idea/workspace.xml *.iws -.DS_Store .classpath +.DS_Store .gradle .kobalt .nb-gradle @@ -17,12 +17,13 @@ /dist /gen /gradle.properties +/lib /local.properties /out /proguard-project.txt /project.properties /target /test-output -Thumbs.db ehthumbs.db -kobaltBuild \ No newline at end of file +kobaltBuild +Thumbs.db \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..8ff795e --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,53 @@ + + + + \ No newline at end of file diff --git a/.idea/kobalt-test.iml b/.idea/kobalt-test.iml new file mode 100644 index 0000000..671b7d1 --- /dev/null +++ b/.idea/kobalt-test.iml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/kobalt.xml b/.idea/kobalt.xml new file mode 100644 index 0000000..c5fd14d --- /dev/null +++ b/.idea/kobalt.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..1c24f9a --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..de2c941 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + Java + + + Portability issuesJava + + + + + Android + + + + + + + + + + + commons-logging-api + + + + + + + + 1.8.x + + + + + + + + 1.8.x + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..75e0758 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..8306744 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/kobalt/Build.kt.iml b/kobalt/Build.kt.iml new file mode 100644 index 0000000..85fc542 --- /dev/null +++ b/kobalt/Build.kt.iml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index 48ffa7f..11e416c 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=1.0.51 \ No newline at end of file +kobalt.version=1.0.60 \ No newline at end of file