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 # Instantiate grit. This will produce a script target to run grit, and a | 5 # Instantiate grit. This will produce a script target to run grit, and a |
6 # static library that compiles the .cc files. | 6 # static library that compiles the .cc files. |
7 # | 7 # |
8 # Parameters | 8 # Parameters |
9 # | 9 # |
10 # source | 10 # source |
11 # Path to .grd file. | 11 # Path to .grd file. |
12 # | 12 # |
13 # grit_flags (optional) | 13 # grit_flags (optional) |
14 # List of strings containing extra command-line flags to pass to Grit. | 14 # List of strings containing extra command-line flags to pass to Grit. |
15 # | 15 # |
16 # deps (optional) | 16 # deps (optional) |
17 # visibility (optional) | 17 # visibility (optional) |
18 # Normal meaning. | 18 # Normal meaning. |
19 # | 19 # |
20 # Example | 20 # Example |
21 # | 21 # |
22 # grit("my_resources") { | 22 # grit("my_resources") { |
23 # source = "myfile.grd" # source is required. | 23 # source = "myfile.grd" # source is required. |
24 # grit_flags = [ "-E", "foo=bar" ] # Optional extra flags. | 24 # grit_flags = [ "-E", "foo=bar" ] # Optional extra flags. |
25 # # You can also put deps here if the grit source depends on generated | 25 # # You can also put deps here if the grit source depends on generated |
26 # # files. | 26 # # files. |
27 # } | 27 # } |
28 import ("//build/config/crypto.gni") | |
28 import ("//build/config/features.gni") | 29 import ("//build/config/features.gni") |
29 import ("//build/config/ui.gni") | 30 import ("//build/config/ui.gni") |
30 | 31 |
31 grit_defines = [] | 32 grit_defines = [] |
32 | 33 |
34 # Mac and iOS want Title Case strings. | |
35 use_titlecase_in_grd_files = is_mac || is_ios | |
36 if (use_titlecase_in_grd_files) { | |
37 grit_defines += [ "-D", "use_titlecase" ] | |
38 } | |
39 | |
40 if (is_chrome_branded) { | |
41 grit_defines += [ | |
42 "-D", "_google_chrome", | |
43 "-E", "CHROMIUM_BUILD=google_chrome", | |
44 ] | |
45 } else { | |
46 grit_defines += [ | |
47 "-D", "_chromium", | |
48 "-E", "CHROMIUM_BUILD=chromium", | |
49 ] | |
50 } | |
51 | |
33 if (is_chromeos) { | 52 if (is_chromeos) { |
34 grit_defines += [ | 53 grit_defines += [ |
35 "-D", "chromeos", | 54 "-D", "chromeos", |
36 "-D", "scale_factors=2x" | 55 "-D", "scale_factors=2x" |
37 ] | 56 ] |
38 } | 57 } |
39 | 58 |
40 if (is_desktop_linux) { | 59 if (is_desktop_linux) { |
41 grit_defines += [ "-D", "desktop_linux" ] | 60 grit_defines += [ "-D", "desktop_linux" ] |
42 } | 61 } |
43 | 62 |
63 if (toolkit_views) { | |
64 grit_defines += [ "-D", "toolkit_views" ] | |
65 } | |
66 | |
67 if (use_aura) { | |
68 grit_defines += [ "-D", "use_aura" ] | |
69 } | |
70 | |
71 if (use_ash) { | |
72 grit_defines += [ "-D", "use_ash" ] | |
73 } | |
74 | |
75 if (use_nss_certs) { | |
76 grit_defines += [ "-D", "use_nss" ] | |
77 } | |
78 | |
79 if (use_ozone) { | |
80 grit_defines += [ "-D", "use_ozone" ] | |
81 } | |
82 | |
83 if (enable_image_loader_extension) { | |
84 grit_defines += [ "-D", "image_loader_extension" ] | |
85 } | |
86 | |
87 if (enable_remoting) { | |
88 grit_defines += [ "-D", "remoting" ] | |
89 } | |
90 | |
44 if (is_android) { | 91 if (is_android) { |
45 grit_defines += [ | 92 grit_defines += [ |
46 "-t", "android", | 93 "-t", "android", |
47 "-E", "ANDROID_JAVA_TAGGED_ONLY=true", | 94 "-E", "ANDROID_JAVA_TAGGED_ONLY=true", |
48 ] | 95 ] |
49 } | 96 } |
50 | 97 |
98 if (is_mac || is_ios) { | |
99 grit_defines += [ "-D", "scale_factors=2x" ] | |
100 } | |
101 | |
102 if (is_ios) { | |
103 grit_defines += [ | |
104 "-t", "ios", | |
105 # iOS uses a whitelist to filter resources. | |
106 "-w", rebase_path("//build/ios/grit_whitelist.txt", root_build_dir), | |
107 ] | |
108 } | |
109 | |
51 if (enable_extensions) { | 110 if (enable_extensions) { |
52 grit_defines += [ "-D", "enable_extensions" ] | 111 grit_defines += [ "-D", "enable_extensions" ] |
53 } | 112 } |
54 if (enable_plugins) { | 113 if (enable_plugins) { |
55 grit_defines += [ "-D", "enable_plugins" ] | 114 grit_defines += [ "-D", "enable_plugins" ] |
56 } | 115 } |
57 if (enable_task_manager) { | 116 if (enable_printing != 0) { |
awong
2014/07/02 01:14:40
This logic is odd given that enable_printing sound
brettw
2014/07/02 02:43:12
Yeah, I've been wanting to rename it. Currently it
| |
58 grit_defines += [ "-D", "enable_task_manager" ] | 117 grit_defines += [ "-D", "enable_printing" ] |
118 if (enable_printing == 1) { | |
119 grit_defines += [ "-D", "enable_full_printing" ] | |
120 } | |
121 } | |
122 if (enable_themes) { | |
123 grit_defines += [ "-D", "enable_themes" ] | |
59 } | 124 } |
60 if (enable_app_list) { | 125 if (enable_app_list) { |
61 grit_defines += [ "-D", "enable_app_list" ] | 126 grit_defines += [ "-D", "enable_app_list" ] |
62 } | 127 } |
63 if (enable_service_discovery) { | 128 if (enable_settings_app) { |
64 grit_defines += [ "-D", "enable_service_discovery" ] | 129 grit_defines += [ "-D", "enable_settings_app" ] |
130 } | |
131 if (enable_google_now) { | |
132 grit_defines += [ "-D", "enable_google_now" ] | |
133 } | |
134 # Note: use_concatenated_impulse_responses is omitted. It is never used and | |
135 # should probably be removed from GYP build. | |
136 if (enable_webrtc) { | |
137 grit_defines += [ "-D", "enable_webrtc" ] | |
138 } | |
139 # Note: enable_hangout_services_extension is omitted. It is never set in the | |
140 # GYP build. Need to figure out what it's for. | |
141 if (enable_task_manager) { | |
142 grit_defines += [ "-D", "enable_task_manager" ] | |
143 } | |
144 if (enable_notifications) { | |
145 grit_defines += [ "-D", "enable_notifications" ] | |
65 } | 146 } |
66 if (enable_wifi_bootstrapping) { | 147 if (enable_wifi_bootstrapping) { |
67 grit_defines += [ "-D", "enable_wifi_bootstrapping" ] | 148 grit_defines += [ "-D", "enable_wifi_bootstrapping" ] |
68 } | 149 } |
69 | 150 if (enable_service_discovery) { |
70 # TODO(GYP) the rest of the grit_defines from the gyp build. | 151 grit_defines += [ "-D", "enable_service_discovery" ] |
152 } | |
awong
2014/07/02 01:14:40
I almost want the ability to take an array of stri
| |
71 | 153 |
72 grit_resource_id_file = "//tools/gritsettings/resource_ids" | 154 grit_resource_id_file = "//tools/gritsettings/resource_ids" |
73 grit_info_script = "//tools/grit/grit_info.py" | 155 grit_info_script = "//tools/grit/grit_info.py" |
74 | 156 |
75 template("grit") { | 157 template("grit") { |
76 assert(defined(invoker.source), | 158 assert(defined(invoker.source), |
77 "\"source\" must be defined for the grit template $target_name") | 159 "\"source\" must be defined for the grit template $target_name") |
78 assert(!defined(invoker.sources) && !defined(invoker.outputs), | 160 assert(!defined(invoker.sources) && !defined(invoker.outputs), |
79 "Neither \"sources\" nor \"outputs\" can be defined for the grit " + | 161 "Neither \"sources\" nor \"outputs\" can be defined for the grit " + |
80 "template $target_name") | 162 "template $target_name") |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 direct_dependent_configs = [ ":$grit_config" ] | 238 direct_dependent_configs = [ ":$grit_config" ] |
157 | 239 |
158 if (defined(invoker.visibility)) { | 240 if (defined(invoker.visibility)) { |
159 visibility = invoker.visibility | 241 visibility = invoker.visibility |
160 } | 242 } |
161 if (defined(invoker.output_name)) { | 243 if (defined(invoker.output_name)) { |
162 output_name = invoker.output_name | 244 output_name = invoker.output_name |
163 } | 245 } |
164 } | 246 } |
165 } | 247 } |
OLD | NEW |