Debian Codegraph @

build-system/integration-test/test-projects/ndkJniLib/app/build.gradle

raw
1 apply plugin: 'com.android.application'
2
3 import com.android.build.OutputFile;
4
5 dependencies {
6 compile project(':lib')
7 }
8
9 // map for the version code for ABIs.
10 // x86 is more important because x86 devices also support arm.
11 // Same for mips
12 ext.versionCodes = ["armeabi-v7a":1, "mips":2, "x86":3, "all":0]
13
14 android {
15 compileSdkVersion rootProject.latestCompileSdk
16 buildToolsVersion = rootProject.buildToolsVersion
17
18 // This actual the app version code. Giving ourselves 100,000 values [0, 99999]
19 defaultConfig.versionCode = 123
20
21 productFlavors {
22 gingerbread {
23 minSdkVersion 10
24 versionCode = 1
25 }
26 icecreamSandwich {
27 minSdkVersion 14
28 versionCode = 2
29 }
30 }
31
32 splits {
33 abi {
34 enable = true
35 universalApk = true
36 exclude "x86_64", "mips64", "arm64-v8a", "armeabi"
37 }
38 }
39
40 // make per-variant version code
41 applicationVariants.all { variant ->
42 // get the version code for the flavor
43 def apiVersion = variant.productFlavors.get(0).versionCode
44
45 // assign a composite version code for each output, based on the flavor above
46 // and the density component.
47 variant.outputs.each { output ->
48 // get the key for the abi component
49 def key = output.getFilter(OutputFile.ABI) == null ? "all" : output.getFilter(OutputFile.ABI)
50
51 // set the versionCode on the output.
52 output.versionCodeOverride = apiVersion * 1000000 + project.ext.versionCodes.get(key) * 100000 + defaultConfig.versionCode
53 }
54 }
55 }