summaryrefslogtreecommitdiff
path: root/android/app/build.gradle
blob: 627ac6ca9f7a9b4821fbc194070674aa4a1af401 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
apply plugin: 'com.android.application'

// buildhost settings - paths and the like
apply from: 'appSettings.gradle'

android {
    compileSdkVersion 28
    buildDir = "${rootProject.getBuildDir()}/app"

    defaultConfig {
        // applicationId, versionCode and versionName are defined in appSettings.gradle
        minSdkVersion 21
        targetSdkVersion 28
    }

    lintOptions {
        disable 'MissingTranslation', 'ExtraTranslation'
    }

    buildTypes {
        debug {
            resValue "string", "app_name", "${liboAppName} Debug"
            resValue "string", "vendor", "${liboVendor}"
            resValue "string", "info_url", "${liboInfoURL}"
            resValue "string", "online_version_hash", "${liboOVersionHash}"
            resValue "string", "core_version_hash", "${liboCoreVersionHash}"
            resValue "string", "image_draw_header", "@drawable/drawer_header"
            manifestPlaceholders = [ appIcon: "${liboLauncherIcon}" ]
            buildConfigField "boolean", "APP_HAS_BRANDING", "${liboHasBranding}"
            ndk {
                abiFilters = []
                abiFilters.addAll("${liboAndroidAbi}".split(' ').collect{it as String})
            }
            applicationIdSuffix '.debug'
            versionNameSuffix '-debug'
            debuggable true
        }
        release {
            resValue "string", "app_name", "${liboAppName}"
            resValue "string", "vendor", "${liboVendor}"
            resValue "string", "info_url", "${liboInfoURL}"
            resValue "string", "online_version_hash", "${liboOVersionHash}"
            resValue "string", "core_version_hash", "${liboCoreVersionHash}"
            if (file("src/main/res/drawable/drawer_header_brand.png").exists()) {
                resValue "string", "image_draw_header", "@drawable/drawer_header_brand"
            } else {
                resValue "string", "image_draw_header", "@drawable/drawer_header"
            }
            manifestPlaceholders = [ appIcon: "${liboLauncherIcon}" ]
            buildConfigField "boolean", "APP_HAS_BRANDING", "${liboHasBranding}"
            ndk {
                abiFilters = []
                abiFilters.addAll("${liboAndroidAbi}".split(' ').collect{it as String})
            }
            minifyEnabled false // FIXME disabled before we get a good proguardRules for callFakeWebsocketOnMessage calling from C++
            shrinkResources false // FIXME cannot be enabled when minifyEnabled is turned off
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.core:core:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'com.google.android.material:material:1.1.0-alpha04'
    implementation 'com.google.android.play:core:1.8.0'

    //before changing the version please see https://issuetracker.google.com/issues/111662669
    implementation 'androidx.preference:preference:1.1.0-alpha01'
    implementation project(path: ':lib')
}

task copyBrandFiles(type: Copy) {
	from "${liboBrandingDir}/android"
	into "src/main/res"
}

afterEvaluate {
	if (!project.ext.liboHasBranding.equals("true") || !file("${liboBrandingDir}").exists()) {
		copyBrandFiles.enabled = false
	}

	preBuild.dependsOn copyBrandFiles
}