Skip to content
Snippets Groups Projects
Commit f9a0d908 authored by Roland McGrath's avatar Roland McGrath Committed by CQ bot account: commit-bot@chromium.org
Browse files

[build] Force a fidl_library() with .test.fidl sources to be testonly

FIDL source files must be named `*.fidl` and if source files are
named `*.test.fidl` then the library using it can only be used in
test code.  So the fidl_library() template automatically sets
`testonly=true` if its sources list include any `*.test.fidl`.
It's not allowed to override this with explicit `testonly=false`.

Change-Id: I7bb79327be678efbfd293b9fa2baaad55832c9df
parent a3684085
No related branches found
No related tags found
No related merge requests found
......@@ -147,6 +147,18 @@ template("fidl_library") {
assert(defined(invoker.sources),
"fidl_library(\"$target_name\") must set `sources`")
foreach(file, invoker.sources) {
assert(get_path_info(file, "extension") == "fidl",
"fidl_library() sources should be `.fidl` files, not $file")
file = get_path_info(file, "name")
if (get_path_info(file, "extension") == "test") {
assert(!defined(invoker.testonly) || invoker.testonly,
"fidl_library(\"$target_name\") is implicitly testonly since " +
" it has `.test.fidl` sources; cannot use testonly=false!")
invoker.testonly = true
}
}
fidl_target = target_name
# TODO(mcgrathr): temporary until everything is renamed with . names
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment