Index: BUILD.gn |
diff --git a/BUILD.gn b/BUILD.gn |
index 5956fa4c671574ec55b74966ec7dbd1d399ee48a..29b94428e7ce43ef084c39d477d7ccdd568dabef 100644 |
--- a/BUILD.gn |
+++ b/BUILD.gn |
@@ -873,3 +873,29 @@ group("chromium_builder_perf") { |
} |
} |
} |
+ |
+# 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") { |
+ # List copied from //build/config/BUILDCONFIG.gn. |
+ set_sources_assignment_filter([ |
+ "*\bandroid/*", |
+ "*\bchromeos/*", |
+ "*\bcocoa/*", |
+ "*\bios/*", |
+ "*\blinux/*", |
+ "*\bmac/*", |
+ "*\bposix/*", |
+ "*\bwin/*", |
+ ]) |
+ assert(target_name != "") # Mark as used. |
+ sources = invoker.actual_sources |
+ assert( |
+ 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("_unused") { |
+ actual_sources = [ "$root_build_dir/foo" ] |
+} |