Commit 556f4b4d authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

[docs] Update documentation about sources assignment filter

All of Chromium and third-party dependencies have been converted
away from sources assignment filter, so update the documentation
to say that the conversion is complete.

Bug: 1018739
Change-Id: Ia47e6e6054744e5aeaccef638e5b081af1abdfe7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2471418
Commit-Queue: Nico Weber <thakis@chromium.org>
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817047}
parent 82b0d994
...@@ -4,52 +4,15 @@ There is a [strong][0] [consensus][1] that the set_sources_assignment_filter ...@@ -4,52 +4,15 @@ There is a [strong][0] [consensus][1] that the set_sources_assignment_filter
feature from GN is a mis-feature and should be removed. This requires that feature from GN is a mis-feature and should be removed. This requires that
Chromium's BUILD.gn file stop using the feature. Chromium's BUILD.gn file stop using the feature.
This conversion is now complete. There are a few straggler calls to
`set_sources_assignment_filter([])` that are no longer needed, but
the Chromium build now no longer sets a default sources assignment filter,
and all build files must manage `sources` with explicit if statements.
## Why convert
When set_sources_assignment_filter is called, it configures a list of patterns
that will be used to filter names every time a variable named "sources" is
assigned a value.
Historically, Chromium used to call this function in build/BUILDCONFIG.gn thus
causing the patterns to be applied to every BUILD.gn file in the project. This
had multiple drawbacks:
1. the configuration of the list of patterns is located far from the point
where they are applied and developer are usually confused when a file
they add to a rule is not build due to those pattern
2. the filtering is applied to every assignment to a variable named "sources"
after interpreting the string as a relative filename, thus build breaks if
one of the forbidden pattern is used in unexpected location (like naming
the build directory out/linux, or having mac/ in path to SDK, ...)
3. the filtering is applied to every assignment to a variable named "sources"
in the whole project, thus it has significant negative impact on the
performance of gn
Since October 2020, the filter is no longer used. Since October 2020, the filter is no longer used.
## Conversion pattern Chromium build does not set a default sources assignment filter, and all build
files must manage `sources` with explicit `if` statements.
To convert a BUILD.gn file it is necessary to change the following:
``` ## Explicit assignment
source_set("foo") {
sources = [
"foo.h",
"foo_mac.mm",
"foo_win.cc",
"foo_linux.cc",
]
}
```
to If you have a target that have platform specific implementation files, you can
use the following pattern:
``` ```
source_set("foo") { source_set("foo") {
...@@ -74,9 +37,5 @@ to ...@@ -74,9 +37,5 @@ to
} }
``` ```
Since the second pattern never assign a name that will be filtered out, then
it is compatible whether the set_sources_assignment_filter feature is used or
not.
[0]: https://groups.google.com/a/chromium.org/d/topic/chromium-dev/hyLuCU6g2V4/discussion [0]: https://groups.google.com/a/chromium.org/d/topic/chromium-dev/hyLuCU6g2V4/discussion
[1]: https://groups.google.com/a/chromium.org/d/topic/gn-dev/oQcYStl_WkI/discussion [1]: https://groups.google.com/a/chromium.org/d/topic/gn-dev/oQcYStl_WkI/discussion
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment