This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ant.condition(property: "os", value: "windows") { os(family: "windows") } | |
ant.condition(property: "os", value: "unix" ) { os(family: "unix") } | |
task execCommandLine(type:Exec) { | |
switch(ant.properties.os){ | |
case 'windows': | |
commandLine 'cmd', '/c', 'echo', 'hello' | |
break | |
case 'unix': | |
commandLine 'echo', 'hello' | |
break | |
} | |
} |
タスクのtypeにはExecを指定する。commandLineプロパティには実行するコマンドと引数をリストととして指定する([]は省略されている)。Windowsの場合、
cmd /c
から呼び出す必要がある点に注意。
0 件のコメント:
コメントを投稿