Index: build/config/BUILD.gn |
diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn |
index abd6c2f09d97144ac1b22973600d040ba3392238..e0dcb893142a201575db9074622ba72445597d01 100644 |
--- a/build/config/BUILD.gn |
+++ b/build/config/BUILD.gn |
@@ -27,6 +27,32 @@ declare_args() { |
dcheck_always_on = false |
} |
+# Because of the source assignment filter, many targets end up over-filtering |
+# their sources if the output directory contains a platform name. Assert that |
+# this doesn't happen. http://crbug.com/548283 |
+template("assert_valid_out_dir") { |
+ assert(target_name != "") # Mark as used. |
+ set_sources_assignment_filter([ |
brettw
2016/02/16 19:19:58
This is a clever idea!
I *think* the default sour
agrieve
2016/02/16 20:04:20
I had thought the same, but then figured it wouldn
|
+ "*\bandroid/*", |
+ "*\bchromeos/*", |
+ "*\bcocoa/*", |
+ "*\bios/*", |
+ "*\blinux/*", |
+ "*\bmac/*", |
+ "*\bposix/*", |
+ "*\bwin/*", |
+ ]) |
+ |
+ assert( |
+ invoker.sources == invoker.actual_sources, |
+ "Do not use a platform name in your output directory (found \"$root_build_dir\"). http://crbug.com/548283") |
+} |
+ |
+assert_valid_out_dir("_check_output_dir_has_no_platform_name") { |
+ actual_sources = [ "$root_build_dir/foo" ] |
+ sources = actual_sources |
+} |
+ |
# TODO(brettw) Most of these should be removed. Instead of global feature |
# flags, we should have more modular flags that apply only to a target and its |
# dependents. For example, depending on the "x11" meta-target should define |