OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 # Generate the binary proto form of "file_types" from the ascii proto. | 5 # Generate the binary proto form of "file_types" from the ascii proto. |
6 action("make_file_types_protobuf") { | 6 action("make_file_types_protobuf") { |
7 script = "gen_file_type_proto.py" | 7 script = "gen_file_type_proto.py" |
8 | 8 |
9 # The output goes in $target_gen_dir since that's where | 9 # The output goes in $target_gen_dir since that's where |
10 # chrome/browser/browser_resources.grd will look for it. | 10 # chrome/browser/browser_resources.grd will look for it. |
11 | 11 |
12 input_filename = "download_file_types.asciipb" | 12 input_filename = "download_file_types.asciipb" |
13 output_filename = "$target_gen_dir/download_file_types.pb" | 13 output_filename = "$target_gen_dir/download_file_types.pb" |
14 python_path_root = "$root_build_dir/pyproto" | 14 python_path_root = "$root_build_dir/pyproto" |
15 python_path_safe_browsing = "$python_path_root/chrome/common/safe_browsing" | 15 python_path_safe_browsing = "$python_path_root/chrome/common/safe_browsing" |
16 | 16 |
| 17 # Pick an architecture to generate for. These string match those |
| 18 # in the python script. |
| 19 if (is_android) { |
| 20 target_arch = "android" |
| 21 } else if (is_chromeos) { |
| 22 target_arch = "chromeos" |
| 23 } else if (is_win) { |
| 24 target_arch = "win" |
| 25 } else if (is_mac) { |
| 26 target_arch = "mac" |
| 27 } else if (is_linux) { |
| 28 target_arch = "linux" |
| 29 } else { |
| 30 # This will cause the script to fail. |
| 31 target_arch = "unknown_target_arch" |
| 32 } |
| 33 |
17 inputs = [ | 34 inputs = [ |
18 script, | 35 script, |
19 input_filename, | 36 input_filename, |
20 ] | 37 ] |
21 | 38 |
22 # This script requires the generated python proto code | 39 # This script requires the generated python proto code |
23 deps = [ | 40 deps = [ |
24 "//chrome/common/safe_browsing:proto", | 41 "//chrome/common/safe_browsing:proto", |
25 "//third_party/protobuf:py_proto", | 42 "//third_party/protobuf:py_proto", |
26 ] | 43 ] |
27 | 44 |
28 outputs = [ | 45 outputs = [ |
29 output_filename, | 46 output_filename, |
30 ] | 47 ] |
31 | 48 |
32 args = [ | 49 args = [ |
33 "-w", | 50 "-w", |
| 51 "-t", |
| 52 target_arch, |
34 "-i", | 53 "-i", |
35 rebase_path(input_filename, root_build_dir), | 54 rebase_path(input_filename, root_build_dir), |
36 "-o", | 55 "-o", |
37 rebase_path(output_filename, root_build_dir), | 56 rebase_path(output_filename, root_build_dir), |
38 "-p", | 57 "-p", |
39 rebase_path(python_path_root, root_build_dir), | 58 rebase_path(python_path_root, root_build_dir), |
40 "-p", | 59 "-p", |
41 rebase_path(python_path_safe_browsing, root_build_dir), | 60 rebase_path(python_path_safe_browsing, root_build_dir), |
42 ] | 61 ] |
43 } | 62 } |
OLD | NEW |