From 6ad6f56cb14d476628fbfc23e98c63c9364b62b0 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sun, 9 May 2021 13:28:24 +0200 Subject: [PATCH] Move shell scripts into sh/ subfolder --- CONTRIBUTING.md | 2 ++ build_demo_native.sh | 4 ---- build_demo_web.sh => sh/build_demo_web.sh | 2 ++ check.sh => sh/check.sh | 5 +++++ sh/docs.sh | 9 +++++++++ sh/find_bloat.sh | 6 ++++++ setup_web.sh => sh/setup_web.sh | 2 ++ start_server.sh => sh/start_server.sh | 2 ++ sh/wasm_size.sh | 6 ++++++ 9 files changed, 34 insertions(+), 4 deletions(-) delete mode 100755 build_demo_native.sh rename build_demo_web.sh => sh/build_demo_web.sh (94%) rename check.sh => sh/check.sh (86%) create mode 100755 sh/docs.sh create mode 100755 sh/find_bloat.sh rename setup_web.sh => sh/setup_web.sh (63%) rename start_server.sh => sh/start_server.sh (82%) create mode 100755 sh/wasm_size.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ea568e92..0be1a4fd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,6 +29,8 @@ First file an issue (or find an existing one) and announce that you plan to work Browse through [`ARCHITECTURE.md`](https://github.com/emilk/egui/blob/master/ARCHITECTURE.md) to get a sense of how all pieces connects. +You can test your code locally by running `./sh/check.sh`. + When you have something that works, open a draft PR. You may get some helpful feedback early! When you feel the PR is ready to go, do a self-review of the code, and then open it for review. diff --git a/build_demo_native.sh b/build_demo_native.sh deleted file mode 100755 index 65fc2da3..00000000 --- a/build_demo_native.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -set -eu - -cargo run --bin egui_demo_app --release --all-features diff --git a/build_demo_web.sh b/sh/build_demo_web.sh similarity index 94% rename from build_demo_web.sh rename to sh/build_demo_web.sh index c148fc2b..e579ef2b 100755 --- a/build_demo_web.sh +++ b/sh/build_demo_web.sh @@ -1,5 +1,7 @@ #!/bin/bash set -eu +script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) +cd "$script_path/.." # Usage: build_demo_web.sh [--open] diff --git a/check.sh b/sh/check.sh similarity index 86% rename from check.sh rename to sh/check.sh index e0786d9f..03e06491 100755 --- a/check.sh +++ b/sh/check.sh @@ -1,4 +1,6 @@ #!/bin/bash +script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) +cd "$script_path/.." set -eux # Checks all tests, lints etc. @@ -24,3 +26,6 @@ cargo doc -p egui_web --target wasm32-unknown-unknown --lib --no-deps --all-feat # what compiles slowly? # cargo clean; cargo +nightly build -p egui -Z timings + +# what compiles slowly? +# cargo llvm-lines --lib -p egui | head -20 diff --git a/sh/docs.sh b/sh/docs.sh new file mode 100755 index 00000000..07ad9bdf --- /dev/null +++ b/sh/docs.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -eu +script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) +cd "$script_path/.." + +cargo doc -p egui_web --target wasm32-unknown-unknown --lib --no-deps --all-features +cargo doc -p emath -p epaint -p egui -p eframe -p epi -p egui_web -p egui_glium --lib --no-deps --all-features --open + +# cargo watch -c -x 'doc -p emath -p epaint -p egui --lib --no-deps --all-features' diff --git a/sh/find_bloat.sh b/sh/find_bloat.sh new file mode 100755 index 00000000..813e35fd --- /dev/null +++ b/sh/find_bloat.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -eu +script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) +cd "$script_path/.." + +cargo bloat --release --bin egui_demo_app -n 200 | rg "egui " diff --git a/setup_web.sh b/sh/setup_web.sh similarity index 63% rename from setup_web.sh rename to sh/setup_web.sh index c0ccdbd2..d61955b3 100755 --- a/setup_web.sh +++ b/sh/setup_web.sh @@ -1,5 +1,7 @@ #!/bin/bash set -eu +script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) +cd "$script_path/.." # Pre-requisites: rustup target add wasm32-unknown-unknown diff --git a/start_server.sh b/sh/start_server.sh similarity index 82% rename from start_server.sh rename to sh/start_server.sh index 78553169..80d48073 100755 --- a/start_server.sh +++ b/sh/start_server.sh @@ -1,5 +1,7 @@ #!/bin/bash set -eu +script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) +cd "$script_path/.." # Starts a local web-server that serves the contents of the `doc/` folder, # i.e. the web-version of `egui_demo_app`. diff --git a/sh/wasm_size.sh b/sh/wasm_size.sh new file mode 100755 index 00000000..90c558ea --- /dev/null +++ b/sh/wasm_size.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -eu +script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) +cd "$script_path" + +./build_demo_web.sh && ls -l ../docs/*.wasm