summaryrefslogtreecommitdiff
path: root/src/buildtool/main/main.cpp
AgeCommit message (Collapse)Author
2023-06-26Add non-upwards symlinks in the rule language...Paul Cristian Sarbu
via a 'SYMLINK' constructor function. This works similarly to the 'FILE' construct, but the name given must point to a non-upwards symlink and a symlink artifact is being generated from it. Also updates the relevant tests.
2023-06-26FileRoot: Add handling of non-upwards symlink...Paul Cristian Sarbu
...and update tests accordingly.
2023-06-06style: Use designated initializersPaul Cristian Sarbu
This feature has been introduced with C++20.
2023-06-05just: improve error reporting on missing pwdKlaus Aehlig
... also, gracefully handle the case of a missing working directory when determining the current module, falling back to the top-level module.
2023-05-31just: Add handling of ignore-special rootsPaul Cristian Sarbu
2023-05-15memcheck: fix race in libgit2...Paul Cristian Sarbu
...caused by incorrectly setting and resetting the library internal state and the misuse of pthreads in libgit2. Normally, git_libgit2_init and git_libgit2_shutdown should span the life of a worker thread in order to be safely used. However, due to an incorrect implementation of libgit2's threadstate with pthreads, on unix systems there is a race condition. Until the use of pthread_key_t is corrected in libgit2, we need to apply a workaround by always ensuring that the main thread is the first thread reaching the GitContext constructor.
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-04just install-cas: use local git as git CASKlaus Aehlig
2023-03-30Improve error messages on reading invalid target filesKlaus Aehlig
... by including the details of the parse error.
2023-03-23just install{,-cas}: offer local CAS as preferred CASKlaus Aehlig
... to avoid unnecessary downloads and hence speed things up.
2023-03-20just: only report export targets if there are anyKlaus Aehlig
By default, messages at level "progress" and above are shown. So, messages at that level should be useful for the user in the typical case. For the count of export targets, this information is only useful if the build involves export targets at all; the absence of export targets is typically only used when debugging the build structure.
2023-03-13Storage: Reworked storage and garbage collectionOliver Reiche
The improved GC implementation uses refactored storage classes instead of directly accessing "unknown" file paths. The required storage class refactoring is quite substantial and outlined in the following paragraphs. The module `buildtool/file_system` was extended by: - `ObjectCAS`: a plain CAS implementation for reading/writing blobs and computing digests for a given `ObjectType`. Depending on that type, files written to the file system may have different properties (e.g., the x-bit set) or the digest may be computed differently (e.g., tree digests in non-compatible mode). A new module `buildtool/storage` was introduced containing: - `LocalCAS`: provides a common interface for the "logical CAS", which internally combines three `ObjectCAS`s, one for each `ObjectType` (file, executable, tree). - `LocalAC`: implements the action cache, which needs the `LocalCAS` for storing cache values. - `TargetCache`: implements the high-level target cache, which also needs the `LocalCAS` for storing cache values. - `LocalStorage`: combines the storage classes `LocalCAS`, `LocalAC`, and `TargetCache`. Those are initialized with settings from `StorageConfig`, such as the build root base path or number of generations for the garbage collector. `LocalStorage` is templated with a Boolean parameter `kDoGlobalUplink`, which indicates that, on every read/write access, the garbage collector should be used for uplinking across all generations (global). - `GarbageCollector`: responsible for garbage collection and the global uplinking across all generations. To do so, it employs instances of `LocalStorage` with `kDoGlobalUplink` set to false, in order to avoid endless recursion. The actual (local) uplinking within two single generations is performed by the corresponding storage class (e.g., `TargetCache` implements uplinking of target cache entries between two target cache generations etc.). Thereby, the actual knowledge how data should be uplinked is implemented by the instance that is responsible for creating the data in the first place.
2023-03-13TargetCache: Drop dependency on execution apiOliver Reiche
2023-03-10execution service: implement WaitExecution and ↵Alberto Sartori
google::longrunning::Operations::GetOperation For each action that is executed, an entry is added to a shared thread safe cache. Once the number of operations stored exceeds twice 2^n, where n is given by the option --log-operations-threshold, at most 2^n operations will be removed, in a FIFO scheme.
2023-03-02just: make -D options overlayKlaus Aehlig
... instead of only honoring the latest argument. In this way, standard overlays coming from the launcher configuration can be amended in individual invocations.
2023-02-27Progress reporting: Extract generic logic from just base progress reporter classSascha Roloff
2023-02-27Logging: Add --log-append clarg to justPaul Cristian Sarbu
2023-02-20Add logging command-line arguments to gc subcommandSascha Roloff
2023-02-15CLI: enforce maximal number of positional argumentsKlaus Aehlig
..., i.e., the requirement that the positional arguments form a syntactically valid target name. An explicit error message (created by the target-name parsing) is preferrable over tacitly dropping all but the last up to two arguments (which is the meaning of CLI11's expected(2)). While there, drop duplicate full stop in error message.
2023-02-02execution-service: add new subcommand executeAlberto Sartori
This subcommand starts a single node remote execution service honoring the just native remote protocol. If the flag --compatible is provided, the execution service will honor the original remote build execution protocol. New command line args supported by this subcommand: -p,--port INT: Execution service will listen to this port. If unset, the service will listen to the first available one. --info-file TEXT: Write the used port, interface, and pid to this file in JSON format. If the file exists, it will be overwritten. -i,--interface TEXT: Interface to use. If unset, the loopback device is used. --pid-file TEXT Write pid to this file in plain txt. If the file exists, it will be overwritten. --tls-server-cert TEXT: Path to the TLS server certificate. --tls-server-key TEXT: Path to the TLS server key. Co-authored by: Klaus Aehlig <klaus.aehlig@huawei.com>
2023-01-20Add gc subcommandSascha Roloff
2023-01-20Add local garbage collectionSascha Roloff
2023-01-20Refactor target cache key and entry to separate files and targetsSascha Roloff
2023-01-18authentication: add TLS and mTLS supportAlberto Sartori
2022-12-22Add option --dump-export-targetsKlaus Aehlig
... dumping only the configured targets that are export targets. Those targets are of particular interest as those are the targets, as they are the high-level caching points and also often serve as interface between projects.
2022-12-21Just: Move constants from main into own header filePaul Cristian Sarbu
2022-12-07just: Allow multiple log filesPaul Cristian Sarbu
2022-11-11Support dumping variables of the analysed targetKlaus Aehlig
Add an option --dump-vars showing the variables of the configuration used (including the use of them being unset). This information can be used, e.g., to export a given target in a maximally flexible way.
2022-10-27main: improve short self-description of justKlaus Aehlig
2022-10-20just: Take lexicographical first repositoryOliver Reiche
... if none is specified on command line or in the config.
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-04just: Fix version subcommand; Fix just section-1 man pagePaul Cristian Sarbu
The version subcommand now has no expected command line options, as expected. Also the version subcommand was missing from the man page synopsis.
2022-09-13Fix build with gcc/g++Oliver Reiche
2022-09-12Adapted TargetCache to download known artifacts from remote CAS to local CASSascha Roloff
2022-08-31Also track the the dependencies on configured targetsKlaus Aehlig
... to be able to report the respective graph for later analysis by other tools.
2022-08-19Add glob reference to source filesKlaus Aehlig
Like file or tree references, globs are restricted to the current module; in fact, by the way we evaluate them, even to the top-level directory of that module: a glob is a target having as artifacts and runfiles those entries of the top-level directory of the specified module that match the given pattern.
2022-08-19main: honor configuration for target_file nameKlaus Aehlig
... also when determining default module or target.
2022-08-05dump-targets: don't dump source treesKlaus Aehlig
We have to include explicit tree references into our target-result map, as these targets can provide a tree definition, if the root is not a git root or compatible mode is used. Nevertheless, from a user's persepective, trees are just source references, like files. Therefore, do not include them, when dumping the map of analyzed targets. In this way, we also avoid the ambiguity in the dump between an explicit tree reference and a defined target with the same name.
2022-08-05Move analysis out of main.cppKlaus Aehlig
Analysing a target is a pretty self-contained task. So move it into a library of its own, to keep main.cpp more managable.
2022-08-05Make ANSI escape sequences optionalKlaus Aehlig
2022-08-05Describe: Move describe code to separate libraryOliver Reiche
2022-08-05InstallCas: Moved install-cas code to separate libraryOliver Reiche
2022-08-05CLI: Add flag for dumping raw tree objectsOliver Reiche
2022-07-27describe: Support serializing to JSONOliver Reiche
2022-07-27describe: Support describing by rule nameOliver Reiche
2022-07-27install-cas now accepts --log-limit and --log-fileAlberto Sartori
2022-07-08In install-cas be more liberal in parsing artifact identifiersKlaus Aehlig
2022-07-06When requesting action input, also provide action informationKlaus Aehlig
Extend the --request-action-input option to also provide command line, environment, etc, of the requested action. As this option is mainly for debugging, having that information available via the analyse subcommand is useful; for build/install that change does not make a difference anyway.
2022-07-05Make remote endpoint specification part of analysisKlaus Aehlig
The remote execution endpoint shards the target-level cache; still, for analysis, we want to specify a particular target-level cache, e.g., to analyse the inputs of a particular action that failed remotely. Note that the action identifier depends on the target-level cache in question, due to the extensional projection implicit in target-level caching.
2022-07-05Remove option --persistentKlaus Aehlig
... as the --request-action-input option provides a clean way of restoring the inputs to a specific action, without the need of interacting with the internal directory structure of the tool. In particular, the new option also works for remote builds.