Bazel vs. Make commands dictionary - magma/magma GitHub Wiki

Bazel vs. Make dictionary

Motivation

For the switchover from Make/CMake to Bazel in the Magma AGW this page aims to list the Bazel commands that replace the Make commands.

A detailed introduction to the Magma AGW with Bazel can be found in the Magma docs. For general notes on how to specify targets in Bazel see the official Bazel documentation.

:warning: Note:

  • Not all Make commands have analogous Bazel commands as some of the concepts or setups are different.
  • In Bazel there may be several ways of building or testing the same targets depending on what is needed. This list mentions only one way of replacing the Make commands, but depending on the use case there may be more convenient options.

The dictionary for the lte/gateway/Makefile

Make command Bazel command Description
make (all)/make build magma-build-agw (VM only) Build all magma services
make base_coverage Not necessary (use e.g. bazel coverage //lte/gateway/... [1]) Generate complete code structural information prior to any test execution
make build_% bazel build //target/path:service_name Build a given service
make build_c bazel build $(bazel query 'kind(cc_binary, //...)') Build all C/C++ services
make build_common bazel build //orc8r/gateway/c/common/... Build shared libraries
make build_connection_tracker bazel build //:connectiond Build connectiond
make build_envoy_controller bazel build //:envoy_controller Build envoy controller
make build_li_agent bazel build //:liagentd Build liagentd
make build_oai bazel build //:agw_of Build OAI
make build_python Not necessary Stop services and build Python environment
make build_sctpd bazel build //:sctpd Build sctpd
make build_session_manager bazel build //:sessiond Build session manager
make clean bazel clean (should not be needed) Clean all builds
make clean_envoy_controller Not necessary Clean envoy controller build
make clean_python Not necessary Clean Python-only builds
make coverage bazel coverage //lte/gateway/...[1] Combines results of other coverage calls (Not necessary anymore, can be replaced by bazel coverage)
make coverage_oai bazel coverage //lte/gateway/c/core/...[1] Generate OAI coverage data
make format_all (:x: Not longer supported) (:x: Not yet supported) Logic was moved to dev_tools/clang_format.sh. Runs clang formatting.
make restart magma-restart Restart all services
make run cd $MAGMA_ROOT && bazel/scripts/build_and_run_bazelified_agw.sh or follow the steps outlined in the docs. Build and run all services
make start magma-start Start all services
make status magma-status Status of all services
make stop magma-stop Stop all services
make test bazel test //lte/gateway/... Run all tests in this folder
make test_% bazel test //target/path/... Run tests for a service
make test_c bazel test $(bazel query 'kind(cc_*, //...)') Run all C/C++ tests
make test_common bazel test //orc8r/gateway/c/common/... Run all tests in magma_common
make test_li_agent bazel test //lte/gateway/c/li_agent/... Run all tests for Liagentd
make test_oai bazel test //lte/gateway/c/core/... Run all OAI-specific tests
make test_oai_runtime Not necessary, bazel already reports the runtimes. Run all OAI-specific tests with report about the running time
make test_python bazel test $(bazel query 'kind(py_*, //...)') Run all Python-specific tests
make test_python_service bazel test //target/path/... Run all Python-specific tests for a given service
make test_sctpd bazel test //lte/gateway/c/sctpd/... Run all tests for sctpd
make test_sudo_python bazel/scripts/run_sudo_tests.sh Run Python tests that require sudo (datapath, etc.)

The dictionary for the lte/gateway/python/Makefile

Make command Bazel command Description
make buildenv Not necessary Set up python env with swagger, protos, patches
make test_all bazel test //lte/gateway/python/... && bazel/scripts/run_sudo_tests.sh Run python unit and sudo tests
make unit_tests bazel test //orc8r/gateway/python/... //lte/gateway/python/... Run all python unit tests
make coverage Not necessary (use e.g. bazel coverage //lte/gateway/...[1]) Install pip packages
make check (:x: Not yet supported) Check codestyle and linter
make clean bazel clean (should not be needed) Clean outputs

The dictionary for the lte/gateway/python/integ_tests/Makefile

Make command Bazel command Description
make default Not necessary Set up the environment for the integ tests
make precommit bazel/scripts/run_integ_tests.sh –precommit Run precommit tests
make integ_test bazel/scripts/run_integ_tests.sh Run integ tests
make fed_integ_test (Not AGW) Run FEG integ tests
make nonsanity bazel/scripts/run_integ_tests.sh –nonsanity Run non-sanity integ tests

[1] Generated coverage data can be found in $MAGMA_ROOT/bazel-out/_coverage/_coverage_report.dat. The data can be further processed with, e.g., genhtml via genhtml bazel-out/_coverage/_coverage_report.dat --output-directory path/to/output/directory.