Merge pull request #6813 from adityasharad/docs/database-create-bazel

CLI docs: Add example for creating a database using a Bazel build command
This commit is contained in:
Cornelius Riemenschneider
2021-10-08 16:56:10 +02:00
committed by GitHub

View File

@@ -221,6 +221,26 @@ commands that you can specify for compiled languages.
codeql database create java-database --language=java --command='ant -f build.xml'
- Project built using Bazel::
# Navigate to the Bazel workspace.
# Before building, remove cached objects
# and stop all running Bazel server processes.
bazel clean --expunge
# Build using the following Bazel flags, to help CodeQL detect the build:
# `--spawn_strategy=local`: build locally, instead of using a distributed build
# `--nouse_action_cache`: turn off build caching, which might prevent recompilation of source code
# `--noremote_accept_cached`, `--noremote_upload_local_results`: avoid using a remote cache
codeql database create new-database --language=<language> \
--command='bazel build --spawn_strategy=local --nouse_action_cache --noremote_accept_cached --noremote_upload_local_results //path/to/package:target'
# After building, stop all running Bazel server processes.
# This ensures future build commands start in a clean Bazel server process
# without CodeQL attached.
bazel shutdown
- Project built using a custom build script::
codeql database create new-database --language=<language> --command='./scripts/build.sh'