OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 # Paths to the JSON files are kind of gross. They're stored in the gypi | 5 # Paths to the JSON files are kind of gross. They're stored in the gypi |
6 # relative to //components, since that's the working directory gyp seems | 6 # relative to //components, since that's the working directory gyp seems |
7 # to use for all of the components. When we depend on them here, we need | 7 # to use for all of the components. When we depend on them here, we need |
8 # to remove the leading domain_reliability, since *our* working directory | 8 # to remove the leading domain_reliability, since *our* working directory |
9 # is one level deeper. When we call bake_in_configs.py, we need to give | 9 # is one level deeper. When we call bake_in_configs.py, we need to give |
10 # it a properly-rebased path to //components so it can properly join the | 10 # it a properly-rebased path to //components so it can properly join the |
11 # paths relative to that and find the JSON files. | 11 # paths relative to that and find the JSON files. |
12 | 12 |
13 baked_in_configs_gypi = exec_script("//build/gypi_to_gn.py", | 13 baked_in_configs_gypi = exec_script("//build/gypi_to_gn.py", |
14 [ rebase_path("baked_in_configs.gypi") ], | 14 [ rebase_path("baked_in_configs.gypi") ], |
15 "scope", | 15 "scope", |
16 [ "baked_in_configs.gypi" ]) | 16 [ "baked_in_configs.gypi" ]) |
| 17 |
| 18 # The config file names in the .gypi are relative to "//components". |
17 baked_in_configs = | 19 baked_in_configs = |
18 rebase_path(baked_in_configs_gypi.baked_in_configs, "domain_reliability") | 20 rebase_path(baked_in_configs_gypi.baked_in_configs, ".", "//components") |
19 | 21 |
20 action("bake_in_configs") { | 22 # TODO(brettw) enable once GN supports response_file_contents for actions. |
21 visibility = [ ":*" ] | 23 if (false) { |
22 script = "bake_in_configs.py" | 24 action("bake_in_configs") { |
| 25 visibility = [ ":*" ] |
| 26 script = "bake_in_configs.py" |
23 | 27 |
24 inputs = baked_in_configs | 28 inputs = baked_in_configs |
25 outputs = [ | 29 output_file = "$target_gen_dir/baked_in_configs.cc" |
26 "$target_gen_dir/baked_in_configs.cc", | 30 outputs = [ |
27 ] | 31 output_file, |
| 32 ] |
28 | 33 |
29 # The actual list of JSON files will overflow the command line length limit | 34 # The JSON file list is too long for the command line on Windows, so put |
30 # on Windows, so pass the name of the .gypi file and bake_in_configs.py will | 35 # them in a response file. |
31 # read the filenames out of it manually. | 36 response_file_contents = rebase_path(inputs, root_build_dir) |
32 args = [ rebase_path("//components", root_build_dir) ] + | 37 args = [ |
33 [ rebase_path("baked_in_configs.gypi", root_build_dir) ] + | 38 "--file-list", |
34 rebase_path(outputs, root_build_dir) | 39 "{{response_file_name}}", |
| 40 "--output", |
| 41 rebase_path(output_file, root_build_dir), |
| 42 ] |
| 43 } |
| 44 } else { |
| 45 action("bake_in_configs") { |
| 46 visibility = [ ":*" ] |
| 47 script = "bake_in_configs.py" |
| 48 |
| 49 inputs = baked_in_configs |
| 50 output_file = "$target_gen_dir/baked_in_configs.cc" |
| 51 outputs = [ |
| 52 output_file, |
| 53 ] |
| 54 |
| 55 # The actual list of JSON files will overflow the command line length limit |
| 56 # on Windows, so pass the name of the .gypi file and bake_in_configs.py will |
| 57 # read the filenames out of it manually. |
| 58 args = [ |
| 59 "--gypi-file=" + rebase_path("baked_in_configs.gypi", root_build_dir), |
| 60 "--gypi-relative-to=" + rebase_path("//components", root_build_dir), |
| 61 "--output=" + rebase_path(output_file, root_build_dir), |
| 62 ] |
| 63 } |
35 } | 64 } |
36 | 65 |
37 component("domain_reliability") { | 66 component("domain_reliability") { |
38 sources = [ | 67 sources = [ |
39 "baked_in_configs.h", | 68 "baked_in_configs.h", |
40 "beacon.cc", | 69 "beacon.cc", |
41 "beacon.h", | 70 "beacon.h", |
42 "clear_mode.h", | 71 "clear_mode.h", |
43 "config.cc", | 72 "config.cc", |
44 "config.h", | 73 "config.h", |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] | 121 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] |
93 | 122 |
94 deps = [ | 123 deps = [ |
95 ":domain_reliability", | 124 ":domain_reliability", |
96 "//base", | 125 "//base", |
97 "//base/test:test_support", | 126 "//base/test:test_support", |
98 "//net:test_support", | 127 "//net:test_support", |
99 "//testing/gtest", | 128 "//testing/gtest", |
100 ] | 129 ] |
101 } | 130 } |
OLD | NEW |