From 968d8a7acd6c23078a3ea6936c03be0b45523227 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 7 Feb 2018 15:48:50 +0200 Subject: Add support for update-for-{test,install} operation aliases --- build2/dist/operation.cxx | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'build2/dist/operation.cxx') diff --git a/build2/dist/operation.cxx b/build2/dist/operation.cxx index a378b5d..e0d1f60 100644 --- a/build2/dist/operation.cxx +++ b/build2/dist/operation.cxx @@ -126,15 +126,25 @@ namespace build2 { if (const operation_info* oif = rs->operations[id]) { + // Skip aliases (e.g., update-for-install). In fact, one can argue + // the default update should be sufficient since it is assumed to + // update all prerequisites and we not longer support ad hoc stuff + // like test.input. + // + if (oif->id != id) + continue; + // Use standard (perform) match. // if (oif->pre != nullptr) { - const operation_info* poif ( - rs->operations[oif->pre (params, dist_id, loc)]); - set_current_oif (*poif, oif); - action a (dist_id, poif->id, oif->id); - match (params, a, ts, true /* quiet */); + if (operation_id pid = oif->pre (params, dist_id, loc)) + { + const operation_info* poif (rs->operations[pid]); + set_current_oif (*poif, oif); + action a (dist_id, poif->id, oif->id); + match (params, a, ts, true /* quiet */); + } } set_current_oif (*oif); @@ -143,11 +153,13 @@ namespace build2 if (oif->post != nullptr) { - const operation_info* poif ( - rs->operations[oif->post (params, dist_id)]); - set_current_oif (*poif, oif); - action a (dist_id, poif->id, oif->id); - match (params, a, ts, true /* quiet */); + if (operation_id pid = oif->post (params, dist_id)) + { + const operation_info* poif (rs->operations[pid]); + set_current_oif (*poif, oif); + action a (dist_id, poif->id, oif->id); + match (params, a, ts, true /* quiet */); + } } } } -- cgit v1.1