diff options
author | Googler <noreply@google.com> | 2018-05-03 11:55:30 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-05-03 11:57:06 -0700 |
commit | 507acf9135b0a0063cb640d8ba4243927f308a09 (patch) | |
tree | 89c01375c91daee466f05f8f37d2a62ece5936a9 | |
parent | f3a01a5871b1df6edcf5d257b97f6b2d72297aba (diff) |
Update recursive glob docs.
PiperOrigin-RevId: 195288040
-rw-r--r-- | site/docs/skylark/build-style.md | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/site/docs/skylark/build-style.md b/site/docs/skylark/build-style.md index c48484a4d6..30bae9a90e 100644 --- a/site/docs/skylark/build-style.md +++ b/site/docs/skylark/build-style.md @@ -143,17 +143,29 @@ dependencies of several targets into a variable reduces maintainability, makes it impossible for tools to change the dependencies of a target and can lead to unused dependencies. - ## Globs -Do not use recursive globs (e.g., `glob(["**/*.java"])`). Recursive globs -make BUILD files difficult to read, as they skip subdirectories containing -BUILD files. Non-recursive globs are generally acceptable, see -language-specific advice below for details. - Indicate "no targets" with `[]`. Do not use a glob that matches nothing: it is more error-prone and less obvious than an empty list. +### Recursive + +Do not use recursive globs (for example, `glob(["**/*.java"])`). + +Recursive globs make BUILD files difficult to reason about because they skip +subdirectories containing BUILD files. + +Recursive globs are generally less efficient than having a BUILD file per +directory with a dependency graph defined between them as this enables better +forge caching and parallelism. + +We recommend authoring a BUILD file per directory and defining a dependency +graph between them instead. + +### Non-recursive + +Non-recursive globs are generally acceptable. + ## Other conventions * Use uppercase and underscores to declare constants (e.g. `GLOBAL_CONSTANT`), |