With the following steps, you will prepare the local workspace to build and run the Hello World Application with Pesto/Bazel.
Optional: Make a Copy
If you don't want to inflict changes to the original Hello World Application example, make a copy of the application first.
- Create an empty directory as a workspace for building and running a copy of your application.
- Copy the
amsr-vector-app-example-hello-worlddirectory of the original application (located in theExamplesdirectory of your delivery) to your newly created directory. - Rename the application copy in the newly created directory.

If you decide to make a copy and want to use that for the following steps, please adapt the given paths from all instructions (building, adapting, installing and running your application) to match the location of your copy.
Step 1: Create a Registry
The components of MICROSAR Adaptive are structured as Bazel modules. To make your project aware of all modules, you need to create a registry.
- Navigate to the directory of your application in your terminal.

This can either be the original Hello World Application directory or the copy you made in Optional: Make a Copy.
- Set the environmental variable
APP_DIRto the application directory which you want to work with in this tutorial: export APP_DIR="$(pwd)"
- Set the environmental variable
AMSR_SRC_DIRto the root directory of your delivery: export AMSR_SRC_DIR="$(pwd)/../.."
- Create a registry by running the Bazel integration tool located in your delivery:
"${AMSR_SRC_DIR}/Bazel/addon/bazel_integration/bazel_integration.py" create-registry \
--output bazel_registry \
--source-type local_path \
--module-base-path "${AMSR_SRC_DIR}" \
--relative-module-base-path \
--add-to-bazelrc .bazelrc \
--workspace .

Depending on your setup, you can adapt the arguments of the Bazel integration tool to create a registry as shown in the command above. General information about commands/arguments can be found by running the tool with --help.
--output:If you want to change the directory of the Bazel registry to be created, set this argument accordingly (e.g.../../bazel_registry).--source-type:
If you plan to host the BSW Package on a Git repository or HTTP server instead, adapt this argument value accordingly.--module-base-path:
If this argument is specified, module paths will be considered as relative to the specified value.--relative-module-base-path:
If this argument is specified, the--module-base-pathwill be considered as relative to the registry.- If neither
--module-base-pathnor--relative-module-base-pathare specified (default), all local paths in the registry will be considered absolute. --add-to-bazelrc:
If this parameter is specified, it will activate the registry in the specified.bazelrcfile (using a relative path to directory specified by--workspace).--workspace:
If you want to specify a different Bazel workspace, you can set the path to its root with this argument.
Step 2: Generate .bazelrc File
To provide configuration options of MICROSAR Adaptive, a .bazelrc file must be generated.
- Create the
.bazelrcfile: "${AMSR_SRC_DIR}/Bazel/addon/bazel_integration/bazel_integration.py" create-bazelrc \
--output .bazelrc_amsr \
--add-to-bazelrc .bazelrc \
--workspace .

General information about commands/arguments can be found by running the tool with --help.
--output:
If you want to change the directory of the.bazelrcfile to be created, set this argument accordingly (e.g.../../.bazelrc).--add-to-bazelrc:
This argument will import the generated file in the specified.bazelrcfile (using a relative path to the specified value of--workspace).--workspace:
If you want to specify a different Bazel workspace, you can set the path to its root with this argument.
Next step in the tutorial: Build Application Files