summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--android/app/build.gradle179
-rw-r--r--android/app/build.gradle.kts180
-rw-r--r--android/build.gradle40
-rw-r--r--android/build.gradle.kts41
-rw-r--r--android/settings.gradle1
-rw-r--r--android/settings.gradle.kts1
-rwxr-xr-xbuild-apk.sh2
-rwxr-xr-xprepare-release.sh2
-rwxr-xr-xversion-metadata.sh14
9 files changed, 231 insertions, 229 deletions
diff --git a/android/app/build.gradle b/android/app/build.gradle
deleted file mode 100644
index 79603dd520..0000000000
--- a/android/app/build.gradle
+++ /dev/null
@@ -1,179 +0,0 @@
-apply plugin: 'com.android.application'
-apply plugin: 'com.github.triplet.play'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-parcelize'
-
-def repoRootPath = rootProject.projectDir.absoluteFile.parentFile.absolutePath
-def extraAssetsDirectory = "$project.buildDir/extraAssets"
-def extraJniDirectory = "$project.buildDir/extraJni"
-
-def keystorePropertiesFile = file("$rootProject.projectDir/keystore.properties")
-def keystoreProperties = new Properties()
-
-if (keystorePropertiesFile.exists()) {
- keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
-}
-
-android {
- compileSdkVersion 30
- buildToolsVersion '30.0.3'
-
- defaultConfig {
- applicationId "net.mullvad.mullvadvpn"
- minSdkVersion 26
- targetSdkVersion 30
- versionCode 21010099
- versionName "2021.1"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
-
- 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)
- }
-
- java {
- srcDirs += 'src/main/kotlin/'
- }
- }
-
- test {
- java {
- srcDirs += 'src/test/kotlin/'
- }
- }
-
- androidTest {
- java {
- srcDirs += 'src/androidTest/kotlin/'
- }
- }
- }
-
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
-
- kotlinOptions {
- jvmTarget = '1.8'
- freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
- // Opt-in option for Koin annotation of KoinComponent.
- }
-
- applicationVariants.all { variant ->
- variant.mergeAssetsProvider.configure {
- dependsOn copyExtraAssets
- }
- }
-
- testOptions {
- unitTests.all {
- testLogging {
- outputs.upToDateWhen { false }
- events "passed", "skipped", "failed", "standardOut", "standardError"
- showCauses true
- showExceptions true
- }
- }
- }
-}
-
-dependencyCheck {
- // Skip the lintClassPath configuration, which relies on many dependencies that has been flagged
- // to have CVEs, as it's related to the lint tooling rather than the project's compilation class
- // path. The alternative would be to suppress specific CVEs, however that could potentially
- // result in suppressed CVEs in project compilation class path.
- skipConfigurations += 'lintClassPath'
-}
-
-tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
- kotlinOptions {
- allWarningsAsErrors = false
-
- kotlinOptions.freeCompilerArgs += [
- "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi",
- "-Xuse-experimental=kotlinx.coroutines.ObsoleteCoroutinesApi",
- ]
- }
-}
-
-task copyExtraAssets(type: Copy) {
- from "$repoRootPath/dist-assets"
- include "relays.json"
- include "api-ip-address.txt"
- into extraAssetsDirectory
-}
-
-play {
- serviceAccountCredentials = file("play-api-key.json")
-}
-
-dependencies {
- implementation "androidx.appcompat:appcompat:1.3.1"
- implementation "androidx.constraintlayout:constraintlayout:2.1.0"
- implementation "androidx.coordinatorlayout:coordinatorlayout:1.1.0"
- implementation "androidx.core:core-ktx:1.6.0"
- implementation "androidx.fragment:fragment-ktx:$fragmentVersion"
- implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"
- implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
- implementation "androidx.recyclerview:recyclerview:1.2.1"
- implementation "com.google.android.material:material:1.4.0"
- implementation "commons-validator:commons-validator:1.7"
- implementation "io.insert-koin:koin-core:$koinVersion"
- implementation "io.insert-koin:koin-core-ext:$koinVersion"
- implementation "io.insert-koin:koin-androidx-fragment:$koinVersion"
- implementation "io.insert-koin:koin-androidx-scope:$koinVersion"
- implementation "io.insert-koin:koin-androidx-viewmodel:$koinVersion"
- implementation "joda-time:joda-time:2.10.2"
- implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
- implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1"
-
- /* Test dependencies */
- testImplementation "io.insert-koin:koin-test:$koinVersion"
- testImplementation "io.mockk:mockk:$mockkVersion"
- testImplementation "junit:junit:4.13"
- testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
- testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.1"
-
- /* UI test dependencies */
- debugImplementation "androidx.fragment:fragment-testing:$fragmentVersion"
- androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
- androidTestImplementation "androidx.test.espresso:espresso-contrib:$espressoVersion"
- androidTestImplementation "androidx.test.ext:junit:1.1.3"
- androidTestImplementation "io.mockk:mockk-android:$mockkVersion"
- androidTestImplementation "io.insert-koin:koin-test:$koinVersion"
- androidTestImplementation "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
-}
diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts
new file mode 100644
index 0000000000..1ff0d1c49c
--- /dev/null
+++ b/android/app/build.gradle.kts
@@ -0,0 +1,180 @@
+
+import java.io.FileInputStream
+import java.util.Properties
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
+plugins {
+ id("com.android.application")
+ id("com.github.triplet.play")
+ id("kotlin-android")
+ id("kotlin-parcelize")
+}
+
+val repoRootPath = rootProject.projectDir.absoluteFile.parentFile.absolutePath
+val extraAssetsDirectory = "${project.buildDir}/extraAssets"
+val extraJniDirectory = "${project.buildDir}/extraJni"
+
+val keystorePropertiesFile = file("$rootProject.projectDir/keystore.properties")
+val keystoreProperties = Properties()
+
+if (keystorePropertiesFile.exists()) {
+ keystoreProperties.load(FileInputStream(keystorePropertiesFile))
+}
+
+android {
+ compileSdkVersion(30)
+ buildToolsVersion("30.0.3")
+
+ defaultConfig {
+ applicationId = "net.mullvad.mullvadvpn"
+ minSdkVersion(26)
+ targetSdkVersion(30)
+ versionCode = 21010099
+ versionName = "2021.1"
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ if (keystorePropertiesFile.exists()) {
+ signingConfigs {
+ getByName("release") {
+ keyAlias = keystoreProperties.getProperty("keyAlias")
+ keyPassword = keystoreProperties.getProperty("keyPassword")
+ storeFile = file(keystoreProperties.getProperty("storeFile"))
+ storePassword = keystoreProperties.getProperty("storePassword")
+ }
+ }
+
+ buildTypes {
+ getByName("release") {
+ isMinifyEnabled = false
+ signingConfig = signingConfigs.getByName("release")
+ }
+ }
+ }
+
+ buildTypes {
+ create("fdroid") {
+ initWith(buildTypes.getByName("release"))
+ isMinifyEnabled = false
+ signingConfig = null
+ }
+ }
+
+ sourceSets {
+ getByName("main") {
+ assets.srcDirs(extraAssetsDirectory)
+ jniLibs.srcDirs(extraJniDirectory)
+ java.srcDirs("src/main/kotlin/")
+ }
+
+ getByName("test") {
+ java.srcDirs("src/test/kotlin/")
+ }
+
+ getByName("androidTest") {
+ java.srcDirs("src/androidTest/kotlin/")
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ }
+
+ kotlinOptions {
+ jvmTarget = "1.8"
+ freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
+ // Opt-in option for Koin annotation of KoinComponent.
+ }
+
+ applicationVariants.forEach { variant ->
+ variant.mergeAssetsProvider.configure{
+ dependsOn(task("copyExtraAssets"))
+ }
+ }
+
+ testOptions {
+ unitTests.all { test ->
+ test.testLogging {
+ test.outputs.upToDateWhen { false }
+ events("passed", "skipped", "failed", "standardOut", "standardError")
+ showCauses = true
+ showExceptions = true
+ }
+ }
+ }
+}
+
+configure<org.owasp.dependencycheck.gradle.extension.DependencyCheckExtension> {
+ // Skip the lintClassPath configuration, which relies on many dependencies that has been flagged
+ // to have CVEs, as it's related to the lint tooling rather than the project's compilation class
+ // path. The alternative would be to suppress specific CVEs, however that could potentially
+ // result in suppressed CVEs in project compilation class path.
+ skipConfigurations = listOf("lintClassPath")
+}
+
+tasks.withType<KotlinCompile>().all {
+ kotlinOptions {
+ allWarningsAsErrors = false
+
+ kotlinOptions.freeCompilerArgs = listOf(
+ "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi",
+ "-Xuse-experimental=kotlinx.coroutines.ObsoleteCoroutinesApi"
+ )
+ }
+}
+
+tasks.register("copyExtraAssets", Copy::class) {
+ from("$repoRootPath/dist-assets")
+ include("relays.json")
+ include("api-ip-address.txt")
+ into(extraAssetsDirectory)
+}
+
+play {
+ serviceAccountCredentials = file("play-api-key.json")
+}
+
+dependencies {
+ val espressoVersion: String by rootProject.extra
+ val fragmentVersion: String by rootProject.extra
+ val koinVersion: String by rootProject.extra
+ val kotlinVersion: String by rootProject.extra
+ val mockkVersion: String by rootProject.extra
+
+ implementation("androidx.appcompat:appcompat:1.3.1")
+ implementation("androidx.constraintlayout:constraintlayout:2.1.0")
+ implementation("androidx.coordinatorlayout:coordinatorlayout:1.1.0")
+ implementation("androidx.core:core-ktx:1.6.0")
+ implementation("androidx.fragment:fragment-ktx:$fragmentVersion")
+ implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.3.1")
+ implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1")
+ implementation("androidx.recyclerview:recyclerview:1.2.1")
+ implementation("com.google.android.material:material:1.4.0")
+ implementation("commons-validator:commons-validator:1.7")
+ implementation("io.insert-koin:koin-core:$koinVersion")
+ implementation("io.insert-koin:koin-core-ext:$koinVersion")
+ implementation("io.insert-koin:koin-androidx-fragment:$koinVersion")
+ implementation("io.insert-koin:koin-androidx-scope:$koinVersion")
+ implementation("io.insert-koin:koin-androidx-viewmodel:$koinVersion")
+ implementation("joda-time:joda-time:2.10.2")
+ implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
+ implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1")
+
+ /* Test dependencies */
+ testImplementation("io.insert-koin:koin-test:$koinVersion")
+ testImplementation("io.mockk:mockk:$mockkVersion")
+ testImplementation("junit:junit:4.13")
+ testImplementation("org.jetbrains.kotlin:kotlin-test:$kotlinVersion")
+ testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.1")
+
+ /* UI test dependencies */
+ debugImplementation("androidx.fragment:fragment-testing:$fragmentVersion")
+ androidTestImplementation("androidx.test.espresso:espresso-core:$espressoVersion")
+ androidTestImplementation("androidx.test.espresso:espresso-contrib:$espressoVersion")
+ androidTestImplementation("androidx.test.ext:junit:1.1.3")
+ androidTestImplementation("io.mockk:mockk-android:$mockkVersion")
+ androidTestImplementation("io.insert-koin:koin-test:$koinVersion")
+ androidTestImplementation("org.jetbrains.kotlin:kotlin-test:$kotlinVersion")
+}
diff --git a/android/build.gradle b/android/build.gradle
deleted file mode 100644
index dd148cccb1..0000000000
--- a/android/build.gradle
+++ /dev/null
@@ -1,40 +0,0 @@
-buildscript {
- ext {
- espressoVersion = "3.3.0"
- fragmentVersion = "1.3.2"
- koinVersion = '2.2.2'
- kotlinVersion = '1.4.31'
- mockkVersion = '1.12.0'
- }
- repositories {
- google()
- mavenCentral()
-
- maven {
- url "https://plugins.gradle.org/m2/"
- }
- }
-
- dependencies {
- classpath "com.android.tools.build:gradle:4.1.3"
- classpath "com.github.triplet.gradle:play-publisher:2.7.5"
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
- classpath "org.owasp:dependency-check-gradle:6.5.0.1"
-
- }
-}
-
-allprojects {
- repositories {
- google()
- mavenCentral()
- }
- apply plugin: 'org.owasp.dependencycheck'
- dependencyCheck {
- failBuildOnCVSS = 0 // All severity levels
- }
-}
-
-task clean(type: Delete) {
- delete rootProject.buildDir
-}
diff --git a/android/build.gradle.kts b/android/build.gradle.kts
new file mode 100644
index 0000000000..6d356007c2
--- /dev/null
+++ b/android/build.gradle.kts
@@ -0,0 +1,41 @@
+plugins {
+ id("org.owasp.dependencycheck") version "6.5.0.1" apply false
+}
+
+buildscript {
+ val espressoVersion by extra { "3.3.0" }
+ val fragmentVersion by extra { "1.3.2" }
+ val koinVersion by extra { "2.2.2" }
+ val kotlinVersion by extra { "1.4.31" }
+ val mockkVersion by extra { "1.12.0" }
+
+ repositories {
+ google()
+ mavenCentral()
+ maven("https://plugins.gradle.org/m2/")
+ }
+
+ dependencies {
+ classpath("com.android.tools.build:gradle:4.1.3")
+ classpath("com.github.triplet.gradle:play-publisher:2.7.5")
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
+ classpath("org.owasp:dependency-check-gradle:6.5.0.1")
+ }
+}
+
+allprojects {
+ apply(plugin = "org.owasp.dependencycheck")
+
+ repositories {
+ google()
+ mavenCentral()
+ }
+
+ configure<org.owasp.dependencycheck.gradle.extension.DependencyCheckExtension> {
+ failBuildOnCVSS = 0F // All severity levels
+ }
+}
+
+tasks.register("clean", Delete::class) {
+ delete(rootProject.buildDir)
+}
diff --git a/android/settings.gradle b/android/settings.gradle
deleted file mode 100644
index af1a998862..0000000000
--- a/android/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include ":app"
diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts
new file mode 100644
index 0000000000..15a801b10a
--- /dev/null
+++ b/android/settings.gradle.kts
@@ -0,0 +1 @@
+include(":app")
diff --git a/build-apk.sh b/build-apk.sh
index 35c340194a..c5a1fea9d1 100755
--- a/build-apk.sh
+++ b/build-apk.sh
@@ -6,7 +6,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
-PRODUCT_VERSION="$(sed -n -e 's/^ *versionName "\([^"]*\)"$/\1/p' android/app/build.gradle)"
+PRODUCT_VERSION="$(sed -n -e 's/^ *versionName = "\([^"]*\)"$/\1/p' android/app/build.gradle.kts)"
BUILD_TYPE="release"
GRADLE_BUILD_TYPE="release"
GRADLE_TASK="assembleRelease"
diff --git a/prepare-release.sh b/prepare-release.sh
index 6bc4765a3f..733d527f46 100755
--- a/prepare-release.sh
+++ b/prepare-release.sh
@@ -76,7 +76,7 @@ git commit -S -m "Updating version in package files" \
mullvad-exclude/Cargo.toml \
talpid-openvpn-plugin/Cargo.toml \
Cargo.lock \
- android/app/build.gradle \
+ android/app/build.gradle.kts \
dist-assets/windows/version.h
echo "Tagging current git commit with release tag $PRODUCT_VERSION..."
diff --git a/version-metadata.sh b/version-metadata.sh
index 856228ccc0..8a68159ca1 100755
--- a/version-metadata.sh
+++ b/version-metadata.sh
@@ -96,11 +96,11 @@ EOF
echo "Setting Android versionName to $PRODUCT_VERSION and versionCode to $android_version_code"
- cp android/app/build.gradle android/app/build.gradle.bak
- sed -i -Ee "s/versionCode [0-9]+/versionCode $android_version_code/g" \
- android/app/build.gradle
- sed -i -Ee "s/versionName \"[^\"]+\"/versionName \"$PRODUCT_VERSION\"/g" \
- android/app/build.gradle
+ cp android/app/build.gradle.kts android/app/build.gradle.kts.bak
+ sed -i -Ee "s/versionCode = [0-9]+/versionCode = $android_version_code/g" \
+ android/app/build.gradle.kts
+ sed -i -Ee "s/versionName = \"[^\"]+\"/versionName = \"$PRODUCT_VERSION\"/g" \
+ android/app/build.gradle.kts
fi
}
@@ -123,7 +123,7 @@ function restore_backup {
if [[ "$ANDROID" == "true" ]]; then
# Android
- mv android/app/build.gradle.bak android/app/build.gradle
+ mv android/app/build.gradle.kts.bak android/app/build.gradle.kts
fi
set -e
}
@@ -147,7 +147,7 @@ function delete_backup {
if [[ "$ANDROID" == "true" ]]; then
# Android
- rm android/app/build.gradle.bak
+ rm android/app/build.gradle.kts.bak
fi
set -e
}