diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-04-22 15:50:27 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-04-23 12:47:11 +0200 |
commit | 72d8bb2c3bf74f24e5def6b16c932c9c0165c6ee (patch) | |
tree | 2f40406c2fb2cfbe79e815479a8c14bdf048ce70 /doc/tutorial | |
parent | 66ee4bff8d5d54e63517f89ec1a2927e9c29638d (diff) | |
download | justbuild-72d8bb2c3bf74f24e5def6b16c932c9c0165c6ee.tar.gz |
tutorial: Update outputs and other improvements
When tutorial docs were changed to showcase running commands with
just-mr instead of just, the outputs were not changed. This is now
fixed to showcase the results run with current master just-mr (and
just), together with other small improvements and fixes.
Diffstat (limited to 'doc/tutorial')
-rw-r--r-- | doc/tutorial/cross-compiling.md | 53 | ||||
-rw-r--r-- | doc/tutorial/getting-started.md | 6 | ||||
-rw-r--r-- | doc/tutorial/hello-world.md | 37 | ||||
-rw-r--r-- | doc/tutorial/just-execute.org | 5 | ||||
-rw-r--r-- | doc/tutorial/proto.md | 170 | ||||
-rw-r--r-- | doc/tutorial/rebuild.md | 102 | ||||
-rw-r--r-- | doc/tutorial/target-file-glob-tree.md | 47 | ||||
-rw-r--r-- | doc/tutorial/tests.md | 89 | ||||
-rw-r--r-- | doc/tutorial/third-party-software.md | 38 |
9 files changed, 385 insertions, 162 deletions
diff --git a/doc/tutorial/cross-compiling.md b/doc/tutorial/cross-compiling.md index 35946a9b..43296400 100644 --- a/doc/tutorial/cross-compiling.md +++ b/doc/tutorial/cross-compiling.md @@ -26,12 +26,14 @@ spread over several packages, often shared by the architecture to cross compile to. Once the required packages are installed, usage is quite forward. -Let's start a new project. +Let's start a new project in a clean working directory. + ``` sh $ touch ROOT ``` We create a file `repos.template.json` specifying the one local repository. + ``` {.jsonc srcname="repos.template.json"} { "repositories": { "": @@ -43,11 +45,13 @@ We create a file `repos.template.json` specifying the one local repository. ``` The actual `rules-cc` are imported via `just-import-git`. + ``` sh $ just-import-git -C repos.template.json -b master --as rules-cc https://github.com/just-buildsystem/rules-cc > repos.json ``` -Let's have `main.cpp` be the canonical Hello-World program. +Let's have `main.cpp` be the canonical _Hello World_ program. + ``` {.cpp srcname="main.cpp"} #include <iostream> @@ -57,7 +61,8 @@ int main() { } ``` -Then, our `TARGETS` file describe a simple binary, as usual. +Then, a `TARGETS` file describing a simple binary. + ``` {.jsonc srcname="TARGETS"} { "helloworld": { "type": ["@", "rules", "CC", "binary"] @@ -70,10 +75,12 @@ Then, our `TARGETS` file describe a simple binary, as usual. As mentioned in the introduction, we need to specify `TOOLCHAIN_CONFIG`, `OS`, and `ARCH`. So the canonical building for host looks something like the following. + ``` sh $ just-mr build -D '{"TOOLCHAIN_CONFIG": {"FAMILY": "gnu"}, "OS": "linux", "ARCH": "x86_64"}' INFO: Performing repositories setup -INFO: Found 21 repositories to set up +INFO: Found 22 repositories to set up +... INFO: Setup finished, exec ["just","build","-C","...","-D","{\"TOOLCHAIN_CONFIG\": {\"FAMILY\": \"gnu\"}, \"OS\": \"linux\", \"ARCH\": \"x86_64\"}"] INFO: Requested target is [["@","","","helloworld"],{"ARCH":"x86_64","OS":"linux","TOOLCHAIN_CONFIG":{"FAMILY":"gnu"}}] INFO: Analysed target [["@","","","helloworld"],{"ARCH":"x86_64","OS":"linux","TOOLCHAIN_CONFIG":{"FAMILY":"gnu"}}] @@ -86,10 +93,11 @@ $ ``` To cross compile, we simply add `TARGET_ARCH`. + ``` sh $ just-mr build -D '{"TOOLCHAIN_CONFIG": {"FAMILY": "gnu"}, "OS": "linux", "ARCH": "x86_64", "TARGET_ARCH": "arm64"}' INFO: Performing repositories setup -INFO: Found 21 repositories to set up +INFO: Found 22 repositories to set up INFO: Setup finished, exec ["just","build","-C","...","-D","{\"TOOLCHAIN_CONFIG\": {\"FAMILY\": \"gnu\"}, \"OS\": \"linux\", \"ARCH\": \"x86_64\", \"TARGET_ARCH\": \"arm64\"}"] INFO: Requested target is [["@","","","helloworld"],{"ARCH":"x86_64","OS":"linux","TARGET_ARCH":"arm64","TOOLCHAIN_CONFIG":{"FAMILY":"gnu"}}] INFO: Analysed target [["@","","","helloworld"],{"ARCH":"x86_64","OS":"linux","TARGET_ARCH":"arm64","TOOLCHAIN_CONFIG":{"FAMILY":"gnu"}}] @@ -103,6 +111,7 @@ $ To inspect the different command lines for native and cross compilation, we can use `just analyse`. + ``` sh $ just-mr analyse -D '{"TOOLCHAIN_CONFIG": {"FAMILY": "gnu"}, "OS": "linux", "ARCH": "x86_64"}' --dump-actions - $ just-mr analyse -D '{"TOOLCHAIN_CONFIG": {"FAMILY": "gnu"}, "OS": "linux", "ARCH": "x86_64", "TARGET_ARCH": "arm64"}' --dump-actions - @@ -115,8 +124,14 @@ Testing in the presence of cross compiling ------------------------------------------ To understand testing the in the presence of cross compiling, let's -walk through a simple example. We create a basic test by adding -a file `test/TARGETS`. +walk through a simple example. We create a basic test in subdirectory `test` + +``` sh +$ mkdir -p ./test +``` + +by adding a file `test/TARGETS` containing + ``` {.jsonc srcname="test/TARGETS"} { "basic": { "type": ["@", "rules", "shell/test", "script"] @@ -134,10 +149,11 @@ a file `test/TARGETS`. Now, if we try to run the test by simply specifying the target architecture, we find that the binary to be tested is still only built for host. + ``` sh $ just-mr analyse --dump-targets - -D '{"TOOLCHAIN_CONFIG": {"FAMILY": "gnu"}, "OS": "linux", "ARCH": "x86_64", "TARGET_ARCH": "arm64"}' test basic INFO: Performing repositories setup -INFO: Found 21 repositories to set up +INFO: Found 22 repositories to set up INFO: Setup finished, exec ["just","analyse","-C","...","--dump-targets","-","-D","{\"TOOLCHAIN_CONFIG\": {\"FAMILY\": \"gnu\"}, \"OS\": \"linux\", \"ARCH\": \"x86_64\", \"TARGET_ARCH\": \"arm64\"}","test","basic"] INFO: Requested target is [["@","","test","basic"],{"ARCH":"x86_64","OS":"linux","TARGET_ARCH":"arm64","TOOLCHAIN_CONFIG":{"FAMILY":"gnu"}}] INFO: Result of target [["@","","test","basic"],{"ARCH":"x86_64","OS":"linux","TARGET_ARCH":"arm64","TOOLCHAIN_CONFIG":{"FAMILY":"gnu"}}]: { @@ -173,9 +189,13 @@ INFO: List of analysed targets: }, "rules-cc/just/rules": { "CC": { - "defaults": [{"ARCH":"x86_64","DEBUG":null,"HOST_ARCH":null,"OS":"linux","TARGET_ARCH":"x86_64","TOOLCHAIN_CONFIG":{"FAMILY":"gnu"}}], - "gcc": [{"ARCH":"x86_64","HOST_ARCH":null,"OS":"linux","TARGET_ARCH":"x86_64"}], - "toolchain": [{"ARCH":"x86_64","HOST_ARCH":null,"OS":"linux","TARGET_ARCH":"x86_64","TOOLCHAIN_CONFIG":{"FAMILY":"gnu"}}] + "defaults": [{"ARCH":"x86_64","DEBUG":null,"HOST_ARCH":null,"OS":"linux","TARGET_ARCH":"x86_64","TOOLCHAIN_CONFIG":{"FAMILY":"gnu"}}] + } + }, + "rules-cc/just/toolchain": { + "CC": { + "defaults": [{"ARCH":"x86_64","HOST_ARCH":null,"OS":"linux","TARGET_ARCH":"x86_64","TOOLCHAIN_CONFIG":{"FAMILY":"gnu"}}], + "gcc": [{"ARCH":"x86_64","HOST_ARCH":null,"OS":"linux","TARGET_ARCH":"x86_64"}] } } } @@ -204,11 +224,12 @@ e.g., obtained by cross compiling. The next step is to tell *justbuild* how to reach that machine; as we only want to use it for certain actions we can't simply set it as (default) remote-execution endpoint (specified by the -`-r` option). Instead we crate a file `dispatch.json`. +`-r` option). Instead we create a file `dispatch.json`. ``` {.jsonc srcname="dispatch.json"} [[{"runner": "arm64-worker"}, "10.204.62.67:9999"]] ``` + This file contains a list of lists pairs (lists of length 2) with the first entry a map of remote-execution properties and the second entry a remote-execution endpoint. For each action, if the remote-execution @@ -246,7 +267,7 @@ still accepts any credentials provided. ``` sh $ just-mr build -D '{"TOOLCHAIN_CONFIG": {"FAMILY": "gnu"}, "OS": "linux", "ARCH": "x86_64", "TARGET_ARCH": "arm64", "ARCH_DISPATCH": {"arm64": {"runner": "arm64-worker"}}}' --endpoint-configuration dispatch.json --tls-ca-cert ca.crt --tls-client-cert client.crt --tls-client-key client.key test basic INFO: Performing repositories setup -INFO: Found 21 repositories to set up +INFO: Found 22 repositories to set up INFO: Setup finished, exec ["just","build","-C","...","-D","{\"TOOLCHAIN_CONFIG\": {\"FAMILY\": \"gnu\"}, \"OS\": \"linux\", \"ARCH\": \"x86_64\", \"TARGET_ARCH\": \"arm64\", \"ARCH_DISPATCH\": {\"arm64\": {\"runner\": \"arm64-worker\"}}}","--endpoint-configuration","dispatch.json","--tls-ca-cert","ca.crt","--tls-client-cert","client.crt","--tls-client-key","client.key","test","basic"] INFO: Requested target is [["@","","test","basic"],{"ARCH":"x86_64","ARCH_DISPATCH":{"arm64":{"runner":"arm64-worker"}},"OS":"linux","TARGET_ARCH":"arm64","TOOLCHAIN_CONFIG":{"FAMILY":"gnu"}}] INFO: Analysed target [["@","","test","basic"],{"ARCH":"x86_64","ARCH_DISPATCH":{"arm64":{"runner":"arm64-worker"}},"OS":"linux","TARGET_ARCH":"arm64","TOOLCHAIN_CONFIG":{"FAMILY":"gnu"}}] @@ -258,8 +279,8 @@ INFO: Artifacts built, logical paths are: result [7ef22e9a431ad0272713b71fdc8794016c8ef12f:5:f] stderr [e69de29bb2d1d6434b8b29ae775ad8c2e48c5391:0:f] stdout [cd0875583aabe89ee197ea133980a9085d08e497:13:f] - time-start [298a717bc8ba9b7e681a6d789104a1204ebe75b8:11:f] - time-stop [298a717bc8ba9b7e681a6d789104a1204ebe75b8:11:f] + time-start [a80d4908a45181a0ed5ebbb8f593cc6260fa51a8:11:f] + time-stop [a80d4908a45181a0ed5ebbb8f593cc6260fa51a8:11:f] (1 runfiles omitted.) INFO: Target tainted ["test"]. $ @@ -272,5 +293,5 @@ be set in the `"just args"` entry of the `.just-mrrc` file. When inspecting the result, we can use `just install-cas` as usual, without any special arguments. Whenever dispatching an action to -a non-default end point, `just` will take care of syncing back the +a non-default endpoint, `just` will take care of syncing back the artifacts to the default CAS. diff --git a/doc/tutorial/getting-started.md b/doc/tutorial/getting-started.md index 0ec1c28a..3047640d 100644 --- a/doc/tutorial/getting-started.md +++ b/doc/tutorial/getting-started.md @@ -58,7 +58,6 @@ To build a target, we need to run `just` with the subcommand `build`: $ just build greeter INFO: Requested target is [["@","","","greeter"],{}] INFO: Analysed target [["@","","","greeter"],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching INFO: Discovered 1 actions, 0 trees, 0 blobs INFO: Building [["@","","","greeter"],{}]. INFO: Processed 1 actions, 0 cache hits. @@ -78,7 +77,6 @@ and specify the output directory: $ just install greeter -o . INFO: Requested target is [["@","","","greeter"],{}] INFO: Analysed target [["@","","","greeter"],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching INFO: Discovered 1 actions, 0 trees, 0 blobs INFO: Building [["@","","","greeter"],{}]. INFO: Processed 1 actions, 1 cache hits. @@ -104,7 +102,6 @@ for piping the artifact to another program. $ just build greeter -P out.txt INFO: Requested target is [["@","","","greeter"],{}] INFO: Analysed target [["@","","","greeter"],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching INFO: Discovered 1 actions, 0 trees, 0 blobs INFO: Building [["@","","","greeter"],{}]. INFO: Processed 1 actions, 1 cache hits. @@ -167,7 +164,6 @@ As we only request targets, no conflicts arise. $ just build upper -P out.txt INFO: Requested target is [["@","","","upper"],{}] INFO: Analysed target [["@","","","upper"],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching INFO: Discovered 1 actions, 0 trees, 0 blobs INFO: Building [["@","","","upper"],{}]. INFO: Processed 1 actions, 0 cache hits. @@ -177,7 +173,6 @@ WORLD $ just build greeter -P out.txt INFO: Requested target is [["@","","","greeter"],{}] INFO: Analysed target [["@","","","greeter"],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching INFO: Discovered 1 actions, 0 trees, 0 blobs INFO: Building [["@","","","greeter"],{}]. INFO: Processed 1 actions, 1 cache hits. @@ -206,7 +201,6 @@ simple case of a target producing precisely one file, the argument $ just build both INFO: Requested target is [["@","","","both"],{}] INFO: Analysed target [["@","","","both"],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching INFO: Discovered 2 actions, 0 trees, 0 blobs INFO: Building [["@","","","both"],{}]. INFO: Processed 2 actions, 2 cache hits. diff --git a/doc/tutorial/hello-world.md b/doc/tutorial/hello-world.md index 23c63d9a..52efbc8f 100644 --- a/doc/tutorial/hello-world.md +++ b/doc/tutorial/hello-world.md @@ -116,6 +116,9 @@ command line: ``` sh $ just-mr build helloworld +INFO: Performing repositories setup +INFO: Found 2 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","helloworld"] INFO: Requested target is [["@","tutorial","","helloworld"],{}] INFO: Analysed target [["@","tutorial","","helloworld"],{}] INFO: Discovered 2 actions, 1 trees, 0 blobs @@ -139,10 +142,10 @@ performs the actual build. Note that these two programs, `just-mr` and `just`, can also be run individually. To do so, first run `just-mr` with `setup` and capture the -path to the generated build configuration from stdout by assigning it to -a shell variable (e.g., `CONF`). Afterwards, `just` can be called to -perform the actual build by explicitly specifying the configuration file -via `-C`: +path to the generated build configuration from stdout (above omitted from the +log message as `"..."`) by assigning it to a shell variable (e.g., `CONF`). +Afterwards, `just` can be called to perform the actual build by explicitly +specifying the configuration file via `-C`, e.g.: ``` sh $ CONF=$(just-mr setup tutorial) @@ -162,6 +165,9 @@ object that sets `"CXX"` to `"clang++"`: ``` sh $ just-mr build helloworld -D'{"CXX":"clang++"}' +INFO: Performing repositories setup +INFO: Found 2 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","helloworld","-D{\"CXX\":\"clang++\"}"] INFO: Requested target is [["@","tutorial","","helloworld"],{"CXX":"clang++"}] INFO: Analysed target [["@","tutorial","","helloworld"],{"CXX":"clang++"}] INFO: Discovered 2 actions, 1 trees, 0 blobs @@ -252,11 +258,15 @@ directory. As our `"defaults"` target is in the directory `"CC"` of the rules repository we could also have written the rule `"type"` simply as `"defaults"`. -To rebuild the project, we need to rerun `just-mr` (note that due to -configuration changes, rerunning only `just` would not suffice): +To rebuild the project, we rerun `just-mr` (note that due to configuration +changes, we expect the intermediary configuration file hash reported to also +change): ``` sh $ just-mr build helloworld +INFO: Performing repositories setup +INFO: Found 3 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","helloworld"] INFO: Requested target is [["@","tutorial","","helloworld"],{}] INFO: Analysed target [["@","tutorial","","helloworld"],{}] INFO: Discovered 2 actions, 1 trees, 0 blobs @@ -296,8 +306,13 @@ Modeling target dependencies For demonstration purposes, we will separate the print statements into a static library `greet`, which will become a dependency to our binary. -Therefore, we create a new subdirectory `greet` with the files -`greet/greet.hpp`: +Therefore, we create a new subdirectory `greet` + +``` sh +$ mkdir -p ./greet +``` + +with the files `greet/greet.hpp`: ``` {.cpp srcname="greet/greet.hpp"} #include <string> @@ -376,6 +391,9 @@ binary can be built with the same command as before (no need to rerun ``` sh $ just-mr build helloworld +INFO: Performing repositories setup +INFO: Found 3 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","helloworld"] INFO: Requested target is [["@","tutorial","","helloworld"],{}] INFO: Analysed target [["@","tutorial","","helloworld"],{}] INFO: Discovered 4 actions, 2 trees, 0 blobs @@ -391,6 +409,9 @@ run the following command: ``` sh $ just-mr build greet greet +INFO: Performing repositories setup +INFO: Found 3 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","greet","greet"] INFO: Requested target is [["@","tutorial","greet","greet"],{}] INFO: Analysed target [["@","tutorial","greet","greet"],{}] INFO: Discovered 2 actions, 1 trees, 0 blobs diff --git a/doc/tutorial/just-execute.org b/doc/tutorial/just-execute.org index 6e9e1ee0..03ac7d19 100644 --- a/doc/tutorial/just-execute.org +++ b/doc/tutorial/just-execute.org @@ -269,7 +269,7 @@ scenarios. - create a suitable chroot environment - chroot into it - run ~just execute~ from there -- in a different shell, ~just build -r <interface>:<port num>~ +- in a different shell, ~just build -r <interface>:<port>~ **** Full latex chroot: walkthrough @@ -346,12 +346,11 @@ INFO: Found 2 repositories to set up INFO: Setup finished, exec ["just","install","-C","...","-o",".","-r","localhost:8080"] INFO: Requested target is [["@","tutorial","doc/just-execute/latex-hello-world","tutorial"],{}] INFO: Analysed target [["@","tutorial","doc/just-execute/latex-hello-world","tutorial"],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching INFO: Discovered 1 actions, 0 trees, 1 blobs INFO: Building [["@","tutorial","doc/just-execute/latex-hello-world","tutorial"],{}]. INFO: Processed 1 actions, 0 cache hits. INFO: Artifacts can be found in: - /home/alberto/opt/src/justbuild/doc/just-execute/latex-hello-world/hello.pdf [25e05d3560e344b0180097f21a8074ecb0d9f343:37614:f] + /tmp/work/doc/just-execute/latex-hello-world/hello.pdf [25e05d3560e344b0180097f21a8074ecb0d9f343:37614:f] #+END_SRC In the shell where ~just execute~ is running, this line should have diff --git a/doc/tutorial/proto.md b/doc/tutorial/proto.md index 8e7fb5c0..e52f38d2 100644 --- a/doc/tutorial/proto.md +++ b/doc/tutorial/proto.md @@ -43,8 +43,8 @@ The missing entry `"rules-cc"` refers to our C/C++ build rules provided [online](https://github.com/just-buildsystem/rules-cc). These rules support protobuf if the dependency `"protoc"` is provided. To import this rule repository including the required transitive dependencies for -protobuf, the `bin/just-import-git` script with option `--as rules-cc` -can be used to generate the actual `repos.json`: +protobuf, the `just-import-git` script of the *justbuild* project can be +used with option `--as rules-cc` to generate the actual `repos.json`: ``` sh $ just-import-git -C repos.template.json -b master --as rules-cc https://github.com/just-buildsystem/rules-cc > repos.json @@ -73,13 +73,21 @@ declare the library, create a `TARGETS` file with the following content: In general, proto libraries could also depend on other proto libraries; those would be added to the `"deps"` field. -When building the library, there's very little to do. +When building the library, there's very little to do after `just-mr` fetches +and sets up all the repositories. ``` sh $ just-mr build address +INFO: Performing repositories setup +INFO: Found 23 repositories to set up +PROG: [ 0%] 1 local, 0 cached, 0 done +PROG: [ 0%] 1 local, 0 cached, 0 done +PROG: [ 66%] 1 local, 1 cached, 14 done +PROG: [ 90%] 1 local, 1 cached, 19 done +PROG: [ 95%] 1 local, 1 cached, 20 done; 1 fetches ("rules-cc/just/import targets") +INFO: Setup finished, exec ["just","build","-C","...","--local-build-root","/tmp/proto","address"] INFO: Requested target is [["@","","","address"],{}] INFO: Analysed target [["@","","","address"],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching INFO: Discovered 0 actions, 0 trees, 0 blobs INFO: Building [["@","","","address"],{}]. INFO: Processed 0 actions, 0 cache hits. @@ -101,6 +109,9 @@ structure of the `.proto` files. ``` sh $ just-mr analyse --dump-nodes - address +INFO: Performing repositories setup +INFO: Found 23 repositories to set up +INFO: Setup finished, exec ["just","analyse","-C","...","--dump-nodes","-","address"] INFO: Requested target is [["@","","","address"],{}] INFO: Result of target [["@","","","address"],{}]: { "artifacts": { @@ -200,30 +211,43 @@ also in different projects, the target-level cache is filled already. ``` sh $ just-mr build add_person -... +[...] $ just-mr build add_person +INFO: Performing repositories setup +INFO: Found 23 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","add_person"] INFO: Requested target is [["@","","","add_person"],{}] INFO: Analysed target [["@","","","add_person"],{}] -INFO: Export targets found: 3 cached, 0 uncached, 0 not eligible for caching +INFO: Export targets found: 2 cached, 0 uncached, 0 not eligible for caching INFO: Discovered 5 actions, 2 trees, 0 blobs INFO: Building [["@","","","add_person"],{}]. INFO: Processed 5 actions, 5 cache hits. INFO: Artifacts built, logical paths are: - add_person [bcbb3deabfe0d77e6d3ea35615336a2f59a1b0aa:2285928:x] + add_person [bca89ed8465e81c629d689b66c71deca138e2c27:2847912:x] $ ``` If we look at the actions associated with the binary, we find that those are still the two actions we expect: a compile action and a link action. +(Some of the fields have been removed in the following example outputs and +replaced by `"..."` for clarity.) ``` sh $ just-mr analyse add_person --dump-actions - +INFO: Performing repositories setup +INFO: Found 23 repositories to set up +INFO: Setup finished, exec ["just","analyse","-C","...","add_person","--dump-actions","-"] INFO: Requested target is [["@","","","add_person"],{}] INFO: Result of target [["@","","","add_person"],{}]: { "artifacts": { - "add_person": {"data":{"id":"fcf211e2291b2867375e915538ce04cb4dfae86d","path":"add_person"},"type":"ACTION"} + "add_person": {"data":{"id":"6ba3552427c6c47b52bc2fa571a64af300e27243","path":"add_person"},"type":"ACTION"} }, "provides": { + "package": { + "to_bin": true + }, + "run-libs": { + } }, "runfiles": { } @@ -231,9 +255,9 @@ INFO: Result of target [["@","","","add_person"],{}]: { INFO: Actions for target [["@","","","add_person"],{}]: [ { - "command": ["c++","-I","work","-isystem","include","-c","work/add_person.cc","-o","work/add_person.o"], + "command": ["c++","-O2",...,"-I","work","-isystem","include","-c","work/add_person.cc","-o","work/add_person.o"], "env": { - "PATH": "/bin:/usr/bin" + "PATH": "/bin:/sbin:/usr/bin:/usr/sbin" }, "input": { ... @@ -241,9 +265,9 @@ INFO: Actions for target [["@","","","add_person"],{}]: "output": ["work/add_person.o"] }, { - "command": ["c++","-o","add_person","add_person.o","libaddressbook.a","libprotobuf.a","libprotobuf_lite.a","libzlib.a"], + "command": ["c++","-Wl,-rpath,$ORIGIN","-Wl,-rpath,$ORIGIN/../lib","-o","add_person","-O2",...,"add_person.o","libaddressbook.a","libprotobuf.a","libprotobuf-lite.a",...,"libz.a"], "env": { - "PATH": "/bin:/usr/bin" + "PATH": "/bin:/sbin:/usr/bin:/usr/sbin" }, "input": { ... @@ -264,12 +288,20 @@ earlier. ``` sh $ just-mr analyse add_person --dump-targets - +INFO: Performing repositories setup +INFO: Found 23 repositories to set up +INFO: Setup finished, exec ["just","analyse","-C","...","add_person","--dump-targets","-"] INFO: Requested target is [["@","","","add_person"],{}] INFO: Result of target [["@","","","add_person"],{}]: { "artifacts": { - "add_person": {"data":{"id":"fcf211e2291b2867375e915538ce04cb4dfae86d","path":"add_person"},"type":"ACTION"} + "add_person": {"data":{"id":"6ba3552427c6c47b52bc2fa571a64af300e27243","path":"add_person"},"type":"ACTION"} }, "provides": { + "package": { + "to_bin": true + }, + "run-libs": { + } }, "runfiles": { } @@ -278,26 +310,42 @@ INFO: List of analysed targets: { "#": { "eda46ea21de25033ff7250e6a4cdc0b2c24be0c7": { - "2a483a2de7f25c1bc066e47245f55ec9a2d4a719": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}] + "2a483a2de7f25c1bc066e47245f55ec9a2d4a719": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"PKG_CONFIG_ARGS":null,"PREFIX":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}] } }, "@": { "": { "": { - "add_person": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], + "add_person": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"ADD_LDFLAGS":null,"AR":null,"ARCH":null,"BUILD_POSITION_INDEPENDENT":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"LDFLAGS":null,"OS":null,"PKG_CONFIG_ARGS":null,"PREFIX":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], "address": [{}] } }, "rules-cc": { "CC": { - "defaults": [{}] + "defaults": [{"ARCH":null,"DEBUG":null,"HOST_ARCH":null,"OS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}] + }, + "CC/proto": { + "defaults": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"PKG_CONFIG_ARGS":null,"PREFIX":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}] } }, "rules-cc/just/protobuf": { "": { - "C++ runtime": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], - "protoc": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], - "well_known_protos": [{}] + "installed protoc": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"PKG_CONFIG_ARGS":null,"PREFIX":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], + "libprotobuf": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"PKG_CONFIG_ARGS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], + "protoc": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"PKG_CONFIG_ARGS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], + "toolchain": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"PKG_CONFIG_ARGS":null,"PREFIX":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], + "toolchain_headers": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"PKG_CONFIG_ARGS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}] + } + }, + "rules-cc/just/rules": { + "CC": { + "defaults": [{"ARCH":null,"DEBUG":null,"HOST_ARCH":null,"OS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}] + } + }, + "rules-cc/just/toolchain": { + "CC": { + "defaults": [{"ARCH":null,"HOST_ARCH":null,"OS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], + "unknown": [{"ARCH":null,"HOST_ARCH":null,"TARGET_ARCH":null}] } } } @@ -322,7 +370,9 @@ purpose. ``` sh $ just-mr analyse 'address proto library' -... +INFO: Performing repositories setup +INFO: Found 23 repositories to set up +INFO: Setup finished, exec ["just","analyse","-C","...","address proto library"] INFO: Requested target is [["@","","","address proto library"],{}] INFO: Result of target [["@","","","address proto library"],{}]: { "artifacts": { @@ -330,7 +380,8 @@ INFO: Result of target [["@","","","address proto library"],{}]: { "provides": { ... "compile-deps": { - "addressbook.pb.h": {"data":{"id":"6d70cd10fabcbc7591cd82aae2f100cca39d3879","path":"work/addressbook.pb.h"},"type":"ACTION"}, + ... + "addressbook.pb.h": {"data":{"id":"b05ff2058068a30961c3e28318b9105795a08a42","path":"work/addressbook.pb.h"},"type":"ACTION"}, ... }, "link-args": [ @@ -338,7 +389,8 @@ INFO: Result of target [["@","","","address proto library"],{}]: { ... ], "link-deps": { - "libaddressbook.a": {"data":{"id":"753073bd026b6470138c47e004469dd1d3df08d4","path":"libaddressbook.a"},"type":"ACTION"}, + ... + "libaddressbook.a": {"data":{"id":"acc15c9c1218b4df277f49d537a3c4b961263490","path":"libaddressbook.a"},"type":"ACTION"}, ... }, ... @@ -355,8 +407,8 @@ Adding a test Finally, let's add a test. As we use the `protobuf` repository as workspace root, we add the test script ad hoc into a targets file, using the `"file_gen"` rule. For debugging a potentially failing test, we also -keep the intermediate files the test generates. Create a top-level -`TARGETS` file with the following content: +keep the intermediate files the test generates. Add to the top-level +`TARGETS` file the following content: ``` {.jsonc srcname="TARGETS"} ... @@ -393,50 +445,69 @@ targets and the one anonymous target is reused by both binaries. ``` sh $ just-mr analyse test --dump-targets - +INFO: Performing repositories setup +INFO: Found 23 repositories to set up +INFO: Setup finished, exec ["just","analyse","-C","...","test","--dump-targets","-"] INFO: Requested target is [["@","","","test"],{}] INFO: Result of target [["@","","","test"],{}]: { "artifacts": { - "result": {"data":{"id":"20967787c42a289f5598249e696f851dde50065c","path":"result"},"type":"ACTION"}, - "stderr": {"data":{"id":"20967787c42a289f5598249e696f851dde50065c","path":"stderr"},"type":"ACTION"}, - "stdout": {"data":{"id":"20967787c42a289f5598249e696f851dde50065c","path":"stdout"},"type":"ACTION"}, - "time-start": {"data":{"id":"20967787c42a289f5598249e696f851dde50065c","path":"time-start"},"type":"ACTION"}, - "time-stop": {"data":{"id":"20967787c42a289f5598249e696f851dde50065c","path":"time-stop"},"type":"ACTION"}, - "work/addressbook.data": {"data":{"id":"20967787c42a289f5598249e696f851dde50065c","path":"work/addressbook.data"},"type":"ACTION"}, - "work/out.txt": {"data":{"id":"20967787c42a289f5598249e696f851dde50065c","path":"work/out.txt"},"type":"ACTION"} + "result": {"data":{"id":"e37a69e5d5213f53da5f1c2a42297c987732984f","path":"result"},"type":"ACTION"}, + "stderr": {"data":{"id":"e37a69e5d5213f53da5f1c2a42297c987732984f","path":"stderr"},"type":"ACTION"}, + "stdout": {"data":{"id":"e37a69e5d5213f53da5f1c2a42297c987732984f","path":"stdout"},"type":"ACTION"}, + "time-start": {"data":{"id":"e37a69e5d5213f53da5f1c2a42297c987732984f","path":"time-start"},"type":"ACTION"}, + "time-stop": {"data":{"id":"e37a69e5d5213f53da5f1c2a42297c987732984f","path":"time-stop"},"type":"ACTION"}, + "work/addressbook.data": {"data":{"id":"e37a69e5d5213f53da5f1c2a42297c987732984f","path":"work/addressbook.data"},"type":"ACTION"}, + "work/out.txt": {"data":{"id":"e37a69e5d5213f53da5f1c2a42297c987732984f","path":"work/out.txt"},"type":"ACTION"} }, "provides": { }, "runfiles": { - "read-write-test": {"data":{"id":"c9d7bfc5bc8448bfef25b4e73e4494560bf6c350"},"type":"TREE"} + "read-write-test": {"data":{"id":"71d9414c93b1bf4c2883af6070671761f9bc5cbf"},"type":"TREE"} } } INFO: List of analysed targets: { "#": { "eda46ea21de25033ff7250e6a4cdc0b2c24be0c7": { - "2a483a2de7f25c1bc066e47245f55ec9a2d4a719": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}] + "2a483a2de7f25c1bc066e47245f55ec9a2d4a719": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"PKG_CONFIG_ARGS":null,"PREFIX":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}] } }, "@": { "": { "": { - "add_person": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], + "add_person": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"ADD_LDFLAGS":null,"AR":null,"ARCH":null,"BUILD_POSITION_INDEPENDENT":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"LDFLAGS":null,"OS":null,"PKG_CONFIG_ARGS":null,"PREFIX":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], "address": [{}], - "list_people": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], - "test": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"RUNS_PER_TEST":null,"TEST_ENV":null,"TOOLCHAIN_CONFIG":null}], + "list_people": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"ADD_LDFLAGS":null,"AR":null,"ARCH":null,"BUILD_POSITION_INDEPENDENT":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"LDFLAGS":null,"OS":null,"PKG_CONFIG_ARGS":null,"PREFIX":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], + "test": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"ADD_LDFLAGS":null,"AR":null,"ARCH":null,"ARCH_DISPATCH":null,"BUILD_POSITION_INDEPENDENT":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"LDFLAGS":null,"OS":null,"PKG_CONFIG_ARGS":null,"PREFIX":null,"RUNS_PER_TEST":null,"TARGET_ARCH":null,"TEST_ENV":null,"TIMEOUT_SCALE":null,"TOOLCHAIN_CONFIG":null}], "test.sh": [{}] } }, "rules-cc": { "CC": { - "defaults": [{}] + "defaults": [{"ARCH":null,"DEBUG":null,"HOST_ARCH":null,"OS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}] + }, + "CC/proto": { + "defaults": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"PKG_CONFIG_ARGS":null,"PREFIX":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}] } }, "rules-cc/just/protobuf": { "": { - "C++ runtime": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], - "protoc": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], - "well_known_protos": [{}] + "installed protoc": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"PKG_CONFIG_ARGS":null,"PREFIX":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], + "libprotobuf": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"PKG_CONFIG_ARGS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], + "protoc": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"PKG_CONFIG_ARGS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], + "toolchain": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"PKG_CONFIG_ARGS":null,"PREFIX":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], + "toolchain_headers": [{"ADD_CFLAGS":null,"ADD_CXXFLAGS":null,"AR":null,"ARCH":null,"CC":null,"CFLAGS":null,"CXX":null,"CXXFLAGS":null,"DEBUG":null,"ENV":null,"HOST_ARCH":null,"OS":null,"PKG_CONFIG_ARGS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}] + } + }, + "rules-cc/just/rules": { + "CC": { + "defaults": [{"ARCH":null,"DEBUG":null,"HOST_ARCH":null,"OS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}] + } + }, + "rules-cc/just/toolchain": { + "CC": { + "defaults": [{"ARCH":null,"HOST_ARCH":null,"OS":null,"TARGET_ARCH":null,"TOOLCHAIN_CONFIG":null}], + "unknown": [{"ARCH":null,"HOST_ARCH":null,"TARGET_ARCH":null}] } } } @@ -448,27 +519,30 @@ $ Finally, the test passes and the output is as expected. ``` sh -$ just-mr build test -Pwork/out.txt +$ just-mr build test -P work/out.txt +INFO: Performing repositories setup +INFO: Found 23 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","test","-P","work/out.txt"] INFO: Requested target is [["@","","","test"],{}] INFO: Analysed target [["@","","","test"],{}] -INFO: Export targets found: 3 cached, 0 uncached, 0 not eligible for caching +INFO: Export targets found: 2 cached, 0 uncached, 0 not eligible for caching INFO: Target tainted ["test"]. -INFO: Discovered 8 actions, 4 trees, 1 blobs +INFO: Discovered 8 actions, 5 trees, 1 blobs INFO: Building [["@","","","test"],{}]. INFO: Processed 8 actions, 5 cache hits. INFO: Artifacts built, logical paths are: result [7ef22e9a431ad0272713b71fdc8794016c8ef12f:5:f] stderr [e69de29bb2d1d6434b8b29ae775ad8c2e48c5391:0:f] stdout [7fab9dd1ee66a1e76a3697a27524f905600afbd0:196:f] - time-start [7ac216a2a98b7739ae5304d96cdfa6f0b0ed87b6:11:f] - time-stop [7ac216a2a98b7739ae5304d96cdfa6f0b0ed87b6:11:f] - work/addressbook.data [baa6f28731ff6d93fbef9fcc5f7e8ae900da5ba5:41:f] - work/out.txt [7fb178dd66ecf24fdb786a0f96ae5969b55442da:101:f] + time-start [8e3614748ef049ea08bc49740d9ba55dfd42ef06:11:f] + time-stop [8e3614748ef049ea08bc49740d9ba55dfd42ef06:11:f] + work/addressbook.data [b673b647fbce717116104e84c335fdecaae974d6:41:f] + work/out.txt [ae02d08605d72d74bbfa72d33e4d314bb3632591:101:f] (1 runfiles omitted.) Person ID: 12345 Name: John Doe E-mail address: jdoe@example.org - Updated: 2022-12-14T18:08:36Z + Updated: 2024-04-19T15:51:27Z INFO: Target tainted ["test"]. $ ``` diff --git a/doc/tutorial/rebuild.md b/doc/tutorial/rebuild.md index 3f1ddd88..bc0c038e 100644 --- a/doc/tutorial/rebuild.md +++ b/doc/tutorial/rebuild.md @@ -2,14 +2,14 @@ Ensuring reproducibility of the build ===================================== Software builds should be -[reproducible](https://reproducible-builds.org/). The `just` tool, +[reproducible](https://reproducible-builds.org/). *Justbuild* supports this goal in local builds by isolating individual actions, -setting permissions and file time stamps to canonical values, etc; most +setting permissions and file time stamps to canonical values, etc.; most remote execution systems take even further measures to ensure the environment always looks the same to every action. Nevertheless, it is always possible to break reproducibility by bad actions, both coming from rules not carefully written, as well as from ad-hoc actions added -by the `generic` target. +by the `generic` target, such as ``` jsonc ... @@ -98,6 +98,29 @@ and the following `TARGETS` file: } ``` +The `repos.json` only needs the `"rules-cc"` repository and as main repository +the current working directory + +``` {.jsonc srcname="repos.json"} +{ "main": "" +, "repositories": + { "rules-cc": + { "repository": + { "type": "git" + , "branch": "master" + , "commit": "307c96681e6626286804c45273082dff94127878" + , "repository": "https://github.com/just-buildsystem/rules-cc.git" + , "subdir": "rules" + } + } + , "": + { "repository": {"type": "file", "path": "."} + , "bindings": {"rules": "rules-cc"} + } + } +} +``` + To search for the root cause of non-reproducibility, `just` has a subcommand `rebuild`. It builds the specified target again, requesting that every action be executed again (but target-level cache is still @@ -107,45 +130,52 @@ first `build` and then `rebuild`. Note that a repeated `build` simply takes the action result from cache. ``` sh +$ touch ROOT $ just-mr build -INFO: Requested target is [["@","tutorial","",""],{}] -INFO: Analysed target [["@","tutorial","",""],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching +INFO: Performing repositories setup +INFO: Found 2 repositories to set up +INFO: Setup finished, exec ["just","build","-C","..."] +INFO: Requested target is [["@","","",""],{}] +INFO: Analysed target [["@","","",""],{}] INFO: Discovered 6 actions, 1 trees, 0 blobs -INFO: Building [["@","tutorial","",""],{}]. +INFO: Building [["@","","",""],{}]. INFO: Processed 6 actions, 0 cache hits. INFO: Artifacts built, logical paths are: - bin/hello [59f7af154b3b7beac4a6cab40499cb3b388220c4:16608:x] - share/hello/OUT.txt [428b97b82b6c59cad7488b24e6b618ebbcd819bc:13:f] - share/hello/version.txt [088ae5a8a57f62016392bdf124a9b8dfc0288763:39:f] + bin/hello [68528cc2b32838573582c4dd4f0eccbae04cb5d6:18072:x] + share/hello/OUT.txt [e69de29bb2d1d6434b8b29ae775ad8c2e48c5391:0:f] + share/hello/version.txt [8a11b38c825a23d8a0ad36ba6793ded347c0aec8:21:f] $ just-mr build -INFO: Requested target is [["@","tutorial","",""],{}] -INFO: Analysed target [["@","tutorial","",""],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching +INFO: Performing repositories setup +INFO: Found 2 repositories to set up +INFO: Setup finished, exec ["just","build","-C","..."] +INFO: Requested target is [["@","","",""],{}] +INFO: Analysed target [["@","","",""],{}] INFO: Discovered 6 actions, 1 trees, 0 blobs -INFO: Building [["@","tutorial","",""],{}]. +INFO: Building [["@","","",""],{}]. INFO: Processed 6 actions, 6 cache hits. INFO: Artifacts built, logical paths are: - bin/hello [59f7af154b3b7beac4a6cab40499cb3b388220c4:16608:x] - share/hello/OUT.txt [428b97b82b6c59cad7488b24e6b618ebbcd819bc:13:f] - share/hello/version.txt [088ae5a8a57f62016392bdf124a9b8dfc0288763:39:f] + bin/hello [68528cc2b32838573582c4dd4f0eccbae04cb5d6:18072:x] + share/hello/OUT.txt [e69de29bb2d1d6434b8b29ae775ad8c2e48c5391:0:f] + share/hello/version.txt [8a11b38c825a23d8a0ad36ba6793ded347c0aec8:21:f] $ just-mr rebuild -INFO: Requested target is [["@","tutorial","",""],{}] -INFO: Analysed target [["@","tutorial","",""],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching +INFO: Performing repositories setup +INFO: Found 2 repositories to set up +INFO: Setup finished, exec ["just","rebuild","-C","..."] +INFO: Requested target is [["@","","",""],{}] +INFO: Analysed target [["@","","",""],{}] INFO: Discovered 6 actions, 1 trees, 0 blobs -INFO: Rebuilding [["@","tutorial","",""],{}]. +INFO: Rebuilding [["@","","",""],{}]. WARN: Found flaky action: - - id: c854a382ea26628e1a5b8d4af00d6d0cef433436 - - cmd: ["sh","-c","echo '#define VERSION \"0.0.0.'`date +%Y%m%d%H%M%S`'\"' > version.h\n"] - - output 'version.h' differs: - - [6aac3477e22cd57e8c98ded78562d3c017e5d611:39:f] (rebuilt) - - [789a29f39b6aa966f91776bfe092e247614e6acd:39:f] (cached) + - id: 98a14505f43f623c8154e29d4b2ae791bfee718a + - cmd: ["sh","-c","echo '#define VERSION \"0.0.0.'`date +%Y%m%d%H%M%S`'\"' > version.h\n"] + - output 'version.h' differs: + - [725d7c207138ed941a181fd2c068a06dd60dff6e:39:f] (rebuilt) + - [c1a2986953451f77021e121c15947259e33dd645:39:f] (cached) INFO: 2 actions compared with cache, 1 flaky actions found (0 of which tainted), no cache entry found for 4 actions. INFO: Artifacts built, logical paths are: - bin/hello [73994ff43ec1161aba96708f277e8c88feab0386:16608:x] - share/hello/OUT.txt [428b97b82b6c59cad7488b24e6b618ebbcd819bc:13:f] - share/hello/version.txt [8dd65747395c0feab30891eab9e11d4a9dd0c715:39:f] + bin/hello [b268a81d3192af9ef737ebd746f941f441dbc3db:18072:x] + share/hello/OUT.txt [e69de29bb2d1d6434b8b29ae775ad8c2e48c5391:0:f] + share/hello/version.txt [202ca71fec8bc5878559261a50c4547e0c851fb1:21:f] $ ``` @@ -166,22 +196,22 @@ $ just-mr rebuild --dump-flaky flakes.json --dump-graph actions.json $ cat flakes.json { "cache misses": [ - "ca45feffd2bab3bdbf752db7c89c451ce99d4803", - "eff0117276a0ad65a331eb29a2393a9b6e106e4b", - "1eef99333e887f2aa78d2eaee0a7c172db66009c", - "72a337628fa6187513818d5d8d00d36fbdb6923e" + "e346c2c18fe1f4662f772f12e85af968ecb2467c", + "2655bfeee10cdefb61c608fe8e81ce3f2846ab0f", + "108c6dee4f87b86cbfdd3cb8c74079a27444f846", + "14a72ddc8f4024eafb290815bc725e1a0d02c065" ], "flaky actions": { - "c854a382ea26628e1a5b8d4af00d6d0cef433436": { + "98a14505f43f623c8154e29d4b2ae791bfee718a": { "version.h": { "cached": { "file_type": "f", - "id": "789a29f39b6aa966f91776bfe092e247614e6acd", + "id": "c1a2986953451f77021e121c15947259e33dd645", "size": 39 }, "rebuilt": { "file_type": "f", - "id": "4b5e64f324745d628c893f9d7e29ce7febdfdd0c", + "id": "52996c0d65266d15173c7c2836b1835070c1a934", "size": 39 } } diff --git a/doc/tutorial/target-file-glob-tree.md b/doc/tutorial/target-file-glob-tree.md index ea0ad3da..3fd4ac0e 100644 --- a/doc/tutorial/target-file-glob-tree.md +++ b/doc/tutorial/target-file-glob-tree.md @@ -8,9 +8,9 @@ more detail the ways to refer to sources, as well as the difference between defined and source targets. The latter is used, e.g., when third-party software has to be patched. -As example for this section we use gnu `units` where we want to patch -into the standard units definition add two units of area popular in -German news. +As example for this section we use +[gnu units](https://www.gnu.org/software/units/) where we want to patch into +the standard units definition add two units of area popular in German news. Repository Config for `units` with patches ------------------------------------------ @@ -58,14 +58,6 @@ following content. } ``` -The repository to set up is `units` and, as usual, we can use `just-mr` -to fetch the archive and obtain the resulting multi-repository -configuration. - -``` sh -$ just-mr setup units -``` - Patching a file: targets versus `FILE` -------------------------------------- @@ -85,6 +77,9 @@ with the empty object and refine it later. ``` sh $ echo {} > TARGETS.units $ just-mr install -o . definitions.units +INFO: Performing repositories setup +INFO: Found 4 repositories to set up +INFO: Setup finished, exec ["just","install","-C","...","-o",".","definitions.units"] INFO: Requested target is [["@","units","","definitions.units"],{}] INFO: Analysed target [["@","units","","definitions.units"],{}] INFO: Discovered 0 actions, 0 trees, 0 blobs @@ -98,7 +93,7 @@ $ echo -e "/German units\n+2a\narea_soccerfield 105 m * 68 m\narea_saarland 2570 342718 # A few German units as currently in use. 342772 -$ mkdir files +$ mkdir -p files $ echo {} > files/TARGETS $ diff -u definitions.units.orig definitions.units > files/definitions.units.diff $ rm definitions.units* @@ -136,6 +131,9 @@ their inputs) and, in fact, have a fixed command line. ``` sh $ just-mr analyse definitions.units --dump-actions - +INFO: Performing repositories setup +INFO: Found 4 repositories to set up +INFO: Setup finished, exec ["just","analyse","-C","...","definitions.units","--dump-actions","-"] INFO: Requested target is [["@","units","","definitions.units"],{}] INFO: Result of target [["@","units","","definitions.units"],{}]: { "artifacts": { @@ -185,10 +183,13 @@ INFO: Actions for target [["@","units","","definitions.units"],{}]: $ ``` -Building `"definitions.units"` we find out patch applied correctly. +Building `"definitions.units"` we find out that the patch applied correctly ``` sh $ just-mr build definitions.units -P definitions.units | grep -A 5 'German units' +INFO: Performing repositories setup +INFO: Found 4 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","definitions.units","-P","definitions.units"] INFO: Requested target is [["@","units","","definitions.units"],{}] INFO: Analysed target [["@","units","","definitions.units"],{}] INFO: Discovered 1 actions, 0 trees, 1 blobs @@ -222,6 +223,9 @@ and the output of the patch action. ``` sh $ just-mr analyse data-draft +INFO: Performing repositories setup +INFO: Found 4 repositories to set up +INFO: Setup finished, exec ["just","analyse","-C","...","data-draft"] INFO: Requested target is [["@","units","","data-draft"],{}] INFO: Result of target [["@","units","","data-draft"],{}]: { "artifacts": { @@ -282,7 +286,8 @@ is the rule `["data", "overlay"]` taking the union of the artifacts of the specified targets, accepting conflicts and resolving them in a latest-wins fashion. Keep in mind, that our target fields are list, not sets. Looking at the definition of the rule, one finds that it is simply -a `"map_union"`. Hence we refine our `"data"` target. +a `"map_union"`. Hence we refine our `"data-draft"` target into the target +`"data"` reading ``` {.jsonc srcname="TARGETS.units"} ... @@ -293,7 +298,7 @@ a `"map_union"`. Hence we refine our `"data"` target. ... ``` -The result of the analysis, of course, still is the same. +The result of the analysis on this target, of course, remains the same. Finishing the example: binaries from globbed sources ---------------------------------------------------- @@ -323,6 +328,9 @@ total, giving 5 compile and one link action. ``` sh $ just-mr build units-draft +INFO: Performing repositories setup +INFO: Found 4 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","units-draft"] INFO: Requested target is [["@","units","","units-draft"],{}] INFO: Analysed target [["@","units","","units-draft"],{}] INFO: Discovered 6 actions, 1 trees, 0 blobs @@ -345,6 +353,9 @@ a patch. ``` sh $ just-mr install -o . strfunc.c +INFO: Performing repositories setup +INFO: Found 4 repositories to set up +INFO: Setup finished, exec ["just","install","-C","...","-o",".","strfunc.c"] INFO: Requested target is [["@","units","","strfunc.c"],{}] INFO: Analysed target [["@","units","","strfunc.c"],{}] INFO: Discovered 0 actions, 0 trees, 0 blobs @@ -395,6 +406,9 @@ cache. ``` sh $ just-mr build units +INFO: Performing repositories setup +INFO: Found 4 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","units"] INFO: Requested target is [["@","units","","units"],{}] INFO: Analysed target [["@","units","","units"],{}] INFO: Discovered 7 actions, 1 trees, 1 blobs @@ -419,6 +433,9 @@ Then things work as expected ``` sh $ just-mr install -o /tmp/testinstall +INFO: Performing repositories setup +INFO: Found 4 repositories to set up +INFO: Setup finished, exec ["just","install","-C","...","-o","/tmp/testinstall"] INFO: Requested target is [["@","units","",""],{}] INFO: Analysed target [["@","units","",""],{}] INFO: Discovered 8 actions, 1 trees, 1 blobs diff --git a/doc/tutorial/tests.md b/doc/tutorial/tests.md index 648d35c7..72749b0a 100644 --- a/doc/tutorial/tests.md +++ b/doc/tutorial/tests.md @@ -20,9 +20,9 @@ build. For the remainder of this section, we expect to have the project files available resulting from successfully completing the tutorial section on -*Building C++ Hello World*. We will demonstrate how to write a test -binary for the `greet` library and a shell test for the `helloworld` -binary. +[*Building C++ Hello World*](./hello-world.md). We will demonstrate how +to write a test binary for the `greet` library and a shell test for the +`helloworld` binary. Creating a C++ test binary -------------------------- @@ -31,9 +31,14 @@ First, we will create a C++ test binary for testing the correct functionality of the `greet` library. Therefore, we need to provide a C++ source file that performs the actual testing and returns non-`0` on failure. For simplicity reasons, we do not use a testing framework for -this tutorial. A simple test that captures standard output and verifies -it with the expected output should be provided in the file -`tests/greet.test.cpp`: +this tutorial. Let us place this code in subdirectory `tests` + +``` sh +mkdir -p ./tests +``` + +A simple test that captures standard output and verifies it with the expected +output should be provided in the file `tests/greet.test.cpp`: ``` {.cpp srcname="tests/greet.test.cpp"} #include <functional> @@ -102,8 +107,15 @@ $ just-mr describe tests greet ``` However, in our case, we want to use the default runner and therefore it -is sufficient to create an empty module. To do so, create the file -`tutorial-defaults/CC/test/TARGETS` with content +is sufficient to create an empty module. To do so, we create subdirectories + +``` sh +$ mkdir -p ./tutorial-defaults/CC/test +$ mkdir -p ./tutorial-defaults/shell/test +``` + +where we create, respectively, the file `tutorial-defaults/CC/test/TARGETS` +with content ``` {.jsonc srcname="tutorial-defaults/CC/test/TARGETS"} {} @@ -119,9 +131,11 @@ Now we can run the test (i.e., build the test result): ``` sh $ just-mr build tests greet +INFO: Performing repositories setup +INFO: Found 3 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","tests","greet"] INFO: Requested target is [["@","tutorial","tests","greet"],{}] INFO: Analysed target [["@","tutorial","tests","greet"],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching INFO: Target tainted ["test"]. INFO: Discovered 5 actions, 3 trees, 1 blobs INFO: Building [["@","tutorial","tests","greet"],{}]. @@ -130,8 +144,8 @@ INFO: Artifacts built, logical paths are: result [7ef22e9a431ad0272713b71fdc8794016c8ef12f:5:f] stderr [8b137891791fe96927ad78e64b0aad7bded08bdc:1:f] stdout [ae6c6813755da67954a4a562f6d2ef01578c3e89:60:f] - time-start [8e7a68af8d5d7a6d0036c1126ff5c16a5045ae95:11:f] - time-stop [8e7a68af8d5d7a6d0036c1126ff5c16a5045ae95:11:f] + time-start [29370bb4a24f378a63986a2a803ea2a5b790a43e:11:f] + time-stop [29370bb4a24f378a63986a2a803ea2a5b790a43e:11:f] (1 runfiles omitted.) INFO: Target tainted ["test"]. $ @@ -155,19 +169,37 @@ is the name of the artifact that should be printed on the command line, in our case `stdout`: ``` sh -$ just-mr build tests greet --log-limit 1 -P stdout +$ just-mr build tests greet -P stdout +INFO: Performing repositories setup +INFO: Found 3 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","tests","greet","-P","stdout"] +INFO: Requested target is [["@","tutorial","tests","greet"],{}] +INFO: Analysed target [["@","tutorial","tests","greet"],{}] +INFO: Target tainted ["test"]. +INFO: Discovered 5 actions, 3 trees, 1 blobs +INFO: Building [["@","tutorial","tests","greet"],{}]. +INFO: Processed 5 actions, 5 cache hits. +INFO: Artifacts built, logical paths are: + result [7ef22e9a431ad0272713b71fdc8794016c8ef12f:5:f] + stderr [8b137891791fe96927ad78e64b0aad7bded08bdc:1:f] + stdout [ae6c6813755da67954a4a562f6d2ef01578c3e89:60:f] + time-start [29370bb4a24f378a63986a2a803ea2a5b790a43e:11:f] + time-stop [29370bb4a24f378a63986a2a803ea2a5b790a43e:11:f] + (1 runfiles omitted.) greet output: Hello World! greet output: Hello Universe! + +INFO: Target tainted ["test"]. $ ``` -Note that `--log-limit 1` was just added to omit *justbuild*'s `INFO:` -prints. +To also strip *justbuild*'s `INFO:` prints from this output, the argument +`--log-limit 1` can be passed to the `just-mr` call. Our test binary does not have any useful options for directly -interacting with it. When working with test frameworks, it sometimes can +interact with it. When working with test frameworks, it sometimes can be desirable to get hold of the test binary itself for manual interaction. The running of the test binary is the last action associated with the test and the test binary is, of course, one of its @@ -175,12 +207,15 @@ inputs. ``` sh $ just-mr analyse --request-action-input -1 tests greet +INFO: Performing repositories setup +INFO: Found 3 repositories to set up +INFO: Setup finished, exec ["just","analyse","-C","...","--request-action-input","-1","tests","greet"] INFO: Requested target is [["@","tutorial","tests","greet"],{}] INFO: Request is input of action #-1 INFO: Result of input of action #-1 of target [["@","tutorial","tests","greet"],{}]: { "artifacts": { "runner": {"data":{"file_type":"x","id":"0647621fba9b22f0727fbef98104f3e398496e2f","size":1876},"type":"KNOWN"}, - "test": {"data":{"id":"465b690f0b006553c15fb059e2293011c20f74d4","path":"test_greet"},"type":"ACTION"}, + "test": {"data":{"id":"79e8adb53ca447c956069ce10ba5504d6cf0fd54","path":"test_greet"},"type":"ACTION"}, "test-args.json": {"data":{"file_type":"f","id":"0637a088a01e8ddab3bf3fa98dbe804cbde1a0dc","size":2},"type":"KNOWN"}, "test-launcher.json": {"data":{"file_type":"f","id":"0637a088a01e8ddab3bf3fa98dbe804cbde1a0dc","size":2},"type":"KNOWN"} }, @@ -216,17 +251,19 @@ can also be useful when debugging a build failure. ``` sh $ just-mr install -o work --request-action-input -1 tests greet +INFO: Performing repositories setup +INFO: Found 3 repositories to set up +INFO: Setup finished, exec ["just","install","-C","...","-o","work","--request-action-input","-1","tests","greet"] INFO: Requested target is [["@","tutorial","tests","greet"],{}] INFO: Request is input of action #-1 INFO: Analysed target [["@","tutorial","tests","greet"],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching INFO: Target tainted ["test"]. INFO: Discovered 5 actions, 3 trees, 1 blobs INFO: Building input of action #-1 of [["@","tutorial","tests","greet"],{}]. INFO: Processed 4 actions, 4 cache hits. INFO: Artifacts can be found in: /tmp/tutorial/work/runner [0647621fba9b22f0727fbef98104f3e398496e2f:1876:x] - /tmp/tutorial/work/test [00458536b165abdee1802e5fb7b0922e04c81491:20352:x] + /tmp/tutorial/work/test [306e9440ba06bf615f51d84cde0ce76563723c3d:24448:x] /tmp/tutorial/work/test-args.json [0637a088a01e8ddab3bf3fa98dbe804cbde1a0dc:2:f] /tmp/tutorial/work/test-launcher.json [0637a088a01e8ddab3bf3fa98dbe804cbde1a0dc:2:f] INFO: Target tainted ["test"]. @@ -291,9 +328,11 @@ Now we can run the shell test (i.e., build the test result): ``` sh $ just-mr build tests helloworld +INFO: Performing repositories setup +INFO: Found 3 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","tests","helloworld"] INFO: Requested target is [["@","tutorial","tests","helloworld"],{}] INFO: Analysed target [["@","tutorial","tests","helloworld"],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching INFO: Target tainted ["test"]. INFO: Discovered 5 actions, 4 trees, 0 blobs INFO: Building [["@","tutorial","tests","helloworld"],{}]. @@ -302,8 +341,8 @@ INFO: Artifacts built, logical paths are: result [7ef22e9a431ad0272713b71fdc8794016c8ef12f:5:f] stderr [e69de29bb2d1d6434b8b29ae775ad8c2e48c5391:0:f] stdout [e69de29bb2d1d6434b8b29ae775ad8c2e48c5391:0:f] - time-start [c31e92e6b16dacec4ee95beefcc6a688dbffee2d:11:f] - time-stop [c31e92e6b16dacec4ee95beefcc6a688dbffee2d:11:f] + time-start [7baa9405e8767e91c434af26e312267c3a114d06:11:f] + time-stop [7baa9405e8767e91c434af26e312267c3a114d06:11:f] (1 runfiles omitted.) INFO: Target tainted ["test"]. $ @@ -343,16 +382,18 @@ target `"ALL"`: ``` sh $ just-mr build tests ALL +INFO: Performing repositories setup +INFO: Found 3 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","tests","ALL"] INFO: Requested target is [["@","tutorial","tests","ALL"],{}] INFO: Analysed target [["@","tutorial","tests","ALL"],{}] -INFO: Export targets found: 0 cached, 0 uncached, 0 not eligible for caching INFO: Target tainted ["test"]. INFO: Discovered 8 actions, 5 trees, 1 blobs INFO: Building [["@","tutorial","tests","ALL"],{}]. INFO: Processed 8 actions, 8 cache hits. INFO: Artifacts built, logical paths are: - test_greet [251ba2038ccdb8ba1ae2f4e963751b9230b36646:177:t] - test_helloworld [63fa5954161b52b275b05c270e1626feaa8e178b:177:t] + test_greet [a06a9ce5ab1fbda1f5d0ee19bdd006d2664eef0a:177:t] + test_helloworld [01f32858b491ef5ef254ec3852ea83b8968ea9b2:177:t] INFO: Target tainted ["test"]. $ ``` diff --git a/doc/tutorial/third-party-software.md b/doc/tutorial/third-party-software.md index 38909ca4..4c57a11c 100644 --- a/doc/tutorial/third-party-software.md +++ b/doc/tutorial/third-party-software.md @@ -16,8 +16,8 @@ a native build description. For the remainder of this section, we expect to have the project files available resulting from successfully completing the tutorial section on -*Building C++ Hello World*. We will demonstrate how to use the -open-source project [fmtlib](https://github.com/fmtlib/fmt) as an +[*Building C++ Hello World*](./hello-world.md). We will demonstrate how to use +the open-source project [fmtlib](https://github.com/fmtlib/fmt) as an example for integrating third-party software to a *justbuild* project. Creating the target overlay layer for fmtlib @@ -57,8 +57,8 @@ code base's structure. It is also good practice to provide a top-level Let's create the overlay structure: ``` sh -$ mkdir -p fmt-layer/include/fmt -$ mkdir -p fmt-layer/src +$ mkdir -p ./fmt-layer/include/fmt +$ mkdir -p ./fmt-layer/src ``` The directory `include/fmt` contains only header files. As we want all @@ -203,6 +203,9 @@ repositories: ``` sh $ just-mr build helloworld +INFO: Performing repositories setup +INFO: Found 5 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","helloworld"] INFO: Requested target is [["@","tutorial","","helloworld"],{}] INFO: Analysed target [["@","tutorial","","helloworld"],{}] INFO: Export targets found: 0 cached, 0 uncached, 1 not eligible for caching @@ -219,6 +222,9 @@ repository `fmtlib` must be specified via the `--main` option: ``` sh $ just-mr --main fmtlib build fmt +INFO: Performing repositories setup +INFO: Found 4 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","fmt"] INFO: Requested target is [["@","fmtlib","","fmt"],{}] INFO: Analysed target [["@","fmtlib","","fmt"],{}] INFO: Export targets found: 0 cached, 0 uncached, 1 not eligible for caching @@ -245,7 +251,13 @@ versioning first: ``` sh $ git init . $ git add tutorial-defaults fmt-layer -$ git commit -m"fix compile flags and fmt targets layer" +$ git commit -m "fix compile flags and fmt targets layer" +[master (root-commit) 9c3a98b] fix compile flags and fmt targets layer + 4 files changed, 29 insertions(+) + create mode 100644 fmt-layer/TARGETS + create mode 100644 fmt-layer/include/fmt/TARGETS + create mode 100644 fmt-layer/src/TARGETS + create mode 100644 tutorial-defaults/CC/TARGETS ``` Note that `rules-cc` already is under Git versioning. @@ -305,6 +317,9 @@ the benefits of the target cache should be visible on the second build: ``` sh $ just-mr build helloworld +INFO: Performing repositories setup +INFO: Found 5 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","helloworld"] INFO: Requested target is [["@","tutorial","","helloworld"],{}] INFO: Analysed target [["@","tutorial","","helloworld"],{}] INFO: Export targets found: 0 cached, 1 uncached, 0 not eligible for caching @@ -313,8 +328,12 @@ INFO: Building [["@","tutorial","","helloworld"],{}]. INFO: Processed 7 actions, 7 cache hits. INFO: Artifacts built, logical paths are: helloworld [18d25e828a0176cef6fb029bfd83e1862712ec87:132736:x] +INFO: Backing up artifacts of 1 export targets $ $ just-mr build helloworld +INFO: Performing repositories setup +INFO: Found 5 repositories to set up +INFO: Setup finished, exec ["just","build","-C","...","helloworld"] INFO: Requested target is [["@","tutorial","","helloworld"],{}] INFO: Analysed target [["@","tutorial","","helloworld"],{}] INFO: Export targets found: 1 cached, 0 uncached, 0 not eligible for caching @@ -330,6 +349,13 @@ Note that in the second run the export target `"fmt"` was taken from cache and its 3 actions were eliminated, as their result has been recorded to the high-level target cache during the first run. +Also note the final message in the first run. As that was the first time the +export target `"fmt"` was built (i.e., target `"fmt"` with default +configuration flags), an entry in the target-level cache was created. The +log message showcases that when a remote-execution endpoint is involved, any +artifacts referenced by a built export target needs to be ensured to be +available. + Combining overlay layers for multiple projects ---------------------------------------------- @@ -478,7 +504,7 @@ provide as well. So there is a rule to import libraries that way and the actual packaging-build version of `libfmt`, as provided in `etc/import.pkgconfig`, looks as follows. -``` {.jsonc srcname="etc/import.pkgconfig/TARGETS.fmt} +``` {.jsonc srcname="etc/import.pkgconfig/TARGETS.fmt"} { "fmt": {"type": ["@", "rules", "CC/pkgconfig", "system_library"], "name": ["fmt"]} } |