# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import("//build/config/features.gni")
-import("//build/json_schema.gni")
+import("//build/json_schema_api.gni")
+import("schemas.gni")
-gypi_values = exec_script(
- "//build/gypi_to_gn.py",
- [ rebase_path("api.gyp") ],
- "scope",
- [ "api.gyp" ])
+assert(enable_extensions)
# GYP version: chrome/common/extensions/api/api.gyp:chrome_api
-group("api") {
- # The GYP version has one target that does both the bundling and compiling
- # over the same set of sources. In GN these actions are separate.
- deps = [
- ":api_bundle",
- ":api_compile",
- ]
-}
+json_schema_api("api") {
+ schemas = true
+ bundle = true
-# Common sources that are both bundled and compiled.
-if (is_android) {
- # Should be eliminated. See crbug.com/305852.
- schema_sources = gypi_values.android_schema_files
-} else {
- schema_sources = gypi_values.main_schema_files
- if (is_chromeos) {
- schema_sources += gypi_values.chromeos_schema_files
- if (is_chrome_branded) {
- schema_sources += gypi_values.chromeos_branded_schema_files
- }
- }
- if (enable_webrtc) {
- schema_sources += gypi_values.webrtc_schema_files
- }
+ deps = schema_dependencies
}
-schema_deps = [
- # Different APIs include some headers crom chrome/common that in turn
- # include generated headers from these targets.
- # TODO(brettw) this should be made unnecessary if possible.
- "//components/metrics/proto",
- "//device/serial",
-
- "//content/public/browser",
- "//skia",
- "//sync",
-]
-if (is_chromeos) {
- # deps += [ "<(DEPTH)/chrome/chrome.gyp:drive_proto" ] TODO)GYP)
-}
+# GYP version: chrome/browser/extensions/api/api.gyp:chrome_api_registration
+json_schema_api("api_registration") {
+ impl_dir = "//chrome/browser/extensions/api"
+ bundle_registration = true
-json_schema_bundle("api_bundle") {
- visibility = ":api"
- sources = schema_sources
- if (!is_android) {
- sources += gypi_values.main_non_compiled_schema_files
+ deps = [
+ # Different APIs include some headers from chrome/common that in turn
+ # include generated headers from these targets.
+ # TODO(brettw) this should be made unnecessary if possible.
+ ":api",
+ "//components/copresence/proto",
+ "//components/metrics/proto",
+ "//skia",
+ "//sync",
+ "//ui/accessibility:ax_gen",
+ ]
+ if (is_chromeos) {
+ # deps += [ "<(DEPTH)/chrome/chrome.gyp:drive_proto" ] TODO(GYP)
}
-
- root_namespace = "extensions::api"
- deps = schema_deps + [ ":api_compile" ]
-
-}
-
-json_schema_compile("api_compile") {
- visibility = ":*"
- sources = schema_sources
- root_namespace = "extensions::api"
- deps = schema_deps
+ deps += schema_dependencies
}