summaryrefslogtreecommitdiff
path: root/doc/tutorial
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-08-12 18:42:18 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2022-08-19 18:38:49 +0200
commit57ab772966f971f8dfdd33a2b50dfcc5a049e58b (patch)
treefaf2a9a0a8e5ac78e7e61bd1e5251c73c7e3cb0a /doc/tutorial
parent3846569e57062c7a6eb91483b88596349024165b (diff)
downloadjustbuild-57ab772966f971f8dfdd33a2b50dfcc5a049e58b.tar.gz
Tutorial: Use sh instead shell for improved rendering
Diffstat (limited to 'doc/tutorial')
-rw-r--r--doc/tutorial/hello-world.org20
-rw-r--r--doc/tutorial/proto.org14
-rw-r--r--doc/tutorial/tests.org14
-rw-r--r--doc/tutorial/third-party-software.org6
4 files changed, 27 insertions, 27 deletions
diff --git a/doc/tutorial/hello-world.org b/doc/tutorial/hello-world.org
index 97be0513..e10782f8 100644
--- a/doc/tutorial/hello-world.org
+++ b/doc/tutorial/hello-world.org
@@ -54,7 +54,7 @@ can be accessed from within the ~"tutorial"~ repository via ~["@", "rules",
First, we need to declare where the root of our workspace is located by creating
an empty file ~ROOT~:
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ touch ROOT
#+END_SRC
@@ -101,7 +101,7 @@ int main() {
To build the ~helloworld~ target, we first need to setup the multi-repository
configuration for the ~tutorial~ project by running ~just-mr~:
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ CONF=$(/usr/src/justbuild/bin/just-mr.py -C repos.json setup tutorial)
#+END_SRC
@@ -113,7 +113,7 @@ build configuration to stdout, which is why we assigned it to the shell variable
once again whenever the ~repos.json~ file is modified. To see the generated
build configuration, run the following command:
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ cat $CONF
{
"main": "tutorial",
@@ -141,7 +141,7 @@ $
With the final configuration at hand, we can now build our ~helloworld~ target
by using the ~build~ subcommand:
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ just build -C $CONF helloworld
INFO: Requested target is [["@","tutorial","","helloworld"],{}]
INFO: Analysed target [["@","tutorial","","helloworld"],{}]
@@ -159,7 +159,7 @@ user-defined location on the file system. To also stage the produced artifact to
the working directory, use the ~install~ subcommand and specify the output
directory:
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ just install -C $CONF helloworld -o .
INFO: Requested target is [["@","tutorial","","helloworld"],{}]
INFO: Analysed target [["@","tutorial","","helloworld"],{}]
@@ -184,7 +184,7 @@ Linux distributions) ~cc~ and ~c++~ are used for C and C++ (variables ~"CC"~ and
provide a JSON object that sets different default variables. For instance, to
use Clang as C++ compiler for a single build invocation, you can use the
following command to provide an object that sets ~"CXX"~ to ~"clang++"~:
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ just build -C $CONF helloworld -D'{"CXX":"clang++"}'
INFO: Requested target is [["@","tutorial","","helloworld"],{"CXX":"clang++"}]
INFO: Analysed target [["@","tutorial","","helloworld"],{"CXX":"clang++"}]
@@ -210,7 +210,7 @@ repository independent of these definitions.
We will call the new file root ~tutorial-defaults~ and need to create a module
directory ~CC~ in it:
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ mkdir -p ./tutorial-defaults/CC
#+END_SRC
@@ -267,7 +267,7 @@ not have any defined bindings.
To rebuild the project, we need to rerun ~just-mr~ and call ~just~ afterwards:
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ CONF=$(/usr/src/justbuild/bin/just-mr.py -C repos.json setup tutorial)
$ just build -C $CONF helloworld
INFO: Requested target is [["@","tutorial","","helloworld"],{}]
@@ -358,7 +358,7 @@ as the appropriate artifacts of dependencies are automatically added to the
inputs of compile and link actions. The new binary can be built with the same
command as before (no need to rerun ~just-mr~):
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ just build -C $CONF helloworld
INFO: Requested target is [["@","tutorial","","helloworld"],{}]
INFO: Analysed target [["@","tutorial","","helloworld"],{}]
@@ -374,7 +374,7 @@ $
To only build the static library target ~"greet"~ from module ~"greet"~, run the
following command:
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ just build -C $CONF greet greet
INFO: Requested target is [["@","tutorial","greet","greet"],{}]
INFO: Analysed target [["@","tutorial","greet","greet"],{}]
diff --git a/doc/tutorial/proto.org b/doc/tutorial/proto.org
index 5ab50886..a1eab184 100644
--- a/doc/tutorial/proto.org
+++ b/doc/tutorial/proto.org
@@ -54,7 +54,7 @@ those would be added to the ~"deps"~ field.
When building the library, there's very little to do.
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ CONF=$(just-mr -C repos.json setup)
$ just build -C $CONF examples address
INFO: Requested target is [["@","","examples","address"],{}]
@@ -78,7 +78,7 @@ implicitly, when we exploited target-level caching for our external dependencies
and did not even construct the dependency graph for that target. A proto
library simply provides the dependency structure of the ~.proto~ files.
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ just analyse --dump-nodes - -C $CONF examples address
INFO: Requested target is [["@","","examples","address"],{}]
INFO: Result of target [["@","","examples","address"],{}]: {
@@ -177,7 +177,7 @@ The first time, we build a target that requires the proto compiler
a bit of time, as the proto compiler has to be built. But in follow-up
builds, also in different projects, the target-level cache is filled already.
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ just build -C $CONF examples add_person
...
$ just build -C $CONF examples add_person
@@ -195,7 +195,7 @@ $
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.
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ just analyse -C $CONF examples add_person --dump-actions -
INFO: Requested target is [["@","","examples","add_person"],{}]
INFO: Result of target [["@","","examples","add_person"],{}]: {
@@ -242,7 +242,7 @@ filled the target-level cache, we can have a look at all targets
still analysed. In the one anonymous target, we find again the
abstract node we discussed earlier.
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ just analyse -C $CONF examples add_person --dump-targets -
INFO: Requested target is [["@","","examples","add_person"],{}]
INFO: Result of target [["@","","examples","add_person"],{}]: {
@@ -332,7 +332,7 @@ the same proto library. And, indeed, analysing the test, we get
the expected additional targets and the one anonymous target is
reused by both binaries.
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ just analyse -C $CONF examples test --dump-targets -
INFO: Requested target is [["@","","examples","test"],{}]
INFO: Result of target [["@","","examples","test"],{}]: {
@@ -388,7 +388,7 @@ $
Finally, the test passes and the output is as expected.
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ just build -C $CONF examples test -Pwork/out.txt
INFO: Requested target is [["@","","examples","test"],{}]
INFO: Analysed target [["@","","examples","test"],{}]
diff --git a/doc/tutorial/tests.org b/doc/tutorial/tests.org
index 13dd3b39..3f68d829 100644
--- a/doc/tutorial/tests.org
+++ b/doc/tutorial/tests.org
@@ -84,14 +84,14 @@ root. However, in our case, we want to use the default runner and therefore it
is sufficient to create an empty module:
Create ~tutorial-defaults/CC/test/TARGETS~:
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ mkdir -p tutorial-defaults/CC/test
$ echo '{}' > tutorial-defaults/CC/test/TARGETS
#+END_SRC
Now we can run the test (i.e., build the test result):
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ CONF=$(/usr/src/justbuild/bin/just-mr.py -C repos.json setup tutorial)
$ just build -C $CONF greet test
INFO: Requested target is [["@","tutorial","greet","test"],{}]
@@ -127,7 +127,7 @@ command line, the ~-P~ option can be used. Argument to this option is the name
of the artifact that should be printed on the command line, in our case
~stdout~:
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ just build -C $CONF greet test --log-limit 1 -P stdout
greet output: Hello World!
@@ -144,7 +144,7 @@ Similarly, to create a shell test for testing the ~helloworld~ binary, a test
script must be provided:
~test.sh~:
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
set -e
[ "$(./helloworld)" = "Hello Universe!" ]
#+END_SRC
@@ -170,14 +170,14 @@ Similar to the binary tests, also for shell tests we need to provide at least an
empty module for the test rule defaults:
Create ~tutorial-defaults/shell/test/TARGETS~:
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ mkdir -p tutorial-defaults/shell/test
$ echo '{}' > tutorial-defaults/shell/test/TARGETS
#+END_SRC
Now we can run the shell test (i.e., build the test result):
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ just build -C $CONF test
INFO: Requested target is [["@","tutorial","","test"],{}]
INFO: Analysed target [["@","tutorial","","test"],{}]
@@ -232,7 +232,7 @@ test target combining the two tests above, add the following to the top-level
Now we can run all tests at once by just building the compound test target
~"all_tests"~:
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ just build -C $CONF all_tests
INFO: Requested target is [["@","tutorial","","all_tests"],{}]
INFO: Analysed target [["@","tutorial","","all_tests"],{}]
diff --git a/doc/tutorial/third-party-software.org b/doc/tutorial/third-party-software.org
index ef77cf0b..2e1fb77e 100644
--- a/doc/tutorial/third-party-software.org
+++ b/doc/tutorial/third-party-software.org
@@ -49,7 +49,7 @@ following structure for the overlay:
Let's create the overlay structure:
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ mkdir -p fmt-layer/include/fmt
$ mkdir -p fmt-layer/src
#+END_SRC
@@ -174,7 +174,7 @@ void greet(std::string const& s) {
Due to changes made to ~repos.json~, building this tutorial requires to rerun
~just-mr~, which will fetch the necessary sources for the external repositories:
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ CONF=$(/usr/src/justbuild/bin/just-mr.py -C repos.json setup tutorial)
$ just build -C $CONF helloworld
INFO: Requested target is [["@","tutorial","","helloworld"],{}]
@@ -249,7 +249,7 @@ high-level target caching will look like this:
Due to changes in the repository configuration, ~just-mr~ needs to be rerun and
the benefits of the target cache should be visible on the second build:
-#+BEGIN_SRC shell
+#+BEGIN_SRC sh
$ CONF=$(/usr/src/justbuild/bin/just-mr.py -C repos.json setup tutorial)
From ~/.cache/just/tmp-workspaces/file/tmp/tutorial/tutorial-defaults
* branch HEAD -> FETCH_HEAD