Upgrading an app
A Mobiler app has two parts that move with the framework:
- Your Rust code depends on
mobiler-core(and onmobiler-webfor a web client), like any crate. - The shells in
Android/andiOS/were written into your project bymobiler new, so a new release’s shell improvements don’t arrive by bumping a dependency.
mobiler upgrade handles both.
Upgrade
Section titled “Upgrade”cargo install mobiler # the newer CLI firstcd myappmobiler upgrade # look first: changes are offered as *.mobiler-new files # (Android resources under .mobiler/new/)mobiler upgrade --apply # write them in place (old versions go to .mobiler/backup/)- A real three-way merge.
mobiler newsaved the original shells in.mobiler/base/, so upgrade merges three versions of each file: the original, yours and the new one, likegit merge. Framework changes apply and your own edits and plugin registrations stay. Only truly overlapping changes become a conflict, written as<file>.mobiler-newwith conflict markers and never applied by itself. - Dependencies move too.
--applymoves the framework’s own pins (crux_core,mobiler-core) in your app. A pin in another crate, such as a sharedapp-coreor a crate outside the app folder, is listed for you to change by hand; a web client’smobiler-webis checked against its own current release. Upgrade never moves a pin down: one already at or above its target is left alone. - It never touches your app’s Rust code. The one framework file in
shared/src/, thebin/codegen.rsthat generates the bindings, is merged like the shells. - Nothing is forgotten. Files waiting for review are recorded in
.mobiler/pending/, and every run lists them. After resolving a conflict yourself, runmobiler upgrade --resolved <file>. - Plugins. A plugin’s native code is copied into your app. When a release updates a plugin you use,
upgrade says so;
mobiler plugin add <name>brings the new version in.
Commit .mobiler/, so the baseline, the version stamp and the pending reviews travel with the repository.
When your code stops compiling
Section titled “When your code stops compiling”Upgrade never edits your Rust, so an API change shows up as a compile error. Most come from a struct that
gained a field. Writing literals with ..Default::default() (or .. in patterns) avoids nearly all of
them:
Theme { seed, corner: Corner::Large, ..Default::default() }Each breaking change is listed, release by release, in the upgrade notes, with what to change.