-
Notifications
You must be signed in to change notification settings - Fork 0
rbm adb shell
inazaruk edited this page Jan 19, 2012
·
13 revisions
Go to home | documentation | ant tasks
Runs any command on device. Gives ability to get output and exit code of executed command. Also there is an option to fail build if exit code is different from expected.
<rbm-adb-shell cmd="${cmd}"
log="${log.output}"
outputProperty="output.prop"
exitCodeProperty="exit.code"
exitCodeFail="${fail.on.exit.code}"
exitCodeExpected="${expected.exit.code}" >
<arg value="${arg1}" />
<arg value="${arg2}" />
<arg value="${arg3}" />
</rbm-adb-shell>-
cmd- optional, command to run. If not specified, first argument is treated as command. In factcmdand allargelements are concatenated (with space inserted). So its up to you to decide where to place command and arguments. -
log- optional, default: true. If set to true, all shell output is printed to ant as it's received from adb. If set to false only result is printed. -
outputProperty- optional, name of property to save output to. If this property is set, all text received from adb during command run is set to this property. -
exitCodeProperty- optional, name of property to store exit code to. If this property is set, exit code is set to this property. -
exitCodeFail- optional, default: true. If exit code is different fromexitCodeExpectedtask fails the build. -
exitCodeExpected- optional, default: 0. If exit code is different from value set in this property andexitCodeFailis set to true, task fails the build.
<arg value="${arg}" />Arguments to pass to command.
Next examples have same effect:
<rbm-adb-shell cmd="echo 1" />
<rbm-adb-shell cmd="echo" >
<arg value="1" />
</rbm-adb-shell>
<rbm-adb-shell>
<arg value="echo 1" />
</rbm-adb-shell>
<rbm-adb-shell>
<arg value="echo" />
<arg value="1" />
</rbm-adb-shell>Enabling and disabling logs during command execution:
<rbm-adb-shell cmd="echo $(pwd)" log="true" />Here is how you can store command output to property:
<rbm-adb-shell cmd="echo 111" outputProperty="output.value" />You also can store exit code to property:
<rbm-adb-shell cmd="ls /system" exitCodeProperty="exit.code" />You can configure what exit code is expected:
<rbm-adb-shell cmd="invalid cmd" exitCodeFail="true" exitCodeExpected="127" />Or you can ignore failures:
<rbm-adb-shell cmd="invalid cmd" exitCodeFail="false" />Go to home | documentation | ant tasks