commit 8c0f8c21ae2d223d7ccfe0ff944a4180f98778aa
parent 99b452cdccb53f00b492538e92b6691522c9e415
Author: Marcel <mtrnord1@gmail.com>
Date: Fri, 24 Jul 2020 23:45:39 +0200
Add cargo make file. (Not fully working yet)
Took 1 hour 36 minutes
Diffstat:
2 files changed, 95 insertions(+), 0 deletions(-)
diff --git a/Makefile.toml b/Makefile.toml
@@ -0,0 +1,68 @@
+[config]
+skip_core_tasks = true
+
+[tasks.format]
+install_crate = "rustfmt"
+command = "cargo"
+args = ["fmt"]
+
+[tasks.wasm-clean]
+script_runner = "@shell"
+script = [
+'''
+rm ./dist
+rm ./pkg
+'''
+]
+
+[tasks.dist]
+# TODO add scss task when it works
+dependencies = ["format", "wasm-clean", "wasm-build", "copy-files"]
+
+[tasks.dist-debug]
+# TODO add scss task when it works
+dependencies = ["format", "wasm-clean", "wasm-build-debug", "copy-files"]
+
+[tasks.run]
+watch = {watch = ["./src", "./static", "./startup_helper"], poll = true}
+dependencies = ["dist-debug", "start-server"]
+
+[tasks.start-server]
+install_crate = { crate_name = "sfz", binary = "sfz", test_arg = "--help" }
+command = "sfz"
+args = ["./dist"]
+
+[tasks.wasm-build]
+command = "wasm-pack"
+args = ["build", "--release", "--target", "web"]
+
+[tasks.wasm-build-debug]
+command = "wasm-pack"
+args = ["build", "--debug", "--target", "web"]
+
+[tasks.copy-files]
+script_runner = "@shell"
+script = [
+'''
+mkdir dist
+cp static/index_rust_only.html dist/index.html
+cp pkg/daydream.js dist/daydream.js
+cp pkg/daydream_bg.wasm dist/daydream_bg.wasm
+'''
+]
+
+[tasks.update-translations]
+condition = { platforms = ["mac", "linux"] }
+ignore_errors = true
+command = "cargo"
+args = ["i18n"]
+dependencies = ["install-xtr"]
+
+[tasks.install-xtr]
+condition = { platforms = ["mac", "linux"] }
+install_crate = { crate_name = "xtr", binary = "xtr", test_arg = "--help" }
+
+[tasks.scss]
+install_crate = { crate_name = "grass", binary = "grass", test_arg = "--help" }
+command = "grass"
+args = ["static/style.scss", "dist/style.css"]
diff --git a/static/index_rust_only.html b/static/index_rust_only.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<html lang="en" data-theme="light">
+ <head>
+ <meta charset="utf-8" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <meta name="Description" content="A Matrix Client written in Rust using WebAssembly.">
+ <link rel="dns-prefetch" href="//fonts.googleapis.com">
+ <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
+ <link href="https://fonts.googleapis.com/css2?family=Dancing+Script:wght@700&family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
+ <script type="module">
+ import init, {run_app, init_worker} from "./daydream.js";
+
+ async function run() {
+ await init();
+ init_worker();
+ run_app();
+ }
+ run();
+
+ </script>
+ <title>Daydream</title>
+ </head>
+ <body>
+ </body>
+</html>