summaryrefslogtreecommitdiff
path: root/src/buildtool/build_engine/expression
AgeCommit message (Collapse)Author
2024-08-27Reformat code to comply with clang-format 18Klaus Aehlig
... while keeping our .clang-format file.
2024-08-14expression language: add nub_leftKlaus Aehlig
Originally, the expression lanuage only contained a function to deduplicate a list, keeping only the right-most occurence. The reason was that this is the order needed for linking: a library providing an open symbol has to come on the command line after the library using that symbol (and hence making it an open symbol). However, by now use cases have emerged that require a topological sorting where definition comes before use; also, when composing the value of PATH from fragments, we usually want to keep the first occurrence in order for it to take precedence. Therefore, also add "nub_left" as built-in function, allowing a more condense (and slightly more efficient) description in rules instead of the revserse-nub_right-reverse pattern.
2024-08-07Replace classic C boolean operators with keywordsMaksim Denisov
! => not; && => and, || => or
2024-08-05Expression language: add expression from_subdirKlaus Aehlig
... allowing to select only the keys in a specific subdir, and move the them to top-level.
2024-08-01expression: add kEmptyStringKlaus Aehlig
2024-07-26Add quasiquote expressionKlaus Aehlig
2024-07-26expression language: add quotingKlaus Aehlig
2024-07-22Rename HashFunction methods and enumsMaksim Denisov
2024-07-22Unify tagging logic in HashFunctionMaksim Denisov
2024-07-22Use a fixed HashFunction in expressionsMaksim Denisov
2024-07-22Use HashFunction functionality via Instance()Maksim Denisov
...to track changes during refactoring easier.
2024-07-12Use static Create functions to construct ArtifactDescriptionMaksim Denisov
...instead of unobvious ctors relying on overload resolution.
2024-04-24expressions: add logical negationKlaus Aehlig
While this can already be expressed by an "if" statement, having a dedicated function for logical negation makes some expressions more readable.
2024-04-24expressions: for "if" expressions, make both branches optionalKlaus Aehlig
... using, also for the "then" branch, the empty list as default. In this way, this statement not only more symmetric, but also allows shorter representations of some typical expressions.
2024-04-24expressions: add "length" functionKlaus Aehlig
Lists are somtimes used in configurations as replacement for tuples. Providing length gives an easy way to detect usage errors.
2024-04-24expressions: add generic assertionsKlaus Aehlig
2024-04-16expression language: add array access by indexKlaus Aehlig
2024-04-08Use properly included standard library types by defaultPaul Cristian Sarbu
2024-04-05Evaluator: Add infrastructure to annotate relevant objectsKlaus Aehlig
... which are, in particular, artifacts involved in staging conflicts. While there, also make disjoint union honor the expression log limit.
2024-04-05bug fix in expresion, Union: propagate the disjointness propertyKlaus Aehlig
To avoid too many intermediate results, we compute the union of a list in a divide and conquer fashion. Of course, for a disjoint union, the recursive calls on the lists of half the length have to be disjoint as well, i.e., the template parameter kDisjoint has to be passed on. Fix this.
2024-03-26Add missing system includesPaul Cristian Sarbu
Main culprits: - std::size_t, std::nullptr_t, and NULL require <cstddef> - std::move and std::forward require <utility> - unordered maps and sets require respective includes - std::for_each and std::all_of require <algorithm>
2024-03-26Expression language: add float operations "*" and "+"Klaus Aehlig
Numerical values are used at some places in justbuild: as value for timeout scaling, as well as by the "range" expression that is used, e.g., to define repreated test runs. Therefore, improve support for numerical values by adding basic operations.
2024-03-15Clean up more includes and targetsPaul Cristian Sarbu
Some of the more specific issues addressed: - missing log_level target/include - header-only libs wrongly marking deps as private - missing/misplaced gsl includes
2024-02-29expressions: add kFalseKlaus Aehlig
2023-11-30Resolve inconsistencies in third-party headers include formatPaul Cristian Sarbu
2023-08-24LinkedMap: Simplify ::Find() methodsOliver Reiche
... to silence false-positive 'possible dangling reference' warning produced by gcc 13.2.0.
2023-08-14expression: add new built in "reverse"Klaus Aehlig
While a foldl is enough to implement a reverse functionality, adding it as a built in allows doing so in linear time.
2023-08-14expression: add new built in "set"Klaus Aehlig
... to obtain from a list of strings a map with those entries as keys and true as value. In this way, repeated membership tests in lists can be implemented more efficiently.
2023-08-14expressions: add constant for trueKlaus Aehlig
2023-06-06style: Use designated initializersPaul Cristian Sarbu
This feature has been introduced with C++20.
2023-05-31ACTION constructor: accept "timeout scaling"Klaus Aehlig
Allow rules to set the timeout-scaling factor for their actions to indicate that some actions are expected to take longer than others, e.g., because they call a foreign build tool or are a very complex end-to-end test.
2023-04-26imports: Switch to Microsoft GSL implementationOliver Reiche
... with two minor code base changes compared to previous use of gsl-lite: - dag.hpp: ActionNode::Ptr and ArtifactNode::Ptr are not wrapped in gsl::not_null<> anymore, due to lack of support for wrapping std::unique_ptr<>. More specifically, the move constructor is missing, rendering it impossible to use std::vector<>::emplace_back(). - utils/cpp/gsl.hpp: New header file added to implement the macros ExpectsAudit() and EnsureAudit(), asserts running only in debug builds, which were available in gsl-lite but are missing in MS GSL.
2023-04-26evaluator: Improve evaluation error reportingOliver Reiche
2023-04-04disjoint_map_union: show conflicting values on errorKlaus Aehlig
2023-03-10Update nlohmann::json to 3.11.2Klaus Aehlig
2023-02-22cleanup: Fix typos in code line comments and logging messagesPaul Cristian Sarbu
2022-11-21Use the newly-added concept of private-depsKlaus Aehlig
While there, also add all direct dependencies explicitly; using directly dependencies that are pulled in only indireclty causes problems from a maintainability point of view.
2022-10-18TargetResult: Serialise inner TargetResults flatOliver Reiche
Before this change, TargetResults that appear inside of other TargetResults (typically via value nodes) were serialised via the top-level serialisation function for TargetResults. While technically correct, it is rather inefficient as identical expressions from outer and inner TargetResults are not properly deduplicated and a deeply nested data structure is maintained. With this change, expressions of inner TargetResults are serialised in the context of outer TargetResults, resulting in a flat list of all transitively contained expressions with proper deduplication applied. As this serialisation of TargetResult is used in target-level cache entries, the new format is a breaking change to existing entries. Therefore, after switching to the new serialisation format introduced by this commit, users are required to clean their target-level cache. This also reverts commit d22adef666d704680ee74b35a46d530f6b6d5f15, "Recursively scan provided results for known artifacts".
2022-10-12Add copyright and license notice to all source and header filesKlaus Aehlig
Signed-off-by: Goetz Brasche <goetz.brasche@huawei.com>
2022-10-05Expr: Add 'env' expressionOliver Reiche
2022-09-13Fix build with gcc/g++Oliver Reiche
2022-07-04Drop copy constructor from linked mapsOliver Reiche
2022-07-04Drop copy constructor for expressionsOliver Reiche
2022-07-04Improve move semantics with smart pointersOliver Reiche
2022-06-29Error reporting: also abbreviate the expression in the stack traceKlaus Aehlig
... to the same limit as the values occuring in the stack.
2022-06-29Use a more meaningful abbreviation of expression valuesKlaus Aehlig
... in error messages. The outer structure is usually more important than the the details of the first element.
2022-06-28Support more verbose error reportingKlaus Aehlig
2022-06-20Correctly serialize and deserialize results and nodesKlaus Aehlig
So far, our serialisation and deserialisation assumed that no node or result values are included contained in the given value. However, for nodes (and hence ressults, given our implementation of value nodes) there is a legitimate use case. An abstract interface specification, given by provided nodes, can well be a meaningful target to be exported. Implement serialisation for those values. Also, avoid tree-unfolding the value when deserialising the value by appropriately caching the corresponding expression pointers. Moreover, avoid the quadratic overhead through linearly searching through the list of artifacts.
2022-06-20Disallow comparison of namesKlaus Aehlig
In our semantics, it was always intended that names are completely opaque and only used by passing them to functions providing information about a target. However, we never enforced that they not be compared for equality, even though we always had this in mind, and the computation of the target-level cache key was designed with this semantics in mind. Enforce this restriction now.
2022-06-20expression: cache the cacheability propertyKlaus Aehlig