build.gradle 6.16 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"
Daniel Wolf's avatar
Daniel Wolf committed
88
            versionCode 52
89
90
91
92
93
        }
        normal {
            dimension "version"
        }
    }
Daniel Wolf's avatar
Daniel Wolf committed
94
    packagingOptions {
95
        exclude 'META-INF/library_release.kotlin_module'
Daniel Wolf's avatar
Daniel Wolf committed
96
    }
97
98
99
100
101
    testOptions {
        unitTests {
            includeAndroidResources = true
        }
    }
102
103
104
105
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
Daniel Wolf's avatar
Daniel Wolf committed
106
107
108
    lintOptions{
        disable 'MissingTranslation'
    }
Daniel Wolf's avatar
Daniel Wolf committed
109
110
}

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

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

Daniel Wolf's avatar
Daniel Wolf committed
121
    implementation fileTree(dir: 'libs', include: ['*.jar'])
122
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
123
124
    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
125

Daniel Wolf's avatar
Daniel Wolf committed
126
127
    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
128
    implementation 'com.frostnerd.utilskt:encrypteddnstunnelproxy:1.5.171' // https://git.frostnerd.com/AndroidUtils/encrypteddnstunnelproxy
Daniel Wolf's avatar
Daniel Wolf committed
129
130
    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
131

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

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

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

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

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

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

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