-
Notifications
You must be signed in to change notification settings - Fork 121
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
Support for including only parts of the default makefile without risk of naming collisions #201
Comments
are you looking for something like this? https://github.com/sagiegurari/cargo-make#disabling-predefined-tasksflows by the way, the reason i put all those predefined tasks internally is to enable the tool to be productive from the first minute and reduce the need to having projects copy pasting same tasks over and over. |
can you explain more about this one?
how you would like to see it in yoru toml file? [config]
include_core_tasks = ["build*", "test*"] something like that? |
*facepalm* I looked right at that several times and, because I was to bed too late and awake too early today, every time I looked at that, I mistook it for the documentation on applying Sorry about that.
Yes, the problem is that, as a UI/UX guy, I have strong opinions about how an interface should work and, scrolling through ...similar to how I've decided I probably won't rebase my template on QuiCLI because it feels like, by the time I've wrestled it into behaving the way I want, the codebase will be 50% QuiCLI and then another 50% hacks to override its default behaviours. (eg. Just StructOpt (not even QuiCLI's helpers for it) needs
There are cases where I would like to use some of your default tasks without having all of them in For example:
It's a nice start, but I don't see how that syntax would allow me to rename included tasks so I could use the names you gave them for different tasks of my own. |
ok, let me think of something that is both simple to configure and meets the needs. |
I was thinking of it more like namespacing. That's why I likened it to Under that interpretation, it'd be equivalent to:
There's a reason I characterized the current state of things as |
if we 'namespace' the core tasks, i'm not sure renaming and excluding/including is needed. [config.modify_core_tasks]
private = true # if true, all core tasks are set to private (default false)
namespace = "default" # if set to some value, all core tasks are modified to: <namespace>::<name> for example default::build This will give you MOST of what you are looking for except allowing you to export core tasks as is, in which case you will have to define your own tasks in your makefile and simply run the core namespaced task. [config.modify_core_tasks]
private = true
namespace = "default"
[tasks.build]
run_task = "default::build" |
That'd work nicely. :) |
@ssokolow I just pushed an initial version. |
Glad to hear it. I'll try to fit testing it in today or tomorrow. |
I just tried using your suggested approach for mapping
(That last one is sufficient reason to copy-paste your |
actually you can. instead of doing [tasks.mytask]
run_task = "default::core_task" you can use aliases which copy everything with them but do not enable customizations. [tasks.mytask]
alias = "default::core_task" and you will have all fields the same as the original task.
Good idea
can you please share more details? do you mean that kcov is failing because of my usage of few args that are not supported in kcov 33? |
I'm not really a big fan of that idea, since I know I'll want to customize That said, it doesn't seem to be working anyway. If I take a config which is successful with
That's correct.
|
if you are customizing the category, write a small description as well :)
not fun. will check it and solve it as it should work and is part of this namespacing solution. as for kcov, i opened a new issue on that #203 |
I don't mind customizing the description. My concern is other fields which may be relevant. (eg. Suppose a default task has a configuration that flat-out hides it from the listing of available tasks on unsupported platforms. That'd be something that really should be automatically kept in sync with the implementation that such a limitation is based on.) ...or, to look at it from the other side, |
i could add 'extends' attribute for tasks (was thinking about it for some time, but never did it). |
Assuming it works as I imagine, I could see that being useful for quite a bit more than just this case. For example, defining a task with inherently complex behaviour like is present in |
small update regarding aliases. they do work just fine. [config.modify_core_tasks]
private = true
namespace = "default"
# this task is actually now private so can't be invoked directly from cli
[tasks.empty2]
alias = "default::empty"
|
extend now pushed to the 0.17.0 branch. |
So far, all of the following were pushed to the 0.17.0 dev branch.
|
Will do. I'll try to get you a solid response by the end of tomorrow, my time. |
0.17.0 released with the changes. if you need more changes, please open a new issue. |
Features Description
I'm working on modernizing my rust-cli-boilerplate and I care very much about providing a clean, coherent development experience... but the default makefile tasks follow a philosophy diametrically opposed to how the justfile I'm interested in replacing is set up.
(Most notably, I consider it borderline insane to make the intutive and concise
build
be a plumbing command (To use the git terminology) which doesn't execute apre-
andpost-
command, while the stuff which seems to be what an "experienced cargo-make user" should be using habitually, like the*-flow
tasks, is verbose in a way I wouldn't expect from a porcelain command. )I also find that having all those default tasks I never use and never test for compatibility with my codebase makes
--list-all-steps
useless when it should be a more convenient alternative to pulling up my project template's README again. (Heck. Ideally, I'd like to generate that part of my README from--list-all-steps
.)That aside, I find myself redefining a lot of commands to get rid of default flags I don't want, like
--all-features
on build commands, which could cause build errors if flags are meant to be mutually exclusive as in rust-cpython, and missing commands which one would think would be obvious to provide a coherent interface, such as a wrapper aroundcargo run
so thatmakers
or a shorter shell alias of it can become muscle memory and I can focus on the subcommands.At present, since I can't find a way to omit theMakefile.toml
in the README, my plan is to write a quick little script which takes an installed instance of cargo-make and my Makefile.toml and amends it with all the lines needed to manually cut out all the predefined bits I don't want.(I already build this stuff from scratch. I'm only interested in
cargo-make
because it's starting to get more painful to hack around Just's myriad GNU Make-esque shortcomings than it would be to write said "explicitly disable all defaults" script.)EDIT: I had an idiot moment.
skip_core_tasks = true
exists.Describe the solution you'd like
Ideally, a
Makefile.toml
option which lets me whitelist and rename which tasks I receive from Makefile.toml (eg. I'm perfectly happy to let you maintain the kcov-related tasks), soMakefile.toml
is lessuse defaults::*
and moreuse defaults::coverage-kcov as kcov;
Failing that, I'll take a simple option inMakefile.toml
which prevents the defaultMakefile.toml
from being loaded so I can take full responsibility for writing and maintaining all of my tasks.The text was updated successfully, but these errors were encountered: