build.gradle 6.13 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 {
9
10
11
12
13
14
15
16
17
18
19
20
21
22
    signingConfigs {
        fromVariablesOrDebug {
            storeFile new File(getSystemVariableOrDefault("KEYSTORE_FILE", debugKeyPath.path))
            storePassword getSystemVariableOrDefault("KEYSTORE_PASSWORD", "android")
            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", "")
        }
    }
Daniel Wolf's avatar
Daniel Wolf committed
23
    compileSdkVersion 29
Daniel Wolf's avatar
Daniel Wolf committed
24
25
26
    defaultConfig {
        applicationId "com.frostnerd.smokescreen"
        minSdkVersion 21
Daniel Wolf's avatar
Daniel Wolf committed
27
        targetSdkVersion 29
Daniel Wolf's avatar
Daniel Wolf committed
28
29
        versionCode 53
        versionName "1.1.0"
Daniel Wolf's avatar
Daniel Wolf committed
30
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
31

32
        buildConfigField("Boolean", "FROM_CI", String.valueOf(getSystemVariableOrDefault("CI_COMMIT_SHORT_SHA", "") != ""))
33
        buildConfigField("String", "COMMIT_HASH", '"' + getGitCommitHash() + '"')
Daniel Wolf's avatar
Daniel Wolf committed
34
        buildConfigField("String", "SENTRY_DSN", '"' + getSystemVariableOrDefault("SENTRY_DSN", "dummy") + '"')
35

36
37
38
39
40
41
42
43
44
45
        kapt {
            arguments {
                arg("room.schemaLocation", "$projectDir/schemas".toString())
            }
        }
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
46
47
48
        vectorDrawables {
            useSupportLibrary = true
        }
49
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
68
        leakCanary {
            initWith buildTypes.debug
69
            buildConfigField("Boolean", "LEAK_DETECTION", "true")
70
        }
71
72
73
74
        fdroid {
            initWith release
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
75
76
77
78
79
        unsignedRelease {
            minifyEnabled true
            debuggable false
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
80
            buildConfigField("Boolean", "LEAK_DETECTION", "false")
81
        }
Daniel Wolf's avatar
Daniel Wolf committed
82
    }
83
84
85
86
    flavorDimensions "version"
    productFlavors {
        adblocker {
            dimension "version"
87
            versionNameSuffix "-adblock"
88
89
90
91
92
        }
        normal {
            dimension "version"
        }
    }
Daniel Wolf's avatar
Daniel Wolf committed
93
    packagingOptions {
94
        exclude 'META-INF/library_release.kotlin_module'
Daniel Wolf's avatar
Daniel Wolf committed
95
    }
96
97
98
99
100
    testOptions {
        unitTests {
            includeAndroidResources = true
        }
    }
101
102
103
104
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
Daniel Wolf's avatar
Daniel Wolf committed
105
106
107
    lintOptions{
        disable 'MissingTranslation'
    }
Daniel Wolf's avatar
Daniel Wolf committed
108
109
}

110
111
112
configurations.all {
    resolutionStrategy {
        force 'org.slf4j:slf4j-api:1.7.26'
Daniel Wolf's avatar
Daniel Wolf committed
113
        force 'androidx.recyclerview:recyclerview:1.1.0'
114
115
116
    }
}

Daniel Wolf's avatar
Daniel Wolf committed
117
dependencies {
Daniel Wolf's avatar
Daniel Wolf committed
118
    def room_version = "2.2.2"
119

Daniel Wolf's avatar
Daniel Wolf committed
120
    implementation fileTree(dir: 'libs', include: ['*.jar'])
121
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
122
123
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2'
Daniel Wolf's avatar
Daniel Wolf committed
124

Daniel Wolf's avatar
Daniel Wolf committed
125
126
    implementation 'com.frostnerd.utilskt:preferences:1.5.17' // https://git.frostnerd.com/AndroidUtils/preferenceskt
    implementation 'com.frostnerd.utilskt:navigationdraweractivity:1.3.29' // https://git.frostnerd.com/AndroidUtils/navigationdraweractivity
127
    implementation 'com.frostnerd.utilskt:encrypteddnstunnelproxy:1.5.171' // https://git.frostnerd.com/AndroidUtils/encrypteddnstunnelproxy
Daniel Wolf's avatar
Daniel Wolf committed
128
129
    implementation 'com.frostnerd.utilskt:general:1.0.19' // https://git.frostnerd.com/AndroidUtils/generalkt
    implementation 'com.frostnerd.utilskt:adapters:1.1.6' // https://git.frostnerd.com/AndroidUtils/Adapters
Daniel Wolf's avatar
Daniel Wolf committed
130

Daniel Wolf's avatar
Daniel Wolf committed
131
    implementation 'androidx.work:work-runtime:2.2.0'
Daniel Wolf's avatar
Daniel Wolf committed
132
133
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation "androidx.preference:preference:1.1.0"
Daniel Wolf's avatar
Daniel Wolf committed
134
    implementation "com.google.android.material:material:1.2.0-alpha02"
135
    implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0-alpha01'
Daniel Wolf's avatar
Daniel Wolf committed
136

Daniel Wolf's avatar
Daniel Wolf committed
137
    implementation "androidx.room:room-runtime:$room_version"
138
    kapt "androidx.room:room-compiler:$room_version"
Daniel Wolf's avatar
Daniel Wolf committed
139
    implementation "androidx.room:room-coroutines:2.1.0-alpha04"
140
141
    testImplementation "androidx.room:room-testing:$room_version"

Daniel Wolf's avatar
Daniel Wolf committed
142
    implementation 'io.sentry:sentry-android:1.7.28'
Daniel Wolf's avatar
Daniel Wolf committed
143

144
    implementation 'com.github.jorgecastilloprz:fabprogresscircle:1.01@aar'
145
    implementation 'com.squareup.leakcanary:leaksentry:2.0-alpha-3'
146

Daniel Wolf's avatar
Daniel Wolf committed
147
    leakCanaryImplementation 'com.squareup.leakcanary:leakcanary-android:2.0'
Daniel Wolf's avatar
Daniel Wolf committed
148

Daniel Wolf's avatar
Daniel Wolf committed
149
    testImplementation 'junit:junit:4.12'
Daniel Wolf's avatar
Daniel Wolf committed
150
    testImplementation "org.robolectric:robolectric:4.3.1"
Daniel Wolf's avatar
Daniel Wolf committed
151
152
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
Daniel Wolf's avatar
Daniel Wolf committed
153
}
154
155
156
157
158
159
160
161
162

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