Commit Graph

25 Commits

Author SHA1 Message Date
Eric Seidel 34509fca3c refactor: split C API into Dart and engine surfaces (#350)
The C surface in `library/src/c_api` was a single bucket of `pub extern "C"`
functions covering both consumers — `package:shorebird_code_push` (via
ffigen) and Shorebird's Flutter engine fork (via direct C++ link). That
made it hard to reason about which symbols are stable ABI versus
internal, and ffigen was generating bindings for engine-only symbols
that no Dart code calls.

Split into two self-contained submodules and two cbindgen-generated
headers:

- `c_api::dart` → `include/updater_dart.h` (stable ABI; ffigen entry
  point). Defines `UpdateResult`, the `SHOREBIRD_*` status constants, and
  the five Dart-stable functions: `shorebird_current_boot_patch_number`,
  `shorebird_next_boot_patch_number`,
  `shorebird_check_for_downloadable_update`,
  `shorebird_update_with_result`, `shorebird_free_update_result`.
- `c_api::engine` → `include/updater_engine.h` (no stability guarantee).
  Defines `AppParameters`, `FileCallbacks`, and the engine-only functions:
  `shorebird_init`, `shorebird_should_auto_update`,
  `shorebird_validate_next_boot_patch`, `shorebird_next_boot_patch_path`,
  `shorebird_free_string`, `shorebird_start_update_thread`, and the
  `shorebird_report_launch_*` trio.

Each bucket file is self-contained: cbindgen scans only the file
(`with_src` in build.rs) and emits the items it defines plus the C
types they reference. There are no exclude/include lists in the
cbindgen configs — adding a function to one bucket automatically lands
it in the right header, and items in the other bucket cannot leak.

`mod.rs` shrinks to a thin layer of private helpers shared by both
buckets (`to_rust`, `allocate_c_string`, `free_c_string`, `log_on_error`)
plus the test module.

`include/updater.h` is removed; consumers include the specific header
for their use case. The Flutter engine's
`shell/common/shorebird/updater.cc` will be updated in a follow-up
engine-repo PR to include `updater_engine.h` directly.

Also drops two retired Dart-side symbols:

- `shorebird_update` (replaced by `shorebird_update_with_result` in the
  Dart 2.0 rewrite, Nov 2024).
- `shorebird_check_for_update` (replaced by
  `shorebird_check_for_downloadable_update` in the same rewrite).

The shorebird_code_push package's `_legacyFallback` was the only path
that still called `shorebird_update`. The package's `flutter: >=3.24.5`
constraint guarantees the engine has `shorebird_update_with_result`, so
the fallback was unreachable in practice. Removing it lets us drop the
ABI symbol.

Bumps shorebird_code_push to 2.0.7. Bindings regenerated via ffigen now
contain only the five Dart-stable symbols.

Follow-up engine PR will: include `updater_engine.h` instead of the
removed `updater.h`; clean up `android_exports.lst` (drop the ghost
`shorebird_active_path` and `shorebird_active_patch_number` exports,
drop `shorebird_check_for_update`).
2026-05-04 15:56:09 -07:00
Eric Seidel f806c7c0cf chore(shorebird_code_push): v2.0.6 (#345) 2026-04-22 02:11:06 +00:00
Felix Angelov dffafaff7a chore(shorebird_code_push): v2.0.5 (#294) 2025-09-12 16:51:27 -05:00
Bryan Oltman 5d7690cd37 chore: draft release 2.0.4 (#282) 2025-05-30 14:58:02 -04:00
Felix Angelov cbe348ce3f chore(shorebird_code_push): v2.0.3 (#268) 2025-02-07 15:51:50 -06:00
Eric Seidel 6298d37d86 chore: add cspell checking and make pass (#244)
* chore: add cspell checking and make pass

* chore(shorebird_code_push): minor improvements to example (#242)

* chore(shorebird_code_push): v2.0.2 (#243)

* chore: fix cspell

---------

Co-authored-by: Felix Angelov <felix@shorebird.dev>
2024-11-20 13:50:16 -05:00
Felix Angelov 7b124114ea chore(shorebird_code_push): v2.0.2 (#243) 2024-11-20 11:56:45 -06:00
Bryan Oltman 8e40228558 fix typo 2024-11-20 09:51:02 -05:00
Bryan Oltman 60c38dc647 feat: 2.0.1 2024-11-20 09:50:21 -05:00
Bryan Oltman 47dd248f0e chore: prep version 2.0 (#237) 2024-11-14 16:31:05 -05:00
Felix Angelov 488570d3f0 chore(shorebird_code_push): v2.0.0-dev.2 (#230) 2024-11-05 11:50:35 -06:00
Felix Angelov 6f1be35bd3 feat(shorebird_code_push): rewrite Dart API (#225) 2024-11-04 12:22:37 -06:00
Bryan Oltman 3384b91597 chore: prepare for release 1.1.6 2024-10-16 16:07:50 -04:00
Bryan Oltman 7324546a55 docs: update changelog for 1.1.5 2024-09-24 11:11:12 -04:00
Eric Seidel 933e231636 feat: add automated publishing to shorebird_code_push (#197)
* feat: add automated publishing to shorebird_code_push

* include version bump
2024-07-25 16:29:21 +00:00
Bryan Oltman 52119a5906 update changelog 2023-10-20 15:48:48 -04:00
Bryan Oltman 3b4b6ebc24 docs: fix method name in readme 2023-10-07 23:41:15 -04:00
Bryan Oltman bb2e0b5c04 Update changelog 2023-10-07 23:37:07 -04:00
Eric Seidel e14f630f91 refactor: move shorebird_code_push_io and _web into src/ (#75)
* break: move shorebird_code_push_io and _web into src/

Users were sometimes importing the _web version thinking it
was the "web safe" import, rather than shorebird_code_push.dart
and then being surprised when ShorebirdCodePush did nothing.

Fixes https://github.com/shorebirdtech/shorebird/issues/1209

* Update formating for Dart 3.1
2023-09-07 07:38:15 -07:00
Felix Angelov abe4126da5 chore(shorebird_code_push): v1.1.0 (#60) 2023-07-14 16:08:24 -05:00
Bryan Oltman 0be41d9d85 chore(shorebird_code_push): Release 1.0.0, change downloadUpdate to downloadUpdateIfAvailable (#46)
* Release 1.0.0, change downloadUpdate to downloadUpdateIfAvailable

* update readme and contributing

* add dart doc

* add discord badge

* remove doc checkin

* formatting
2023-06-29 16:42:56 -04:00
Bryan Oltman 9336cb3add Release shorebird_code_push 0.1.3 2023-06-23 18:07:14 -04:00
Bryan Oltman aa60264e15 release shorebird_code_push 0.1.2 2023-06-23 14:12:42 -04:00
Bryan Oltman fb89fdd412 Update to version 0.1.1, readme updates 2023-06-21 11:02:30 -04:00
Bryan Oltman 1776b058b4 chore(shorebird_code_push): add CHANGELOG.md (#41)
* chore(shorebird_code_push): add CHANGELOG.md

* remove build number from version

* correct version number
2023-06-20 17:52:12 -04:00