From f823f3be8c9575abb3fdc164980b5ff163bb712a Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 8 Mar 2017 01:29:35 -0800 Subject: [PATCH] Added examples to main build file. --- .idea/encodings.xml | 6 -- .idea/inspectionProfiles/Project_Default.xml | 10 +-- .idea/kobalt.xml | 12 +--- .idea/misc.xml | 4 +- .idea/modules.xml | 2 +- .idea/vcs.xml | 2 - example/example.iml | 7 +- example/example2.iml | 7 +- example/kobalt/src/Build.kt | 9 ++- .../kobalt/wrapper/kobalt-wrapper.properties | 2 +- kobalt-exec.iml | 5 +- kobalt/Build.kt.iml | 40 +++++++++++ kobalt/src/Build.kt | 69 ++++++++++++++++++- kobalt/wrapper/kobalt-wrapper.properties | 2 +- 14 files changed, 135 insertions(+), 42 deletions(-) delete mode 100644 .idea/encodings.xml create mode 100644 kobalt/Build.kt.iml diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 97626ba..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 8ff795e..17b1e81 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -1,8 +1,9 @@ diff --git a/.idea/kobalt.xml b/.idea/kobalt.xml index ed2be6d..52b4669 100644 --- a/.idea/kobalt.xml +++ b/.idea/kobalt.xml @@ -5,23 +5,13 @@ - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index fbc2102..f1a9bb1 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,4 @@ - - - + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 720e369..e443ce8 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,7 @@ - + diff --git a/.idea/vcs.xml b/.idea/vcs.xml index c42d940..d175698 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -4,7 +4,5 @@ - - \ No newline at end of file diff --git a/example/example.iml b/example/example.iml index 0e41929..a07481d 100644 --- a/example/example.iml +++ b/example/example.iml @@ -1,8 +1,8 @@ - + - - + + @@ -11,5 +11,6 @@ + \ No newline at end of file diff --git a/example/example2.iml b/example/example2.iml index c661fd1..7109c9b 100644 --- a/example/example2.iml +++ b/example/example2.iml @@ -1,8 +1,8 @@ - + - - + + @@ -11,5 +11,6 @@ + \ No newline at end of file diff --git a/example/kobalt/src/Build.kt b/example/kobalt/src/Build.kt index ba62bf0..256c64a 100644 --- a/example/kobalt/src/Build.kt +++ b/example/kobalt/src/Build.kt @@ -1,10 +1,13 @@ import com.beust.kobalt.* -import com.beust.kobalt.plugin.application.application -import com.beust.kobalt.plugin.packaging.assemble +import com.beust.kobalt.plugin.application.* +import com.beust.kobalt.plugin.packaging.* import net.thauvin.erik.kobalt.plugin.exec.* +// ./kobaltw exec +// ./kobaltw example:exec +// ./kobaltw example2:exec + val bs = buildScript { - //plugins(file("../kobaltBuild/libs/kobalt-exec-0.6.3.jar")) plugins("net.thauvin.erik:kobalt-exec:") } diff --git a/example/kobalt/wrapper/kobalt-wrapper.properties b/example/kobalt/wrapper/kobalt-wrapper.properties index 91fe49a..1ec9521 100644 --- a/example/kobalt/wrapper/kobalt-wrapper.properties +++ b/example/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=1.0.3 \ No newline at end of file +kobalt.version=1.0.5 \ No newline at end of file diff --git a/kobalt-exec.iml b/kobalt-exec.iml index 24686a0..b9f476d 100644 --- a/kobalt-exec.iml +++ b/kobalt-exec.iml @@ -5,8 +5,9 @@ - - + + + diff --git a/kobalt/Build.kt.iml b/kobalt/Build.kt.iml new file mode 100644 index 0000000..c6d6e39 --- /dev/null +++ b/kobalt/Build.kt.iml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt index ff30d1e..e931620 100644 --- a/kobalt/src/Build.kt +++ b/kobalt/src/Build.kt @@ -1,15 +1,29 @@ import com.beust.kobalt.buildScript +import com.beust.kobalt.file +import com.beust.kobalt.misc.kobaltLog +import com.beust.kobalt.plugin.application.application import com.beust.kobalt.plugin.packaging.assemble import com.beust.kobalt.plugin.publish.bintray import com.beust.kobalt.project +import net.thauvin.erik.kobalt.plugin.exec.Os +import net.thauvin.erik.kobalt.plugin.exec.exec import net.thauvin.erik.kobalt.plugin.versioneye.versionEye import org.apache.maven.model.Developer import org.apache.maven.model.License import org.apache.maven.model.Model import org.apache.maven.model.Scm +val semver = "0.6.3" + val bs = buildScript { - plugins("net.thauvin.erik:kobalt-versioneye:") + val f = java.io.File("kobaltBuild/libs/kobalt-exec-$semver.jar") + val p = if (f.exists()) { + kobaltLog(1, " >>> Using: ${f.path}") + file(f.path) + } else { + "net.thauvin.erik:kobalt-exec:" + } + plugins("net.thauvin.erik:kobalt-versioneye:", p) } val dev = false @@ -20,7 +34,7 @@ val p = project { name = "kobalt-exec" group = "net.thauvin.erik" artifactId = name - version = "0.6.3" + version = semver pom = Model().apply { description = "Command Line Execution plug-in for the Kobalt build system." @@ -71,3 +85,54 @@ val p = project { team = "Owners" } } + +val example = project(p) { + + name = "example" + group = "com.example" + artifactId = name + version = "0.1" + directory = ("example") + + sourceDirectories { + path("src/main/java") + } + + sourceDirectoriesTest { + path("src/test/java") + } + + dependencies { + } + + dependenciesTest { + } + + assemble { + jar { + } + } + + application { + mainClass = "com.example.Main" + } + + exec { + commandLine(listOf("echo", "Test Example 1"), os = setOf(Os.LINUX)) + commandLine(listOf("cmd", "/c", "echo", "Test Example 1"), os = setOf(Os.WINDOWS)) + commandLine(args = listOf("ls", "-l"), dir = "../libs", os = setOf(Os.LINUX)) + commandLine(args = listOf("cmd", "/c", "dir /Q"), dir = "../libs", os = setOf(Os.WINDOWS)) + } +} + +val example2 = project(p) { + name = "example2" + directory = "example" + + exec { + commandLine(listOf("cmd", "/c", "echo", "Test Example 2"), os = setOf(Os.WINDOWS)) + commandLine(listOf("echo", "Test example 2"), os = setOf(Os.LINUX)) + //commandLine(listOf("cmd", "/c", "tasklist | find \"cmd.exe\""), os = setOf(Os.WINDOWS), fail = setOf(Fail.NONE)) + commandLine(listOf("/bin/sh", "-c", "ps aux | grep bash"), os = setOf(Os.LINUX)) + } +} diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index 91fe49a..1ec9521 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=1.0.3 \ No newline at end of file +kobalt.version=1.0.5 \ No newline at end of file