aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/dist
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-10-13 09:00:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-10-13 09:00:11 +0200
commit219e00f3b8caec38a9c8fbb4d70e33455aba5a92 (patch)
treeaf77a460d37589b6ca535cdd8d0100440d9f45a1 /libbuild2/dist
parent7935281661a3fd50454432fae1bbf4152758137a (diff)
Optimize by going straight to public variable pool where applicable
Diffstat (limited to 'libbuild2/dist')
-rw-r--r--libbuild2/dist/init.cxx52
1 files changed, 29 insertions, 23 deletions
diff --git a/libbuild2/dist/init.cxx b/libbuild2/dist/init.cxx
index 5e371bf..26ff86d 100644
--- a/libbuild2/dist/init.cxx
+++ b/libbuild2/dist/init.cxx
@@ -33,7 +33,34 @@ namespace build2
// Enter module variables. Do it during boot in case they get assigned
// in bootstrap.build (which is customary for, e.g., dist.package).
//
- auto& vp (rs.var_pool ());
+
+ // The dist flag or path. Normally it is a flag (true or false) but can
+ // also be used to remap the distribution location.
+ //
+ // In the latter case it specifies the "imaginary" source location which
+ // is used to derive the corresponding distribution local. This location
+ // can be specified as either a directory path (to remap with the same
+ // file name) or a file path (to remap with a different name). And the
+ // way we distinguish between the two is via the presence/absence of the
+ // trailing directory separator. If the path is relative, then it's
+ // treated relative to the target directory. Note that to make things
+ // less error prone, simple paths without any directory separators are
+ // not allowed (use ./<name> instead).
+ //
+ // Note that if multiple targets end up with the same source location,
+ // the behavior is undefined and no diagnostics is issued.
+ //
+ // Note also that such remapping has no effect in the bootstrap
+ // distribution mode.
+ //
+ // Note: project-private.
+ //
+ rs.var_pool ().insert<path> ("dist", variable_visibility::target);
+
+ // The rest of the variables we enter are qualified so go straight for
+ // the public variable pool.
+ //
+ auto& vp (rs.var_pool (true /* public */));
// config.dist.archives is a list of archive extensions (e.g., zip,
// tar.gz) that can be optionally prefixed with a directory. If it is
@@ -72,27 +99,6 @@ namespace build2
vp.insert<paths> ("dist.archives");
vp.insert<paths> ("dist.checksums");
- // The dist flag or path. Normally it is a flag (true or false) but can
- // also be used to remap the distribution location.
- //
- // In the latter case it specifies the "imaginary" source location which
- // is used to derive the corresponding distribution local. This location
- // can be specified as either a directory path (to remap with the same
- // file name) or a file path (to remap with a different name). And the
- // way we distinguish between the two is via the presence/absence of the
- // trailing directory separator. If the path is relative, then it's
- // treated relative to the target directory. Note that to make things
- // less error prone, simple paths without any directory separators are
- // not allowed (use ./<name> instead).
- //
- // Note that if multiple targets end up with the same source location,
- // the behavior is undefined and no diagnostics is issued.
- //
- // Note also that such remapping has no effect in the bootstrap
- // distribution mode.
- //
- vp.insert<path> ("dist", variable_visibility::target);
-
// Project's package name. Note: if set, must be in bootstrap.build.
//
auto& v_d_p (vp.insert<string> ("dist.package"));
@@ -202,7 +208,7 @@ namespace build2
l5 ([&]{trace << "for " << rs;});
- auto& vp (rs.var_pool ());
+ auto& vp (rs.var_pool (true /* public */)); // All qualified.
// Register our wildcard rule. Do it explicitly for the alias to prevent
// something like insert<target>(dist_id, test_id) taking precedence.