diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-06-25 11:11:17 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-06-25 15:57:29 +0200 |
commit | 23b54f3f6401d5b52bd903485985ad38e0c3fba7 (patch) | |
tree | 07dcc9c98e95f7cd603a8f50842221ad6df677d7 /src/buildtool/main/describe.cpp | |
parent | 165d9ba942171ab3436c834c83184abf38b11bec (diff) | |
download | justbuild-23b54f3f6401d5b52bd903485985ad38e0c3fba7.tar.gz |
describe: also describe "configure" targets in more detail
Most built-in rules are just described by their name, assuming they
are known to the user anyway. One exception, however, are "export"
targets, as those serve as interfaces to (logical) repositories and
hence is supposed to have a documentation of the target itself. Over
time, however, "configure" targets have evolved to become internal
interfaces (maybe even for an external target), e.g., to provide
default values and hence make better use of the actual export target.
Therefore it is desirable to provide a bit more information when
asked to describe a "configure" target.
- As "configure" targets have a fixed set of keys, adding a "doc"
field is a conservative extension; this can be useful to give an
overview what the target is about.
- An important information of a "configure" target is the target
that is configured. While this, in general, is an expression, in
the typical cases, the description is very short (a literal target
name, or a variable). So we can afford to show the definition.
Diffstat (limited to 'src/buildtool/main/describe.cpp')
-rw-r--r-- | src/buildtool/main/describe.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/buildtool/main/describe.cpp b/src/buildtool/main/describe.cpp index 4739ba88..e3ab1223 100644 --- a/src/buildtool/main/describe.cpp +++ b/src/buildtool/main/describe.cpp @@ -431,6 +431,17 @@ auto DescribeTarget(BuildMaps::Target::ConfiguredTarget const& id, PrintFields(*flexible_config, config_doc, " - ", " | "); } } + else if (*rule_it == "configure") { + auto target = desc.find("target"); + auto doc = desc.find("doc"); + if (doc != desc.end()) { + PrintDoc(*doc, " | "); + } + if (target != desc.end()) { + std::cout << "The target to be configured is defined as " + << target->dump() << "." << std::endl; + } + } return kExitSuccess; } auto rule_name = BuildMaps::Base::ParseEntityNameFromJson( |