简体   繁体   English

bazel build //my_folder/my_subfolder:node_modules 中的 //(双正斜杠)和 :(冒号)是什么意思?

[英]What is the meaning of // (double forward slash) and : (colon) in bazel build //my_folder/my_subfolder:node_modules?

I do not understand this syntax:我不明白这个语法:

bazel build //<my_dir>/<my_subdir>:node_modules

I believe // is to specify a route relative to a WORKSPACE, but the meaning of : is unclear to me.我相信, //是指定相对于工作空间中的路线,但含义:我不清楚。

Similarly, you can use bazel build ... and that seems to build all subfolders within a WORSKPACE.同样,您可以使用bazel build ...这似乎在 WORSKPACE 中构建所有子文件夹。

What are all these strange symbols?这些奇怪的符号是什么? Where are they documented?它们在哪里记录?

The documentation for this is here: https://docs.bazel.build/versions/master/build-ref.html文档在这里: https : //docs.bazel.build/versions/master/build-ref.html

Additional syntax related to external dependencies is documented here: https://docs.bazel.build/versions/master/external.html此处记录了与外部依赖项相关的其他语法: https : //docs.bazel.build/versions/master/external.html

Things like ... are called target patterns and are documented here: https://docs.bazel.build/versions/master/guide.html#target-patterns诸如...之类的...被称为目标模式,并在此处记录: https : //docs.bazel.build/versions/master/guide.html#target-patterns

I believe // is to specify a route relative to a WORKSPACE我相信//是指定一个相对于 WORKSPACE 的路由

Correct, // starts an "absolute label"正确, //开始一个“绝对标签”

meaning of :的意思:

This separates the package (on the left) from the target name in the package (on the right).这将包(左侧)与包中的目标名称(右侧)分开。

you can use bazel build ... and that seems to build all subfolders within a WORSKPACE您可以使用bazel build ...这似乎在 WORSKPACE 中构建所有子文件夹

That will build all targets in the current package (ie, current working directory) and subpackages of the current package.这将构建当前包(即当前工作目录)和当前包的子包中的所有目标。 If you're at the root of the workspace, then it's the same as //... which will build everything.如果您位于工作区的根目录,则它与//...相同,它将构建所有内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM