Created
August 27, 2015 12:24
-
-
Save bholota/caca557160d48cbd53c6 to your computer and use it in GitHub Desktop.
gradle task dependency
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
// Custom tasks | |
/** | |
* This test make sure if we have everything committed (or stashed). Allows keep project clean | |
* and with even small change crashlytics beta upload will have different SHA1. | |
*/ | |
task testGitWorkingCopy << { | |
def checkChanges = 'git status -uno --porcelain'.execute([], project.rootDir).text.trim() | |
if(checkChanges) { | |
throw new GradleException('Commit or shash your working copy before BETA upload!') | |
} | |
} | |
/** | |
* This app uses multidex and it compiles faster with minimum api version 21+ (ART etc.) | |
* This test make us sure if we're not uploading apk with bad min api to testing pipeline. | |
*/ | |
task testMinSDK << { | |
if(MIN_SDK != project.android.defaultConfig.minSdkVersion.mApiLevel) { | |
throw new GradleException('Check your minSdkVersion!') | |
} | |
} | |
/** | |
* Allow triggering custom tests before uploading to crashlytics beta. | |
*/ | |
tasks.whenTaskAdded { task -> | |
if(task.name.startsWith("crashlyticsUpload")) { | |
task.dependsOn testGitWorkingCopy | |
task.dependsOn testMinSDK | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment