Commit 63bf6bc7 authored by Jens Widell's avatar Jens Widell Committed by Commit Bot

Generate jumbo source files into `invoker.target_gen_dir`

This typically means a path based on the directory containing the
BUILD.gn file that defined the jumbo target, which generally makes
sense.

The old solution of finding a suitable directory by looking at the
directories containing the target's source files can generate the
same name for multiple targets, meaning such targets can't all be
jumbo enabled. This is rare, but is the case for the targets

  //extensions:test_support

and

  //extensions/browser:test_support

since the former has source files from //extensions/browser/ that
end up being used as the target directory.

Change-Id: Ie0c9ee2fcef25c6b0705e0fed3f1dce060459537
Reviewed-on: https://chromium-review.googlesource.com/924023Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Jens Widell <jl@opera.com>
Cr-Commit-Position: refs/heads/master@{#537623}
parent 5bf513dc
...@@ -84,31 +84,7 @@ template("internal_jumbo_target") { ...@@ -84,31 +84,7 @@ template("internal_jumbo_target") {
invoker_sources = [] invoker_sources = []
} }
if (invoker_sources != []) { gen_target_dir = invoker.target_gen_dir
gen_target_dir = get_path_info(invoker_sources[0], "gen_dir")
assert(excluded_sources != [] || true) # Prevent "unused variable".
# Find the gen_target_dir directory with shortest path. Short paths
# are nice in themselves since they mean shorter error messages and
# fewer bytes to parse, but the currently deployed version of ninja
# also has a limitation where it only allows 32 path components in
# Windows.
# See https://crbug.com/738186 and
# https://github.com/ninja-build/ninja/issues/1161
foreach(source_file, invoker_sources) {
possibly_better_gen_target_dir = get_path_info(gen_target_dir, "dir")
possibly_better_gen_target_dir_2 =
get_path_info(possibly_better_gen_target_dir, "dir")
alt_gen_target_dir = get_path_info(source_file, "gen_dir")
if (alt_gen_target_dir == possibly_better_gen_target_dir ||
alt_gen_target_dir == possibly_better_gen_target_dir_2) {
gen_target_dir = alt_gen_target_dir
}
}
} else {
gen_target_dir = "<will not be used>" # Will not result in
# anything used anyway.
}
assert(gen_target_dir != "") # Prevent "unused variable". assert(gen_target_dir != "") # Prevent "unused variable".
......
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