Skip to content

Instantly share code, notes, and snippets.

@patrickhammond
Last active April 30, 2018 21:11
Show Gist options
  • Save patrickhammond/f7d7c3f1a3cb7af4a1e4 to your computer and use it in GitHub Desktop.
Save patrickhammond/f7d7c3f1a3cb7af4a1e4 to your computer and use it in GitHub Desktop.
// Put this at the end of your project build.gradle
// Execute on your CI server with something like:
// ./gradlew continuousIntegration -Pfingerprint=asdf -PbuildNumber=2 -PdisablePreDex
evaluationDependsOnChildren();
task staticAnalysis() {
def appProject = subprojects.find { project -> 'app' == project.name }
dependsOn appProject.getTasksByName('findbugs', true)
dependsOn appProject.getTasksByName('pmd', true)
dependsOn appProject.getTasksByName('lint', true)
}
task testing() {
def appProject = subprojects.find { project -> 'app' == project.name }
def unitTestTasks = appProject.getTasksByName('testAppDebugUnitTest', true);
def integrationTestTasks = appProject.getTasksByName('spoonAppDebugAndroidTest', true);
dependsOn unitTestTasks
dependsOn integrationTestTasks
// Run unit tests first
integrationTestTasks.each { task -> task.mustRunAfter unitTestTasks }
}
task release() {
def appProject = subprojects.find { project -> 'app' == project.name }
dependsOn appProject.getTasksByName('assembleAppRelease', true)
}
task continuousIntegration() {
dependsOn staticAnalysis
dependsOn testing
dependsOn release
// Static analysis first, then testing, then release
testing.mustRunAfter staticAnalysis
release.mustRunAfter testing
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment