summaryrefslogtreecommitdiffhomepage
path: root/android/build.gradle
blob: 3ec109fbeb24834909a33eebe0e8fa50d1afd0ff (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
apply plugin: 'com.android.application'
apply plugin: 'com.github.triplet.play'
apply plugin: 'kotlin-android'

def repoRootPath = projectDir.absoluteFile.parentFile.absolutePath
def extraAssetsDirectory = "$project.buildDir/extraAssets"
def extraJniDirectory = "$project.buildDir/extraJni"

def keystorePropertiesFile = file('keystore.properties')
def keystoreProperties = new Properties()

if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "net.mullvad.mullvadvpn"
        minSdkVersion 24
        targetSdkVersion 28
        versionCode 20050099
        versionName "2020.5"
    }

    if (keystorePropertiesFile.exists()) {
        signingConfigs {
            release {
                keyAlias keystoreProperties['keyAlias']
                keyPassword keystoreProperties['keyPassword']
                storeFile file(keystoreProperties['storeFile'])
                storePassword keystoreProperties['storePassword']
            }
        }

        buildTypes {
            release {
                minifyEnabled false
                signingConfig signingConfigs.release
            }
        }
    }

    buildTypes {
        fdroid {
            initWith release
            minifyEnabled false
            signingConfig null
        }
    }

    sourceSets {
        main {
            assets {
                srcDirs = files(extraAssetsDirectory)
            }

            jniLibs {
                srcDirs = files(extraJniDirectory)
            }
        }
    }

    applicationVariants.all { variant ->
        variant.mergeAssetsProvider.configure {
            dependsOn copyExtraAssets
        }
    }
}

play {
    serviceAccountCredentials = file("play-api-key.json")
}

repositories {
    jcenter()
    google()
}

dependencies {
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.21'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1'
    implementation 'joda-time:joda-time:2.10.2'
}

buildscript {
    repositories {
        jcenter()
        google()

        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.0'
        classpath 'com.github.triplet.gradle:play-publisher:2.7.5'
        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20'
    }
}

task copyExtraAssets(type: Copy) {
    from "$repoRootPath/dist-assets"
    include "relays.json"
    into extraAssetsDirectory
}