Skip to content

Commit

Permalink
build: run tasks from workpace or member directory (leptos-rs#1339)
Browse files Browse the repository at this point in the history
  • Loading branch information
agilarity authored Jul 13, 2023
1 parent d1ef5fc commit 3481a6e
Show file tree
Hide file tree
Showing 19 changed files with 82 additions and 93 deletions.
98 changes: 5 additions & 93 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
22 changes: 22 additions & 0 deletions cargo-make/main.toml
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions integrations/actix/Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extend = { path = "../../cargo-make/main.toml" }
1 change: 1 addition & 0 deletions integrations/axum/Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extend = { path = "../../cargo-make/main.toml" }
1 change: 1 addition & 0 deletions integrations/utils/Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extend = { path = "../../cargo-make/main.toml" }
1 change: 1 addition & 0 deletions integrations/viz/Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extend = { path = "../../cargo-make/main.toml" }
15 changes: 15 additions & 0 deletions leptos/Makefile.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down Expand Up @@ -43,3 +54,7 @@ args = [
"--features=csr",
"--target=wasm32-unknown-unknown",
]

[tasks.check-release]
command = "cargo"
args = ["check", "--release"]
1 change: 1 addition & 0 deletions leptos_config/Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extend = { path = "../cargo-make/main.toml" }
1 change: 1 addition & 0 deletions leptos_dom/Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extend = { path = "../cargo-make/main.toml" }
1 change: 1 addition & 0 deletions leptos_hot_reload/Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extend = { path = "../cargo-make/main.toml" }
23 changes: 23 additions & 0 deletions leptos_macro/Makefile.toml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions leptos_macro/src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -1685,6 +1686,7 @@ pub(crate) fn component_to_tokens(
}
});

#[allow(unused_mut)] // used in debug
let mut component = quote! {
::leptos::component_view(
&#name,
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions leptos_reactive/Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extend = { path = "../cargo-make/main.toml" }
1 change: 1 addition & 0 deletions leptos_server/Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extend = { path = "../cargo-make/main.toml" }
1 change: 1 addition & 0 deletions meta/Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extend = { path = "../cargo-make/main.toml" }
1 change: 1 addition & 0 deletions router/Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extend = { path = "../cargo-make/main.toml" }
1 change: 1 addition & 0 deletions server_fn/Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extend = { path = "../cargo-make/main.toml" }
1 change: 1 addition & 0 deletions server_fn/server_fn_macro_default/Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extend = { path = "../../cargo-make/main.toml" }
1 change: 1 addition & 0 deletions server_fn_macro/Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extend = { path = "../cargo-make/main.toml" }

0 comments on commit 3481a6e

Please sign in to comment.