Bazel Concepts: Difference between revisions
(10 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
=Repository= | =Repository= | ||
{{External|https://bazel.build/concepts/build-ref#repositories}} | {{External|https://bazel.build/concepts/build-ref#repositories}} | ||
Also see: {{Internal|Gazelle#go_repository|<tt>go_repository</tt>}} | |||
=Package= | =Package= | ||
Line 46: | Line 39: | ||
Generated files, sometimes called derived files or output files, are not checked in the repository, but are generated from [[#Source_File|source files]]. | Generated files, sometimes called derived files or output files, are not checked in the repository, but are generated from [[#Source_File|source files]]. | ||
== | ==<span id='Go_Rules'></span>Rule== | ||
{{Internal|Bazel_BUILD_Files#Rules|<tt>BUILD</tt> Files | Rules}} | |||
=Label= | =Label= | ||
Line 65: | Line 54: | ||
=Platforms= | =Platforms= | ||
{{External|https://bazel.build/concepts/platforms}} | {{External|https://bazel.build/concepts/platforms}} | ||
=Hermeticity= | =Hermeticity= | ||
{{External|https://bazel.build/basics/hermeticity}} | {{External|https://bazel.build/basics/hermeticity}} | ||
Line 73: | Line 61: | ||
{{External|https://bazel.build/concepts/build-ref#workspace}} | {{External|https://bazel.build/concepts/build-ref#workspace}} | ||
A project's workspace is the directory where bazel looks for build inputs and <code>BUILD</code> files, and where it stores build outputs. The actual location is obtained with <code>[[Bazel_Operations#info|bazel info]]</code>. | A project's workspace is the directory where bazel looks for build inputs and <code>BUILD</code> files, and where it stores build outputs. The actual location is obtained with <code>[[Bazel_Operations#info|bazel info]]</code>. | ||
===<tt>WORKSPACE<tt> File=== | ===<tt>WORKSPACE</tt> File=== | ||
{{Internal|Bazel_WORKSPACE_File|<tt>WORKSPACE</tt> File}} | |||
==Bin== | ==Bin== | ||
Line 131: | Line 120: | ||
</font> | </font> | ||
==BUILD File== | ==<tt>BUILD</tt> File== | ||
{{Internal|Bazel_BUILD_Files#Overview|Bazel BUILD Files}} | {{Internal|Bazel_BUILD_Files#Overview|Bazel <tt>BUILD</tt> Files}} | ||
==<tt>WORKSPACE</tt> File== | |||
{{Internal|Bazel_WORKSPACE_File|<tt>WORKSPACE</tt> File}} | |||
=Starlark= | =Starlark= | ||
Line 150: | Line 141: | ||
<font color=darkkhaki>TODO: https://blog.bazel.build/2019/09/29/intellij-bazel-sync.html</font> | <font color=darkkhaki>TODO: https://blog.bazel.build/2019/09/29/intellij-bazel-sync.html</font> | ||
=< | =<span id='Analyzers'></span><span id='nogo_Setup'></span><span id='nogo_Configuration'><tt>nogo</tt>= | ||
{{Internal|nogo|<tt>nogo</tt>}} | |||
< | |||
{{ | |||
< | |||
=<span id='gazelle'></span><tt>Gazelle</tt>= | =<span id='gazelle'></span><tt>Gazelle</tt>= |
Latest revision as of 07:27, 23 November 2024
Internal
Repository
Also see:
Package
A package is the primary unit of code organization in a repository. A package is a collection of related files, and a specification, embodied by the BUILD file, of how these files can be used to produce artifacts.
The directory that contains the BUILD file is called the package directory. The package name is given by the name of the package directory.
The package contains all the files from the package directory, and recursively, from all its subdirectories, except those which themselves contain a BUILD file. From this definition, no file or directory may be a part of two different packages.
BUILD File
Package Group
A package group is a set of packages whose purpose is to limit accessibility of certain rules. Package groups are defined by the package_group
function. TODO: https://bazel.build/concepts/build-ref#targets.
Target
A target is either a file or a rule.
A package contains a collection of targets, defined in the package's BUILD file.
File
A file is a kind of target. There are two kinds of files: source files and generated files.
Source File
Source files are usually written by the efforts of people, and checked in to the repository.
Generated File
Generated files, sometimes called derived files or output files, are not checked in the repository, but are generated from source files.
Rule
Label
Dependencies
Build Dependency Graph
Also see:
Visibility
Platforms
Hermeticity
Directories
Workspace
A project's workspace is the directory where bazel looks for build inputs and BUILD
files, and where it stores build outputs. The actual location is obtained with bazel info
.
WORKSPACE File
Bin
The actual location is obtained with bazel info
.
Genfiles
The actual location is obtained with bazel info
.
Testlogs
The actual location is obtained with bazel info
.
Execution Root
The actual location is obtained with bazel info
.
Install Base
The actual location is obtained with bazel info
.
Output Base
The actual location is obtained with bazel info
.
Output Path
The actual location is obtained with bazel info
.
Package Path
%workspace%
. See Workspace.
Repository Cache
The actual location is obtained with bazel info
.
Files
Server Log
The actual location is obtained with bazel info
.
Command Log
The actual location is obtained with bazel info
.
.bazelrc
Project View File
Seems to be this one:
directories: # Add the directories you want added as source here # By default, we've added your entire workspace ('.') . # Automatically includes all relevant targets under the 'directories' above derive_targets_from_directories: true targets: # If source code isn't resolving, add additional targets that compile it here additional_languages: # Uncomment any additional languages you want supported # android # dart # go # javascript # kotlin # python # scala # typescript # Uncomment to run this target before every sync # gazelle_target: //:gazelle
BUILD File
WORKSPACE File
Starlark
Bazelisk
A bazel runner. as "Bazel binary location" in the Bazel IntelliJ Plugin.
Bazel and IntelliJ
Sync Process
The sync process queries Bazel for information and builds IntelliJ project structure to fid Bazel's model. It runs automatically during a project import, and manually by clicking on the sync icon in the menu bar, or partially syncing packages and individual files in contextual menus.
If the file is not reachable from Bazel targets, it will show up as unsynced in the IDE.
TODO: https://blog.bazel.build/2019/09/29/intellij-bazel-sync.html
nogo
Gazelle
vet
Also see nogo
.