diff --git a/bridge/.gitignore b/bridge/.gitignore new file mode 100644 index 000000000..796b96d1c --- /dev/null +++ b/bridge/.gitignore @@ -0,0 +1 @@ +/build diff --git a/bridge/CHANGELOG.md b/bridge/CHANGELOG.md new file mode 100644 index 000000000..62a9ddd44 --- /dev/null +++ b/bridge/CHANGELOG.md @@ -0,0 +1,8 @@ +v0.1.0 (pending) +-------- + +### API Changes + +### Breaking Changes + +### Bug Fixes diff --git a/bridge/CHANGELOG_FORMAT.MD b/bridge/CHANGELOG_FORMAT.MD new file mode 100644 index 000000000..4f30ff5b5 --- /dev/null +++ b/bridge/CHANGELOG_FORMAT.MD @@ -0,0 +1,36 @@ +# CHANGELOG Format + +## Contents + +* [Template](#template) +* [Sections](#sections) + +## Template + +Each new version of the SDK should be accompanied by a new `CHANGELOG` entry with the following template: + +``` +vX.Y.0 (pending) +-------- + +### API Changes + +### Breaking Changes + +### Bug Fixes + +``` + +The `(pending)` label, as well as any unused sections, should be removed prior to creating a release. + +## Sections + +One or more `CHANGELOG` entries should be added for each PR that makes a change that either adds / updates the exposed API of the SDK or changes code internally in a way that is detectable as a behavior change by external consumers. These entries should fall into one of the following sections: + +- **API Changes**: Any update to existing code that affects the exposed API or behavior of the SDK in a backwards-compatible way should be included in this section. + +- **Breaking Changes**: Any code introduced in a **backwards-incompatible** manner that could in principle affect compilation of existing code should be included in this section. Examples of this include changing return types, changing function / constructor parameter lists, and changing function / class names. Each entry in this list should include detailed instructions where necessary for how a caller should address any related compilation issues. + +- **Bug Fixes**: Any update that is performed in order to fix a known bug should be included in this section. + +If an PR exhibits multiple kinds of changes then there should be multiple corresponding entries. \ No newline at end of file diff --git a/bridge/README.md b/bridge/README.md new file mode 100644 index 000000000..41277e388 --- /dev/null +++ b/bridge/README.md @@ -0,0 +1,36 @@ +# Bitwarden Native Bridge SDK + +## Contents + +- [Compatibility](#compatibility) +- [Versioning](#versioning) + +## Other Documents + +- [Changelog](CHANGELOG.md) +- [Changelog Format Guide](CHANGELOG_FORMAT.MD) + +## Compatibility + +- **Minimum SDK**: 28 +- **Target SDK**: 34 + +## Versioning +This repository conforms to the following versioning convention: + +**v[MAJOR].[MINOR].[PATCH]** + +``` +where [RELEASE] is incremented to represent major milestones that indicate a significant change in the library. + + [MINOR] is incremented when any standard changes (breaking or otherwise) are introduced to the library. + + [PATCH] is incremented when a hot-fix patch is required to an existing minor + release due to a bug introduced in that release. +``` + +Some things to note: + +- All updates should have a corresponding `CHANGELOG.md` entry that at a high-level describes what is being newly introduced in it. For more info, see [Changelog Format Guide](CHANGELOG_FORMAT.MD) + +- When incrementing a level any lower-levels should always reset to 0. \ No newline at end of file diff --git a/bridge/build.gradle.kts b/bridge/build.gradle.kts new file mode 100644 index 000000000..fc732b4c2 --- /dev/null +++ b/bridge/build.gradle.kts @@ -0,0 +1,52 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + +// For more info on versioning, see the README. +val version = "0.1.0" + +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.parcelize) +} + +android { + namespace = "com.bitwarden.bridge" + compileSdk = libs.versions.compileSdk.get().toInt() + + defaultConfig { + // This min value is selected to accommodate known consumers + minSdk = 28 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + buildConfigField("String", "VERSION", "\"$version\"") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility(libs.versions.jvmTarget.get()) + targetCompatibility(libs.versions.jvmTarget.get()) + } + buildFeatures { + buildConfig = true + aidl = true + } +} + +kotlin { + compilerOptions { + jvmTarget.set(JvmTarget.fromTarget(libs.versions.jvmTarget.get())) + } +} + +dependencies { + implementation(libs.androidx.core.ktx) +} diff --git a/bridge/consumer-rules.pro b/bridge/consumer-rules.pro new file mode 100644 index 000000000..e69de29bb diff --git a/bridge/proguard-rules.pro b/bridge/proguard-rules.pro new file mode 100644 index 000000000..f1b424510 --- /dev/null +++ b/bridge/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/bridge/src/main/AndroidManifest.xml b/bridge/src/main/AndroidManifest.xml new file mode 100644 index 000000000..8bdb7e14b --- /dev/null +++ b/bridge/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + diff --git a/build.gradle.kts b/build.gradle.kts index a8bc6377e..a64f6bd68 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,6 @@ plugins { alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false alias(libs.plugins.hilt) apply false alias(libs.plugins.kotlin.android) apply false alias(libs.plugins.kotlin.compose.compiler) apply false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 18b8cadfc..18ffbd4da 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -113,6 +113,7 @@ zxing-zxing-core = { module = "com.google.zxing:core", version.ref = "zxing" } [plugins] android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } +android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" } crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "crashlytics" } detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } google-services = { id = "com.google.gms.google-services", version.ref = "googleServices" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 9a6dc424b..f7993c47f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -46,3 +46,4 @@ buildCache { rootProject.name = "Bitwarden" include(":app") +include(":bridge")