From ea57c514dc169afb3ece21ff2e4c1d2ab0c47d6a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 4 Aug 2021 06:45:02 +0200 Subject: Take into account file-base'ness in ad hoc buildscript recipes --- libbuild2/build/script/parser.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libbuild2/build/script/parser.cxx') diff --git a/libbuild2/build/script/parser.cxx b/libbuild2/build/script/parser.cxx index b602880..43ec0d5 100644 --- a/libbuild2/build/script/parser.cxx +++ b/libbuild2/build/script/parser.cxx @@ -28,6 +28,7 @@ namespace build2 script parser:: pre_parse (const scope& bs, + const target_type& tt, const small_vector& as, istream& is, const path_name& pn, uint64_t line, optional diag, const location& diag_loc) @@ -48,6 +49,7 @@ namespace build2 pbase_ = scope_->src_path_; + file_based_ = tt.is_a (); perform_update_ = find (as.begin (), as.end (), perform_update_id) != as.end (); @@ -454,7 +456,7 @@ namespace build2 verify (); // Verify that depdb is not used for anything other than - // performing update. + // performing update on a file-based target. // assert (actions_ != nullptr); @@ -466,6 +468,10 @@ namespace build2 << ' ' << ctx.operation_table[a.operation ()]; } + if (!file_based_) + fail (l) << "'depdb' builtin can only be used for file-based " + << "targets"; + if (diag_line_) fail (diag_line_->second) << "'diag' builtin call before 'depdb' call" << @@ -1215,7 +1221,7 @@ namespace build2 void parser:: lookup_function (string&& name, const location& loc) { - if (perform_update_ && !impure_func_) + if (perform_update_ && file_based_ && !impure_func_) { const function_overloads* f (ctx.functions.find (name)); -- cgit v1.1