blob: 8c023f430e369aa3b8da7b2a3889995e7861b38d [file] [log] [blame]
# Copyright 2014 The Chromium Authors. All rights reserved.
# 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")
gypi_values = exec_script(
"//build/gypi_to_gn.py",
[ rebase_path("api.gyp") ],
"scope",
[ "api.gyp" ])
# 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",
]
}
# 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
}
}
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)
}
json_schema_bundle("api_bundle") {
visibility = ":api"
sources = schema_sources
if (!is_android) {
sources += gypi_values.main_non_compiled_schema_files
}
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
}