Skip to content

Add a mechanism for "publishing" internal APIs for use across our libraries #423

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kstenerud
Copy link
Contributor

A client library loads the API class "BD_InternalAPI_Capture" and then calls "exposeAPI" on it to link up at runtime. If the class fails to load, or the requested API doesn't exist, it downgrades gracefully to a no-op rather than crashing.

See InternalAPI.h for a more thorough description + example client.

The unit tests also include SampleClient.[hm], which is a full example of a client library.

…ur libraries.

A client library loads the API class "BD_InternalAPI_Capture" and then calls "exposeAPI" on it to link up at runtime.
If the class fails to load, or the requested API doesn't exist, it downgrades gracefully to a no-op rather than crashing.

See InternalAPI.h for a more thorough description + example client.
@kstenerud kstenerud requested review from kattrali and snowp June 5, 2025 13:16
@kstenerud
Copy link
Contributor Author

Note: I'm not sure if the Bazel changes are the best way to do this!

@@ -58,3 +58,46 @@ def bitdrift_mobile_objc_test(name, srcs, data = [], deps = [], tags = [], visib
tags = tags,
visibility = visibility,
)

def bitdrift_mobile_swift_objc_test(name, srcs_swift, srcs_objc, data = [], deps = [], tags = [], use_test_host = False, repository = "", visibility = []):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is basically a copy of bitdrift_mobile_swift_test with an additional objc_library cribbed from bitdrift_mobile_objc_test in this same file.

Copy link
Contributor

@kattrali kattrali left a comment

Choose a reason for hiding this comment

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

This makes sense overall. I think a good next step is probably to pull the branch into the RN library and try it out, to test both the ergonomics and the functionality work as expected. wdyk, @snowp? (Since I think you were looking into having internal APIs for RN?)

Another set of eyes on the build system changes also would help, maybe @Reflejo?

@kattrali kattrali requested a review from Reflejo June 6, 2025 15:12
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.

2 participants