File: build.gradle

package info (click to toggle)
android-platform-tools-base 2.2.2-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 113,836 kB
  • sloc: java: 696,390; xml: 45,920; cpp: 2,526; ansic: 1,432; sh: 508; lisp: 110; javascript: 108; makefile: 17
file content (55 lines) | stat: -rw-r--r-- 1,639 bytes parent folder | download | duplicates (3)
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
apply plugin: 'com.android.application'

import com.android.build.OutputFile;

dependencies {
    compile project(':lib')
}

// map for the version code for ABIs.
// x86 is more important because x86 devices also support arm.
// Same for mips
ext.versionCodes = ["armeabi-v7a":1, "mips":2, "x86":3, "all":0]

android {
    compileSdkVersion rootProject.latestCompileSdk
    buildToolsVersion = rootProject.buildToolsVersion

    // This actual the app version code. Giving ourselves 100,000 values [0, 99999]
    defaultConfig.versionCode = 123

    productFlavors {
        gingerbread {
            minSdkVersion 10
            versionCode = 1
        }
        icecreamSandwich {
            minSdkVersion 14
            versionCode = 2
        }
    }

    splits {
        abi {
            enable = true
            universalApk = true
            exclude "x86_64", "mips64", "arm64-v8a", "armeabi"
        }
    }

    // make per-variant version code
    applicationVariants.all { variant ->
        // get the version code for the flavor
        def apiVersion = variant.productFlavors.get(0).versionCode

        // assign a composite version code for each output, based on the flavor above
        // and the density component.
        variant.outputs.each { output ->
            // get the key for the abi component
            def key = output.getFilter(OutputFile.ABI) == null ? "all" : output.getFilter(OutputFile.ABI)

            // set the versionCode on the output.
            output.versionCodeOverride = apiVersion * 1000000 + project.ext.versionCodes.get(key) * 100000 + defaultConfig.versionCode
        }
    }
}