Compare commits
17 commits
Author | SHA1 | Date | |
---|---|---|---|
acb492b30e | |||
a2bbaf9f0f | |||
38d7714f22 | |||
49a01d2586 | |||
9d5b969dd9 | |||
dc99641c3e | |||
b0e025206b | |||
182b975b85 | |||
0531a8a139 | |||
5672ad96b0 | |||
a55d7f34eb | |||
43d55803a9 | |||
6530e8f7be | |||
3007041be4 | |||
9fb31c09e5 | |||
395fa127b9 | |||
d990c6d598 |
18 changed files with 557 additions and 127 deletions
31
.circleci/config.yml
Normal file
31
.circleci/config.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
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
|
6
.idea/encodings.xml
generated
Normal file
6
.idea/encodings.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
10
.idea/inspectionProfiles/Project_Default.xml
generated
10
.idea/inspectionProfiles/Project_Default.xml
generated
|
@ -1,9 +1,8 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AndroidLintNewerVersionAvailable" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<option name="myLocal" value="true" />
|
||||
<inspection_tool class="FieldMayBeFinal" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="GroovyVariableCanBeFinal" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||
<value>
|
||||
|
@ -37,18 +36,17 @@
|
|||
</inspection_tool>
|
||||
<inspection_tool class="LocalCanBeFinal" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="REPORT_VARIABLES" value="true" />
|
||||
<option name="REPORT_PARAMETERS" value="true" />
|
||||
<option name="REPORT_PARAMETERS" value="false" />
|
||||
<option name="REPORT_CATCH_PARAMETERS" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
|
||||
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="NonFinalUtilityClass" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="UnnecessarySemicolon" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="WeakerAccess" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<inspection_tool class="WeakerAccess" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS" value="true" />
|
||||
<option name="SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES" value="true" />
|
||||
<option name="SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES" value="false" />
|
||||
<option name="SUGGEST_PRIVATE_FOR_INNERS" value="false" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
|
|
4
.idea/kobalt.xml
generated
4
.idea/kobalt.xml
generated
|
@ -4,13 +4,15 @@
|
|||
<option name="linkedExternalProjectsSettings">
|
||||
<KobaltProjectSettings>
|
||||
<option name="autoDownloadKobalt" value="true" />
|
||||
<option name="downloadSources" value="false" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="kobaltHome" value="$USER_HOME$/.kobalt/wrapper/dist/kobalt-1.0.69" />
|
||||
<option name="kobaltHome" value="$USER_HOME$/.kobalt/wrapper/dist/kobalt-1.0.82" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="profiles" value="" />
|
||||
</KobaltProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
|
7
.idea/kotlinc.xml
generated
7
.idea/kotlinc.xml
generated
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinCommonCompilerArguments">
|
||||
<option name="languageVersion" value="1.1" />
|
||||
<option name="apiVersion" value="1.1" />
|
||||
</component>
|
||||
</project>
|
64
.idea/misc.xml
generated
64
.idea/misc.xml
generated
|
@ -1,4 +1,66 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" project-jdk-name="1.8.x" project-jdk-type="JavaSDK" />
|
||||
<component name="ClientPropertiesManager">
|
||||
<properties class="javax.swing.AbstractButton">
|
||||
<property name="hideActionText" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JComponent">
|
||||
<property name="html.disable" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JEditorPane">
|
||||
<property name="JEditorPane.w3cLengthUnits" class="java.lang.Boolean" />
|
||||
<property name="JEditorPane.honorDisplayProperties" class="java.lang.Boolean" />
|
||||
<property name="charset" class="java.lang.String" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JList">
|
||||
<property name="List.isFileList" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JPasswordField">
|
||||
<property name="JPasswordField.cutCopyAllowed" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JSlider">
|
||||
<property name="Slider.paintThumbArrowShape" class="java.lang.Boolean" />
|
||||
<property name="JSlider.isFilled" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JTable">
|
||||
<property name="Table.isFileList" class="java.lang.Boolean" />
|
||||
<property name="JTable.autoStartsEdit" class="java.lang.Boolean" />
|
||||
<property name="terminateEditOnFocusLost" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JToolBar">
|
||||
<property name="JToolBar.isRollover" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JTree">
|
||||
<property name="JTree.lineStyle" class="java.lang.String" />
|
||||
</properties>
|
||||
<properties class="javax.swing.text.JTextComponent">
|
||||
<property name="caretAspectRatio" class="java.lang.Double" />
|
||||
<property name="caretWidth" class="java.lang.Integer" />
|
||||
</properties>
|
||||
</component>
|
||||
<component name="ProjectInspectionProfilesVisibleTreeState">
|
||||
<entry key="Project Default">
|
||||
<profile-state>
|
||||
<expanded-state>
|
||||
<State>
|
||||
<id />
|
||||
</State>
|
||||
<State>
|
||||
<id>Java</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>Portability issuesJava</id>
|
||||
</State>
|
||||
</expanded-state>
|
||||
<selected-state>
|
||||
<State>
|
||||
<id>Android</id>
|
||||
</State>
|
||||
</selected-state>
|
||||
</profile-state>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8.x" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/kobaltBuild/classes" />
|
||||
</component>
|
||||
</project>
|
1
.idea/modules.xml
generated
1
.idea/modules.xml
generated
|
@ -3,7 +3,6 @@
|
|||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/kobalt/Build.kt.iml" filepath="$PROJECT_DIR$/kobalt/Build.kt.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/example/example2.iml" filepath="$PROJECT_DIR$/example/example2.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/kobalt-exec.iml" filepath="$PROJECT_DIR$/kobalt-exec.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
|
|
2
.idea/vcs.xml
generated
2
.idea/vcs.xml
generated
|
@ -2,7 +2,5 @@
|
|||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
82
README.md
82
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://travis-ci.org/ethauvin/kobalt-exec) [](https://bintray.com/ethauvin/maven/kobalt-exec/_latestVersion)
|
||||
[](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)
|
||||
|
||||
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.
|
||||
|
||||
|
@ -17,7 +17,7 @@ val p = project {
|
|||
name = "example"
|
||||
|
||||
exec {
|
||||
commandLine(listOf("echo", "Hello, World!"))
|
||||
commandLine("echo", "Hello, World!")
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -35,9 +35,10 @@ The `commandLine` directive is used to execute command line(s) during the build
|
|||
|
||||
```kotlin
|
||||
exec {
|
||||
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))
|
||||
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))
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -45,12 +46,13 @@ exec {
|
|||
|
||||
### `args`
|
||||
|
||||
The full command line including the executable and all parameters.
|
||||
The full command line including the executable and all arguments.
|
||||
|
||||
```kotlin
|
||||
exec {
|
||||
commandLine(listOf("ls", "-l"))
|
||||
commandLine(args = listOf("cmd", "/c", "dir /Q"))
|
||||
commandLine(args = "ls")
|
||||
commandLine("ls", "-l")
|
||||
commandLine("cmd", "/c", "dir /Q")
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -60,7 +62,7 @@ The working directory in which the command should be executed. Defaults to the p
|
|||
|
||||
```kotlin
|
||||
exec {
|
||||
commandLine(listOf("cmd", "/c", "stop.bat"), dir = "../tomcat/bin")
|
||||
commandLine("cmd", "/c", "stop.bat", dir = "../tomcat/bin")
|
||||
commandLine("./stop.sh", dir = "../tomcat/bin")
|
||||
}
|
||||
```
|
||||
|
@ -72,21 +74,26 @@ 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
|
||||
|
||||
<sub>* Excluding Cygwin, MinGW and MSYS.</sub>
|
||||
|
||||
```kotlin
|
||||
exec {
|
||||
commandLine(listOf("cmd", "/c", "stop.cmd"), os = setOf(Os.WINDOWS))
|
||||
commandLine(listOf("./stop.sh"), os = setOf(Os.LINUX, Os.MAC))
|
||||
commandLine("cmd", "/c", "stop.bat", os = setOf(Os.WINDOWS))
|
||||
commandLine("./stop.sh", os = setOf(Os.LINUX, Os.MAC))
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -97,7 +104,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.
|
||||
|
@ -110,14 +117,48 @@ Name | Failure When
|
|||
|
||||
```kotlin
|
||||
exec {
|
||||
commandLine(listOf("cmd", "/c", "stop.bat"), fail = setOf(Fail.EXIT))
|
||||
commandLine(listOf("./stop.sh"), fail = setOf(Fail.EXIT, Fail.STDOUT))
|
||||
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))
|
||||
}
|
||||
```
|
||||
|
||||
## Logging / Debugging
|
||||
|
||||
To view the output of the `exec` task, use:
|
||||
|
||||
```sh
|
||||
./kobaltw exec --log 2
|
||||
```
|
||||
|
@ -125,10 +166,7 @@ You could also redirect the error stream to a file:
|
|||
|
||||
```kotlin
|
||||
exec {
|
||||
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))
|
||||
commandLine("sh", "-c", "./stop.sh 2> error.txt", os = setOf(Os.LINUX))
|
||||
commandLine("cmd", "/c", "stop.bat 2> error.txt", os = setOf(Os.WINDOWS))
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
37
clean.sh
Normal file
37
clean.sh
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/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
|
|
@ -1,31 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="Build.kt" external.linked.project.path="$MODULE_DIR$/.." external.root.project.path="$MODULE_DIR$/.." external.system.id="KOBALT" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/../kobaltBuild/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/../kobaltBuild/test-classes" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: kobalt-exec-0.6.2.jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/net/thauvin/erik/kobalt-exec/0.6.2/kobalt-exec-0.6.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: com.beust.kobalt:kobalt:jar:1.0.3">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-1.0.3/kobalt/wrapper/kobalt-1.0.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
</module>
|
|
@ -3,12 +3,13 @@ import com.beust.kobalt.plugin.application.*
|
|||
import com.beust.kobalt.plugin.packaging.*
|
||||
import net.thauvin.erik.kobalt.plugin.exec.*
|
||||
|
||||
// ./kobaltw exec echo ps --log 2
|
||||
// ./kobaltw exec --log 2
|
||||
// ./kobaltw example:exec --log 2
|
||||
// ./kobaltw example2:exec --log 2
|
||||
// ./kobaltw echo --log 2
|
||||
// ./kobaltw ps --log 2
|
||||
|
||||
val bs = buildScript {
|
||||
//repos(file("K:/maven/repository"))
|
||||
repos(localMaven())
|
||||
plugins("net.thauvin.erik:kobalt-exec:")
|
||||
}
|
||||
|
||||
|
@ -29,20 +30,23 @@ val example = project {
|
|||
}
|
||||
|
||||
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))
|
||||
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))
|
||||
}
|
||||
}
|
||||
|
||||
val example2 = project {
|
||||
name = "example2"
|
||||
|
||||
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))
|
||||
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))
|
||||
}
|
||||
}
|
||||
|
||||
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))
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
kobalt.version=1.0.75
|
||||
kobalt.version=1.0.90
|
||||
|
|
264
kobalt-exec.iml
264
kobalt-exec.iml
|
@ -21,6 +21,51 @@
|
|||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="Kobalt: org.jetbrains:annotations:jar:13.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="Kobalt: org.jetbrains.kotlin:kotlin-stdlib:jar:1.1.2-2">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/jetbrains/kotlin/kotlin-stdlib/1.1.2-2/kotlin-stdlib-1.1.2-2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.jetbrains:annotations:jar:13.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="Kobalt: org.jetbrains.kotlin:kotlin-test:jar:1.1.2-2">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/jetbrains/kotlin/kotlin-test/1.1.2-2/kotlin-test-1.1.2-2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.jetbrains.kotlin:kotlin-stdlib:jar:1.1.2-2">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/jetbrains/kotlin/kotlin-stdlib/1.1.2-2/kotlin-stdlib-1.1.2-2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="Kobalt: com.beust:jcommander:jar:1.64">
|
||||
<CLASSES>
|
||||
|
@ -42,7 +87,7 @@
|
|||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: com.beust:kobalt-plugin-api:jar:(0,]">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/com/beust/kobalt-plugin-api/1.0.8/kobalt-plugin-api-1.0.8.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/com/beust/kobalt-plugin-api/1.0.68/kobalt-plugin-api-1.0.68.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
|
@ -111,15 +156,6 @@
|
|||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: com.beust:jcommander:jar:1.48">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/com/beust/jcommander/1.48/jcommander-1.48.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.eclipse.jgit:org.eclipse.jgit:jar:4.5.0.201609210915-r">
|
||||
<CLASSES>
|
||||
|
@ -210,6 +246,78 @@
|
|||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.testng.testng-remote:testng-remote:jar:1.3.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/testng/testng-remote/testng-remote/1.3.2/testng-remote-1.3.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: commons-io:commons-io:jar:2.5">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/commons-io/commons-io/2.5/commons-io-2.5.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.junit.platform:junit-platform-surefire-provider:jar:1.0.0-M4">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/junit/platform/junit-platform-surefire-provider/1.0.0-M4/junit-platform-surefire-provider-1.0.0-M4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.junit.platform:junit-platform-runner:jar:1.0.0-M4">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/junit/platform/junit-platform-runner/1.0.0-M4/junit-platform-runner-1.0.0-M4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.junit.platform:junit-platform-console:jar:1.0.0-M4">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/junit/platform/junit-platform-console/1.0.0-M4/junit-platform-console-1.0.0-M4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.junit.jupiter:junit-jupiter-engine:jar:5.0.0-M4">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/junit/jupiter/junit-jupiter-engine/5.0.0-M4/junit-jupiter-engine-5.0.0-M4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.junit.vintage:junit-vintage-engine:jar:4.12.0-M4">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/junit/vintage/junit-vintage-engine/4.12.0-M4/junit-vintage-engine-4.12.0-M4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.apache.commons:commons-compress:jar:1.13">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/apache/commons/commons-compress/1.13/commons-compress-1.13.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: javax.inject:javax.inject:jar:1">
|
||||
<CLASSES>
|
||||
|
@ -363,6 +471,78 @@
|
|||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: com.google.auto.service:auto-service:jar:1.0-rc3">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/com/google/auto/service/auto-service/1.0-rc3/auto-service-1.0-rc3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.testng:testng:jar:6.11">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/testng/testng/6.11/testng-6.11.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.junit.platform:junit-platform-launcher:jar:1.0.0-M4">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/junit/platform/junit-platform-launcher/1.0.0-M4/junit-platform-launcher-1.0.0-M4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.apache.maven.surefire:surefire-api:jar:2.19.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/apache/maven/surefire/surefire-api/2.19.1/surefire-api-2.19.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.apache.maven.surefire:common-java5:jar:2.19.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/apache/maven/surefire/common-java5/2.19.1/common-java5-2.19.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.junit.platform:junit-platform-suite-api:jar:1.0.0-M4">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/junit/platform/junit-platform-suite-api/1.0.0-M4/junit-platform-suite-api-1.0.0-M4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: junit:junit:jar:4.12">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/junit/junit/4.12/junit-4.12.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.junit.jupiter:junit-jupiter-api:jar:5.0.0-M4">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/junit/jupiter/junit-jupiter-api/5.0.0-M4/junit-jupiter-api-5.0.0-M4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: com.squareup.okio:okio:jar:1.8.0">
|
||||
<CLASSES>
|
||||
|
@ -435,6 +615,68 @@
|
|||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: com.google.auto:auto-common:jar:0.3">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/com/google/auto/auto-common/0.3/auto-common-0.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: com.beust:jcommander:jar:1.64">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/com/beust/jcommander/1.64/jcommander-1.64.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.yaml:snakeyaml:jar:1.17">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.junit.platform:junit-platform-engine:jar:1.0.0-M4">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/junit/platform/junit-platform-engine/1.0.0-M4/junit-platform-engine-1.0.0-M4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.hamcrest:hamcrest-core:jar:1.3">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.junit.platform:junit-platform-commons:jar:1.0.0-M4">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/junit/platform/junit-platform-commons/1.0.0-M4/junit-platform-commons-1.0.0-M4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: org.opentest4j:opentest4j:jar:1.0.0-M2">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/org/opentest4j/opentest4j/1.0.0-M2/opentest4j-1.0.0-M2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
</module>
|
|
@ -10,32 +10,33 @@
|
|||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: kobalt-versioneye-0.4.4.jar">
|
||||
<library name="Kobalt: kobalt-versioneye-0.4.5.jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/net/thauvin/erik/kobalt-versioneye/0.4.4/kobalt-versioneye-0.4.4.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/net/thauvin/erik/kobalt-versioneye/0.4.5/kobalt-versioneye-0.4.5.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: com.beust.kobalt:kobalt:jar:1.0.26">
|
||||
<library name="Kobalt: kobalt-maven-local-0.5.3.jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-1.0.26/kobalt/wrapper/kobalt-1.0.26.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.kobalt/cache/net/thauvin/erik/kobalt-maven-local/0.5.3/kobalt-maven-local-0.5.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="Kobalt: kobalt-exec-0.6.3.jar">
|
||||
<library name="Kobalt: com.beust.kobalt:kobalt:jar:1.0.82">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../kobaltBuild/libs/kobalt-exec-0.6.3.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-1.0.82/kobalt/wrapper/kobalt-1.0.82.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-1.0.82/kobalt/wrapper/kobalt-1.0.82-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||
</component>
|
||||
</module>
|
|
@ -1,13 +1,19 @@
|
|||
|
||||
import com.beust.kobalt.*
|
||||
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.project
|
||||
import net.thauvin.erik.kobalt.plugin.versioneye.versionEye
|
||||
import org.apache.maven.model.*
|
||||
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 bs = buildScript {
|
||||
repos(file("K:/maven/repository"))
|
||||
repos(localMaven())
|
||||
plugins("net.thauvin.erik:kobalt-versioneye:", "net.thauvin.erik:kobalt-maven-local:")
|
||||
}
|
||||
|
||||
|
@ -19,7 +25,7 @@ val p = project {
|
|||
name = "kobalt-exec"
|
||||
group = "net.thauvin.erik"
|
||||
artifactId = name
|
||||
version = "0.6.5"
|
||||
version = "0.7.0"
|
||||
|
||||
pom = Model().apply {
|
||||
description = "Command Line Execution plug-in for the Kobalt build system."
|
||||
|
@ -42,10 +48,12 @@ val p = project {
|
|||
|
||||
dependencies {
|
||||
compile("com.beust:$kobaltDependency:")
|
||||
compile("org.jetbrains.kotlin:kotlin-stdlib:1.1.51")
|
||||
}
|
||||
|
||||
dependenciesTest {
|
||||
compile("org.testng:testng:")
|
||||
compile("org.testng:testng:6.12")
|
||||
compile("org.jetbrains.kotlin:kotlin-test:1.1.51")
|
||||
}
|
||||
|
||||
assemble {
|
||||
|
@ -56,6 +64,7 @@ val p = project {
|
|||
|
||||
autoGitTag {
|
||||
enabled = true
|
||||
push = false
|
||||
message = "Version $version"
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
kobalt.version=1.0.75
|
||||
kobalt.version=1.0.90
|
||||
|
|
|
@ -44,8 +44,8 @@ import java.util.*
|
|||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@Singleton
|
||||
class ExecPlugin @Inject constructor(val configActor: ConfigActor<ExecConfig>) :
|
||||
BasePlugin(), ITaskContributor, IConfigActor<ExecConfig> by configActor {
|
||||
class ExecPlugin @Inject constructor(val taskContributor: TaskContributor, val configActor: ConfigsActor<ExecConfig>) :
|
||||
BasePlugin(), ITaskContributor, IConfigsActor<ExecConfig> by configActor {
|
||||
// ITaskContributor
|
||||
override fun tasksFor(project: Project, context: KobaltContext): List<DynamicTask> {
|
||||
return emptyList()
|
||||
|
@ -57,21 +57,51 @@ class ExecPlugin @Inject constructor(val configActor: ConfigActor<ExecConfig>) :
|
|||
|
||||
override val name = NAME
|
||||
|
||||
@Suppress("unused")
|
||||
@Task(name = "exec", description = "Execute a command line process.")
|
||||
fun taskExec(project: Project): TaskResult {
|
||||
configurationFor(project)?.let { config ->
|
||||
return executeCommands(project, config)
|
||||
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) })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 TaskResult()
|
||||
return false
|
||||
}
|
||||
|
||||
private fun matchOs(os: Os): Boolean {
|
||||
val curOs: String = System.getProperty("os.name").toLowerCase(Locale.US)
|
||||
when (os) {
|
||||
Os.WINDOWS -> {
|
||||
return curOs.contains("windows")
|
||||
if (!isMinGW(any = true) && !isCygwin()) {
|
||||
return curOs.contains("windows")
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
Os.MAC -> {
|
||||
return (curOs.contains("mac") || curOs.contains("darwin") || curOs.contains("osx"))
|
||||
|
@ -97,6 +127,15 @@ class ExecPlugin @Inject constructor(val configActor: ConfigActor<ExecConfig>) :
|
|||
Os.OS400 -> {
|
||||
return curOs.contains("os/400")
|
||||
}
|
||||
Os.CYGWIN -> {
|
||||
return isCygwin()
|
||||
}
|
||||
Os.MINGW -> {
|
||||
return isMinGW()
|
||||
}
|
||||
Os.MSYS -> {
|
||||
return isMinGW(Os.MSYS)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +154,7 @@ class ExecPlugin @Inject constructor(val configActor: ConfigActor<ExecConfig>) :
|
|||
}
|
||||
}
|
||||
if (execute) {
|
||||
log(2, "> " + args.joinToString(" "))
|
||||
log(2, (if (!wrkDir.name.equals(".")) wrkDir.name else "") + "> " + args.joinToString(" "))
|
||||
val pb = ProcessBuilder().command(args.toList())
|
||||
pb.directory(wrkDir)
|
||||
val proc = pb.start()
|
||||
|
@ -179,7 +218,7 @@ enum class Fail {
|
|||
}
|
||||
|
||||
enum class Os {
|
||||
FREEBSD, LINUX, MAC, OPENVMS, OS400, SOLARIS, TANDEM, WINDOWS, ZOS
|
||||
CYGWIN, FREEBSD, LINUX, MAC, MINGW, MSYS, OPENVMS, OS400, SOLARIS, TANDEM, WINDOWS, ZOS
|
||||
}
|
||||
|
||||
data class CommandLine(var args: List<String> = emptyList(), var dir: String = "", var os: Set<Os> = emptySet(),
|
||||
|
@ -187,12 +226,14 @@ data class CommandLine(var args: List<String> = emptyList(), var dir: String = "
|
|||
|
||||
@Directive
|
||||
class ExecConfig {
|
||||
var taskName: String = "exec"
|
||||
val commandLines = arrayListOf<CommandLine>()
|
||||
var dependsOn = listOf("assemble")
|
||||
|
||||
@Suppress("unused")
|
||||
fun commandLine(args: List<String> = emptyList(), dir: String = "", os: Set<Os> = emptySet(),
|
||||
fun commandLine(vararg args: String, dir: String = "", os: Set<Os> = emptySet(),
|
||||
fail: Set<Fail> = setOf(Fail.NORMAL)) {
|
||||
if (args.isNotEmpty()) commandLines.add(CommandLine(args, dir, os, fail))
|
||||
if (args.isNotEmpty()) commandLines.add(CommandLine(listOf(*args), dir, os, fail))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue