Skip to content

Commit

Permalink
Merge pull request #638 from tiziodcaio/main
Browse files Browse the repository at this point in the history
Build linked runtime by default
  • Loading branch information
filips123 authored Feb 11, 2025
2 parents f522eba + 3b948bf commit 02e9341
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/native.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ jobs:
path: signed/paf/*.paf.exe
compression-level: 0

# == BUILD PROVENANCE
# == Build Provenance

- name: Attest artifacts
if: startsWith(github.ref, 'refs/tags/v')
Expand Down
3 changes: 1 addition & 2 deletions native/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ lto = true
portable = ["dep:phf"]
static = ["reqwest/native-tls-vendored", "bzip2/static", "xz2/static"]
immutable-runtime = []
linked-runtime = ["dep:blake3"]

[dependencies]
ab_glyph = "0.2.29"
Expand Down Expand Up @@ -77,9 +76,9 @@ features = [
[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd"))'.dependencies]
glob = "0.3.2"
phf = { version = "0.11.2", features = ["macros"] }
blake3 = { version = "1.5.5", optional = true }

[target.'cfg(target_os = "linux")'.dependencies]
blake3 = "1.5.5"
bzip2 = "0.5.0"
xz2 = "0.1.7"
tar = "0.4.43"
Expand Down
4 changes: 2 additions & 2 deletions native/src/components/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl Runtime {
const COPY_ERROR: &str = "Failed to copy the runtime";
const CLEANUP_ERROR: &str = "Failed to clean up the runtime";

#[cfg(feature = "linked-runtime")]
#[cfg(platform_linux)]
{
use crate::storage::Storage;

Expand Down Expand Up @@ -352,7 +352,7 @@ impl Runtime {
Ok(())
}

#[cfg(feature = "linked-runtime")]
#[cfg(platform_linux)]
pub fn link(&self) -> Result<()> {
use std::fs::{copy, create_dir_all};
use std::os::unix::fs::symlink;
Expand Down
2 changes: 1 addition & 1 deletion native/src/connector/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl Process for SetConfig {
impl Process for InstallRuntime {
fn process(&self, _connection: &Connection) -> Result<ConnectorResponse> {
let command = RuntimeInstallCommand {
#[cfg(feature = "linked-runtime")]
#[cfg(platform_linux)]
link: self.link,
};
command.run()?;
Expand Down
7 changes: 3 additions & 4 deletions native/src/connector/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,14 @@ pub struct SetConfig(pub Config);
///
/// [`ConnectorResponse::RuntimeInstalled`] - No data.
///

#[cfg(feature = "linked-runtime")]
#[cfg(platform_linux)]
#[derive(Deserialize, Debug, Eq, PartialEq, Clone)]
pub struct InstallRuntime {
/// Experimental: Use a linked runtime instead of downloading from Mozilla.
pub link: bool,
}

#[cfg(not(feature = "linked-runtime"))]
#[cfg(not(platform_linux))]
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct InstallRuntime;

Expand Down Expand Up @@ -612,7 +611,7 @@ impl Into<crate::console::app::HTTPClientConfig> for HTTPClientConfig {

deserialize_unit_struct!(GetSystemVersions);
deserialize_unit_struct!(GetConfig);
#[cfg(not(feature = "linked-runtime"))]
#[cfg(not(platform_linux))]
deserialize_unit_struct!(InstallRuntime);
deserialize_unit_struct!(UninstallRuntime);
deserialize_unit_struct!(GetSiteList);
Expand Down
2 changes: 1 addition & 1 deletion native/src/console/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ pub enum RuntimeCommand {
#[derive(Parser, Debug, Eq, PartialEq, Clone)]
pub struct RuntimeInstallCommand {
/// Experimental: Use a linked runtime instead of downloading from Mozilla
#[cfg(feature = "linked-runtime")]
#[cfg(target_os = "linux")]
#[clap(long)]
pub link: bool,
}
Expand Down
4 changes: 2 additions & 2 deletions native/src/console/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ impl Run for RuntimeInstallCommand {
let dirs = ProjectDirs::new()?;
let runtime = Runtime::new(&dirs)?;

#[cfg(feature = "linked-runtime")]
#[cfg(platform_linux)]
if self.link {
runtime.link().context("Failed to link runtime")?
} else {
runtime.install().context("Failed to install runtime")?;
}

#[cfg(not(feature = "linked-runtime"))]
#[cfg(not(platform_linux))]
runtime.install().context("Failed to install runtime")?;

let runtime = Runtime::new(&dirs)?;
Expand Down
2 changes: 1 addition & 1 deletion native/src/console/site.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl Run for SiteLaunchCommand {
bail!("Runtime not installed");
}

#[cfg(feature = "linked-runtime")]
#[cfg(platform_linux)]
{
use std::fs::File;
use std::io::Read;
Expand Down
2 changes: 1 addition & 1 deletion native/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub struct Config {
/// May be overwritten with a system environment variable.
pub runtime_use_portals: bool,

#[cfg(feature = "linked-runtime")]
#[cfg(platform_linux)]
/// Experimental: Using the system runtime to save some disk space.
/// This might not work on your system.
pub use_linked_runtime: bool,
Expand Down

0 comments on commit 02e9341

Please sign in to comment.