Skip to content

Commit

Permalink
Disable download feature on wasm
Browse files Browse the repository at this point in the history
The download feature caused CI failures on wasm, due to dependencies breaking in ways difficult to diagnose. I searched the issues for the relevant dependencies and didn't find other people running into the same problem.

Since I worry that these deps may continue to be unstable, I think the best thing is to disable them on wasm builds. This shouldn't affect any functionality we actually care about.

Longer term, we probably want to move these more sophisticated examples out of the vello crate proper.

Fixes #394
  • Loading branch information
raphlinus committed Oct 25, 2023
1 parent 0e998df commit f937baf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/scenes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ rand = "0.8.5"
instant = { workspace = true }

# Used for the `download` command
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
byte-unit = "4.0"
dialoguer = "0.10"
ureq = "2.6"
6 changes: 6 additions & 0 deletions examples/scenes/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[cfg(not(target_arch = "wasm32"))]
pub mod download;
mod images;
mod mmark;
Expand All @@ -8,6 +9,7 @@ use std::path::PathBuf;

use anyhow::{anyhow, Result};
use clap::{Args, Subcommand};
#[cfg(not(target_arch = "wasm32"))]
use download::Download;
pub use images::ImageCache;
pub use simple_text::SimpleText;
Expand Down Expand Up @@ -77,6 +79,7 @@ pub struct Arguments {
#[derive(Subcommand, Debug)]
enum Command {
/// Download SVG files for testing. By default, downloads a set of files from wikipedia
#[cfg(not(target_arch = "wasm32"))]
Download(Download),
}

Expand Down Expand Up @@ -111,7 +114,10 @@ impl Arguments {
impl Command {
fn action(&self) -> Result<()> {
match self {
#[cfg(not(target_arch = "wasm32"))]
Command::Download(download) => download.action(),
#[cfg(target_arch = "wasm32")]
_ => unreachable!("downloads not supported on wasm"),
}
}
}
Expand Down

0 comments on commit f937baf

Please sign in to comment.