Created
August 27, 2014 04:55
-
-
Save jromero/99952e33165281aebc27 to your computer and use it in GitHub Desktop.
A basic spoon task for Gradle to assemble debug apk, test apk, and execute spoon runner. (For a more robust implementation take a look at: https://github.com/stanfy/spoon-gradle-plugin)
This file contains hidden or 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
def spoonRunner = "libs-uitests/spoon-runner-1.1.1-jar-with-dependencies.jar" | |
task spoon (dependsOn: ['assembleDebug', 'assembleDebugTest']) << { | |
def rootDir = project.rootDir | |
def localProperties = new File(rootDir, "local.properties") | |
def sdkDir | |
if (localProperties.exists()) { | |
Properties properties = new Properties() | |
localProperties.withInputStream { instr -> | |
properties.load(instr) | |
} | |
sdkDir = properties.getProperty('sdk.dir') | |
} | |
def apk | |
android.applicationVariants.each { variant -> | |
if (variant.name == "debug") { | |
apk = variant.outputFile | |
} | |
} | |
def testApk | |
android.testVariants.each { variant -> | |
testApk = variant.outputFile | |
} | |
println "sdk=" + sdkDir | |
println "apk=" + apk | |
println "testApk=" + testApk | |
exec { | |
executable "java" | |
args "-jar", spoonRunner, | |
"--sdk", sdkDir, | |
"--apk", apk, | |
"--test-apk", testApk, | |
"--output", "build/outputs/spoon/" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment