summaryrefslogtreecommitdiff
path: root/library/self.gradle
blob: e155fee31284b6405ee77172d9b58d87cc4aaaf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
 * 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 {
    // TODO: Fix lint errors and re-enable fatal lint
    abortOnError false
    htmlReport true
    textOutput 'stderr'
    textReport 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
    }
}