From b61e0de250d522ec9a8e16146ef979a65c181db1 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 20 Jul 2023 07:44:36 +0200 Subject: Change inner rule/prerequisites match order in install::file_rule The old order messed up the for-install signaling logic. See the long comment in install::file_rule::apply_impl() for background and details. --- libbuild2/in/rule.cxx | 11 +++++++++-- libbuild2/in/rule.hxx | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'libbuild2/in') diff --git a/libbuild2/in/rule.cxx b/libbuild2/in/rule.cxx index 74bc2a7..31a9d94 100644 --- a/libbuild2/in/rule.cxx +++ b/libbuild2/in/rule.cxx @@ -47,6 +47,13 @@ namespace build2 if (!fi) l5 ([&]{trace << "no in file prerequisite for target " << t;}); + // If we match, derive the file name here instead of in apply() to make + // it available early for the in{} prerequisite search (see + // install::file_rule::apply_impl() for background). + // + if (fi) + t.derive_path (); + return fi; } @@ -55,9 +62,9 @@ namespace build2 { file& t (xt.as ()); - // Derive the file name. + // Make sure derived rules assign the path in match(). // - t.derive_path (); + assert (!t.path ().empty ()); // Inject dependency on the output directory. // diff --git a/libbuild2/in/rule.hxx b/libbuild2/in/rule.hxx index 369fd93..67c2509 100644 --- a/libbuild2/in/rule.hxx +++ b/libbuild2/in/rule.hxx @@ -22,6 +22,11 @@ namespace build2 // cache data (e.g., in match() or apply()) to be used in substitute() and // lookup() calls. // + // A derived rule is also required to derive the target file name in + // match() instead of apply() to make it available early for the in{} + // prerequisite search (see install::file_rule::apply_impl() for + // background). + // // Note also that currently this rule ignores the dry-run mode (see // perform_update() for the rationale). // -- cgit v1.1