OLD | NEW |
1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/split_static_library.gni") # When someone uses that target_type | 5 import("//build/split_static_library.gni") # When someone uses that target_type |
6 | 6 |
7 declare_args() { | 7 declare_args() { |
8 # If true, use a jumbo build (files compiled together) to speed up | 8 # If true, use a jumbo build (files compiled together) to speed up |
9 # compilation. | 9 # compilation. |
10 use_jumbo_build = false | 10 use_jumbo_build = false |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 | 60 |
61 excluded_sources = [] | 61 excluded_sources = [] |
62 if (defined(invoker.jumbo_excluded_sources)) { | 62 if (defined(invoker.jumbo_excluded_sources)) { |
63 excluded_sources += invoker.jumbo_excluded_sources | 63 excluded_sources += invoker.jumbo_excluded_sources |
64 } | 64 } |
65 | 65 |
66 invoker_sources = invoker.sources | 66 invoker_sources = invoker.sources |
67 gen_target_dir = get_path_info(invoker_sources[0], "gen_dir") | 67 gen_target_dir = get_path_info(invoker_sources[0], "gen_dir") |
68 assert(excluded_sources != [] || true) # Prevent "unused variable". | 68 assert(excluded_sources != [] || true) # Prevent "unused variable". |
| 69 |
| 70 # Find the gen_target_dir directory with shortest path. Short paths |
| 71 # are nice in themselves since they mean shorter error messages and |
| 72 # fewer bytes to parse, but the currently deployed version of ninja |
| 73 # also has a limitation where it only allows 32 path components in |
| 74 # Windows. |
| 75 # See https://crbug.com/738186 and |
| 76 # https://github.com/ninja-build/ninja/issues/1161 |
| 77 foreach(source_file, invoker.sources) { |
| 78 possibly_better_gen_target_dir = get_path_info(gen_target_dir, "dir") |
| 79 possibly_better_gen_target_dir_2 = |
| 80 get_path_info(possibly_better_gen_target_dir, "dir") |
| 81 alt_gen_target_dir = get_path_info(source_file, "gen_dir") |
| 82 if (alt_gen_target_dir == possibly_better_gen_target_dir || |
| 83 alt_gen_target_dir == possibly_better_gen_target_dir_2) { |
| 84 gen_target_dir = alt_gen_target_dir |
| 85 } |
| 86 } |
| 87 |
69 assert(gen_target_dir != "") # Prevent "unused variable". | 88 assert(gen_target_dir != "") # Prevent "unused variable". |
70 | 89 |
71 if (use_jumbo_build_for_target) { | 90 if (use_jumbo_build_for_target) { |
72 jumbo_files = [] | 91 jumbo_files = [] |
73 | 92 |
74 # Split the sources list into chunks that are not excessively large | 93 # Split the sources list into chunks that are not excessively large |
75 files_per_chunk = jumbo_file_merge_limit | 94 files_per_chunk = jumbo_file_merge_limit |
76 current_file_index = 0 | 95 current_file_index = 0 |
77 next_chunk_start = 0 | 96 next_chunk_start = 0 |
78 next_chunk_number = 1 | 97 next_chunk_number = 1 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 forward_variables_from(invoker, "*", variables_to_not_forward) | 171 forward_variables_from(invoker, "*", variables_to_not_forward) |
153 } | 172 } |
154 } | 173 } |
155 | 174 |
156 set_defaults("jumbo_target") { | 175 set_defaults("jumbo_target") { |
157 # This sets the default list of configs when the content_source_set target | 176 # This sets the default list of configs when the content_source_set target |
158 # is defined. The default_compiler_configs comes from BUILDCONFIG.gn and | 177 # is defined. The default_compiler_configs comes from BUILDCONFIG.gn and |
159 # is the list normally applied to static libraries and source sets. | 178 # is the list normally applied to static libraries and source sets. |
160 configs = default_compiler_configs | 179 configs = default_compiler_configs |
161 } | 180 } |
OLD | NEW |