Commit af001fe4 authored by Harley Li's avatar Harley Li Committed by Commit Bot

GN "component" template: if static lib, verify it has source file(s)

Originally the condition check catches the case where 'sources' is
absent in the invoking target, but doesn't catch the case where the list
is empty. The comment given in the code says we need to ensure the list
contains at least one source to avoid building an empty static lib.

Change-Id: Iaafda906bf177d95d8908498b042f15c28cbd271
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2215581Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Harley Li <hhli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772003}
parent 0c8b5b4e
......@@ -641,7 +641,7 @@ template("component") {
assert(invoker.static_component_type == "static_library" ||
invoker.static_component_type == "source_set")
_component_mode = invoker.static_component_type
} else if (!defined(invoker.sources)) {
} else if (!defined(invoker.sources) || invoker.sources == []) {
# When there are no sources defined, use a source set to avoid creating
# an empty static library (which generally don't work).
_component_mode = "source_set"
......
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