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 # TODO(nparker): reduce the duplication between these two, somehow. | |
6 | |
5 # Generate the binary proto form of "file_types" from the ascii proto. | 7 # Generate the binary proto form of "file_types" from the ascii proto. |
6 action("make_file_types_protobuf") { | 8 action("make_file_types_protobuf") { |
7 script = "gen_file_type_proto.py" | 9 script = "gen_file_type_proto.py" |
8 | 10 |
9 # The output goes in $target_gen_dir since that's where | 11 # The output goes in $target_gen_dir since that's where |
10 # chrome/browser/browser_resources.grd will look for it. | 12 # chrome/browser/browser_resources.grd will look for it. |
11 | 13 |
12 input_filename = "download_file_types.asciipb" | 14 input_filename = "download_file_types.asciipb" |
13 output_filename = "$target_gen_dir/download_file_types.pb" | 15 output_dir = target_gen_dir |
16 output_basename = "download_file_types.pb" | |
14 python_path_root = "$root_build_dir/pyproto" | 17 python_path_root = "$root_build_dir/pyproto" |
15 python_path_safe_browsing = "$python_path_root/chrome/common/safe_browsing" | 18 python_path_safe_browsing = "$python_path_root/chrome/common/safe_browsing" |
16 | 19 |
17 # Pick an architecture to generate for. These string match those | 20 # Pick an architecture to generate for. These string match those |
18 # in the python script. | 21 # in the python script. |
19 if (is_android) { | 22 if (is_android) { |
20 target_arch = "android" | 23 target_arch = "android" |
21 } else if (is_chromeos) { | 24 } else if (is_chromeos) { |
22 target_arch = "chromeos" | 25 target_arch = "chromeos" |
23 } else if (is_win) { | 26 } else if (is_win) { |
24 target_arch = "win" | 27 target_arch = "win" |
25 } else if (is_mac) { | 28 } else if (is_mac) { |
26 target_arch = "mac" | 29 target_arch = "mac" |
27 } else if (is_linux) { | 30 } else if (is_linux) { |
28 target_arch = "linux" | 31 target_arch = "linux" |
29 } else { | 32 } else { |
30 # This will cause the script to fail. | 33 # This will cause the script to fail. |
31 target_arch = "unknown_target_arch" | 34 target_arch = "unknown_target_arch" |
32 } | 35 } |
33 | 36 |
34 inputs = [ | 37 inputs = [ |
35 script, | |
36 input_filename, | 38 input_filename, |
37 ] | 39 ] |
38 | 40 |
39 # This script requires the generated python proto code | |
40 deps = [ | 41 deps = [ |
41 "//chrome/common/safe_browsing:proto", | 42 "//chrome/common/safe_browsing:proto", |
42 "//third_party/protobuf:py_proto", | 43 "//third_party/protobuf:py_proto", |
43 ] | 44 ] |
44 | 45 |
45 outputs = [ | 46 outputs = [ |
46 output_filename, | 47 "$output_dir/$output_basename", |
47 ] | 48 ] |
48 | 49 |
49 args = [ | 50 args = [ |
50 "-w", | 51 "-w", |
51 "-t", | 52 "-t", |
52 target_arch, | 53 target_arch, |
53 "-i", | 54 "-i", |
54 rebase_path(input_filename, root_build_dir), | 55 rebase_path(input_filename, root_build_dir), |
56 "-d", | |
57 rebase_path(output_dir, root_build_dir), | |
55 "-o", | 58 "-o", |
56 rebase_path(output_filename, root_build_dir), | 59 output_basename, |
57 "-p", | 60 "-p", |
58 rebase_path(python_path_root, root_build_dir), | 61 rebase_path(python_path_root, root_build_dir), |
59 "-p", | 62 "-p", |
63 rebase_path(python_path_safe_browsing, root_build_dir), | |
64 ] | |
65 } | |
66 | |
67 # Generate the binary proto for ALL platforms. This is only run manually | |
68 # when pushing the files to GCS for the component-updater to pick up. | |
69 action("make_all_file_types_protobuf") { | |
Lei Zhang
2016/05/25 21:44:09
Just curious why there's no GYP equivalent. Is it
Nathan Parker
2016/05/26 00:38:27
Yes! You've got it.
| |
70 script = "gen_file_type_proto.py" | |
71 | |
72 input_filename = "download_file_types.asciipb" | |
73 output_dir = "$target_gen_dir/all" | |
74 output_basename = "download_file_types.pb" | |
75 python_path_root = "$root_build_dir/pyproto" | |
76 python_path_safe_browsing = "$python_path_root/chrome/common/safe_browsing" | |
77 | |
78 inputs = [ | |
79 input_filename, | |
80 ] | |
81 | |
82 deps = [ | |
83 "//chrome/common/safe_browsing:proto", | |
84 "//third_party/protobuf:py_proto", | |
85 ] | |
86 | |
87 # A directory, since we can't derive the actual file names here. | |
88 outputs = [ | |
89 output_dir, | |
90 ] | |
91 | |
92 args = [ | |
93 "-w", | |
94 "-a", | |
95 "-i", | |
96 rebase_path(input_filename, root_build_dir), | |
97 "-d", | |
98 rebase_path(output_dir, root_build_dir), | |
99 "-o", | |
100 output_basename, | |
101 "-p", | |
102 rebase_path(python_path_root, root_build_dir), | |
103 "-p", | |
60 rebase_path(python_path_safe_browsing, root_build_dir), | 104 rebase_path(python_path_safe_browsing, root_build_dir), |
61 ] | 105 ] |
62 } | 106 } |
OLD | NEW |