-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(vdev): Rewrite compile-vrl-wasm.sh to vdev (#16751)
* chore(vdev): Rewrite compile-vrl-wasm.sh to vdev * Move compile-vrl-wasm to the top level * Remove comment that wasn't an issue to begin with * Refactor compile_vrl_wasm.rs to utilize for-loop * Use correct vdev command for compile-vrl-wasm in Makefile * Use .clone() in compile_vrl_wasm.rs to avoid clippy formatting error * move vrl-wasm to generate subcommand, modify Makefile to use cargo vdev generate * remove clone in vrl_wasm.js
- Loading branch information
1 parent
afae677
commit be9e2c4
Showing
4 changed files
with
26 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use std::path::Path; | ||
use anyhow::Result; | ||
use clap::Args; | ||
|
||
use crate::app; | ||
|
||
/// Compiles VRL crates to wasm32-unknown-unknown | ||
#[derive(Args, Debug)] | ||
#[command()] | ||
pub struct Cli {} | ||
|
||
impl Cli { | ||
pub fn exec(self) -> Result<()> { | ||
let vrl_path = Path::new(app::path()).join("lib").join("vrl"); | ||
let args = &["build", "--release", "--target", "wasm32-unknown-unknown"]; | ||
|
||
for crate_name in ["compiler", "core", "diagnostic", "parser"] { | ||
println!("Compiling lib/vrl/{crate_name} to wasm32-unknown-unknown"); | ||
std::env::set_current_dir(vrl_path.join(crate_name))?; | ||
app::exec("cargo", *args, false)?; | ||
} | ||
Ok(()) | ||
} | ||
} |