I'm concerned that the design of xtask as a single all-tasks binary with custom opaque command-line parsing doesn't allow external tools to integrate with the tasks. This limits xtask to UI interaction with humans only, and doesn't allow graceful integration with packagers, CI or editors.
For example, when adding a new project in a CI service, the service could search the repository to decide how to build it, and create a build template automatically. For Cargo projects that's something like cargo test --all. But if xtask was machine-readable, the CI could also check if xtask ci exists, and use it instead of the default cargo test. There's similar story for deployments like Heroku or packaging like cargo-deb. They could replace Rusty default assumptions with a specific tasks, if they could know that the task is implemented by the xtask binary.
However, this is currently not possible, because mere presence of the xtask crate is not enough to know that xtask ci works. Running xtask commands to see if they work is not reliable (e.g. xtask ci may fail because tests failed, not because the subcommand is not implemented. Conversely, xtask ci can succeed because a custom command-line parsing library interprets it as some other argument or fails to use appropriate exit code).
Running xtask --help might work sometimes, but it's not a machine readable output, and in any case running arbitrary code to check what it supports is not so great. Especially when the thing that inspects the repo is not prepared to sandbox arbitrary code (the configuration-detection part of a system is usually separate from the part that runs the configured project sandboxed).
I'm concerned that the design of xtask as a single all-tasks binary with custom opaque command-line parsing doesn't allow external tools to integrate with the tasks. This limits xtask to UI interaction with humans only, and doesn't allow graceful integration with packagers, CI or editors.
For example, when adding a new project in a CI service, the service could search the repository to decide how to build it, and create a build template automatically. For Cargo projects that's something like
cargo test --all. But ifxtaskwas machine-readable, the CI could also check ifxtask ciexists, and use it instead of the defaultcargo test. There's similar story for deployments like Heroku or packaging likecargo-deb. They could replace Rusty default assumptions with a specific tasks, if they could know that the task is implemented by the xtask binary.However, this is currently not possible, because mere presence of the
xtaskcrate is not enough to know thatxtask ciworks. Runningxtaskcommands to see if they work is not reliable (e.g.xtask cimay fail because tests failed, not because the subcommand is not implemented. Conversely,xtask cican succeed because a custom command-line parsing library interprets it as some other argument or fails to use appropriate exit code).Running
xtask --helpmight work sometimes, but it's not a machine readable output, and in any case running arbitrary code to check what it supports is not so great. Especially when the thing that inspects the repo is not prepared to sandbox arbitrary code (the configuration-detection part of a system is usually separate from the part that runs the configured project sandboxed).