From bce3a325759938bab2ef231c80148b0865e169d1 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sun, 10 Jul 2016 21:29:09 -0700 Subject: [PATCH] Initial commit. --- .gitignore | 29 +++++ .idea/compiler.xml | 23 ++++ .idea/copyright/Erik_s_Copyright_Notice.xml | 6 ++ .idea/copyright/profiles_settings.xml | 11 ++ .idea/encodings.xml | 6 ++ .idea/inspectionProfiles/Project_Default.xml | 53 +++++++++ .../inspectionProfiles/profiles_settings.xml | 7 ++ .idea/kobalt.xml | 29 +++++ .idea/misc.xml | 64 +++++++++++ .idea/modules.xml | 10 ++ .idea/scopes/Source.xml | 3 + example/example.iml | 28 +++++ example/kobalt/src/Build.kt | 37 +++++++ example/kobalt/wrapper/kobalt-wrapper.jar | Bin 0 -> 8829 bytes .../kobalt/wrapper/kobalt-wrapper.properties | 1 + example/kobaltw | 1 + example/src/main/java/com/example/Main.java | 7 ++ .../test/java/com/example/ExampleTest.java | 9 ++ kobalt-exec.iml | 73 +++++++++++++ kobalt/Build.kt.iml | 12 +++ kobalt/src/Build.kt | 37 +++++++ kobalt/wrapper/kobalt-wrapper.properties | 1 + .../erik/kobalt/plugin/exec/ExecPlugin.kt | 101 ++++++++++++++++++ src/main/resources/META-INF/kobalt-plugin.xml | 6 ++ src/test/kotlin/com/example/MainTest.kt | 39 +++++++ 25 files changed, 593 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/compiler.xml create mode 100644 .idea/copyright/Erik_s_Copyright_Notice.xml create mode 100644 .idea/copyright/profiles_settings.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/kobalt.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/scopes/Source.xml create mode 100644 example/example.iml create mode 100644 example/kobalt/src/Build.kt create mode 100644 example/kobalt/wrapper/kobalt-wrapper.jar create mode 100644 example/kobalt/wrapper/kobalt-wrapper.properties create mode 100644 example/kobaltw create mode 100644 example/src/main/java/com/example/Main.java create mode 100644 example/src/test/java/com/example/ExampleTest.java create mode 100644 kobalt-exec.iml create mode 100644 kobalt/Build.kt.iml create mode 100644 kobalt/src/Build.kt create mode 100644 kobalt/wrapper/kobalt-wrapper.properties create mode 100644 src/main/kotlin/net/thauvin/erik/kobalt/plugin/exec/ExecPlugin.kt create mode 100644 src/main/resources/META-INF/kobalt-plugin.xml create mode 100644 src/test/kotlin/com/example/MainTest.kt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..87ff9b0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +**/.idea/dictionaries +**/.idea/gradle.xml +**/.idea/libraries +**/.idea/tasks.xml +**/.idea/workspace.xml +*.iws +.DS_Store +.classpath +.gradle +.kobalt +.nb-gradle +.project +.settings +/bin +/build +/deploy +/dist +/gen +/gradle.properties +/libs +/local.properties +/out +/proguard-project.txt +/project.properties +/target +/test-output +Thumbs.db +ehthumbs.db +kobaltBuild \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..a852314 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/.idea/copyright/Erik_s_Copyright_Notice.xml b/.idea/copyright/Erik_s_Copyright_Notice.xml new file mode 100644 index 0000000..5cd1489 --- /dev/null +++ b/.idea/copyright/Erik_s_Copyright_Notice.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..2bbc8ca --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ 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/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..3b31283 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/kobalt.xml b/.idea/kobalt.xml new file mode 100644 index 0000000..18044a8 --- /dev/null +++ b/.idea/kobalt.xml @@ -0,0 +1,29 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..30626e1 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..47c9da8 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/scopes/Source.xml b/.idea/scopes/Source.xml new file mode 100644 index 0000000..5ed504c --- /dev/null +++ b/.idea/scopes/Source.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/example/example.iml b/example/example.iml new file mode 100644 index 0000000..514e55d --- /dev/null +++ b/example/example.iml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/example/kobalt/src/Build.kt b/example/kobalt/src/Build.kt new file mode 100644 index 0000000..ab4c586 --- /dev/null +++ b/example/kobalt/src/Build.kt @@ -0,0 +1,37 @@ +import com.beust.kobalt.* +import com.beust.kobalt.plugin.packaging.* +import com.beust.kobalt.plugin.application.* +import com.beust.kobalt.plugin.java.* +//import net.thauvin.erik.kobalt.plugin.exec.* + +val p = project { + + name = "example" + group = "com.example" + artifactId = name + version = "0.1" + + sourceDirectories { + path("src/main/java") + } + + sourceDirectoriesTest { + path("src/test/java") + } + + dependencies { + compile(file("../libs/kobalt-exec-0.1.jar")) + } + + dependenciesTest { + } + + assemble { + jar { + } + } + + application { + mainClass = "com.example.Main" + } +} diff --git a/example/kobalt/wrapper/kobalt-wrapper.jar b/example/kobalt/wrapper/kobalt-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..f40ec90499fba75a9728f76fa503d2a1f3b2b603 GIT binary patch literal 8829 zcma)?1xy@FyYF!+#oZQ%;uL2~vBj4Kik2?!P~6>}0!52-OY!3F4#i!IyTjtHx9|P# z$@%WdImvk@lbK}xGxI#jSSCMJFfs}e0tN;Kf-~{HJi@;j5dsPVL`FlBQ$bml8zQN! zASYCO|?Yuo3L;o&LQQ3VdJIyL#xu^F%; z=U>gxsEXn+>jXQuBF7tf&Pim}jqQzXBm`A3I!4XpskijsIseJ3|Dz`ie_KuLZMluj zT%BFGKieA{*|>1KI~h4Rm^pDnjI8XqOl*vtos+#VeKcmSUPOfWE>@HP3S<~Ov_K5` zezs`*Fc~C9JWK_~Ks*Vfgx8EbrW?Z{J$X@4&02?A6`H!6TEx?g5mB1av%ZCzpFhJ_ zGHbm{!4r?|yRAZrX?WA(G#4w)H$S|O8+U(Pyx(0q>nR8LM@8fpu3A!^j~nTipP}KJ zoq7qqtsl%83GVaqw7EQG#u@r!4qFUmqmRMy{9fod4Vsq{jyD1JZ7&yIkihB>T1H~h z76rtHKsg?*qZUICRIst+!qxa*Pk>mayT>h3n<`1`n?(2X9$v3VAHAY8v-39H&G<>r zP!7Mm@bZmfnY|OQTZ%TV-4oASVA~2v~5dGfghyt@oY9~2teM5lNe2j%%h ziIB< z)bmk!cXcS`nO5}qO`Q1tqXq0mWjBuhIXXjpr+x6;f9m!G_|gs1K4k~KsBijv?lt>F z_r6?@*FMsC`q0M}=TTxkYp41bU04A9%PvTPe|vWW{R=O&fj9e66~BxjtUTJ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}0WrG$ z>X~cc@8d15+q?MAF|ivO8~3bRE@g*yhu+`rCvP`R&2X!=xb zed8)ry2F*LeWRLsl6QD3))apthjhxb+~Ylhp(Qa|?$9BBM6q*bl>5au;z7$Vj!%#E z2A?BXnEgE@CT75rTCyeuYf1*yymToeMTg1Qk>JojGX-Je5V!TRuPZ5}{^fbKhBW|{XeH2;KqjQ^^W&>B=9IfuKKil zUh>r49~x<}8r9-o>F33!Sn)`9<6&?RFmV^lof-h1<*Wn1RSmRBE&2 zo$X0%lWh2nziZrhBeG3QEQ3(d*#tk%{ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kobalt/Build.kt.iml b/kobalt/Build.kt.iml new file mode 100644 index 0000000..7bc9dd6 --- /dev/null +++ b/kobalt/Build.kt.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt new file mode 100644 index 0000000..8fe41de --- /dev/null +++ b/kobalt/src/Build.kt @@ -0,0 +1,37 @@ +import com.beust.kobalt.plugin.packaging.assemble +import com.beust.kobalt.project +import com.beust.kobalt.repos + +val repos = repos() + +val dev = true +val kobaltDependency = if (dev) "kobalt" else "kobalt-plugin-api" + +val p = project { + + name = "kobalt-exec" + group = "net.thauvin.erik.kobalt" + artifactId = name + version = "0.1" + + sourceDirectories { + path("src/main/kotlin") + } + + sourceDirectoriesTest { + path("src/test/kotlin") + } + + dependencies { + compile("com.beust:$kobaltDependency:0.725") + } + + dependenciesTest { + compile("org.testng:testng:") + + } + + assemble { + jar {} + } +} diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties new file mode 100644 index 0000000..40e4395 --- /dev/null +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -0,0 +1 @@ +kobalt.version=0.843 \ No newline at end of file diff --git a/src/main/kotlin/net/thauvin/erik/kobalt/plugin/exec/ExecPlugin.kt b/src/main/kotlin/net/thauvin/erik/kobalt/plugin/exec/ExecPlugin.kt new file mode 100644 index 0000000..1556b9b --- /dev/null +++ b/src/main/kotlin/net/thauvin/erik/kobalt/plugin/exec/ExecPlugin.kt @@ -0,0 +1,101 @@ +/* + * ExecPlugin.kt + * + * 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.kobalt.plugin.exec + +import com.beust.kobalt.TaskResult +import com.beust.kobalt.api.* +import com.beust.kobalt.api.annotation.Directive +import com.beust.kobalt.api.annotation.Task +import com.beust.kobalt.misc.log + +class ExecPlugin : BasePlugin(), ITaskContributor { + + fun main(argv: Array) { + com.beust.kobalt.main(argv) + } + + // ITaskContributor + override fun tasksFor(context: KobaltContext): List { + return emptyList() + } + + + companion object { + const val NAME: String = "kobalt-exec" + } + + override val name = NAME + + @Task(name = "exec", description = "Executes a command line process.") + fun taskExec(project: Project): TaskResult { + return executeCommands(project) + } + + private fun executeCommands(project: Project): TaskResult { + var success = false + val config = configs[project.name] + + if (config != null) { + config.commandLines.forEach { + log(2, "Executing: '" + { it.args.joinToString { " " } } + "' in '{$it.dir}'") + success = true + } + } + + return TaskResult(success) + } + + private val configs = hashMapOf() + fun addExecConfig(projectName: String, config: ExecConfig) { + configs.put(projectName, config) + } +} + +data class CommandLine(var os: String = "", var dir: String = "", var args: Array = emptyArray()) + +data class ExecConfig(val project: Project) { + val commandLines = arrayListOf() + + @Directive + public fun commandLine(os: String = "", dir: String = "", args: Array = emptyArray()) { + if (args.size > 0) commandLines.add(CommandLine(os, dir, args)) + } +} + +@Directive +fun Project.exec(init: ExecConfig.() -> Unit): ExecConfig { + with(ExecConfig(this)) { + init() + (Kobalt.findPlugin(ExecPlugin.NAME) as ExecPlugin).addExecConfig(name, this) + return this + } +} \ No newline at end of file diff --git a/src/main/resources/META-INF/kobalt-plugin.xml b/src/main/resources/META-INF/kobalt-plugin.xml new file mode 100644 index 0000000..1cab08a --- /dev/null +++ b/src/main/resources/META-INF/kobalt-plugin.xml @@ -0,0 +1,6 @@ + + kobalt-exec + + net.thauvin.erik.kobalt.plugin.exec.ExecPlugin + + \ No newline at end of file diff --git a/src/test/kotlin/com/example/MainTest.kt b/src/test/kotlin/com/example/MainTest.kt new file mode 100644 index 0000000..c2a547d --- /dev/null +++ b/src/test/kotlin/com/example/MainTest.kt @@ -0,0 +1,39 @@ +/* + * MainTest.kt + * + * 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 com.example + +import org.testng.annotations.Test + +class ExampleTest { + @Test + fun f() = println("Running test") +} \ No newline at end of file