From b0a75662bf03d11fccc154cf81fad924d9003070 Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Fri, 26 Jul 2019 14:25:02 +0200 Subject: [PATCH] Add a cargo-make makefile This will facilitate building each crate with the correct target, placing the assets in the correct place before running and only running tests on the stoptime_server crate. --- Makefile.toml | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Makefile.toml diff --git a/Makefile.toml b/Makefile.toml new file mode 100644 index 0000000..4f6d752 --- /dev/null +++ b/Makefile.toml @@ -0,0 +1,47 @@ +[config] +workspace = false + +[tasks.build] +clear = true +workspace = false +category = "Build" +description = "Runs the rust compiler for both server and UI" +dependencies = ["build-server", "build-ui"] + +[tasks.build-server] +category = "Build" +description = "Runs the rust compiler for the server" +command = "cargo" +args = ["build", "-p", "stoptime_server"] + +[tasks.build-ui] +category = "Build" +description = "Runs the rust compiler via cargo-web for the UI" +install-crate = "cargo-web" +command = "cargo" +args = ["web", "build", "-p", "stoptime_ui", "--target", "wasm32-unknown-unknown"] + +[tasks.copy-wasm-assets] +description = "Copies the WASM assets generated by cargo-web to the static assets directory" +command = "cp" +args = [ + "target/wasm32-unknown-unknown/debug/stoptime_ui.js", + "target/wasm32-unknown-unknown/debug/stoptime_ui.wasm", + "ui/static" +] +dependencies = ["build-ui"] + +[tasks.run] +clear = true +workspace = false +description = "Runs the server" +dependencies = ["copy-wasm-assets"] +command = "cargo" +args = ["run", "-p", "stoptime_server"] + +[tasks.test] +clear = true +workspace = false +description = "Run all available tests for the server" +command = "cargo" +args = ["test", "-p", "stoptime_server", "--all-features"]