Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add kotlin for android client #556

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

fachrymaul
Copy link

@fachrymaul fachrymaul commented Dec 3, 2024

add client SDK for Kotlin Android using FFI

Fixes: #264 #471

TODO

  • change README.md
  • support CI

Signed-off-by: Fachry Maulana Muhsinin <[email protected]>
@fachrymaul fachrymaul requested a review from a team as a code owner December 3, 2024 08:03
@fachrymaul fachrymaul marked this pull request as draft December 3, 2024 08:08
Copy link
Contributor

@markphelps markphelps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking great to me!

WithDirectory("/src", t.dir.Directory("flipt-client-kotlin-android"), dagger.ContainerWithDirectoryOpts{
Exclude: []string{"./.idea/", ".gradle/", "build/"},
}).
WithFile(fmt.Sprintf("/src/main/cpp/libs/%s/libfliptengine.so", path), t.test.File(libFile)).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is src/main/cpp/libs the standard path for android / kotlin to look for shared C libs? or is this configured somewhere else?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sirce I'm using .a file , it is configured in the CMakeLists.txt. there's no standard for .a file, unlike .so file that must be stored in jniLibs directory

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see are you saying this is just for the tests? just wondering why its at src/main/cpp/libs/%s/libfliptengine.so if its a .a file

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.65%. Comparing base (94fc2f9) to head (1db3fcf).
Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #556      +/-   ##
==========================================
+ Coverage   85.48%   85.65%   +0.17%     
==========================================
  Files           8        7       -1     
  Lines        3933     3905      -28     
==========================================
- Hits         3362     3345      -17     
+ Misses        571      560      -11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@markphelps markphelps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look great! what do we have left to get this across the finish line? how can I help?

Comment on lines +57 to +63
- Linux x86_64
- Linux x86_64 (musl)
- Linux arm64
- Linux arm64 (musl)
- MacOS x86_64
- MacOS arm64
- Windows x86_64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Linux x86_64
- Linux x86_64 (musl)
- Linux arm64
- Linux arm64 (musl)
- MacOS x86_64
- MacOS arm64
- Windows x86_64
- Linux x86_64
- Linux arm64

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it needs Android x86_64 and android arm64

Comment on lines +65 to +68
### Glibc vs Musl

Most Linux distributions use [Glibc](https://en.wikipedia.org/wiki/Glibc), but some distributions like Alpine Linux use [Musl](https://en.wikipedia.org/wiki/Musl). If you are using Alpine Linux, you will need to install the `musl` version of the client.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Glibc vs Musl
Most Linux distributions use [Glibc](https://en.wikipedia.org/wiki/Glibc), but some distributions like Alpine Linux use [Musl](https://en.wikipedia.org/wiki/Musl). If you are using Alpine Linux, you will need to install the `musl` version of the client.

I dont think we are doing a MUSL version

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree on this.

return resp.result ?: throw EvaluationException(resp.errorMessage ?: "Unknown Error")
}

fun readFlags(ptr: String): Result<ArrayList<Flag>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont think we want this function exposed publicly. can we just inline it in listFlags?



@Serializable
data class InternalEvaluationRequest(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make this private?

WithDirectory("/src", t.dir.Directory("flipt-client-kotlin-android"), dagger.ContainerWithDirectoryOpts{
Exclude: []string{"./.idea/", ".gradle/", "build/"},
}).
WithFile(fmt.Sprintf("/src/main/cpp/libs/%s/libfliptengine.so", path), t.test.File(libFile)).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see are you saying this is just for the tests? just wondering why its at src/main/cpp/libs/%s/libfliptengine.so if its a .a file

Signed-off-by: Roman Dmytrenko <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FLI-988] Kotlin SDK
4 participants