From 3481a6ee5336fa5cc0236a4e3e46a86fc2869c58 Mon Sep 17 00:00:00 2001 From: Joseph Cruz Date: Thu, 13 Jul 2023 16:46:51 -0400 Subject: [PATCH] build: run tasks from workpace or member directory (#1339) --- Makefile.toml | 98 +------------------ cargo-make/main.toml | 22 +++++ integrations/actix/Makefile.toml | 1 + integrations/axum/Makefile.toml | 1 + integrations/utils/Makefile.toml | 1 + integrations/viz/Makefile.toml | 1 + leptos/Makefile.toml | 15 +++ leptos_config/Makefile.toml | 1 + leptos_dom/Makefile.toml | 1 + leptos_hot_reload/Makefile.toml | 1 + leptos_macro/Makefile.toml | 23 +++++ leptos_macro/src/view.rs | 3 + leptos_reactive/Makefile.toml | 1 + leptos_server/Makefile.toml | 1 + meta/Makefile.toml | 1 + router/Makefile.toml | 1 + server_fn/Makefile.toml | 1 + .../server_fn_macro_default/Makefile.toml | 1 + server_fn_macro/Makefile.toml | 1 + 19 files changed, 82 insertions(+), 93 deletions(-) create mode 100644 cargo-make/main.toml create mode 100644 integrations/actix/Makefile.toml create mode 100644 integrations/axum/Makefile.toml create mode 100644 integrations/utils/Makefile.toml create mode 100644 integrations/viz/Makefile.toml create mode 100644 leptos_config/Makefile.toml create mode 100644 leptos_dom/Makefile.toml create mode 100644 leptos_hot_reload/Makefile.toml create mode 100644 leptos_macro/Makefile.toml create mode 100644 leptos_reactive/Makefile.toml create mode 100644 leptos_server/Makefile.toml create mode 100644 meta/Makefile.toml create mode 100644 router/Makefile.toml create mode 100644 server_fn/Makefile.toml create mode 100644 server_fn/server_fn_macro_default/Makefile.toml create mode 100644 server_fn_macro/Makefile.toml diff --git a/Makefile.toml b/Makefile.toml index 5ca9991c7..d933f470d 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -3,113 +3,25 @@ # cargo install --force cargo-make ############ -[config] -# make tasks run at the workspace root -default_to_workspace = false - -[tasks.check] -clear = true -dependencies = [ - "check-all", - "check-wasm", - "check-all-release", - "check-wasm-release", -] - -[tasks.check-all] -command = "cargo" -args = ["+nightly", "check-all-features"] -install_crate = "cargo-all-features" - -[tasks.check-wasm] -clear = true -dependencies = [{ name = "check-wasm", path = "leptos" }] - -[tasks.check-all-release] -command = "cargo" -args = ["+nightly", "check-all-features"] -install_crate = "cargo-all-features" - -[tasks.check-wasm-release] -clear = true -dependencies = [{ name = "check-wasm-release", path = "leptos" }] - -[tasks.check-examples] -clear = true -dependencies = [ - { name = "check", path = "examples/counter" }, - { name = "check", path = "examples/counter_isomorphic" }, - { name = "check", path = "examples/counters" }, - { name = "check", path = "examples/error_boundary" }, - { name = "check", path = "examples/errors_axum" }, - { name = "check", path = "examples/fetch" }, - { name = "check", path = "examples/hackernews" }, - { name = "check", path = "examples/hackernews_axum" }, - { name = "check", path = "examples/js-framework-benchmark" }, - { name = "check", path = "examples/leptos-tailwind-axum" }, - { name = "check", path = "examples/login_with_token_csr_only" }, - { name = "check", path = "examples/parent_child" }, - { name = "check", path = "examples/router" }, - { name = "check", path = "examples/session_auth_axum" }, - { name = "check", path = "examples/slots" }, - { name = "check", path = "examples/ssr_modes" }, - { name = "check", path = "examples/ssr_modes_axum" }, - { name = "check", path = "examples/tailwind" }, - { name = "check", path = "examples/tailwind_csr_trunk" }, - { name = "check", path = "examples/timer" }, - { name = "check", path = "examples/todo_app_sqlite" }, - { name = "check", path = "examples/todo_app_sqlite_axum" }, - { name = "check", path = "examples/todo_app_sqlite_viz" }, - { name = "check", path = "examples/todomvc" }, -] +[env] +CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true [tasks.check-stable] +workspace = false clear = true dependencies = [ { name = "check", path = "examples/counter_without_macros" }, { name = "check", path = "examples/counters_stable" }, ] -[tasks.test] -clear = true -dependencies = [ - "test-all", - "test-leptos_macro-example", - "doc-leptos_macro-example", -] - -[tasks.test-all] -command = "cargo" -args = ["+nightly", "test-all-features"] -install_crate = "cargo-all-features" - -[tasks.test-leptos_macro-example] -description = "Tests the leptos_macro/example to check if macro handles doc comments correctly" -command = "cargo" -args = ["+nightly", "test", "--doc"] -cwd = "leptos_macro/example" -install_crate = false - -[tasks.doc-leptos_macro-example] -description = "Docs the leptos_macro/example to check if macro handles doc comments correctly" -command = "cargo" -args = ["+nightly", "doc"] -cwd = "leptos_macro/example" -install_crate = false - [tasks.ci-examples] +workspace = false cwd = "examples" command = "cargo" args = ["make", "ci-clean"] [tasks.clean-examples] +workspace = false cwd = "examples" command = "cargo" args = ["make", "clean"] - -[env] -RUSTFLAGS = "" -LEPTOS_OUTPUT_NAME = "ci" # allows examples to check/build without cargo-leptos - -[env.github-actions] -RUSTFLAGS = "-D warnings" diff --git a/cargo-make/main.toml b/cargo-make/main.toml new file mode 100644 index 000000000..9f9f91c5a --- /dev/null +++ b/cargo-make/main.toml @@ -0,0 +1,22 @@ +[env] +RUSTFLAGS = "" +LEPTOS_OUTPUT_NAME = "ci" # allows examples to check/build without cargo-leptos + +[env.github-actions] +RUSTFLAGS = "-D warnings" + +[tasks.check] +alias = "check-all" + +[tasks.check-all] +command = "cargo" +args = ["+nightly", "check-all-features"] +install_crate = "cargo-all-features" + +[tasks.test] +alias = "test-all" + +[tasks.test-all] +command = "cargo" +args = ["+nightly", "test-all-features"] +install_crate = "cargo-all-features" diff --git a/integrations/actix/Makefile.toml b/integrations/actix/Makefile.toml new file mode 100644 index 000000000..84f458ce3 --- /dev/null +++ b/integrations/actix/Makefile.toml @@ -0,0 +1 @@ +extend = { path = "../../cargo-make/main.toml" } diff --git a/integrations/axum/Makefile.toml b/integrations/axum/Makefile.toml new file mode 100644 index 000000000..84f458ce3 --- /dev/null +++ b/integrations/axum/Makefile.toml @@ -0,0 +1 @@ +extend = { path = "../../cargo-make/main.toml" } diff --git a/integrations/utils/Makefile.toml b/integrations/utils/Makefile.toml new file mode 100644 index 000000000..84f458ce3 --- /dev/null +++ b/integrations/utils/Makefile.toml @@ -0,0 +1 @@ +extend = { path = "../../cargo-make/main.toml" } diff --git a/integrations/viz/Makefile.toml b/integrations/viz/Makefile.toml new file mode 100644 index 000000000..84f458ce3 --- /dev/null +++ b/integrations/viz/Makefile.toml @@ -0,0 +1 @@ +extend = { path = "../../cargo-make/main.toml" } diff --git a/leptos/Makefile.toml b/leptos/Makefile.toml index 7490fb344..0fe31b5f1 100644 --- a/leptos/Makefile.toml +++ b/leptos/Makefile.toml @@ -1,3 +1,14 @@ +extend = { path = "../cargo-make/main.toml" } + +[tasks.check] +clear = true +dependencies = [ + "check-all", + "check-wasm", + "check-release", + "check-wasm-release", +] + [tasks.check-wasm] clear = true dependencies = ["check-hydrate", "check-csr"] @@ -43,3 +54,7 @@ args = [ "--features=csr", "--target=wasm32-unknown-unknown", ] + +[tasks.check-release] +command = "cargo" +args = ["check", "--release"] diff --git a/leptos_config/Makefile.toml b/leptos_config/Makefile.toml new file mode 100644 index 000000000..3d822c68d --- /dev/null +++ b/leptos_config/Makefile.toml @@ -0,0 +1 @@ +extend = { path = "../cargo-make/main.toml" } diff --git a/leptos_dom/Makefile.toml b/leptos_dom/Makefile.toml new file mode 100644 index 000000000..3d822c68d --- /dev/null +++ b/leptos_dom/Makefile.toml @@ -0,0 +1 @@ +extend = { path = "../cargo-make/main.toml" } diff --git a/leptos_hot_reload/Makefile.toml b/leptos_hot_reload/Makefile.toml new file mode 100644 index 000000000..3d822c68d --- /dev/null +++ b/leptos_hot_reload/Makefile.toml @@ -0,0 +1 @@ +extend = { path = "../cargo-make/main.toml" } diff --git a/leptos_macro/Makefile.toml b/leptos_macro/Makefile.toml new file mode 100644 index 000000000..a4d6f2ebf --- /dev/null +++ b/leptos_macro/Makefile.toml @@ -0,0 +1,23 @@ +extend = { path = "../cargo-make/main.toml" } + +[tasks.test] +clear = true +dependencies = [ + "test-all", + "test-leptos_macro-example", + "doc-leptos_macro-example", +] + +[tasks.test-leptos_macro-example] +description = "Tests the leptos_macro/example to check if macro handles doc comments correctly" +command = "cargo" +args = ["+nightly", "test", "--doc"] +cwd = "example" +install_crate = false + +[tasks.doc-leptos_macro-example] +description = "Docs the leptos_macro/example to check if macro handles doc comments correctly" +command = "cargo" +args = ["+nightly", "doc"] +cwd = "example" +install_crate = false diff --git a/leptos_macro/src/view.rs b/leptos_macro/src/view.rs index a539eb56e..5d05040b9 100644 --- a/leptos_macro/src/view.rs +++ b/leptos_macro/src/view.rs @@ -1553,6 +1553,7 @@ pub(crate) fn component_to_tokens( global_class: Option<&TokenTree>, ) -> TokenStream { let name = node.name(); + #[cfg(debug_assertions)] let component_name = ident_from_tag_name(node.name()); let span = node.name().span(); @@ -1685,6 +1686,7 @@ pub(crate) fn component_to_tokens( } }); + #[allow(unused_mut)] // used in debug let mut component = quote! { ::leptos::component_view( &#name, @@ -2120,6 +2122,7 @@ impl IdeTagHelper { /// open_tag(open_tag.props().slots().children().build()) /// } /// ``` + #[cfg(debug_assertions)] pub fn add_component_completion( component: &mut TokenStream, node: &NodeElement, diff --git a/leptos_reactive/Makefile.toml b/leptos_reactive/Makefile.toml new file mode 100644 index 000000000..3d822c68d --- /dev/null +++ b/leptos_reactive/Makefile.toml @@ -0,0 +1 @@ +extend = { path = "../cargo-make/main.toml" } diff --git a/leptos_server/Makefile.toml b/leptos_server/Makefile.toml new file mode 100644 index 000000000..3d822c68d --- /dev/null +++ b/leptos_server/Makefile.toml @@ -0,0 +1 @@ +extend = { path = "../cargo-make/main.toml" } diff --git a/meta/Makefile.toml b/meta/Makefile.toml new file mode 100644 index 000000000..3d822c68d --- /dev/null +++ b/meta/Makefile.toml @@ -0,0 +1 @@ +extend = { path = "../cargo-make/main.toml" } diff --git a/router/Makefile.toml b/router/Makefile.toml new file mode 100644 index 000000000..3d822c68d --- /dev/null +++ b/router/Makefile.toml @@ -0,0 +1 @@ +extend = { path = "../cargo-make/main.toml" } diff --git a/server_fn/Makefile.toml b/server_fn/Makefile.toml new file mode 100644 index 000000000..3d822c68d --- /dev/null +++ b/server_fn/Makefile.toml @@ -0,0 +1 @@ +extend = { path = "../cargo-make/main.toml" } diff --git a/server_fn/server_fn_macro_default/Makefile.toml b/server_fn/server_fn_macro_default/Makefile.toml new file mode 100644 index 000000000..84f458ce3 --- /dev/null +++ b/server_fn/server_fn_macro_default/Makefile.toml @@ -0,0 +1 @@ +extend = { path = "../../cargo-make/main.toml" } diff --git a/server_fn_macro/Makefile.toml b/server_fn_macro/Makefile.toml new file mode 100644 index 000000000..3d822c68d --- /dev/null +++ b/server_fn_macro/Makefile.toml @@ -0,0 +1 @@ +extend = { path = "../cargo-make/main.toml" }