Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,41 @@ servers. For server-side use, see FeatBit's server SDKs.

### Installation

Add the dependency (coordinates depend on where you publish it):
Artifacts are built on demand by [JitPack](https://jitpack.io) whenever a consumer
requests a git tag from this repository, so no separate publish step is needed.

Add the JitPack repository in `settings.gradle.kts`:

```kotlin
dependencyResolutionManagement {
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
```

Then depend on either the core SDK or, on Android, the optional lifecycle connector:

```kotlin
dependencies {
implementation("co.featbit:featbit-client:<version>")
// Core SDK — flag evaluation, polling, streaming, event tracking.
implementation("com.github.Fluent-Health.featbit-android-sdk:featbit-client:<tag>")

// Optional: Android lifecycle glue. Depends on the core SDK transitively.
implementation("com.github.Fluent-Health.featbit-android-sdk:featbit-client-android:<tag>")
}
```

Replace `<tag>` with a released git tag (e.g. `v0.1.0`). JitPack pins the artifact to the
exact commit that tag points at, so the version you see is the version you get.

The library requires `minSdk 21` and the `INTERNET` permission (declared by the library
manifest and merged automatically).

Groovy DSL is identical apart from the string form:
`implementation 'com.github.Fluent-Health.featbit-android-sdk:featbit-client:<tag>'`.

### Prerequisite

Before using the SDK, obtain your environment secret and SDK URLs:
Expand Down
38 changes: 38 additions & 0 deletions featbit-client-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
`maven-publish`
}

android {
Expand Down Expand Up @@ -37,3 +38,40 @@ dependencies {
api(project(":featbit-client"))
implementation(libs.androidx.lifecycle.process)
}

// Publishes the `release` AAR + sources jar under `co.featbit:featbit-client-android:<version>`.
// See the sibling `featbit-client/build.gradle.kts` for the full rationale behind the version
// resolution rule — the same pattern is applied here so both modules pick up identical
// coordinates from JitPack's `VERSION` env var (or the `VERSION_NAME` gradle property locally).
publishing {
publications {
register<MavenPublication>("release") {
groupId = providers.gradleProperty("GROUP").get()
artifactId = "featbit-client-android"
version = System.getenv("VERSION") ?: providers.gradleProperty("VERSION_NAME").get()
afterEvaluate { from(components["release"]) }

pom {
name.set("FeatBit Client — Android Lifecycle Connector")
description.set(
"Optional Android lifecycle glue for the FeatBit client SDK: wires " +
"ProcessLifecycleOwner + ConnectivityManager into `setForeground` / " +
"`setNetworkAvailable` so the underlying client suspends streaming while " +
"the app is backgrounded or offline."
)
url.set("https://github.com/Fluent-Health/featbit-android-sdk")
licenses {
license {
name.set("Apache-2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
scm {
url.set("https://github.com/Fluent-Health/featbit-android-sdk")
connection.set("scm:git:https://github.com/Fluent-Health/featbit-android-sdk.git")
developerConnection.set("scm:git:ssh://git@github.com/Fluent-Health/featbit-android-sdk.git")
}
}
}
}
}
39 changes: 39 additions & 0 deletions featbit-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.serialization)
`maven-publish`
}

android {
Expand Down Expand Up @@ -59,3 +60,41 @@ dependencies {
testImplementation(libs.testcontainers)
testRuntimeOnly("org.slf4j:slf4j-simple:2.0.13")
}

// Publishes the `release` AAR + sources jar under `co.featbit:featbit-client:<version>`.
// `./gradlew publishToMavenLocal` publishes to `~/.m2/repository` with no extra config, so
// consumers can smoke-test the artifact locally before any remote repository exists.
//
// Version resolution prefers JitPack's `VERSION` env var (populated with the git tag being
// built, e.g. `v0.1.0`) so the file names JitPack looks for match what Gradle publishes. The
// `VERSION_NAME` gradle property is the local fallback for `publishToMavenLocal`.
publishing {
publications {
register<MavenPublication>("release") {
groupId = providers.gradleProperty("GROUP").get()
artifactId = "featbit-client"
version = System.getenv("VERSION") ?: providers.gradleProperty("VERSION_NAME").get()
afterEvaluate { from(components["release"]) }

pom {
name.set("FeatBit Client")
description.set(
"FeatBit feature-flag client SDK for Kotlin/Android — local evaluation " +
"with real-time WebSocket streaming and lifecycle-aware sync."
)
url.set("https://github.com/Fluent-Health/featbit-android-sdk")
licenses {
license {
name.set("Apache-2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
scm {
url.set("https://github.com/Fluent-Health/featbit-android-sdk")
connection.set("scm:git:https://github.com/Fluent-Health/featbit-android-sdk.git")
developerConnection.set("scm:git:ssh://git@github.com/Fluent-Health/featbit-android-sdk.git")
}
}
}
}
}
6 changes: 6 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ android.useAndroidX=true
android.nonTransitiveRClass=true

kotlin.code.style=official

# Publication coordinates. `groupId` + `version` are consumed by the `maven-publish`
# block in each library module; `artifactId` is set per-module because the group ships
# two artifacts (`featbit-client`, `featbit-client-android`).
GROUP=co.featbit
VERSION_NAME=0.1.0-SNAPSHOT
16 changes: 16 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# JitPack build configuration.
#
# JitPack builds a public Maven artifact per git tag on demand: when a consumer requests
# `com.github.Fluent-Health:featbit-android-sdk:<tag>`, JitPack clones the tag, runs
# `./gradlew publishToMavenLocal`, and serves whatever landed in `~/.m2`.
#
# The install command below matches what a maintainer would run locally, so a consumer
# fetching from JitPack sees the same AAR + sources jar + POM as `publishToMavenLocal`.
#
# JDK 17 matches the toolchain the CI workflow uses; both library modules target JVM 11,
# so the compile toolchain and target bytecode are independent.
jdk:
- openjdk17

install:
- ./gradlew :featbit-client:publishToMavenLocal :featbit-client-android:publishToMavenLocal
Loading