Page MenuHomePhabricator

[native] introduce RustCallback
ClosedPublic

Authored by varun on Mar 27 2023, 8:54 PM.
Tags
None
Referenced Files
F3524904: D7214.id24292.diff
Mon, Dec 23, 3:03 PM
F3524341: D7214.id24257.diff
Mon, Dec 23, 12:20 PM
F3523245: D7214.diff
Mon, Dec 23, 8:44 AM
Unknown Object (File)
Sat, Dec 7, 7:21 AM
Unknown Object (File)
Wed, Dec 4, 3:23 AM
Unknown Object (File)
Wed, Dec 4, 3:23 AM
Unknown Object (File)
Wed, Dec 4, 3:23 AM
Unknown Object (File)
Nov 7 2024, 4:31 AM
Subscribers

Details

Summary

we introduce a generic C++ callback function to be called from Rust

note that this function is only used when the js return type is Promise<string>

we'll have to add similar functions to RustCallback for other return types
luckily we really only ever return strings from rust...

Test Plan

this gets tested in the next diff in stack

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

varun requested review of this revision.Mar 27 2023, 9:09 PM
native/android/app/build.gradle
382–401

we build the native_rust_library in a gradle preBuild step because RustCallback includes generated files that need to exist before CMake attempts to build the binary

native/native_rust_library/RustCallback.cpp
1

i'll remove this random extra line

3–5

couldn't figure out how to make these absolute paths without xcode complaining..

ashoat added 1 blocking reviewer(s): jon.
ashoat added inline comments.
native/android/app/build.gradle
382–401

Does this mean we build it "twice"? Is it cached the second time? Do we build it for every architecture here?

I'm not able to comment on gradle code, but I couldn't find a better way to do this using just cmake + corrosion + cxxbridge

native/native_rust_library/RustCallback.cpp
3–5

I'll do it some time later https://linear.app/comm/issue/ENG-3419

This revision is now accepted and ready to land.Mar 28 2023, 8:25 AM
native/android/app/build.gradle
382–401

yeah we build it twice, but it is cached the second time. we only build for a single arch here since we just need the generated C++ files

This revision was automatically updated to reflect the committed changes.