build.gradle 6.24 KB
Newer Older
Daniel Wolf's avatar
Daniel Wolf committed
1
2
3
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
4
apply plugin: 'kotlin-kapt'
Daniel Wolf's avatar
Daniel Wolf committed
5

6
7
def debugKeyPath = new File(System.properties['user.home'], ".android/debug.keystore")

Daniel Wolf's avatar
Daniel Wolf committed
8
android {
Daniel Wolf's avatar
Daniel Wolf committed
9
    compileSdkVersion 29
Daniel Wolf's avatar
Daniel Wolf committed
10
11
12
    defaultConfig {
        applicationId "com.frostnerd.smokescreen"
        minSdkVersion 21
Daniel Wolf's avatar
Daniel Wolf committed
13
        targetSdkVersion 29
14
        versionCode 65
15
        versionName "1.4.1.1"
Daniel Wolf's avatar
Daniel Wolf committed
16
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17

18
        buildConfigField("Boolean", "FROM_CI", String.valueOf(getSystemVariableOrDefault("CI_COMMIT_SHORT_SHA", "") != ""))
19
        buildConfigField("String", "COMMIT_HASH", '"' + getGitCommitHash() + '"')
Daniel Wolf's avatar
Daniel Wolf committed
20
        buildConfigField("String", "SENTRY_DSN", '""')
21

22
23
24
25
26
27
28
29
30
31
        kapt {
            arguments {
                arg("room.schemaLocation", "$projectDir/schemas".toString())
            }
        }
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
32
33
34
        vectorDrawables {
            useSupportLibrary = true
        }
35
    }
36
37
38
    signingConfigs {
        fromVariablesOrDebug {
            storeFile new File(getSystemVariableOrDefault("KEYSTORE_FILE", debugKeyPath.path))
39
            storePassword getSystemVariableOrDefault("KEYSTORE_PASSWORD", "android")
40
41
42
43
44
45
46
47
48
49
            keyAlias = getSystemVariableOrDefault("KEYSTORE_KEY_NAME", "androiddebugkey")
            keyPassword getSystemVariableOrDefault("KEYSTORE_KEY_PASSWORD", "android")
        }
        release {
            storeFile new File(getSystemVariableOrDefault("KEYSTORE_FILE", ""))
            storePassword getSystemVariableOrDefault("KEYSTORE_PASSWORD", "")
            keyAlias = getSystemVariableOrDefault("KEYSTORE_KEY_NAME", "")
            keyPassword getSystemVariableOrDefault("KEYSTORE_KEY_PASSWORD", "")
        }
    }
50
51
    sourceSets {
        androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
52
        debug.assets.srcDirs += files("$projectDir/schemas".toString())
Daniel Wolf's avatar
Daniel Wolf committed
53
54
55
56
    }
    buildTypes {
        release {
            minifyEnabled true
Daniel Wolf's avatar
Daniel Wolf committed
57
58
            debuggable false
            shrinkResources true
59
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
60
            signingConfig signingConfigs.release
61
62
63
64
65
            buildConfigField("Boolean", "LEAK_DETECTION", "false")
        }
        debug {
            initWith buildTypes.debug
            buildConfigField("Boolean", "LEAK_DETECTION", "false")
Daniel Wolf's avatar
Daniel Wolf committed
66
        }
67
        leakCanary {
68
            matchingFallbacks = ['debug']
69
            initWith buildTypes.debug
70
            buildConfigField("Boolean", "LEAK_DETECTION", "true")
71
        }
72
        fdroid {
73
            matchingFallbacks = ['release']
74
75
76
            initWith release
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
77
78
79
80
81
        unsignedRelease {
            minifyEnabled true
            debuggable false
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
82
            buildConfigField("Boolean", "LEAK_DETECTION", "false")
83
        }
Daniel Wolf's avatar
Daniel Wolf committed
84
    }
85
86
87
    flavorDimensions "version"
    productFlavors {
        adblocker {
88
            matchingFallbacks = ['default']
89
            dimension "version"
90
            versionNameSuffix "-adblock"
91
92
        }
        normal {
93
            matchingFallbacks = ['default']
94
95
96
            dimension "version"
        }
    }
Daniel Wolf's avatar
Daniel Wolf committed
97
    packagingOptions {
98
        exclude 'META-INF/library_release.kotlin_module'
Daniel Wolf's avatar
Daniel Wolf committed
99
    }
100
101
102
103
104
    testOptions {
        unitTests {
            includeAndroidResources = true
        }
    }
105
106
107
108
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
Daniel Wolf's avatar
Daniel Wolf committed
109
110
    lintOptions{
        disable 'MissingTranslation'
111
        disable 'InvalidPeriodicWorkRequestInterval'
Daniel Wolf's avatar
Daniel Wolf committed
112
    }
Daniel Wolf's avatar
Daniel Wolf committed
113
114
115
116
117
    dependenciesInfo {
        includeInApk = false
        includeInBundle = false
    }

Daniel Wolf's avatar
Daniel Wolf committed
118
119
120
}

dependencies {
Daniel Wolf's avatar
Daniel Wolf committed
121
    def room_version = "2.2.5"
122

Daniel Wolf's avatar
Daniel Wolf committed
123
    implementation fileTree(dir: 'libs', include: ['*.jar'])
Daniel Wolf's avatar
Daniel Wolf committed
124
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$KOTLIN_VERSION"
Daniel Wolf's avatar
Daniel Wolf committed
125
126
    implementation('org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9')
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
Daniel Wolf's avatar
Daniel Wolf committed
127

128

Daniel Wolf's avatar
Daniel Wolf committed
129
    implementation 'com.frostnerd.utilskt:preferences:1.5.29' // https://git.frostnerd.com/AndroidUtils/preferenceskt
Daniel Wolf's avatar
Daniel Wolf committed
130
    implementation 'com.frostnerd.utilskt:navigationdraweractivity:1.4.0' // https://git.frostnerd.com/AndroidUtils/navigationdraweractivity
131
    implementation 'com.frostnerd.utilskt:encrypteddnstunnelproxy:1.6.3' // https://git.frostnerd.com/AndroidUtils/encrypteddnstunnelproxy
Daniel Wolf's avatar
Daniel Wolf committed
132
    implementation 'com.frostnerd.utilskt:general:1.0.25' // https://git.frostnerd.com/AndroidUtils/generalkt
Daniel Wolf's avatar
Daniel Wolf committed
133
    implementation 'com.frostnerd.utilskt:adapters:1.2.0' // https://git.frostnerd.com/AndroidUtils/Adapters
Daniel Wolf's avatar
Daniel Wolf committed
134

Daniel Wolf's avatar
Daniel Wolf committed
135
    implementation 'androidx.work:work-runtime:2.4.0'
Daniel Wolf's avatar
Daniel Wolf committed
136
    implementation 'androidx.appcompat:appcompat:1.3.0-alpha02'
Daniel Wolf's avatar
Daniel Wolf committed
137
    implementation "androidx.preference:preference:1.1.1"
Daniel Wolf's avatar
Daniel Wolf committed
138
    implementation "com.google.android.material:material:1.3.0-alpha02"
139
    implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0-alpha01'
Daniel Wolf's avatar
Daniel Wolf committed
140

Daniel Wolf's avatar
Daniel Wolf committed
141
    implementation "androidx.room:room-runtime:$room_version"
142
    kapt "androidx.room:room-compiler:$room_version"
Daniel Wolf's avatar
Daniel Wolf committed
143
    implementation "androidx.room:room-coroutines:2.1.0-alpha04"
144
145
    testImplementation "androidx.room:room-testing:$room_version"

Daniel Wolf's avatar
Daniel Wolf committed
146
    implementation 'io.sentry:sentry-android:2.3.1'
Daniel Wolf's avatar
Daniel Wolf committed
147

148
    implementation 'com.github.jorgecastilloprz:fabprogresscircle:1.01@aar'
149
    implementation 'com.squareup.leakcanary:leaksentry:2.0-alpha-3'
150

Daniel Wolf's avatar
Daniel Wolf committed
151
    leakCanaryImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'
Daniel Wolf's avatar
Daniel Wolf committed
152

Daniel Wolf's avatar
Daniel Wolf committed
153
    testImplementation 'junit:junit:4.13'
Daniel Wolf's avatar
Daniel Wolf committed
154
    testImplementation "org.robolectric:robolectric:4.3.1"
Daniel Wolf's avatar
Daniel Wolf committed
155
156
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
Daniel Wolf's avatar
Daniel Wolf committed
157
}
158
159
160
161
162
163
164
165
166

def getGitCommitHash() {
    def stdout = new ByteArrayOutputStream()
    exec {
        commandLine 'git', 'rev-parse', '--short', 'HEAD'
        standardOutput = stdout
    }
    return stdout.toString().trim()
}