mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 07:05:35 +03:00
[PM-7587] Support conditionally loading local sdk (#3957)
This commit is contained in:
parent
415aafb5e9
commit
61b09fe8f1
3 changed files with 26 additions and 1 deletions
|
@ -28,6 +28,7 @@
|
||||||
2. Create a `user.properties` file in the root directory of the project and add the following properties:
|
2. Create a `user.properties` file in the root directory of the project and add the following properties:
|
||||||
|
|
||||||
- `gitHubToken`: A "classic" Github Personal Access Token (PAT) with the `read:packages` scope (ex: `gitHubToken=gph_xx...xx`). These can be generated by going to the [Github tokens page](https://github.com/settings/tokens). See [the Github Packages user documentation concerning authentication](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry#authenticating-to-github-packages) for more details.
|
- `gitHubToken`: A "classic" Github Personal Access Token (PAT) with the `read:packages` scope (ex: `gitHubToken=gph_xx...xx`). These can be generated by going to the [Github tokens page](https://github.com/settings/tokens). See [the Github Packages user documentation concerning authentication](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry#authenticating-to-github-packages) for more details.
|
||||||
|
- `localSdk`: A boolean value to determine if the SDK should be loaded from the local maven artifactory (ex: `localSdk=true`). This is particularly useful when developing new SDK capabilities. Review [Linking SDK to clients](https://contributing-docs.pages.dev/getting-started/sdk/#linking-sdk-to-clients) for more details.
|
||||||
|
|
||||||
3. Setup the code style formatter:
|
3. Setup the code style formatter:
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ import com.google.firebase.crashlytics.buildtools.gradle.tasks.InjectMappingFile
|
||||||
import com.google.firebase.crashlytics.buildtools.gradle.tasks.UploadMappingFileTask
|
import com.google.firebase.crashlytics.buildtools.gradle.tasks.UploadMappingFileTask
|
||||||
import com.google.gms.googleservices.GoogleServicesTask
|
import com.google.gms.googleservices.GoogleServicesTask
|
||||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
|
import java.io.FileInputStream
|
||||||
|
import java.util.Properties
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application)
|
alias(libs.plugins.android.application)
|
||||||
|
@ -20,6 +22,16 @@ plugins {
|
||||||
alias(libs.plugins.sonarqube)
|
alias(libs.plugins.sonarqube)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads local user-specific build properties that are not checked into source control.
|
||||||
|
*/
|
||||||
|
val userProperties = Properties().apply {
|
||||||
|
val buildPropertiesFile = File(rootDir, "user.properties")
|
||||||
|
if (buildPropertiesFile.exists()) {
|
||||||
|
FileInputStream(buildPropertiesFile).use { load(it) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "com.x8bit.bitwarden"
|
namespace = "com.x8bit.bitwarden"
|
||||||
compileSdk = libs.versions.compileSdk.get().toInt()
|
compileSdk = libs.versions.compileSdk.get().toInt()
|
||||||
|
@ -130,6 +142,15 @@ kotlin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configurations.all {
|
||||||
|
resolutionStrategy.dependencySubstitution {
|
||||||
|
if ((userProperties["localSdk"] as String?).toBoolean()) {
|
||||||
|
substitute(module("com.bitwarden:sdk-android"))
|
||||||
|
.using(module("com.bitwarden:sdk-android:LOCAL"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
fun standardImplementation(dependencyNotation: Any) {
|
fun standardImplementation(dependencyNotation: Any) {
|
||||||
add("standardImplementation", dependencyNotation)
|
add("standardImplementation", dependencyNotation)
|
||||||
|
@ -312,4 +333,4 @@ tasks {
|
||||||
getByName("sonar") {
|
getByName("sonar") {
|
||||||
dependsOn("check")
|
dependsOn("check")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,9 @@ dependencyResolutionManagement {
|
||||||
password = userProperties["gitHubToken"] as String? ?: System.getenv("GITHUB_TOKEN")
|
password = userProperties["gitHubToken"] as String? ?: System.getenv("GITHUB_TOKEN")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ((userProperties["localSdk"] as String?).toBoolean()) {
|
||||||
|
mavenLocal()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue