Commit a31e2479 authored by Dan Sheppard's avatar Dan Sheppard
Browse files

Hide non-important console logs in deploy mode.

parent cb23143b
......@@ -25,6 +25,10 @@ case "$1" in
echo "Running deploy"
$BASE/../deploy.sh
;;
deploy-check)
echo "Running deploy check"
$BASE/../deploy.sh check
;;
*)
echo "Unknown command '$1'"
;;
......
......@@ -10,8 +10,14 @@ SRC="$BASE/.."
DEST="$BASE/../../../../ensembl/static/browser"
cd $SRC
touch Cargo.lock # force build
RUSTFLAGS="--cfg=deploy" cargo +nightly web build --target=wasm32-unknown-unknown --release
RUSTFLAGS="--cfg=deploy" cargo +nightly web deploy --target=wasm32-unknown-unknown --release
if [ "$1" == "check" ] ; then
export RUSTFLAGS="--cfg=deploy --cfg=console"
else
export RUSTFLAGS="--cfg=deploy"
fi
cargo +nightly web build --target=wasm32-unknown-unknown --release
cargo +nightly web deploy --target=wasm32-unknown-unknown --release
cp $SRC/target/deploy/hellostdweb.wasm $DEST/browser.wasm
cp $SRC/target/deploy/hellostdweb.js $DEST/browser.js
sed -i -e 's~"hellostdweb.wasm"~"/static/browser/browser.wasm"~g' $DEST/browser.js
......@@ -42,6 +42,6 @@ fn main() {
stdweb::initialize();
global::setup_global();
debug!("global","{}",build_summary());
console!("{}",build_summary());
console_force!("{}",build_summary());
stdweb::event_loop();
}
......@@ -37,12 +37,17 @@ macro_rules! vec_s {
}}
}
#[allow(unused_macros)]
macro_rules! console_force {
($($arg:tt)*) => {{
let s = format!($($arg)*);
js! { console.log(@{s}); };
}}
}
macro_rules! console {
($($arg:tt)*) => {{
if true {
let s = format!($($arg)*);
js! { console.log(@{s}); };
if !cfg!(deploy) || cfg!(console) {
console_force!($($arg)*);
}
}}
}
......
......@@ -16,4 +16,3 @@ pub use self::smallest::Smallest;
pub use self::text::truncate;
pub use self::thisbuild::build_summary;
pub use self::valuestore::ValueStore;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment