ninja $(ninja -t targets | grep ^foo | sed 's/:.*//')
ninja -w foo*
or
ninja -r ^foo
--
You received this message because you are subscribed to the Google Groups "ninja-build" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ninja-build...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I have tried done that in the past. However, IMO the problems with that approach are:
· Very annoying to do in CMake (opinion)
· Only allows for the predefined groupings
· I believe this should be a feature of the build system not the generator. My CMakeLists.txt are complicated enough without having to try and embed tricks to help make specifying what to build easier J
The project is a framework that contains a large number utilities for handling different formats of data. There are about 300 different data formats and for each we ship a set of ~15 “applications” for. These “applications” are each tailored to each of the formats but ultimately perform the same functions. Some of the applications serve as examples/reference some are useful utilities. The code ends up being structured into well-defined folder structures according to the format it is intended for.
For instance, let’s say I have version 1 of a format named “A.B “ (the naming isn’t important other than its hierarchal):
`-- A
`-- B
`-- v1
|-- examples
| |-- example1
| |-- example2
| `-- example3
`-- utils
|-- util1
|-- util2
`-- util3
Each example / util below would be a different target named something like:
A.B.v1.examples.example1
If you are a developer working on one of these formats you might want to build all the related tools for it:
ninja A.B.v1.*
However, if you are someone developing a new tool for all of them you might want to build only that tool for all the formats:
ninja *utils.newutil
There are more complications than this but I think it illustrates the use case. I have in the past setup CMake to generate these phony grouping targets but it gets very ugly very fast. I have since removed the functionality from our CMakeLists.txt in an effort to keep them more clear and concise (not working by the way).
However, to me this doesn’t feel like a job of the generator. This feels like an appropriate feature for the build system itself. Particularly because it is not specifying “how to build” something just the users desire of “what to build”. In addition, a feature like this seems like you can get a lot of “bang for your buck”. Would only require a small function to pattern match against the known list of targets and now I can satisfy all of the intended use cases.
I can try and describe the setup better if this wasn’t clear enough.
Cool thanks.
Again, whatever globbing scheme you feel is appropriate is fine with me: glob, regex, anything really.
I also must say that I am continuously impressed by ninja. Both in by the quality of the software and the community supporting it. Thanks again for all the effort put into this project.
-Kris
I also cannot think of another command line build tool that does this globbing. Most are done in the following way:
tool [target [ target2 [target3] … ]]
with no target running a default “all” target
All GUI build systems that I remember also had a way to build multiple targets. Typically selecting checkboxes in some modal dialog. It’s been a while since I have used any of them so I may be wrong here. However, I find this similar to the above rather than a glob.
I do feel all the “modify your generator” arguments fall into the same category of answers though. Basically, cluttering up your “how to build my target” definitions with “what I want to build at this moment” definitions. As I said earlier, I can do this via the generator and have in the past. However, I think this is solving it in the wrong location.
Inherently what we are talking about here is whether or not the user should have to type out all the targets they want to build or whether the build tool itself should allow some short hand. I believe most people already think “some” sort of short hand is a good idea. For instance, make’s “build from here down” behavior or the default “all” target. Many people use that in make and have come to expect that from other build tools. I think the reason globbing has not been seen before is the fact that most projects boil down to “one or two targets that have many dependencies” rather than “many independent targets”. If your project either fits into the “one or two targets with many dependencies” category or is small enough that the “all” target is fast enough you wouldn’t need to specify many targets on the command line or this feature. Another interesting effect in my opinion is that most project layouts are now crafted with the “make” style of organization to leverage the “build from here down” behavior. Was this a result of the build systems limitations or are the build systems features reflective of the one true organizational pattern? I do not know.
-Kris
I also cannot think of another command line build tool that does this globbing. Most are done in the following way:
tool [target [ target2 [target3] … ]]
with no target running a default “all” target
All GUI build systems that I remember also had a way to build multiple targets. Typically selecting checkboxes in some modal dialog. It’s been a while since I have used any of them so I may be wrong here. However, I find this similar to the above rather than a glob.
I do feel all the “modify your generator” arguments fall into the same category of answers though. Basically, cluttering up your “how to build my target” definitions with “what I want to build at this moment” definitions. As I said earlier, I can do this via the generator and have in the past. However, I think this is solving it in the wrong location.