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.
EVERY app gets its own staged copy of the shell under
~/.rubyeverywhere/desktop/every build swaps the app's
icon into icons/icon.png, so compiling the template in place means writing
into the installed gem — Errno::EACCES on a system-wide install, and one
app's branding in the next app's build when two builds share it.
What the two paths differ in is the stamp and the target dir:
no native.desktop the template verbatim, compiled against the SHARED
~/.rubyeverywhere/shell-target. The source really is
identical for every such app, so one warm target dir
serves all of them.
native.desktop the app's Rust stamped in, and 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.
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/everywhere/builders/desktop.rb', line 65 def prepare! template = @template_dir || Paths.shell_dir! stamped = @config.native_desktop? preflight! if stamped src_tauri = stage(template) stamp!(src_tauri) if stamped Prepared.new(dir: src_tauri, target_dir: stamped ? Paths.desktop_target_dir(bundle_id) : Paths.cargo_target_dir, stamped: stamped) end |