Feat: more cleanup

This commit is contained in:
Jonathan Kelley committed 2021-03-04 12:03:22 -05:00
1 parent cf16090838
commit 5a9155b059
17 files changed
+156 -259

No files matched your search

+2
View File
@@ -62,6 +62,8 @@ pub fn build(config: &Config, _build_config: &BuildConfig) -> Result<()> {
let mut child = cmd.spawn()?;
let _err_code = child.wait()?;
info!("Build complete!");
// [2] Establish the output directory structure
let bindgen_outdir = out_dir.join("wasm");
+8 -1
View File
@@ -1,4 +1,3 @@
use argh::FromArgs;
#[derive(FromArgs, PartialEq, Debug)]
@@ -43,6 +42,10 @@ pub struct BuildOptions {
/// an example in the crate
#[argh(option)]
pub example: Option<String>,
/// develop in release mode
#[argh(switch, short = 'r')]
pub release: bool,
}
/// 🛠 Start a development server
@@ -52,4 +55,8 @@ pub struct DevelopOptions {
/// an example in the crate
#[argh(option)]
pub example: Option<String>,
/// develop in release mode
#[argh(switch, short = 'r')]
pub release: bool,
}
+8 -3
View File
@@ -2,7 +2,6 @@ use crate::{
cli::{BuildOptions, DevelopOptions},
error::Result,
};
// use log::{info, warn};
use std::{io::Write, path::PathBuf, process::Command};
#[derive(Debug, Clone)]
@@ -70,10 +69,16 @@ impl Config {
self
}
pub fn with_release(&mut self, release: bool) -> &mut Self {
self.release = release;
self
}
pub fn with_build_options(&mut self, options: &BuildOptions) {
if let Some(name) = &options.example {
self.as_example(name.clone());
}
self.release = options.release;
self.out_dir = options.outdir.clone().into();
}
@@ -81,7 +86,7 @@ impl Config {
if let Some(name) = &options.example {
self.as_example(name.clone());
}
let outdir = tempfile::Builder::new().tempdir().expect("").into_path();
self.out_dir = outdir;
self.release = options.release;
self.out_dir = tempfile::Builder::new().tempdir().expect("").into_path();
}
}
+1 -1
View File
@@ -57,7 +57,7 @@ async fn watch_directory(config: Config) -> Result<()> {
.watch(src_dir.join("examples"), RecursiveMode::Recursive)
.expect("Failed to watch dir");
let build_config = BuildConfig::default();
let mut build_config = BuildConfig::default();
'run: loop {
crate::builder::build(&config, &build_config)?;