Bazel Operations: Difference between revisions
Jump to navigation
Jump to search
(→query) |
(→query) |
||
Line 33: | Line 33: | ||
Executes a query language expression over a specified subgraph of the [[Bazel_Concepts#Build_Dependency_Graph|build dependency graph]]. | Executes a query language expression over a specified subgraph of the [[Bazel_Concepts#Build_Dependency_Graph|build dependency graph]]. | ||
=== | ===Find all Dependencies of a Dependency Graph Node=== | ||
=== | <syntaxhighlight lang='bash'> | ||
bazel query 'deps(//path/to/package:target)' | |||
</syntaxhighlight> | |||
Example: | |||
<syntaxhighlight lang='bash'> | |||
bazel query 'deps(//my_package:my_executable)' | |||
</syntaxhighlight> | |||
===Find All Targets=== | |||
<syntaxhighlight lang='bash'> | |||
bazel query '//:*' | |||
</syntaxhighlight> | |||
=Scenarios= | =Scenarios= |
Revision as of 20:18, 5 June 2024
External
- Command Line Reference https://bazel.build/reference/command-line-reference
Internal
Commands
build
bazel build //...
clean
fetch
info
bazel info
run
Runs the specified target. It inherits all options form build
.
bazel run --script_path=/Users/ovidiu/bin/something //a/something
Runs the specified target.
--script-path
Write a shell script that invokes the target. In this way, the target is not run from bazel - the bazel lock is released and the executable is connected to the terminal's stdin.
version
query
bazel query <options> <query-expression>
Executes a query language expression over a specified subgraph of the build dependency graph.
Find all Dependencies of a Dependency Graph Node
bazel query 'deps(//path/to/package:target)'
Example:
bazel query 'deps(//my_package:my_executable)'
Find All Targets
bazel query '//:*'
Scenarios
Clean Cache
bazel run @cached_local_xcode//:clear_cache; bazel clean --expunge; bazel shutdown; go clean -cache