From a2f4e4f3b5d0de778c257cc92d6a1f7bb5a086a6 Mon Sep 17 00:00:00 2001 From: Patrick Honkonen Date: Fri, 28 Mar 2025 16:12:24 -0400 Subject: [PATCH] [PM-19738] Create `network` module Create a library module responsible for communicating with the Bitwarden network API. Additionally, the following changes were made to checks and workflows: - Updated `build.gradle.kts` to include Kover for the `network` module. - Updated `Fastfile` to include lint, test and kover report generation tasks for the `network` module. --- .github/workflows/test.yml | 1 + build.gradle.kts | 2 ++ fastlane/Fastfile | 2 +- network/.gitignore | 1 + network/README.md | 12 ++++++++++ network/build.gradle.kts | 36 ++++++++++++++++++++++++++++ network/consumer-rules.pro | 0 network/proguard-rules.pro | 21 ++++++++++++++++ network/src/main/AndroidManifest.xml | 5 ++++ settings.gradle.kts | 1 + 10 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 network/.gitignore create mode 100644 network/README.md create mode 100644 network/build.gradle.kts create mode 100644 network/consumer-rules.pro create mode 100644 network/proguard-rules.pro create mode 100644 network/src/main/AndroidManifest.xml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7e6b478aa3..ee8c4897e5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -85,6 +85,7 @@ jobs: authenticator/build/reports/tests/ authenticatorbridge/build/reports/tests/ core/build/reports/tests/ + network/build/reports/tests/ - name: Upload to codecov.io id: upload-to-codecov diff --git a/build.gradle.kts b/build.gradle.kts index da31dd913e..d755b30740 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,6 +20,7 @@ dependencies { kover(project(":authenticator")) kover(project(":authenticatorbridge")) kover(project(":core")) + kover(project(":network")) } detekt { @@ -30,6 +31,7 @@ detekt { "authenticator/src", "authenticatorbridge/src", "core/src", + "network/src", ) } diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 082d810057..3b708483df 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -105,7 +105,7 @@ platform :android do ) end - desc "Runs lint, tests and generates Kover reports for all project modules" + desc "Runs lint, tests, and generates Kover reports for all project modules" lane :check do gradle( tasks: [ diff --git a/network/.gitignore b/network/.gitignore new file mode 100644 index 0000000000..796b96d1c4 --- /dev/null +++ b/network/.gitignore @@ -0,0 +1 @@ +/build diff --git a/network/README.md b/network/README.md new file mode 100644 index 0000000000..0699aa758d --- /dev/null +++ b/network/README.md @@ -0,0 +1,12 @@ +# Network module + +A client library for communicating with the Bitwarden web API. + +## Contents + +- [Compatibility](#compatibility) + +## Compatibility + +- **Minimum SDK**: 28 +- **Target SDK**: 35 diff --git a/network/build.gradle.kts b/network/build.gradle.kts new file mode 100644 index 0000000000..de987a8ef3 --- /dev/null +++ b/network/build.gradle.kts @@ -0,0 +1,36 @@ +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) +} + +android { + namespace = "com.bitwarden.network" + compileSdk = libs.versions.compileSdk.get().toInt() + + defaultConfig { + minSdk = libs.versions.minSdk.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()) + } + kotlinOptions { + jvmTarget = libs.versions.jvmTarget.get() + } +} + +dependencies { +} diff --git a/network/consumer-rules.pro b/network/consumer-rules.pro new file mode 100644 index 0000000000..e69de29bb2 diff --git a/network/proguard-rules.pro b/network/proguard-rules.pro new file mode 100644 index 0000000000..f1b424510d --- /dev/null +++ b/network/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/network/src/main/AndroidManifest.xml b/network/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..56a9e28a20 --- /dev/null +++ b/network/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/settings.gradle.kts b/settings.gradle.kts index 25d7352fb4..b57dd37567 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -53,4 +53,5 @@ include( ":authenticator", ":authenticatorbridge", ":core", + ":network", )