Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
261825f
Apply the Kotlin Multiplatform plugin
bencehornak May 17, 2025
6203a9c
Rename 'android' directory to 'shared'
bencehornak May 17, 2025
6d22e95
Rename sourcesets to commonMain and commonTest
bencehornak May 17, 2025
6253153
Add jvm and linux targets
bencehornak May 17, 2025
3a9b1a4
Add .kotlin directory to the .gitignore
bencehornak May 17, 2025
a667444
Remove empty manifest
bencehornak May 17, 2025
ae17c58
Replace junit4 with kotlin-test
bencehornak May 17, 2025
34dbd09
Remove javaClass references
bencehornak May 17, 2025
7eb2b37
Fix import of Dispatchers.IO
bencehornak May 17, 2025
e864b67
Replace java.util.Date with kotlin.time.Instant
bencehornak May 17, 2025
b9ee3f1
Fix type inference
bencehornak May 17, 2025
569e760
Remove JVM-only DebugProbes
bencehornak May 17, 2025
8a28aee
Remove mock library
bencehornak May 17, 2025
c5ba7a1
Add support for js targets
bencehornak May 17, 2025
0bc9be0
Rename module to kotlin-sdk
bencehornak May 18, 2025
a9935e1
Fix artifact coordinates
bencehornak May 18, 2025
c4371b9
Upgrade Gradle dependencies
bencehornak May 19, 2025
7a853ef
Execute apiDump
bencehornak May 19, 2025
7bfb2df
Resolve linter errors
bencehornak May 19, 2025
e8c40aa
Rename root project
bencehornak May 27, 2025
3201abb
Rename base package to dev.openfeature.kotlin.sdk
bencehornak May 31, 2025
6f6563c
Document supported platforms
bencehornak May 31, 2025
9db495a
Fix and document browser tests
bencehornak May 31, 2025
e101cb3
Fix immutability
bencehornak Aug 13, 2025
996e953
Resolve lint errors
bencehornak Aug 13, 2025
d79e221
Add upgrade notes
bencehornak Aug 14, 2025
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
9 changes: 6 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ ij_kotlin_method_call_chain_wrap = normal
ij_kotlin_method_parameters_new_line_after_left_paren = true
ij_kotlin_method_parameters_right_paren_on_new_line = true
ij_kotlin_method_parameters_wrap = on_every_item
ij_kotlin_name_count_to_use_star_import = 5
ij_kotlin_name_count_to_use_star_import_for_members = 3
ij_kotlin_name_count_to_use_star_import = 999
ij_kotlin_name_count_to_use_star_import_for_members = 999
ij_kotlin_packages_to_use_import_on_demand = unset
ij_kotlin_parameter_annotation_wrap = off
ij_kotlin_space_after_comma = true
Expand Down Expand Up @@ -130,4 +130,7 @@ max_line_length=120

# Ignore max line for kotlin test files, the same as Detekt.
[**/{test,androidTest}/**/*.kt]
max_line_length=off
max_line_length=off

[*.kts]
max_line_length = off
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

# For browser tests
- uses: browser-actions/setup-chrome@v1

- name: Run checks
run: ./gradlew check --no-daemon --stacktrace
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

.idea
local.properties
.kotlin
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ Manual formatting is done by invoking
./gradlew ktlintFormat
```

## Testing

Prerequisite for browser tests: Install Google Chrome (or Google Chrome headless)

To run tests on all supported platforms:
```
./gradlew allTests
```

To run all verifications:
```
./gradlew check
```

## Releases

This repo uses _Release Please_ to release packages. Release Please sets up a running PR that tracks all changes in the library, and maintains the versions according to [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/), generated when [PRs are merged](https://github.com/amannn/action-semantic-pull-request), based on the PR title. The semantics of the PR title are enforced by the `lint-pr.yml` workflow. When Release Please's running PR is merged, a new release is created, and the associated artifacts are published.
Expand Down
61 changes: 52 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,70 @@

### Requirements

- The Android minSdk version supported is: `21`.
The following [Kotlin Multiplatform Targets](https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-dsl-reference.html#targets) are supported:

Note that this library is intended to be used in a mobile context, and has not been evaluated for use in other types of applications (e.g. server applications).
| Supported | Platform | Supported versions |
|-----------|----------------------|--------------------------------------------------------------------------------|
| ✅ | Android | SDK 21+ |
| ✅ | JVM | JDK 11+ |
| ✅ | Native | Linux x64 |
| ❌ | Native | [Other native targets](https://kotlinlang.org/docs/native-target-support.html) |
| ✅ | Javascript (Node.js) | |
| ✅ | Javascript (Browser) | |
| ❌ | Wasm | |

### Install

#### Maven Central
Note that this library adheres to the
[Static Context Paradigm](https://openfeature.dev/docs/reference/concepts/sdk-paradigms), so it is
intended to be used on the **client side** (i.e. mobile apps, web apps and desktop apps), and has
not been evaluated for use in other types of applications (e.g. server applications).

Installation via Maven Central is preferred, using the following dependency:
### Installation

Installation is preferred via Maven Central.

#### In Android projects

> [!IMPORTANT]
> Before version 0.6.0 the Maven artifact's id was `android-sdk`. When upgrading to 0.6.0 or higher
> please do make sure to use the new artifact id, which is `kotlin-sdk`.

<!-- x-release-please-start-version -->

```kotlin
dependencies {
api("dev.openfeature:android-sdk:0.5.3")
api("dev.openfeature:kotlin-sdk:0.5.3")
}
```
<!-- x-release-please-end -->

#### In multiplatform projects

<!-- x-release-please-start-version -->
```kotlin
kotlin {
sourceSets {
commonMain.dependencies {
api("dev.openfeature:kotlin-sdk:0.5.3")
}
}
}
```
<!-- x-release-please-end -->


### Usage

> [!NOTE]
> In version 0.6.0 the base package name has changed from `dev.openfeature.sdk` to
> `dev.openfeature.kotlin.sdk`. When upgrading to 0.6.0 or higher please update your imports
> accordingly.
>
> **Example:** `import dev.openfeature.sdk.EvaluationContext` ->
> `import dev.openfeature.kotlin.sdk.EvaluationContext`.

```kotlin
coroutineScope.launch(Dispatchers.IO) {
coroutineScope.launch(Dispatchers.Default) {
// configure a provider, wait for it to complete its initialization tasks
OpenFeatureAPI.setProviderAndWait(customProvider)
val client = OpenFeatureAPI.getClient()
Expand Down Expand Up @@ -90,7 +133,7 @@ If the provider you're looking for hasn't been created yet, see the [develop a p
Once you've added a provider as a dependency, it can be registered with OpenFeature like this:

```kotlin
coroutineScope.launch(Dispatchers.IO) {
coroutineScope.launch(Dispatchers.Default) {
OpenFeatureAPI.setProviderAndWait(MyProvider())
}
```
Expand Down Expand Up @@ -195,7 +238,7 @@ viewModelScope.launch {
viewModelScope.launch {
OpenFeatureAPI.setProviderAndWait(
MyFeatureProvider(),
Dispatchers.IO,
Dispatchers.Default,
myEvaluationContext
)
}
Expand Down
Loading