SetupWizardLibrary/library/self.gradle
Maurice Lam 63cdc5ccb7 [SuwLib] Turn on fatal lint
Fix (or suppress) lint warnings and make it fatal again in the build
process.
Additionally, warnings are treated as errors now. If there are
warnings that are not applicable, add @SuppressLint or tools:ignore
to suppress the warning, so code reviewers can be aware of the lint
issue too.

Test: ./gradlew lint
Change-Id: I63c83ff1b95a0817dc2ac777adce0fa9f9ebd45a
2016-12-12 19:15:44 +00:00

60 lines
1.7 KiB
Groovy

/**
* This self.gradle build file is only run when built in ub-setupwizard-* branches.
*/
apply plugin: 'dist'
apply from: 'standalone-rules.gradle'
// Add targets for tests
android.sourceSets {
androidTest {
manifest.srcFile 'test/AndroidManifest.xml'
java.srcDirs = ['test/src']
res.srcDirs = ['test/res']
dependencies {
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
androidTestCompile 'junit:junit:4.+'
androidTestCompile 'org.mockito:mockito-core:1.9.5'
}
}
androidTestEclairMr1Compat {
java.srcDirs = ['eclair-mr1/test/src']
}
androidTestFullSupport {
java.srcDirs = ['full-support/test/src', 'eclair-mr1/test/src']
res.srcDirs = ['full-support/test/res']
}
}
android.defaultConfig.testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
android.lintOptions {
abortOnError true
htmlReport true
textOutput 'stderr'
textReport true
warningsAsErrors true
xmlReport false
}
// Run lint for all variants
android.libraryVariants.all { variant ->
variant.assemble.dependsOn(tasks.findByName('lint'))
}
// Output all test APKs to the distribution folder
def distTask = tasks.findByName('dist')
if (distTask) {
android.testVariants.all { variant ->
// Make the dist task depend on the test variant, so the test APK will be built
distTask.dependsOn variant.assemble
// TODO: remap the different test variants to different file names
}
}