-
Notifications
You must be signed in to change notification settings - Fork 7
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
Set up CI for bob / rn compatibility matrix and handle non-standard codegen output dirs #163
Changes from all commits
1a9059e
3c62eb6
54e1b43
06a92cc
2419811
d616f84
5d6c630
f91d93e
6df9a36
fd0c748
580acb8
003c812
b408f62
257884d
299e25d
90bbaca
3799a4f
3672ef4
0b08caa
88fb39c
8fd9c2d
125cf24
0cdd977
2016643
d75dc6f
f233d50
bf3e7b9
59bc61e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Compat | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" # Once a day at midnight | ||
pull_request: | ||
branches: ["main"] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
integration-tests-generation: | ||
strategy: | ||
matrix: | ||
runner: | ||
- macos-latest | ||
- ubuntu-latest | ||
bob-version: | ||
- 0.42.2 | ||
- 0.42.3 | ||
- latest | ||
rn-version: | ||
- 0.76.0 | ||
- latest | ||
|
||
runs-on: ${{ matrix.runner }} | ||
name: "bob ${{ matrix.bob-version }} / rn ${{ matrix.rn-version }} / ${{ matrix.runner == 'macos-latest' && 'ios' || 'android' }}" | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install cargo-ndk | ||
if: ${{ matrix.runner != 'macos-latest' }} | ||
run: | | ||
cargo install cargo-ndk | ||
|
||
- name: Install JDK | ||
if: ${{ matrix.runner != 'macos-latest' }} | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: "zulu" | ||
java-version: "17" | ||
|
||
- name: Install Rust toolchains | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
targets: ${{ matrix.runner == 'macos-latest' && 'aarch64-apple-ios-sim' || 'aarch64-linux-android' }} | ||
|
||
- name: Generate & build turbo module | ||
run: | | ||
./scripts/test-turbo-modules.sh \ | ||
--slug '@my-org/my-lib' \ | ||
--ubrn-config integration/fixtures/compat/ubrn.config.yaml \ | ||
--builder-bob-version ${{ matrix.bob-version }} \ | ||
--rn-version ${{ matrix.rn-version }} \ | ||
--packgage-json-mixin integration/fixtures/compat/package.json \ | ||
--react-native-config integration/fixtures/compat/react-native.config.js \ | ||
--${{ matrix.runner == 'macos-latest' && 'ios' || 'android' }} \ | ||
../turbo-module |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
[![CI](https://github.com/jhugman/uniffi-bindgen-react-native/actions/workflows/ci.yml/badge.svg)](https://github.com/jhugman/uniffi-bindgen-react-native/actions/workflows/ci.yml) | ||
[![build-bob compatibility](https://github.com/jhugman/uniffi-bindgen-react-native/actions/workflows/compat.yml/badge.svg)](https://github.com/jhugman/uniffi-bindgen-react-native/actions/workflows/compat.yml) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😻 |
||
|
||
# uniffi-bindgen-react-native | ||
[UniFFI](https://mozilla.github.io/uniffi-rs/latest/) is a multi-language bindings generator for Rust. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,14 @@ impl PackageJson { | |
} | ||
} | ||
|
||
pub(crate) fn android_codegen_output_dir(&self) -> String { | ||
self.codegen_config.output_dir.android.clone() | ||
} | ||
|
||
pub(crate) fn ios_codegen_output_dir(&self) -> String { | ||
self.codegen_config.output_dir.ios.clone() | ||
} | ||
|
||
pub(crate) fn repo(&self) -> &PackageJsonRepo { | ||
&self.repository | ||
} | ||
|
@@ -69,6 +77,8 @@ pub(crate) struct RnCodegenConfig { | |
pub(crate) js_srcs_dir: String, | ||
#[serde(default)] | ||
android: RnAndroidCodegenConfig, | ||
#[serde(default)] | ||
output_dir: RnOutputDirCodegenConfig, | ||
} | ||
|
||
impl Default for RnCodegenConfig { | ||
|
@@ -82,3 +92,29 @@ impl Default for RnCodegenConfig { | |
struct RnAndroidCodegenConfig { | ||
java_package_name: Option<String>, | ||
} | ||
|
||
#[derive(Deserialize)] | ||
#[serde(rename_all = "camelCase")] | ||
struct RnOutputDirCodegenConfig { | ||
#[serde(default = "default_ios_codegen_output_dir")] | ||
ios: String, | ||
#[serde(default = "default_android_codegen_output_dir")] | ||
android: String, | ||
} | ||
|
||
impl Default for RnOutputDirCodegenConfig { | ||
fn default() -> Self { | ||
Self { | ||
ios: default_ios_codegen_output_dir(), | ||
android: default_android_codegen_output_dir(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It feels slightly awkward having to pass in the default values here and in the |
||
} | ||
} | ||
} | ||
|
||
fn default_android_codegen_output_dir() -> String { | ||
"android/generated".to_string() | ||
} | ||
|
||
fn default_ios_codegen_output_dir() -> String { | ||
"ios/generated".to_string() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"codegenConfig": { | ||
"outputDir": { | ||
"ios": "ios/tmp", | ||
"android": "android/tmp" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
dependency: { | ||
platforms: { | ||
android: { | ||
cmakeListsPath: "tmp/jni/CMakeLists.txt", | ||
}, | ||
}, | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
rust: | ||
repo: https://github.com/ianthetechie/uniffi-starter | ||
branch: main | ||
manifestPath: rust/foobar/Cargo.toml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this.