From f6c20e08d1ab5ea4db33a3715e86812538aa6bf1 Mon Sep 17 00:00:00 2001 From: Patrick Honkonen <1883101+SaintPatrck@users.noreply.github.com> Date: Thu, 11 Sep 2025 08:49:06 -0400 Subject: [PATCH] [PM-25637] Add CXF module for Credential Exchange support (#5858) --- build.gradle.kts | 2 + cxf/.gitignore | 1 + cxf/build.gradle.kts | 71 ++++++++++++++++++++++++++++++++ cxf/consumer-rules.pro | 0 cxf/proguard-rules.pro | 21 ++++++++++ cxf/src/main/AndroidManifest.xml | 4 ++ gradle/libs.versions.toml | 3 ++ settings.gradle.kts | 1 + 8 files changed, 103 insertions(+) create mode 100644 cxf/.gitignore create mode 100644 cxf/build.gradle.kts create mode 100644 cxf/consumer-rules.pro create mode 100644 cxf/proguard-rules.pro create mode 100644 cxf/src/main/AndroidManifest.xml diff --git a/build.gradle.kts b/build.gradle.kts index 882c7d7175..f1d63fb167 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,6 +24,7 @@ dependencies { kover(project(":authenticator")) kover(project(":authenticatorbridge")) kover(project(":core")) + kover(project(":cxf")) kover(project(":data")) kover(project(":network")) kover(project(":ui")) @@ -38,6 +39,7 @@ detekt { "authenticator/src", "authenticatorbridge/src", "core/src", + "cxf/src", "data/src", "network/src", "ui/src", diff --git a/cxf/.gitignore b/cxf/.gitignore new file mode 100644 index 0000000000..796b96d1c4 --- /dev/null +++ b/cxf/.gitignore @@ -0,0 +1 @@ +/build diff --git a/cxf/build.gradle.kts b/cxf/build.gradle.kts new file mode 100644 index 0000000000..5fe3a900e8 --- /dev/null +++ b/cxf/build.gradle.kts @@ -0,0 +1,71 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.google.services) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.parcelize) +} + +android { + namespace = "com.bitwarden.cxf" + compileSdk = libs.versions.compileSdk.get().toInt() + + defaultConfig { + minSdk = libs.versions.minSdkBwa.get().toInt() + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro", + ) + } + } + compileOptions { + sourceCompatibility(libs.versions.jvmTarget.get()) + targetCompatibility(libs.versions.jvmTarget.get()) + } +} + +kotlin { + compilerOptions { + jvmTarget = JvmTarget.fromTarget(libs.versions.jvmTarget.get()) + } +} + +dependencies { + + implementation(project(":annotation")) + implementation(project(":core")) + implementation(project(":ui")) + + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.appcompat) + implementation(libs.androidx.compose.runtime) + implementation(libs.androidx.credentials) + implementation(libs.androidx.credentials.providerevents) + implementation(libs.androidx.credentials.providerevents.play.services) + implementation(libs.kotlinx.coroutines.android) + + testImplementation(platform(libs.junit.bom)) + testRuntimeOnly(libs.junit.platform.launcher) + testImplementation(libs.junit.junit5) + testImplementation(libs.junit.vintage) + testImplementation(libs.kotlinx.coroutines.test) + testImplementation(libs.mockk.mockk) +} + +tasks { + withType { + useJUnitPlatform() + maxHeapSize = "2g" + maxParallelForks = Runtime.getRuntime().availableProcessors() + jvmArgs = jvmArgs.orEmpty() + "-XX:+UseParallelGC" + } +} diff --git a/cxf/consumer-rules.pro b/cxf/consumer-rules.pro new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cxf/proguard-rules.pro b/cxf/proguard-rules.pro new file mode 100644 index 0000000000..f1b424510d --- /dev/null +++ b/cxf/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/cxf/src/main/AndroidManifest.xml b/cxf/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..e100076157 --- /dev/null +++ b/cxf/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b0a6662bc5..9aa5ccc309 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -22,6 +22,7 @@ androidxCamera = "1.4.2" androidxComposeBom = "2025.08.01" androidxCore = "1.17.0" androidxCredentials = "1.5.0" +androidxCredentialsProviderEvents = "1.0.0-alpha02" androidxHiltNavigationCompose = "1.2.0" androidxLifecycle = "2.9.3" androidxNavigation = "2.9.3" @@ -83,6 +84,8 @@ androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "androidxCore" } #noinspection CredentialDependency - Used for Passkey support, which is not available below Android 14 androidx-credentials = { module = "androidx.credentials:credentials", version.ref = "androidxCredentials" } +androidx-credentials-providerevents = { module = "androidx.credentials.providerevents:providerevents", version.ref = "androidxCredentialsProviderEvents" } +androidx-credentials-providerevents-play-services = { module = "androidx.credentials.providerevents:providerevents-play-services", version.ref = "androidxCredentialsProviderEvents" } androidx-hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "androidxHiltNavigationCompose" } androidx-lifecycle-process = { module = "androidx.lifecycle:lifecycle-process", version.ref = "androidxLifecycle" } androidx-lifecycle-runtime-compose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "androidxLifecycle" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 0c845ca0d6..6adfa7a248 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -53,6 +53,7 @@ include( ":authenticator", ":authenticatorbridge", ":core", + ":cxf", ":data", ":network", ":ui",