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

chore(ci): dart-sdk rust cross compile for Android target #222

Merged
merged 37 commits into from
Mar 4, 2025

Conversation

felipecsl
Copy link
Contributor

@felipecsl felipecsl commented Feb 28, 2025

Note: This is a stacked PR on #197

Description

  • Use cross-rs/cross to cross-compile dart-sdk for android target in CI
  • Fix python build issues with maturin-action
  • Removed flutter codegen step from build.rs in favor of standalone step (flutter_rust_bridge_codegen generate --config-file flutter_rust_bridge.yaml)

The flutter codegen build step caused numerous issues, most notably with docker paths when running cross build and with trying to install cargo-expand during the build, which caused a deadlock. According to this it shouldn't be doing that, so that seemed like a bug to me.
Additionally, we don't need dart codegen when cross-compiling the dart sdk for Android, so it makes sense to skip that.

image

Copy link

changeset-bot bot commented Feb 28, 2025

⚠️ No Changeset found

Latest commit: 553fafa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@felipecsl
Copy link
Contributor Author

flutter_rust_bridge_codegen is failing here, gotta figure out why

@felipecsl
Copy link
Contributor Author

YES this is FINALLY ready to go, PTAL @rasendubi @leoromanovsky

@felipecsl felipecsl changed the title chore(ci): dart-sdk rust cross compile for android target chore(ci): dart-sdk rust cross compile for Android target Mar 3, 2025
@felipecsl felipecsl requested a review from leoromanovsky March 3, 2025 23:28
Comment on lines +66 to +71
- name: Override eppo_core for testing
shell: bash
run: |
mkdir -p "${CARGO_HOME:-$HOME/.cargo}"
echo "[patch.crates-io.eppo_core]" >> "${CARGO_HOME:-$HOME/.cargo}/config.toml"
echo "path = '${{ github.workspace }}/eppo_core'" >> "${CARGO_HOME:-$HOME/.cargo}/config.toml"
Copy link
Member

Choose a reason for hiding this comment

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

does this need to be removed or later after publishing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I think for CI here we want to build against the current unreleased version of eppo_core, but for publishing (assuming that will be in a separate github workflow) we'll want to use the released version instead. So yeah I think this is fine as is, cc @rasendubi to keep me honest

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh, yeah. good catch that we need to remove publish against released version of eppo_core

I've updated CI here: #229

@felipecsl felipecsl merged commit b755cc2 into feat-dart Mar 4, 2025
39 checks passed
@felipecsl felipecsl deleted the dart-android-ci branch March 4, 2025 17:25
leoromanovsky added a commit that referenced this pull request Mar 4, 2025
* feat(dart): setup minimal example

Copied flutter_rust_bridge minimal example[1] and beat it into working:
- vendored simple_build.dart to remove dependency on an unpublished
  git-only package
- updated packages because I couldn't get dart test to work otherwise
- stripped flutter_rust_bridge internal options

[1]: https://github.com/fzyzcjy/flutter_rust_bridge/tree/05247dd90a7fcb2512c5ede13cf00271b0eb548e/frb_example/dart_minimal

* chore: add logs for stopping background runtime

Dropping `BackgroundRuntime` cancels all tracked tasks. This may (and
have) lead to hard to debug issues when configuration poller just
stops working and `.wait_for_configuration()` unhelpfully returns
`PollerThreadPanicked`. (I am a little embarrassed to say how long
this simple issue took me to debug when it was paired with running in
Dart environment.)

* feat(dart): PoC implementation of SDK

* feat(dart): boolean assignment, bandits, logging

* feat(dart): rest of assignment methods

* test(dart): sdk-test-data tests

* feat(dart): enable wasm_js for getrandom on wasm platform

* feat(core,dart): abstract over async runtimes to support Dart web

* chore(dart): upgrade flutter_rust_bridge

* chore(dart): integrate with changeset

* fix: add .gitkeep for dart-sdk/lib/src/rust directory

* fix(dart): use poll interval/jitter initialization parameters

* chore(dart): add build&test CI setup

* chore(dart): add hook/build.dart

It looks like newer versions of dart look at hook/build.dart instead
of build.dart in the root and this is the longer-term plan, too.

* chore(dart): update lockfile

* chore(dart): bump eppo_core version

* chore(dart): pin to 3.6 (for testing)

* chore(dart): properly install flutter_rust_bridge_codegen

* chore(dart): add missing working-directory

* chore(dart): install toolchain for wasm

* chore(dart): fix lint errors

* chore(dart): downgrade version to 0.1.0, prepare to publish

* chore(dart): bump minimal sdk boundary to 3.6.0

This is required to use hook/build.dart.

* chore(dart): lower meta boundary

* fix(core): fix configuration poller running in wasm target

* fix(dart): properly default base url

* chore(dart): rename eppo_dart to eppo_sdk

This is used as the name of js/wasm generated files.

* fix(dart): enable logging in web

* chore(dart): upload dart web files in ci

* chore(dart): CI to publish dart sdk

* docs(dart): add dart tag format to documentation

* chore(dart): add license file

* chore(dart): add missing id-token permissions for write

* chore(dart): refresh pub.dev auth token?

* chore(dart): release on tag, not release event 🤷

* chore(dart): silence publish dry-run error code

* chore(android): Setup dart-sdk for android target (#220)

* add plugin info

* remove plugin details

* vendor libs

* remove corepack changes

* add rust api files

* add more generated code

* add another missing file

* catch reqwest panic

* replace openssl with rustls-tls

* update deps

* remove native-tls and openssl

* remove generated files

* another file to remove

* remove openssl-sys

* newlines

* revert this

* keep vendored feature

* try to fix python CI

* set vars for linux gnu

* install deps

* another try

* build with `cross` instead

* fix cross commang

* fix target platform triple

* another try

* revert action changes

* another try - see PyO3/maturin-action#222

* once again

* anotehr place

* chore: add changeset for openssl->rustls change

* chore(dart): build release artifacts for web

This reduces wasm file from 12M down to 2M.

* chore(ci): `dart-sdk` rust cross compile for Android target (#222)

* chore(ci): dart-sdk rust cross compile for android target

* eppo_dart instead of eppo_sdk

* revert this

* build patches

* revert this

* update file path for testing

* another try

* change working dir

* CI tweaks

* better logs

* more fix attempts

* aaaand another try

* 10th time is the charm

* check for path instead

* check CI env var

* passthrough env var

* use the fork of maturin-action

* yup

* bump action version

* fix step

* fix ste

* update action version, another shot at android fix

* fix pytest

* move file

* add file

* set rust root to current dir

* fix cross build config

* manually run codegen

* install dart

* reorder steps

* another reorder

* another try

* go back to main maturin-action

* remove custom build scripts

* add android x86

* remove images cross config

* go back to maturin-action v1

---------

Co-authored-by: Leo Romanovsky <leoromanovsky@users.noreply.github.com>
Co-authored-by: Felipe Lima <felipe.lima@gmail.com>
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.

3 participants