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 import("//build/config/features.gni") | 5 import("//build/config/features.gni") |
6 import("//build/json_schema.gni") | 6 import("//extensions/generated_extensions_api.gni") |
7 | 7 |
8 gypi_values = exec_script( | 8 gypi_values = exec_script( |
9 "//build/gypi_to_gn.py", | 9 "//build/gypi_to_gn.py", |
10 [ rebase_path("api.gyp") ], | 10 [ rebase_path("api.gyp") ], |
11 "scope", | 11 "scope", |
12 [ "api.gyp" ]) | 12 [ "api.gyp" ]) |
13 | 13 |
| 14 # Common sources that are both bundled and compiled. |
14 # GYP version: chrome/common/extensions/api/api.gyp:chrome_api | 15 # GYP version: chrome/common/extensions/api/api.gyp:chrome_api |
15 group("api") { | 16 generated_extensions_api("api") { |
16 # The GYP version has one target that does both the bundling and compiling | 17 if (is_android) { |
17 # over the same set of sources. In GN these actions are separate. | 18 # Should be eliminated. See crbug.com/305852. |
18 deps = [ | 19 sources = gypi_values.android_schema_files |
19 ":api_bundle", | 20 } else { |
20 ":api_compile", | 21 sources = gypi_values.main_schema_files |
21 ] | 22 if (is_chromeos) { |
22 } | 23 sources += gypi_values.chromeos_schema_files |
23 | 24 if (is_chrome_branded) { |
24 # Common sources that are both bundled and compiled. | 25 sources += gypi_values.chromeos_branded_schema_files |
25 if (is_android) { | 26 } |
26 # Should be eliminated. See crbug.com/305852. | 27 } |
27 schema_sources = gypi_values.android_schema_files | 28 if (enable_webrtc) { |
28 } else { | 29 sources += gypi_values.webrtc_schema_files |
29 schema_sources = gypi_values.main_schema_files | |
30 if (is_chromeos) { | |
31 schema_sources += gypi_values.chromeos_schema_files | |
32 if (is_chrome_branded) { | |
33 schema_sources += gypi_values.chromeos_branded_schema_files | |
34 } | 30 } |
35 } | 31 } |
36 if (enable_webrtc) { | 32 |
37 schema_sources += gypi_values.webrtc_schema_files | 33 if (!is_android) { |
| 34 uncompiled_sources = gypi_values.main_non_compiled_schema_files |
| 35 } |
| 36 |
| 37 impl_dir = "//chrome/browser/extensions/api" |
| 38 root_namespace = "extensions::api" |
| 39 |
| 40 deps = [ |
| 41 # Different APIs include some headers from chrome/common that in turn |
| 42 # include generated headers from these targets. |
| 43 # TODO(brettw) this should be made unnecessary if possible. |
| 44 "//components/metrics/proto", |
| 45 "//device/serial", |
| 46 |
| 47 "//content/public/browser", |
| 48 "//skia", |
| 49 "//sync", |
| 50 ] |
| 51 if (is_chromeos) { |
| 52 # deps += [ "<(DEPTH)/chrome/chrome.gyp:drive_proto" ] TODO)GYP) |
38 } | 53 } |
39 } | 54 } |
40 | |
41 schema_deps = [ | |
42 # Different APIs include some headers from chrome/common that in turn | |
43 # include generated headers from these targets. | |
44 # TODO(brettw) this should be made unnecessary if possible. | |
45 "//components/metrics/proto", | |
46 "//device/serial", | |
47 | |
48 "//content/public/browser", | |
49 "//skia", | |
50 "//sync", | |
51 ] | |
52 if (is_chromeos) { | |
53 # deps += [ "<(DEPTH)/chrome/chrome.gyp:drive_proto" ] TODO)GYP) | |
54 } | |
55 | |
56 json_schema_bundle("api_bundle") { | |
57 visibility = ":api" | |
58 sources = schema_sources | |
59 if (!is_android) { | |
60 sources += gypi_values.main_non_compiled_schema_files | |
61 } | |
62 | |
63 root_namespace = "extensions::api" | |
64 deps = schema_deps + [ ":api_compile" ] | |
65 } | |
66 | |
67 json_schema_compile("api_compile") { | |
68 visibility = ":*" | |
69 sources = schema_sources | |
70 root_namespace = "extensions::api" | |
71 deps = schema_deps | |
72 } | |
OLD | NEW |