From d28fc5a7e6396a4e952660281780b32f146b5e57 Mon Sep 17 00:00:00 2001 From: Alexander Talledo Date: Fri, 13 Feb 2026 15:07:01 +0100 Subject: [PATCH] chore: Convetion Plugins introduccion [VPNAND-2527] --- app/build.gradle | 17 ++--- build-logic/.gitignore | 1 + build-logic/build.gradle.kts | 43 +++++++++++ build-logic/settings.gradle.kts | 33 +++++++++ .../logic/domain/config/AndroidConfig.kt | 36 +++++++++ .../domain/dependencies/PluginDependency.kt | 26 +++++++ .../AndroidApplicationConventionPlugin.kt | 46 ++++++++++++ .../plugins/AndroidLibraryConventionPlugin.kt | 45 +++++++++++ .../logic/domain/plugins/ConventionPlugin.kt | 74 +++++++++++++++++++ ...onVpnAndroidApplicationConventionPlugin.kt | 40 ++++++++++ ...ProtonVpnAndroidLibraryConventionPlugin.kt | 40 ++++++++++ build.gradle | 3 - gradle/libs.versions.toml | 4 + release_tests/build.gradle | 14 +--- settings.gradle.kts | 2 + shared-test-code/build.gradle | 18 ++--- ui_automator_test_util/build.gradle.kts | 35 +++++---- 17 files changed, 423 insertions(+), 54 deletions(-) create mode 100644 build-logic/.gitignore create mode 100644 build-logic/build.gradle.kts create mode 100644 build-logic/settings.gradle.kts create mode 100644 build-logic/src/main/java/com/protonvpn/android/build/logic/domain/config/AndroidConfig.kt create mode 100644 build-logic/src/main/java/com/protonvpn/android/build/logic/domain/dependencies/PluginDependency.kt create mode 100644 build-logic/src/main/java/com/protonvpn/android/build/logic/domain/plugins/AndroidApplicationConventionPlugin.kt create mode 100644 build-logic/src/main/java/com/protonvpn/android/build/logic/domain/plugins/AndroidLibraryConventionPlugin.kt create mode 100644 build-logic/src/main/java/com/protonvpn/android/build/logic/domain/plugins/ConventionPlugin.kt create mode 100644 build-logic/src/main/java/com/protonvpn/android/build/logic/plugins/ProtonVpnAndroidApplicationConventionPlugin.kt create mode 100644 build-logic/src/main/java/com/protonvpn/android/build/logic/plugins/ProtonVpnAndroidLibraryConventionPlugin.kt diff --git a/app/build.gradle b/app/build.gradle index f76ab0ee6..6b060650d 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ buildscript { } plugins { - alias(libs.plugins.android.application) + alias(libs.plugins.proton.vpn.android.application) alias(libs.plugins.android.compose.screenshot) alias(libs.plugins.androidx.baselineprofile) alias(libs.plugins.androidx.room) @@ -45,7 +45,6 @@ plugins { alias(libs.plugins.detekt) alias(libs.plugins.jacoco) alias(libs.plugins.jaredsburrows.gradle.license) - alias(libs.plugins.kotlin.android) alias(libs.plugins.kotlin.compose) alias(libs.plugins.kotlin.parcelize) alias(libs.plugins.kotlin.serialization) @@ -143,8 +142,6 @@ def debugKeystorePath = System.getenv("DEBUG_KEYSTORE_FILE") android { namespace "com.protonvpn.android" testNamespace 'com.protonvpn' - ndkVersion rootProject.ext.compileNdkVersion - compileSdk rootProject.ext.compileSdkVersion useLibrary 'org.apache.http.legacy' signingConfigs { if (debugKeystorePath) { @@ -163,8 +160,6 @@ android { } defaultConfig { applicationId appId - minSdkVersion rootProject.ext.minSdkVersion // See also build flavors. - targetSdkVersion 35 multiDexEnabled true versionName helpers.fullVersionName versionCode helpers.getVersionCode() @@ -387,17 +382,15 @@ android { // Adds exported schema location as test app assets. androidTest.assets.srcDirs += files("$projectDir/schemas".toString()) } + compileOptions { - targetCompatibility JavaVersion.VERSION_17 - sourceCompatibility JavaVersion.VERSION_17 coreLibraryDesugaringEnabled = true } + kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - freeCompilerArgs += [ - "-Xopt-in=kotlin.RequiresOptIn" - ] + freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn"] } + lint { // In our process we might temporarily have extra translations that will get removed on // next update. diff --git a/build-logic/.gitignore b/build-logic/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/build-logic/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts new file mode 100644 index 000000000..c75f4d17c --- /dev/null +++ b/build-logic/build.gradle.kts @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2026 Proton AG + * + * This file is part of ProtonVPN. + * + * ProtonVPN is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ProtonVPN is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ProtonVPN. If not, see . + */ + +plugins { + `kotlin-dsl` +} + +group = "com.protonvpn.android.build.logic" + +dependencies { + compileOnly(libs.android.tools.build.gradle) + compileOnly(libs.kotlin.gradle.plugin) +} + +gradlePlugin { + plugins { + register("android-application") { + id = "me.proton.vpn.android.application" + implementationClass = "com.protonvpn.android.build.logic.plugins.ProtonVpnAndroidApplicationConventionPlugin" + } + + register("android-library") { + id = "me.proton.vpn.android.library" + implementationClass = "com.protonvpn.android.build.logic.plugins.ProtonVpnAndroidLibraryConventionPlugin" + } + } +} diff --git a/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts new file mode 100644 index 000000000..d4c94875f --- /dev/null +++ b/build-logic/settings.gradle.kts @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2026 Proton AG + * + * This file is part of ProtonVPN. + * + * ProtonVPN is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ProtonVPN is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ProtonVPN. If not, see . + */ + +rootProject.name = "build-logic" + +dependencyResolutionManagement { + repositories { + google() + mavenCentral() + } + + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} diff --git a/build-logic/src/main/java/com/protonvpn/android/build/logic/domain/config/AndroidConfig.kt b/build-logic/src/main/java/com/protonvpn/android/build/logic/domain/config/AndroidConfig.kt new file mode 100644 index 000000000..83be8ffa6 --- /dev/null +++ b/build-logic/src/main/java/com/protonvpn/android/build/logic/domain/config/AndroidConfig.kt @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2026 Proton AG + * + * This file is part of ProtonVPN. + * + * ProtonVPN is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ProtonVPN is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ProtonVPN. If not, see . + */ + +package com.protonvpn.android.build.logic.domain.config + +import org.gradle.api.JavaVersion + +internal object AndroidConfig { + + internal const val COMPILE_SDK_VERSION = 36 + + internal const val MIN_SDK_VERSION = 26 + + internal const val TARGET_SDK_VERSION = 35 + + internal const val NDK_VERSION = "28.1.13356709" + + internal val CompileJavaVersion: JavaVersion = JavaVersion.VERSION_17 + +} diff --git a/build-logic/src/main/java/com/protonvpn/android/build/logic/domain/dependencies/PluginDependency.kt b/build-logic/src/main/java/com/protonvpn/android/build/logic/domain/dependencies/PluginDependency.kt new file mode 100644 index 000000000..ccf0effa8 --- /dev/null +++ b/build-logic/src/main/java/com/protonvpn/android/build/logic/domain/dependencies/PluginDependency.kt @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2026 Proton AG + * + * This file is part of ProtonVPN. + * + * ProtonVPN is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ProtonVPN is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ProtonVPN. If not, see . + */ + +package com.protonvpn.android.build.logic.domain.dependencies + +internal enum class PluginDependency(internal val alias: String) { + AndroidApplication(alias = "android-application"), + AndroidLibrary(alias = "android-library"), + KotlinAndroid(alias = "kotlin-android"), +} diff --git a/build-logic/src/main/java/com/protonvpn/android/build/logic/domain/plugins/AndroidApplicationConventionPlugin.kt b/build-logic/src/main/java/com/protonvpn/android/build/logic/domain/plugins/AndroidApplicationConventionPlugin.kt new file mode 100644 index 000000000..016bfa8aa --- /dev/null +++ b/build-logic/src/main/java/com/protonvpn/android/build/logic/domain/plugins/AndroidApplicationConventionPlugin.kt @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2026 Proton AG + * + * This file is part of ProtonVPN. + * + * ProtonVPN is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ProtonVPN is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ProtonVPN. If not, see . + */ + +package com.protonvpn.android.build.logic.domain.plugins + +import com.android.build.gradle.internal.dsl.BaseAppModuleExtension +import com.protonvpn.android.build.logic.domain.config.AndroidConfig +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure + +internal abstract class AndroidApplicationConventionPlugin : ConventionPlugin() { + + protected fun Project.configureAndroidApplication() { + extensions.configure { + compileSdk = AndroidConfig.COMPILE_SDK_VERSION + ndkVersion = AndroidConfig.NDK_VERSION + + defaultConfig { + minSdk = AndroidConfig.MIN_SDK_VERSION + targetSdk = AndroidConfig.TARGET_SDK_VERSION + } + + compileOptions { + sourceCompatibility = AndroidConfig.CompileJavaVersion + targetCompatibility = AndroidConfig.CompileJavaVersion + } + } + } + +} diff --git a/build-logic/src/main/java/com/protonvpn/android/build/logic/domain/plugins/AndroidLibraryConventionPlugin.kt b/build-logic/src/main/java/com/protonvpn/android/build/logic/domain/plugins/AndroidLibraryConventionPlugin.kt new file mode 100644 index 000000000..dafc9c824 --- /dev/null +++ b/build-logic/src/main/java/com/protonvpn/android/build/logic/domain/plugins/AndroidLibraryConventionPlugin.kt @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2026 Proton AG + * + * This file is part of ProtonVPN. + * + * ProtonVPN is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ProtonVPN is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ProtonVPN. If not, see . + */ + +package com.protonvpn.android.build.logic.domain.plugins + +import com.android.build.api.dsl.LibraryExtension +import com.protonvpn.android.build.logic.domain.config.AndroidConfig +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure + +internal abstract class AndroidLibraryConventionPlugin : ConventionPlugin() { + + protected fun Project.configureAndroidLibrary() { + extensions.configure { + compileSdk = AndroidConfig.COMPILE_SDK_VERSION + ndkVersion = AndroidConfig.NDK_VERSION + + defaultConfig { + minSdk = AndroidConfig.MIN_SDK_VERSION + } + + compileOptions { + sourceCompatibility = AndroidConfig.CompileJavaVersion + targetCompatibility = AndroidConfig.CompileJavaVersion + } + } + } + +} diff --git a/build-logic/src/main/java/com/protonvpn/android/build/logic/domain/plugins/ConventionPlugin.kt b/build-logic/src/main/java/com/protonvpn/android/build/logic/domain/plugins/ConventionPlugin.kt new file mode 100644 index 000000000..50d1044f9 --- /dev/null +++ b/build-logic/src/main/java/com/protonvpn/android/build/logic/domain/plugins/ConventionPlugin.kt @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2026 Proton AG + * + * This file is part of ProtonVPN. + * + * ProtonVPN is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ProtonVPN is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ProtonVPN. If not, see . + */ + +package com.protonvpn.android.build.logic.domain.plugins + +import com.protonvpn.android.build.logic.domain.dependencies.PluginDependency +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.artifacts.VersionCatalogsExtension +import org.gradle.api.plugins.PluginAware +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.getByType +import org.gradle.kotlin.dsl.withType +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile + +internal abstract class ConventionPlugin : Plugin { + + protected fun Project.applyPlugins(vararg pluginDependencies: PluginDependency) { + pluginDependencies.forEach { pluginDependency -> + applyPlugin(pluginDependency = pluginDependency) + } + } + + protected fun Project.applyPlugin(pluginDependency: PluginDependency) { + getVersionCatalogsPlugin(pluginAlias = pluginDependency.alias).also { plugin -> + applyPlugin(pluginId = plugin.pluginId) + } + } + + private fun PluginAware.applyPlugin(pluginId: String) { + apply(plugin = pluginId) + } + + protected fun Project.configureKotlinOptions() { + tasks.withType(type = KotlinJvmCompile::class) { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_17) + } + } + } + + private fun Project.getVersionCatalogsPlugin(pluginAlias: String) = getVersionCatalogs() + .findPlugin(pluginAlias) + .get() + .get() + + private fun Project.getVersionCatalogs() = extensions + .getByType() + .named(VERSION_CATALOGS_CONTAINER_NAME) + + private companion object { + + private const val VERSION_CATALOGS_CONTAINER_NAME = "libs" + + } + +} diff --git a/build-logic/src/main/java/com/protonvpn/android/build/logic/plugins/ProtonVpnAndroidApplicationConventionPlugin.kt b/build-logic/src/main/java/com/protonvpn/android/build/logic/plugins/ProtonVpnAndroidApplicationConventionPlugin.kt new file mode 100644 index 000000000..338f3036e --- /dev/null +++ b/build-logic/src/main/java/com/protonvpn/android/build/logic/plugins/ProtonVpnAndroidApplicationConventionPlugin.kt @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2026 Proton AG + * + * This file is part of ProtonVPN. + * + * ProtonVPN is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ProtonVPN is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ProtonVPN. If not, see . + */ + +package com.protonvpn.android.build.logic.plugins + +import com.protonvpn.android.build.logic.domain.dependencies.PluginDependency +import com.protonvpn.android.build.logic.domain.plugins.AndroidApplicationConventionPlugin +import org.gradle.api.Project + +internal class ProtonVpnAndroidApplicationConventionPlugin : AndroidApplicationConventionPlugin() { + + override fun apply(project: Project) = with(receiver = project) { + applyPlugins( + pluginDependencies = arrayOf( + PluginDependency.AndroidApplication, + PluginDependency.KotlinAndroid, + ) + ) + + configureAndroidApplication() + configureKotlinOptions() + } + +} diff --git a/build-logic/src/main/java/com/protonvpn/android/build/logic/plugins/ProtonVpnAndroidLibraryConventionPlugin.kt b/build-logic/src/main/java/com/protonvpn/android/build/logic/plugins/ProtonVpnAndroidLibraryConventionPlugin.kt new file mode 100644 index 000000000..ee737562a --- /dev/null +++ b/build-logic/src/main/java/com/protonvpn/android/build/logic/plugins/ProtonVpnAndroidLibraryConventionPlugin.kt @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2026 Proton AG + * + * This file is part of ProtonVPN. + * + * ProtonVPN is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ProtonVPN is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ProtonVPN. If not, see . + */ + +package com.protonvpn.android.build.logic.plugins + +import com.protonvpn.android.build.logic.domain.dependencies.PluginDependency +import com.protonvpn.android.build.logic.domain.plugins.AndroidLibraryConventionPlugin +import org.gradle.api.Project + +internal class ProtonVpnAndroidLibraryConventionPlugin : AndroidLibraryConventionPlugin() { + + override fun apply(project: Project) = with(receiver = project) { + applyPlugins( + pluginDependencies = arrayOf( + PluginDependency.AndroidLibrary, + PluginDependency.KotlinAndroid, + ) + ) + + configureAndroidLibrary() + configureKotlinOptions() + } + +} diff --git a/build.gradle b/build.gradle index b25fec95b..9b543e7ab 100644 --- a/build.gradle +++ b/build.gradle @@ -42,10 +42,7 @@ plugins { } project.ext { - minSdkVersion = 26 minSdkVersionAmazon = 25 // Fire OS 6, see VPNAND-1914. - compileSdkVersion = 36 - compileNdkVersion = "28.1.13356709" } allprojects { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f256b09a6..6bd721643 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -92,6 +92,7 @@ airbnb-lottie = { group = "com.airbnb.android", name = "lottie", version.ref = " airbnb-lottie-compose = { group = "com.airbnb.android", name = "lottie-compose", version.ref = "airbnb-lottie-version" } android-flexbox = { group = "com.google.android.flexbox", name = "flexbox", version.ref = "android-flexbox-version" } android-material = { group = "com.google.android.material", name = "material", version.ref = "android-material-version" } +android-tools-build-gradle = { group = "com.android.tools.build", name = "gradle", version.ref = "agp-version" } android-tools-desugar-jdk-libs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "android-tools-version" } androidx-activity-ktx = { group = "androidx.activity", name = "activity-ktx", version.ref = "androidx-activity-version" } androidx-arch-core-testing = { group = "androidx.arch.core", name = "core-testing", version.ref = "androidx-arch-core-version" } @@ -184,6 +185,7 @@ google-truth = { group = "com.google.truth", name = "truth", version.ref = "goog java-jna = { group = "net.java.dev.jna", name = "jna", version.ref = "java-jna-version" } junit = { group = "junit", name = "junit", version.ref = "junit-version" } kotlin-bom = { group = "org.jetbrains.kotlin", name = "kotlin-bom", version.ref = "kotlin-version" } +kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin" } kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test" } kotlin-test-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit" } kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinx-coroutines-version" } @@ -317,5 +319,7 @@ kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", versi ksp = { id = "com.google.devtools.ksp", version.ref = "ksp-version" } owasp-dependencycheck = { id = "org.owasp.dependencycheck", version.ref = "owasp-dependencycheck-version" } proton-core-env-config = { id = "me.proton.core.gradle-plugins.environment-config", version.ref = "proton-core-env-config-version" } +proton-vpn-android-application = { id = "me.proton.vpn.android.application" } +proton-vpn-android-library = { id = "me.proton.vpn.android.library" } sentry = { id = "io.sentry.android.gradle", version.ref = "sentry-plugin-version" } triplet-play = { id = "com.github.triplet.play", version.ref = "triplet-play-version" } diff --git a/release_tests/build.gradle b/release_tests/build.gradle index bfa5df252..dac642232 100644 --- a/release_tests/build.gradle +++ b/release_tests/build.gradle @@ -20,15 +20,13 @@ import groovy.json.StringEscapeUtils */ plugins { - alias(libs.plugins.android.application) - alias(libs.plugins.kotlin.android) + alias(libs.plugins.proton.vpn.android.application) } def debugKeystorePath = file(new File(rootDir, "app/${System.getenv("DEBUG_KEYSTORE_FILE")}")) android { namespace "com.protonvpn.android.release_tests" - compileSdk rootProject.ext.compileSdkVersion signingConfigs { release { @@ -41,8 +39,6 @@ android { defaultConfig { applicationId "com.protonvpn.android.release_tests" - minSdkVersion rootProject.ext.minSdkVersion - targetSdk 35 versionCode 1 versionName "1.0" def lokiEndpoint = System.getenv("LOKI_ENDPOINT") @@ -63,6 +59,7 @@ android { buildFeatures { buildConfig = true } + buildTypes { release { minifyEnabled false @@ -70,13 +67,6 @@ android { signingConfig signingConfigs.release } } - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - } } dependencies { diff --git a/settings.gradle.kts b/settings.gradle.kts index a96a0ffdd..240e808f9 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -20,6 +20,8 @@ rootProject.name = "ProtonVPN" pluginManagement { + includeBuild("build-logic") + repositories { val mavenCachePkgUrl = System.getenv("MAVEN_CACHE_PKG_URL") if (!mavenCachePkgUrl.isNullOrBlank()) { diff --git a/shared-test-code/build.gradle b/shared-test-code/build.gradle index 339f32b7d..25201a354 100644 --- a/shared-test-code/build.gradle +++ b/shared-test-code/build.gradle @@ -18,20 +18,15 @@ */ plugins { - alias(libs.plugins.android.library) - alias(libs.plugins.kotlin.android) + alias(libs.plugins.dagger.hilt) alias(libs.plugins.ksp) + alias(libs.plugins.proton.vpn.android.library) } -apply plugin: 'dagger.hilt.android.plugin' - android { namespace 'com.protonvpn.test.shared' - compileSdk rootProject.ext.compileSdkVersion defaultConfig { - minSdk rootProject.ext.minSdkVersionAmazon - consumerProguardFiles "consumer-rules.pro" } @@ -78,16 +73,13 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } + compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 coreLibraryDesugaringEnabled = true } + kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - freeCompilerArgs += [ - "-Xopt-in=kotlin.RequiresOptIn" - ] + freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn"] } } diff --git a/ui_automator_test_util/build.gradle.kts b/ui_automator_test_util/build.gradle.kts index 74c6c4a64..d25ae8335 100644 --- a/ui_automator_test_util/build.gradle.kts +++ b/ui_automator_test_util/build.gradle.kts @@ -1,16 +1,30 @@ -plugins { - alias(libs.plugins.android.library) - alias(libs.plugins.kotlin.android) -} +/* + * Copyright (c) 2026 Proton AG + * + * This file is part of ProtonVPN. + * + * ProtonVPN is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ProtonVPN is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ProtonVPN. If not, see . + */ -val minSdkVersion: Int by rootProject.extra +plugins { + alias(libs.plugins.proton.vpn.android.library) +} android { namespace = "com.protonvpn.android.ui_automator_test_util" - compileSdk = 36 defaultConfig { - minSdk = minSdkVersion consumerProguardFiles("consumer-rules.pro") } @@ -23,13 +37,6 @@ android { ) } } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - } } dependencies {