diff --git a/.circleci/config.yml b/.circleci/config.yml
deleted file mode 100644
index dffffe6..0000000
--- a/.circleci/config.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-version: 2
-jobs:
- build:
- docker:
- - image: circleci/openjdk:8-jdk
-
- working_directory: ~/repo
-
- environment:
- JVM_OPTS: -Xmx3200m
- TERM: dumb
-
- steps:
- - checkout
- - restore_cache:
- keys:
- - kobalt-dependencies-{{ checksum "kobalt/src/Build.kt" }}
- # fallback to using the latest cache if no exact match is found
- - kobalt-dependencies-
-
- - run:
- name: Check Versions
- command: ./kobaltw checkVersions
-
- - save_cache:
- paths: ~/.kobalt
- key: kobalt-dependencies-{{ checksum "kobalt/src/Build.kt" }}
-
- - run:
- name: Assemble
- command: ./kobaltw assemble
\ No newline at end of file
diff --git a/.gitattributes b/.gitattributes
index 6ec2ae2..92d2493 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,5 +1,4 @@
-# Set the default behavior, in case people don't have core.autocrlf set.
-* text=auto
+# Normalize line endings in text files to LF on checkin.
+# (this overrides core.autocrlf)
-# batch files are specific to windows and always crlf
-*.bat eol=crlf
+* text=auto
diff --git a/.gitignore b/.gitignore
index 173de82..58a18f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,9 +4,8 @@
**/.idea/tasks.xml
**/.idea/workspace.xml
*.iws
-*.sublime-*
-.classpath
.DS_Store
+.classpath
.gradle
.kobalt
.nb-gradle
@@ -16,10 +15,8 @@
/build
/deploy
/dist
-/example/libs/
/gen
/gradle.properties
-/lib
/libs
/local.properties
/out
@@ -27,6 +24,7 @@
/project.properties
/target
/test-output
+Thumbs.db
ehthumbs.db
kobaltBuild
-Thumbs.db
\ No newline at end of file
+/example/libs/
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
index 6763f1b..5cd1489 100644
--- a/.idea/copyright/Erik_s_Copyright_Notice.xml
+++ b/.idea/copyright/Erik_s_Copyright_Notice.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
index 2bbc8ca..89ab48c 100644
--- a/.idea/copyright/profiles_settings.xml
+++ b/.idea/copyright/profiles_settings.xml
@@ -1,5 +1,5 @@
-
+
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
index c71b85c..c63b8f8 100644
--- a/.idea/kobalt.xml
+++ b/.idea/kobalt.xml
@@ -4,15 +4,9 @@
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 7826943..cbe635d 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -38,29 +38,31 @@
-
-
-
-
-
-
-
-
- Java
-
-
- Portability issuesJava
-
-
-
-
- Android
-
-
-
-
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 48f8f9e..de1fa43 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -3,7 +3,6 @@
-
\ No newline at end of file
diff --git a/.idea/scopes/Copyright.xml b/.idea/scopes/Copyright.xml
deleted file mode 100644
index e487d4e..0000000
--- a/.idea/scopes/Copyright.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/.idea/scopes/Source.xml b/.idea/scopes/Source.xml
new file mode 100644
index 0000000..f3b802c
--- /dev/null
+++ b/.idea/scopes/Source.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 94a25f7..4c0d94b 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -2,5 +2,8 @@
+
+
+
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 9b93be0..aa9226e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,7 +13,4 @@ cache:
- $HOME/.m2
- $HOME/.kobalt
-before_cache:
- - rm -rf .kobalt/*
-
script: ./kobaltw clean assemble
diff --git a/LICENSE.txt b/LICENSE.txt
index f30d392..84fe1dc 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2016-2017, Erik C. Thauvin (erik@thauvin.net)
+Copyright (c) 2016, Erik C. Thauvin (erik@thauvin.net)
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/README.md b/README.md
index 7081070..a51de8a 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Command Line Execution plug-in for [Kobalt](http://beust.com/kobalt/home/index.html)
-[](http://opensource.org/licenses/BSD-3-Clause) [](https://github.com/ethauvin/kobalt-exec/releases/latest) [](https://travis-ci.org/ethauvin/kobalt-exec) [](https://circleci.com/gh/ethauvin/kobalt-exec/tree/master) [](https://bintray.com/ethauvin/maven/kobalt-exec/_latestVersion)
+[](http://opensource.org/licenses/BSD-3-Clause) [](https://travis-ci.org/ethauvin/kobalt-exec) [](https://bintray.com/ethauvin/maven/kobalt-exec/_latestVersion)
The plug-in allows for the execution of system commands, similarly to the [Gradle Exec](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.Exec.html) or [Ant Exec](https://ant.apache.org/manual/Tasks/exec.html) tasks.
@@ -9,15 +9,13 @@ To use the plug-in include the following in your `Build.kt` file:
```kotlin
import net.thauvin.erik.kobalt.plugin.exec.*
-val bs = buildScript {
- plugins("net.thauvin.erik:kobalt-exc:")
-}
+val pl = plugins("net.thauvin.erik:kobalt-exc:")
val p = project {
name = "example"
-
+
exec {
- commandLine("echo", "Hello, World!")
+ commandLine(listOf("echo", "Hello, World!"))
}
}
```
@@ -35,10 +33,9 @@ The `commandLine` directive is used to execute command line(s) during the build
```kotlin
exec {
- commandLine("cmd", "/c", "stop.bat", dir = "../tomcat/bin", os = setOf(Os.WINDOWS))
- commandLine("./stop.sh", dir = "../tomcat/bin", os = setOf(Os.MAC, Os.LINUX))
- commandLine("sh", "-c", "ps aux | grep tomcat", os = setOf(Os.MAC, Os.LINUX), fail = setOf(Fail.EXIT))
- commandLine("cmd", "/c", "tasklist | find \"tomcat\"", os = setOf(Os.WINDOWS), fail = setOf(Fail.EXIT))
+ commandLine(listOf("cmd", "/c", "stop.bat"), dir = "../tomcat/bin", os = setOf(Os.WINDOWS))
+ commandLine(listOf("./stop.sh"), dir = "../tomcat/bin", os = setOf(Os.MAC, Os.LINUX))
+ commandLine(listOf("/bin/sh", "-c", "ps aux | grep tomcat"), fail = setOf(Fail.EXIT))
}
```
@@ -46,13 +43,12 @@ exec {
### `args`
-The full command line including the executable and all arguments.
+The full command line including the executable and all parameters.
```kotlin
exec {
- commandLine(args = "ls")
- commandLine("ls", "-l")
- commandLine("cmd", "/c", "dir /Q")
+ commandLine(listOf("ls", "-l"))
+ commandLine(args = listOf("cmd", "/c", "dir /Q"))
}
```
@@ -62,7 +58,7 @@ The working directory in which the command should be executed. Defaults to the p
```kotlin
exec {
- commandLine("cmd", "/c", "stop.bat", dir = "../tomcat/bin")
+ commandLine(listOf("cmd", "/c", "stop.bat"), dir = "../tomcat/bin")
commandLine("./stop.sh", dir = "../tomcat/bin")
}
```
@@ -74,26 +70,21 @@ List of operating systems on which the command may be executed. If the current O
The following predefined values are available:
Name | Operating System
-:-------------|:-------------------------
-`Os.CYGWIN` | Cygwin for Windows
+--------------|-----------------------
`Os.FREEBSD` | FreeBSD
`Os.LINUX` | Linux
`Os.MAC` | Apple Macintosh / OS X
-`Os.MINGW` | Minimalist GNU for Windows
-`OS.MSYS` | MinGW Minimal System
`Os.OPENVMS` | OpenVMS
`Os.OS400` | OS/400
`Os.SOLARIS` | Solaris / SunOS
`Os.TANDEM` | Tandem's Non-Stop
-`Os.WINDOWS` | Microsoft Windows*
+`Os.WINDOWS` | Microsoft Windows
`Os.ZOS` | z/OS / OS/390
-* Excluding Cygwin, MinGW and MSYS.
-
```kotlin
exec {
- commandLine("cmd", "/c", "stop.bat", os = setOf(Os.WINDOWS))
- commandLine("./stop.sh", os = setOf(Os.LINUX, Os.MAC))
+ commandLine(listOf("cmd", "/c", "stop.cmd"), os = setOf(Os.WINDOWS))
+ commandLine(listOf("./stop.sh"), os = setOf(Os.LINUX, Os.MAC))
}
```
@@ -104,7 +95,7 @@ List of error options to specify whether data returned to the standard streams a
The following predefined values are available:
Name | Failure When
-:-------------|:----------------------------------------------------------------
+--------------|-----------------------------------------------------------------
`Fail.EXIT` | Exit value > 0
`Fail.NORMAL` | Exit value > 0 or any data to the standard error stream (stderr)
`Fail.OUTPUT` | Any data to the standard output stream (stdout) or stderr.
@@ -117,48 +108,14 @@ Name | Failure When
```kotlin
exec {
- commandLine("cmd", "/c", "stop.bat", fail = setOf(Fail.EXIT))
- commandLine("./stop.sh", fail = setOf(Fail.EXIT, Fail.STDOUT))
-}
-```
-
-## taskName
-
-Additionally, you can specify a task name to easily identify multiple `exec` tasks.
-
-```kotlin
-exec {
- taskName = "start"
- commandLine("./start.sh", os = setOf(Os.LINUX, Os.MAC))
-}
-
-exec {
- taskName = "stop"
- commandLine("./stop.sh", os = setOf(Os.LINUX, Os.MAC))
-}
-```
-
-```sh
-./kobaltw start
-./kobaltw stop
-```
-
-## dependsOn
-
-
-By default the `exec` task depends on `assemble`, use the `dependsOn` parameter to change the dependencies:
-
-```kotlin
-exec {
- dependsOn = listOf("assemble", "run")
- commandLine("cmd", "/c", "start.bat", fail = setOf(Fail.EXIT))
+ commandLine(listOf("cmd", "/c", "stop.bat"), fail = setOf(Fail.EXIT))
+ commandLine(listOf("./stop.sh"), fail = setOf(Fail.EXIT, Fail.STDOUT))
}
```
## Logging / Debugging
To view the output of the `exec` task, use:
-
```sh
./kobaltw exec --log 2
```
@@ -166,7 +123,10 @@ You could also redirect the error stream to a file:
```kotlin
exec {
- commandLine("sh", "-c", "./stop.sh 2> error.txt", os = setOf(Os.LINUX))
- commandLine("cmd", "/c", "stop.bat 2> error.txt", os = setOf(Os.WINDOWS))
+ commandLine(listOf("/bin/sh", "-c", "./stop.sh 2> error.txt"), os = setOf(Os.LINUX))
+ commandLine(listOf("cmd", "/c", "stop.bat 2> error.txt"), os = setOf(Os.WINDOWS))
}
-```
\ No newline at end of file
+```
+
+
+
diff --git a/clean.sh b/clean.sh
deleted file mode 100644
index 552252d..0000000
--- a/clean.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-
-DEBUG=false
-
-rm="rm -rf"
-
-if [ "$DEBUG" = true ]; then
- rm="echo rm -rf"
-fi
-
-buildkt="kobalt/src/Build.kt"
-
-name=$(cat $buildkt | grep -m 1 "name = " | cut -d"\"" -f 2)
-group=$(cat $buildkt | grep -m 1 "group = " | cut -d"\"" -f 2)
-
-if [ -z "$1" ]; then
- version=$(cat $buildkt | grep -m 1 "version = " | cut -d"\"" -f 2)
-else
- version="$1"
-fi
-
-maven="/k/maven/repository/${group//.//}/${name}/${version}"
-kobalt="$HOME/.kobalt/cache/${group//.//}/${name}/${version}"
-localRepo="$HOME/.kobalt/localMavenRepo/${group//.//}/${name}/${version}"
-
-read -p "Delete version ${version}? " -n 1 -r
-echo
-if [[ $REPLY =~ ^[Yy]$ ]]; then
- for dir in "$kobalt" "$maven" "$localRepo"; do
- if [ -d "$dir" ]; then
- echo -e "Deleting : \e[32;1m$dir\e[0m"
- $rm "$dir"
- else
- echo -e "Not Found: \e[31;1m$dir\e[0m"
- fi
- done
-fi
\ No newline at end of file
diff --git a/example/kobalt/src/Build.kt b/example/kobalt/src/Build.kt
index 76e2c24..82fd738 100644
--- a/example/kobalt/src/Build.kt
+++ b/example/kobalt/src/Build.kt
@@ -1,17 +1,13 @@
import com.beust.kobalt.*
-import com.beust.kobalt.plugin.application.*
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.*
-// ./kobaltw exec echo ps --log 2
-// ./kobaltw exec --log 2
-// ./kobaltw echo --log 2
-// ./kobaltw ps --log 2
+val repos = repos("https://dl.bintray.com/ethauvin/maven/")
-val bs = buildScript {
- repos(localMaven())
- plugins("net.thauvin.erik:kobalt-exec:")
-}
+//val pl = plugins(file("../kobaltBuild/libs/kobalt-exec-0.6.2.jar"))
+val pl = plugins("net.thauvin.erik:kobalt-exec:0.6.2")
val example = project {
@@ -20,6 +16,20 @@ val example = project {
artifactId = name
version = "0.1"
+ sourceDirectories {
+ path("src/main/java")
+ }
+
+ sourceDirectoriesTest {
+ path("src/test/java")
+ }
+
+ dependencies {
+ }
+
+ dependenciesTest {
+ }
+
assemble {
jar {
}
@@ -30,23 +40,20 @@ val example = project {
}
exec {
- commandLine("ls", "-l", dir = "../kobalt/wrapper", os = setOf(Os.LINUX, Os.MINGW, Os.CYGWIN))
- commandLine("cmd", "/c", "dir /Q", dir = "../kobalt/wrapper", os = setOf(Os.WINDOWS))
+ 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 {
+ name = "example2"
exec {
- taskName = "echo"
- dependsOn = listOf("exec", "run")
-
- val echo = arrayOf("echo", "Test", "Example")
- commandLine(*echo, os = setOf(Os.LINUX, Os.MINGW, Os.CYGWIN))
- commandLine("cmd", "/c", *echo, os = setOf(Os.WINDOWS))
+ 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))
}
-
- exec {
- taskName = "ps"
- dependsOn = listOf() // no dependencies
- commandLine("sh", "-c", "ps aux | grep bash", os = setOf(Os.LINUX, Os.MINGW, Os.CYGWIN))
- commandLine("cmd", "/c", "tasklist | find \"cmd.exe\"", os = setOf(Os.WINDOWS), fail = setOf(Fail.EXIT))
- }
-}
\ No newline at end of file
+}
diff --git a/example/kobalt/wrapper/kobalt-wrapper.jar b/example/kobalt/wrapper/kobalt-wrapper.jar
index 7c076e6..055a613 100644
Binary files a/example/kobalt/wrapper/kobalt-wrapper.jar and b/example/kobalt/wrapper/kobalt-wrapper.jar differ
diff --git a/example/kobalt/wrapper/kobalt-wrapper.properties b/example/kobalt/wrapper/kobalt-wrapper.properties
index a6a4316..5436766 100644
--- a/example/kobalt/wrapper/kobalt-wrapper.properties
+++ b/example/kobalt/wrapper/kobalt-wrapper.properties
@@ -1 +1 @@
-kobalt.version=1.0.90
+kobalt.version=0.879
\ No newline at end of file
diff --git a/kobalt-exec.iml b/kobalt-exec.iml
deleted file mode 100644
index bffb9cc..0000000
--- a/kobalt-exec.iml
+++ /dev/null
@@ -1,682 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/kobalt/Build.kt.iml b/kobalt/Build.kt.iml
index 0098d0a..f641794 100644
--- a/kobalt/Build.kt.iml
+++ b/kobalt/Build.kt.iml
@@ -1,42 +1,12 @@
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt
index 7a5bf23..20c1be6 100644
--- a/kobalt/src/Build.kt
+++ b/kobalt/src/Build.kt
@@ -1,23 +1,19 @@
-import com.beust.kobalt.buildScript
-import com.beust.kobalt.localMaven
-import com.beust.kobalt.file
import com.beust.kobalt.plugin.packaging.assemble
-import com.beust.kobalt.plugin.publish.autoGitTag
import com.beust.kobalt.plugin.publish.bintray
-import com.beust.kobalt.profile
+import com.beust.kobalt.plugins
import com.beust.kobalt.project
-import net.thauvin.erik.kobalt.plugin.versioneye.versionEye
+import com.beust.kobalt.repos
import org.apache.maven.model.Developer
import org.apache.maven.model.License
import org.apache.maven.model.Model
import org.apache.maven.model.Scm
+import net.thauvin.erik.kobalt.plugin.versioneye.*
-val bs = buildScript {
- repos(localMaven())
- plugins("net.thauvin.erik:kobalt-versioneye:", "net.thauvin.erik:kobalt-maven-local:")
-}
-val dev by profile()
+val pl = plugins("net.thauvin.erik:kobalt-versioneye:0.4.2-beta")
+val repos = repos()
+
+val dev = false
val kobaltDependency = if (dev) "kobalt" else "kobalt-plugin-api"
val p = project {
@@ -25,7 +21,7 @@ val p = project {
name = "kobalt-exec"
group = "net.thauvin.erik"
artifactId = name
- version = "0.7.0"
+ version = "0.6.2"
pom = Model().apply {
description = "Command Line Execution plug-in for the Kobalt build system."
@@ -46,36 +42,33 @@ val p = project {
})
}
+ sourceDirectories {
+ path("src/main/kotlin")
+ }
+
+ sourceDirectoriesTest {
+ path("src/test/kotlin")
+ }
+
dependencies {
- compile("com.beust:$kobaltDependency:")
- compile("org.jetbrains.kotlin:kotlin-stdlib:1.1.51")
+ compile("com.beust:$kobaltDependency:0.878")
}
dependenciesTest {
- compile("org.testng:testng:6.12")
- compile("org.jetbrains.kotlin:kotlin-test:1.1.51")
+ compile("org.testng:testng:")
+
}
assemble {
- mavenJars {
- fatJar = true
- }
- }
-
- autoGitTag {
- enabled = true
- push = false
- message = "Version $version"
+ mavenJars {}
}
bintray {
publish = true
- description = "Release version $version"
- vcsTag = version
}
versionEye {
- org = "Thauvin"
+ org = "thauvin"
team = "Owners"
}
-}
\ No newline at end of file
+}
diff --git a/kobalt/wrapper/kobalt-wrapper.jar b/kobalt/wrapper/kobalt-wrapper.jar
index 7c076e6..055a613 100644
Binary files a/kobalt/wrapper/kobalt-wrapper.jar and b/kobalt/wrapper/kobalt-wrapper.jar differ
diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties
index a6a4316..5436766 100644
--- a/kobalt/wrapper/kobalt-wrapper.properties
+++ b/kobalt/wrapper/kobalt-wrapper.properties
@@ -1 +1 @@
-kobalt.version=1.0.90
+kobalt.version=0.879
\ No newline at end of file
diff --git a/kobaltw b/kobaltw
old mode 100755
new mode 100644
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
index 9dccff5..fb99d3a 100644
--- a/src/main/kotlin/net/thauvin/erik/kobalt/plugin/exec/ExecPlugin.kt
+++ b/src/main/kotlin/net/thauvin/erik/kobalt/plugin/exec/ExecPlugin.kt
@@ -1,7 +1,7 @@
/*
* ExecPlugin.kt
*
- * Copyright (c) 2016-2017, Erik C. Thauvin (erik@thauvin.net)
+ * Copyright (c) 2016, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -39,13 +39,16 @@ import com.beust.kobalt.api.annotation.Task
import com.beust.kobalt.misc.log
import com.google.inject.Inject
import com.google.inject.Singleton
-import java.io.*
+import java.io.BufferedReader
+import java.io.File
+import java.io.InputStream
+import java.io.InputStreamReader
import java.util.*
import java.util.concurrent.TimeUnit
@Singleton
-class ExecPlugin @Inject constructor(val taskContributor: TaskContributor, val configActor: ConfigsActor) :
- BasePlugin(), ITaskContributor, IConfigsActor by configActor {
+class ExecPlugin @Inject constructor(val configActor: ConfigActor) :
+ BasePlugin(), ITaskContributor, IConfigActor by configActor {
// ITaskContributor
override fun tasksFor(project: Project, context: KobaltContext): List {
return emptyList()
@@ -57,51 +60,20 @@ class ExecPlugin @Inject constructor(val taskContributor: TaskContributor, val c
override val name = NAME
- override fun apply(project: Project, context: KobaltContext) {
- configurationFor(project)?.let { configs ->
- configs.forEach { config ->
- taskManager.addTask(this, project, config.taskName,
- description = "Execute a command line process.",
- group = "Other",
- dependsOn = config.dependsOn,
- task = { executeCommands(project, config) })
- taskContributor.addVariantTasks(this, project, context, config.taskName,
- dependsOn = config.dependsOn,
- runTask = { executeCommands(project, config) })
- }
+ @Task(name = "exec", description = "Execute a command line process.")
+ fun taskExec(project: Project): TaskResult {
+ var result = TaskResult()
+ configurationFor(project)?.let { config ->
+ result = executeCommands(project, config)
}
- }
-
- private fun isCygwin(): Boolean {
- val path: String? = System.getenv("ORIGINAL_PATH")
- return path?.contains("/cygdrive/") ?: false
- }
-
- private fun isMinGW(os: Os = Os.MINGW, any: Boolean = false): Boolean {
- val msys: String? = System.getenv("MSYSTEM")
-
- if (!msys.isNullOrBlank()) {
- if (any) {
- return true
- } else if (os.equals(Os.MSYS)) {
- return msys!!.startsWith("MSYS")
- } else if (os.equals(Os.MINGW)) {
- return msys!!.startsWith("MINGW")
- }
- }
-
- return false
+ return result
}
private fun matchOs(os: Os): Boolean {
val curOs: String = System.getProperty("os.name").toLowerCase(Locale.US)
when (os) {
Os.WINDOWS -> {
- if (!isMinGW(any = true) && !isCygwin()) {
- return curOs.contains("windows")
- } else {
- return false
- }
+ return curOs.contains("windows")
}
Os.MAC -> {
return (curOs.contains("mac") || curOs.contains("darwin") || curOs.contains("osx"))
@@ -127,15 +99,6 @@ class ExecPlugin @Inject constructor(val taskContributor: TaskContributor, val c
Os.OS400 -> {
return curOs.contains("os/400")
}
- Os.CYGWIN -> {
- return isCygwin()
- }
- Os.MINGW -> {
- return isMinGW()
- }
- Os.MSYS -> {
- return isMinGW(Os.MSYS)
- }
}
}
@@ -146,7 +109,7 @@ class ExecPlugin @Inject constructor(val taskContributor: TaskContributor, val c
for ((args, dir, os, fail) in config.commandLines) {
val wrkDir = File(if (dir.isNullOrBlank()) project.directory else dir)
if (wrkDir.isDirectory) {
- var execute = (os.isEmpty())
+ var execute = (os.size == 0)
if (!execute) {
for (name in os) {
execute = matchOs(name)
@@ -154,7 +117,7 @@ class ExecPlugin @Inject constructor(val taskContributor: TaskContributor, val c
}
}
if (execute) {
- log(2, (if (!wrkDir.name.equals(".")) wrkDir.name else "") + "> " + args.joinToString(" "))
+ log(2, "> " + args.joinToString(" "))
val pb = ProcessBuilder().command(args.toList())
pb.directory(wrkDir)
val proc = pb.start()
@@ -163,7 +126,7 @@ class ExecPlugin @Inject constructor(val taskContributor: TaskContributor, val c
val stderr = if (proc.errorStream.available() > 0) fromStream(proc.errorStream) else emptyList()
val cmdInfo = "Program \"" + args.joinToString(" ") + "\" (in directory \"${wrkDir.path}\"): "
- if (!err) {
+ if (err == false) {
errorMessage.append(cmdInfo).append("TIMEOUT")
success = false
} else if (!fail.contains(Fail.NONE)) {
@@ -191,10 +154,10 @@ class ExecPlugin @Inject constructor(val taskContributor: TaskContributor, val c
if (!success) break
}
- //@TODO until Cedric fixes it.
+ //@TODO until cedric fixes it.
if (!success) error(errorMessage)
- return TaskResult(success)
+ return TaskResult(success, errorMessage.toString())
}
private fun fromStream(ins: InputStream): List {
@@ -213,31 +176,27 @@ class ExecPlugin @Inject constructor(val taskContributor: TaskContributor, val c
}
}
-enum class Fail {
+enum class Fail() {
ALL, EXIT, NONE, NORMAL, OUTPUT, STDERR, STDOUT
}
-enum class Os {
- CYGWIN, FREEBSD, LINUX, MAC, MINGW, MSYS, OPENVMS, OS400, SOLARIS, TANDEM, WINDOWS, ZOS
+enum class Os() {
+ FREEBSD, LINUX, MAC, OPENVMS, OS400, SOLARIS, TANDEM, WINDOWS, ZOS
}
data class CommandLine(var args: List = emptyList(), var dir: String = "", var os: Set = emptySet(),
var fail: Set = setOf(Fail.NORMAL))
@Directive
-class ExecConfig {
- var taskName: String = "exec"
+class ExecConfig() {
val commandLines = arrayListOf()
- var dependsOn = listOf("assemble")
- @Suppress("unused")
- fun commandLine(vararg args: String, dir: String = "", os: Set = emptySet(),
+ fun commandLine(args: List = emptyList(), dir: String = "", os: Set = emptySet(),
fail: Set = setOf(Fail.NORMAL)) {
- if (args.isNotEmpty()) commandLines.add(CommandLine(listOf(*args), dir, os, fail))
+ if (args.size > 0) commandLines.add(CommandLine(args, dir, os, fail))
}
}
-@Suppress("unused")
@Directive
fun Project.exec(init: ExecConfig.() -> Unit) {
ExecConfig().let { config ->
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