build.gradle 7.59 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
apply plugin: 'app.cash.exhaustive'
Daniel Wolf's avatar
Daniel Wolf committed
6

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

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

19
20
        def sentryDSN = String.valueOf(getSystemVariableOrDefault("NEBULO_SENTRY_DSN", "dummy"))
        def sentryConfigServer = String.valueOf(getSystemVariableOrDefault("NEBULO_SENTRY_CONFIGSERVER", "dummy"))
21
        buildConfigField("Boolean", "FROM_CI", String.valueOf(getSystemVariableOrDefault("CI_COMMIT_SHORT_SHA", "") != ""))
22
        buildConfigField("String", "COMMIT_HASH", '"' + getGitCommitHash() + '"')
23
24
        buildConfigField("String", "SENTRY_DSN", '"' + sentryDSN+ '"') // A valid Sentry DSN, or "dummy"
        buildConfigField("String", "SENTRY_DSN_CONFIGSERVER", '"' + sentryConfigServer + '"') // A host which returns a valid Sentry DSN on GET, or "dummy". If both are dummy Sentry is disabled.
Daniel Wolf's avatar
Daniel Wolf committed
25
        buildConfigField("Boolean", "SHOW_DOQ", 'false')
Daniel Wolf's avatar
Daniel Wolf committed
26
        buildConfigField("Boolean", "SHOW_INTRO", 'false')
27
        buildConfigField("Boolean", "IN_APP_UPDATES", "false")
28

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

137
138
139
140
141
142
143
// Uncomment to force a dependency version
//configurations.all {
//    resolutionStrategy {
//        force 'com.example:example:1.2.3'
//    }
//}

Daniel Wolf's avatar
Daniel Wolf committed
144
dependencies {
Daniel Wolf's avatar
Daniel Wolf committed
145
    def room_version = "2.2.6"
146

Daniel Wolf's avatar
Daniel Wolf committed
147
    implementation fileTree(dir: 'libs', include: ['*.jar'])
Daniel Wolf's avatar
Daniel Wolf committed
148
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$KOTLIN_VERSION"
Daniel Wolf's avatar
Daniel Wolf committed
149
150
    implementation('org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2')
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2'
Daniel Wolf's avatar
Daniel Wolf committed
151

152

Daniel Wolf's avatar
Daniel Wolf committed
153
    implementation 'com.frostnerd.utilskt:lifecycle:1.2.1'
Daniel Wolf's avatar
Daniel Wolf committed
154
    implementation 'com.frostnerd.utilskt:preferences:1.5.30' // https://git.frostnerd.com/AndroidUtils/preferenceskt
Daniel Wolf's avatar
Daniel Wolf committed
155
156
    implementation 'com.frostnerd.utilskt:navigationdraweractivity:1.4.2' // https://git.frostnerd.com/AndroidUtils/navigationdraweractivity
    implementation 'com.frostnerd.utilskt:encrypteddnstunnelproxy:2.1.21' // https://git.frostnerd.com/AndroidUtils/encrypteddnstunnelproxy
Daniel Wolf's avatar
Daniel Wolf committed
157
    implementation 'com.frostnerd.utilskt:general:1.0.25' // https://git.frostnerd.com/AndroidUtils/generalkt
Daniel Wolf's avatar
Daniel Wolf committed
158
    implementation 'com.frostnerd.utilskt:adapters:1.2.0' // https://git.frostnerd.com/AndroidUtils/Adapters
Daniel Wolf's avatar
Daniel Wolf committed
159

Daniel Wolf's avatar
Daniel Wolf committed
160
    implementation 'androidx.work:work-runtime:2.4.0'
Daniel Wolf's avatar
Daniel Wolf committed
161
    implementation 'androidx.appcompat:appcompat:1.3.0-alpha02'
Daniel Wolf's avatar
Daniel Wolf committed
162
    implementation "androidx.preference:preference:1.1.1"
Daniel Wolf's avatar
Daniel Wolf committed
163
    implementation "com.google.android.material:material:1.3.0-beta01"
164
    implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0-alpha01'
Daniel Wolf's avatar
Daniel Wolf committed
165
    implementation "androidx.core:core-ktx:1.3.2"
Daniel Wolf's avatar
Daniel Wolf committed
166

Daniel Wolf's avatar
Daniel Wolf committed
167
    implementation "androidx.room:room-runtime:$room_version"
168
    kapt "androidx.room:room-compiler:$room_version"
Daniel Wolf's avatar
Daniel Wolf committed
169
    implementation "androidx.room:room-coroutines:2.1.0-alpha04"
170
171
    testImplementation "androidx.room:room-testing:$room_version"

Daniel Wolf's avatar
Daniel Wolf committed
172
    implementation 'io.sentry:sentry-android:3.2.0'
Daniel Wolf's avatar
Daniel Wolf committed
173

174
    implementation 'com.github.jorgecastilloprz:fabprogresscircle:1.01@aar'
175

176
    leakCanaryImplementation 'com.squareup.leakcanary:leakcanary-android:2.6'
Daniel Wolf's avatar
Daniel Wolf committed
177

Daniel Wolf's avatar
Daniel Wolf committed
178
    implementation "com.squareup.okhttp3:okhttp:4.9.0"
Daniel Wolf's avatar
Daniel Wolf committed
179
    implementation 'com.github.AppIntro:AppIntro:6.0.0'
Daniel Wolf's avatar
Daniel Wolf committed
180
181

    implementation 'com.google.android.play:core:1.9.0'
Daniel Wolf's avatar
Daniel Wolf committed
182
}
183
184
185
186
187
188
189
190
191

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