Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo make clean #526

Open
MartinKavik opened this issue Aug 30, 2020 · 2 comments
Open

cargo make clean #526

MartinKavik opened this issue Aug 30, 2020 · 2 comments

Comments

@MartinKavik
Copy link
Member

Clean all build artifacts from the Seed and examples by cargo make clean.
See Makefile.toml in the PR: #523.

@arn-the-long-beard
Copy link
Member

arn-the-long-beard commented Feb 16, 2021

Well,

I am almost there 😉 .

# ---- CLEAN----

[tasks.clean]
description = "Clean only Seed"
command = "cargo"
args = ["clean"]

[tasks.clean_pkg]
description = "Generic Clean command"
command = "cargo"
args = ["clean","--target-dir" ,"pkg"]

[tasks.clean_examples]
description = "Clean all examples pkg"
command = "cargo"
args = ["make", "for_each", "clean_pkg"]

[tasks.clean_all]
description = "Clean all artifact in seed and examples"
dependencies = ["clean", "clean_examples"]

The script breaks for project that are build with /client and /server folders like https://github.com/seed-rs/seed/tree/master/examples/e2e_encryption

I guess I need to have a new code that differ from this in for_each :

#!@duckscript
defined = is_defined 1
assert ${defined} "Wrong number of arguments! Correct example: 'cargo make for_each build'"

task = set ${1}

handle = glob_array examples/*/Makefile.toml

for path in ${handle}
    example_root = dirname ${path}
    echo Example root: ${example_root}
    exec --fail-on-error cargo make --cwd ${example_root} ${task}
end
'''
] 

Does somebody know how I could detect the folder /client and change the target of it ? Or maybe there is a better solution like having a specific command for theses projects.

@mankinskin
Copy link

mankinskin commented Feb 16, 2021

The way I handle this is that I have a Makefile in each server and client, and also one above each of those, calling both of their make commands: see here

[tasks.clean]
description = "Clean"
dependencies = ["clean_client", "clean_server"]

[tasks.clean_client]
command = "cargo"
args = ["make", "--cwd", "client", "clean"]

[tasks.clean_server]
command = "cargo"
args = ["make", "--cwd", "server", "clean"]

It might not be the most expandable method but it works for this pattern. Also you have dedicated Makefiles for each package.

But I guess you can easily make this use your for_each script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants