aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/target.hxx
AgeCommit message (Collapse)AuthorFilesLines
2024-02-12Add ability to specify recipes in separate filesBoris Kolpackov1-0/+16
This can now be achieved with the new `recipe` directive: recipe <language> <file> Note that similar to the use of if-else and switch directives with recipes, this directive requires explicit % recipe header. For example, instead of: file{foo.output}: {{ echo 'hello' >$path($>) }} We can now write: file{foo.output}: % recipe buildscript hello.buildscript With hello.buildscript containing: echo 'hello' >$path($>) Similarly, for C++ recipes (this time for a pattern), instead of: [rule_name=hello] file{~'/(.+)\.output/'}: % update clean {{ c++ 1 -- -- ... }} We can now write: [rule_name=hello] file{~'/(.+)\.output/'}: % update clean recipe c++ hello.cxx With hello.cxx containing: // c++ 1 -- -- ... Relative <file> paths are resolved using the buildfile directory that contains the `recipe` directive as a base. Note also that this mechanism can be used in exported buildfiles with recipe files placed into build/export/ together with buildfiles.
2024-02-12Extend class target, prerequisite_target interfacesBoris Kolpackov1-2/+34
2023-12-03Reimplement search_existing() functions via target_type::searchBoris Kolpackov1-5/+12
This allows us to automatically get the target type-specific behavior with regards to the out_only semantics (added in the previous commit) instead of passing it explicitly from each call site.
2023-11-21Add target::append_locked() variantBoris Kolpackov1-2/+8
2023-11-16Fix target::group_state() for unmatched ad hoc group membersBoris Kolpackov1-1/+1
2023-11-07Account for match options re-locking when checking if target is matchedBoris Kolpackov1-0/+2
2023-11-03Fix data race in match options logicBoris Kolpackov1-9/+13
2023-11-01Add support for adjusting match options of post hoc prerequisitesBoris Kolpackov1-1/+11
2023-11-01Add notion of match optionsBoris Kolpackov1-6/+101
Now, when matching a rule, the caller may request a subset of the full functionality of performing an operation on a target. This is achieved with match options.
2023-10-06Handle 0 mask in update_during_match_prerequisites()Boris Kolpackov1-1/+2
2023-08-02Diagnose declarations of targets/prerequisites with abstract target typesBoris Kolpackov1-1/+1
2023-07-20Consider unmatched prerequisites in updated_during_match() checkBoris Kolpackov1-2/+9
2023-06-15Fix incorrect memory order in target::matched() callBoris Kolpackov1-1/+1
2023-06-02Fix data race in library metadata protocol logicBoris Kolpackov1-1/+5
2023-06-01Diagnose null include, operation-specific variable valuesBoris Kolpackov1-3/+1
While assigning null directly is unlikely, it's fairly easy via a variable expansion. Real-world example: ./: exe{tensor}: include = $config.Eigen.unsupported
2023-06-01Add inner_recipe for expressivenessBoris Kolpackov1-1/+1
2023-06-01Resolve (but disable for now) target_count issue in resolve_members()Boris Kolpackov1-14/+19
2023-05-29Avoid group linkup deadlocks for dynamic and pattern-static membersBoris Kolpackov1-2/+5
2023-05-29Explicit group: dynamic membersBoris Kolpackov1-4/+5
2023-05-29Explicit group: static membersBoris Kolpackov1-4/+32
2023-05-29Explicit group: syntax parsingBoris Kolpackov1-2/+33
2023-05-21Add support for dynamic target extraction in addition to prerequisitesBoris Kolpackov1-0/+4
This functionality is enabled with the depdb-dyndep --dyn-target option. Only the make format is supported, where the listed targets are added as ad hoc group members (unless already specified as static members). This functionality is not available in the --byproduct mode.
2023-03-02Replace deprecated std::aligned_storage with alignasBoris Kolpackov1-4/+4
Based on patch by Matthew Krupcale.
2022-11-30Reserve targets, variables to avoid rehashingBoris Kolpackov1-0/+4
2022-11-18Complete low verbosity diagnostics reworkBoris Kolpackov1-4/+4
2022-10-19Add support for post hoc prerequisitesBoris Kolpackov1-2/+11
Unlike normal and ad hoc prerequisites, a post hoc prerequisite is built after the target, not before. It may also form a dependency cycle together with normal/ad hoc prerequisites. In other words, all this form of dependency guarantees is that a post hoc prerequisite will be built if its dependent target is built. See the NEWS file for details and an example.
2022-10-10Preparatory work for public/private variable distinctionBoris Kolpackov1-15/+15
We still always use the public var_pool from context but where required, all access now goes through scope::var_pool().
2022-09-21Fix regression in dynamic dependency extraction, byproduct modeBoris Kolpackov1-0/+3
2022-09-12Do not treat primary ad hoc group member as group for variable lookupBoris Kolpackov1-0/+14
Note that we started with this semantics but it was changed in a commit on 2021-09-16 for reasons not entirely unclear but most likely due to target- specific variables specified for the group not being set on all the members. Which we have now addressed (see the previous commit). Note also that this new (old) semantics is not without its own drawbacks. Specifically, there is a bit of waste when the target-specific variable is really only meant for the recipe and thus setting it on all the members is unnecessary. For example: <{hxx ixx cxx}{options}>: cli{options} { options = ... } {{ # Use options. }} But this feels like a quality of implementation rather than conceptual issue. For example, we could likely one day address it by synthesizing a separate group target for ad hoc groups.
2022-06-29Make sure we generate common pkg-config file for only liba{}/libs{}Boris Kolpackov1-4/+10
2022-06-24Allow ad hoc rules not to list targets that are updated during matchBoris Kolpackov1-6/+27
For example, this allows a Qt moc rule not to list generated headers from libQtCore since they are pre-generated by the library.
2022-06-22Add missing match_data() destructorBoris Kolpackov1-0/+5
2022-04-20Replace match_extra::buffer with more general data storage facilityBoris Kolpackov1-2/+66
2022-04-19Use target recipe for auxiliary data storage during match-applyBoris Kolpackov1-41/+92
In particular, we now have separate auxiliary data storage for inner and outer operations.
2022-04-19Switch to using std::function for target::data_padBoris Kolpackov1-34/+80
2022-04-19Skip find() inside target_set::insert*() if target is unlikely to be thereBoris Kolpackov1-7/+19
2022-04-19Cache "recipe is group_action" information, clear recipes after executionBoris Kolpackov1-0/+1
2022-04-18Avoid locking target set if in load phaseBoris Kolpackov1-5/+15
2022-04-15Get rid of target::dynamic_type() virtual functionBoris Kolpackov1-35/+85
Instead of overriding this function, derived targets must now set the dynamic_type variable to their static_type in their constructor body.
2022-04-13Cache target base scope lookupsBoris Kolpackov1-5/+31
2022-04-07Rename {match,execute}() to *_sync(), add *_complete()Boris Kolpackov1-2/+2
In particular, the match() rename makes sure it doesn't clash with rule::match() which, after removal of the hint argument in simple_rule, has exactly the same signature, thus making it error-prone to calling recursively.
2022-04-06Add support for rule hintsBoris Kolpackov1-9/+60
A rule hint is a target attribute, for example: [rule_hint=cxx] exe{hello}: c{hello} Rule hints can be used to resolve ambiguity when multiple rules match the same target as well as to override an unambiguous match.
2022-03-31Use own type information instead of dynamic_cast in target::is_a()Boris Kolpackov1-6/+29
2022-03-07Add support for update=unmatch|match to ad hoc recipesBoris Kolpackov1-1/+2
2022-03-02Add update operation-specific variable with unmatch|match additional valuesBoris Kolpackov1-12/+19
Note that the unmatch (match but do not update) and match (update during match) values are only supported by certain rules (and potentially only for certain prerequisite types). Additionally: - All operation-specific variables are now checked for false as an override for the prerequisite-specific include value. In particular, this can now be used to disable a prerequisite for update, for example: ./: exe{test}: update = false - The cc::link_rule now supports the update=match value for headers and ad hoc prerequisites. In particular, this can be used to make sure all the library headers are updated before matching any of its (or dependent's) object files.
2022-02-15Diagnose various misuses of library metadata protocolBoris Kolpackov1-1/+1
2022-02-09Don't use fallback file_rule to clean real targetsBoris Kolpackov1-0/+4
2022-02-09Don't skip empty see-through target groupsBoris Kolpackov1-5/+15
2022-01-11Work around VC14 bugBoris Kolpackov1-9/+0
2022-01-10Consider implied targets when resolving dynamic dependenciesBoris Kolpackov1-0/+9