Class: Everywhere::Builders::Desktop
- Inherits:
-
Object
- Object
- Everywhere::Builders::Desktop
- Defined in:
- lib/everywhere/builders/desktop.rb
Overview
Resolves where cargo should run for the desktop shell, and stamps a
per-app copy of it when the app declares native.desktop.
Two paths, deliberately:
no native.desktop the gem's own support/desktop/src-tauri, compiled
against the SHARED ~/.rubyeverywhere/shell-target.
Identical source for every app, so one warm target
dir serves all of them. This is what every app did
before extensions existed, and it stays free.
native.desktop a stamped copy under ~/.rubyeverywhere/desktop/<id>
with its own target dir, exactly like the iOS and
Android work dirs. Costs one cold Tauri compile
(minutes) and a couple of GB, which is why it is not
the default.
The stamped list, and nothing else:
Cargo.toml the template's, with native.desktop.crates
substituted into the __EVERYWHERE_APP_CRATES__
marker
src/extensions/** native/desktop/**/*.rs, plus a generated
mod.rs per directory
Everything else in the work dir is the frozen template, copied as-is. In particular src/main.rs, src/extension_host.rs and capabilities/ are never rewritten — see support/desktop/README.md.
Defined Under Namespace
Classes: Prepared
Constant Summary collapse
- MODULE_FILE =
The generated module file, at every level of src/extensions. Reserved: an app shipping its own would be silently overwritten, so we refuse.
"mod.rs"- STAGE_MARKER =
".everywhere-template"- CRATES_MARKER =
"# __EVERYWHERE_APP_CRATES__"- SOURCE_DIR =
Where the app keeps its Rust, relative to the app root.
File.join("native", "desktop")
Instance Method Summary collapse
-
#initialize(config:, root:, template_dir: nil) ⇒ Desktop
constructor
A new instance of Desktop.
-
#prepare! ⇒ Object
Returns where to run cargo and what to set CARGO_TARGET_DIR to.
Constructor Details
Instance Method Details
#prepare! ⇒ Object
Returns where to run cargo and what to set CARGO_TARGET_DIR to. Callers
(every dev, every build) don't need to care which path they got.
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/everywhere/builders/desktop.rb', line 60 def prepare! template = @template_dir || Paths.shell_dir! unless @config.native_desktop? return Prepared.new(dir: template, target_dir: Paths.cargo_target_dir, stamped: false) end preflight! src_tauri = stage(template) stamp!(src_tauri) Prepared.new(dir: src_tauri, target_dir: Paths.desktop_target_dir(bundle_id), stamped: true) end |