diff options
author | Albert J. Wong <ajwong@chromium.org> | 2014-08-26 18:10:24 -0700 |
---|---|---|
committer | Albert J. Wong <ajwong@chromium.org> | 2014-08-27 01:14:22 +0000 |
commit | 8f65982274893958898690b22e1c0c9ed4968857 (patch) | |
tree | a6e258ea0f77c26bd5c5637a6310d134979526d6 | |
parent | 1a2f0e0889de76e03e14d454fef33711b4be3a3b (diff) | |
download | chromium_src-8f65982274893958898690b22e1c0c9ed4968857.zip chromium_src-8f65982274893958898690b22e1c0c9ed4968857.tar.gz chromium_src-8f65982274893958898690b22e1c0c9ed4968857.tar.bz2 |
Revert "Split bundle generation steps so that API registration is generated in browser, not common."
Causing build failure in Android due to failed include for extensions/common/api/runtime.h.
This reverts commit 3b70ef14be986a3252428cc6d9553bf2c69deb70.
BUG=none
TBR=yoz
Review URL: https://codereview.chromium.org/506253003
Cr-Commit-Position: refs/heads/master@{#292059}
37 files changed, 426 insertions, 678 deletions
diff --git a/build/json_schema_bundle_compile.gypi b/build/json_schema_bundle_compile.gypi index 7560bdc..7e712d7 100644 --- a/build/json_schema_bundle_compile.gypi +++ b/build/json_schema_bundle_compile.gypi @@ -19,29 +19,30 @@ # chrome/browser/extensions/api and can be overridden by setting "impl_dir". 'api_gen_dir': '<(DEPTH)/tools/json_schema_compiler', 'api_gen': '<(api_gen_dir)/compiler.py', - 'generator_files': [ - '<(api_gen_dir)/cc_generator.py', - '<(api_gen_dir)/code.py', - '<(api_gen_dir)/compiler.py', - '<(api_gen_dir)/cpp_bundle_generator.py', - '<(api_gen_dir)/cpp_type_generator.py', - '<(api_gen_dir)/cpp_util.py', - '<(api_gen_dir)/h_generator.py', - '<(api_gen_dir)/idl_schema.py', - '<(api_gen_dir)/json_schema.py', - '<(api_gen_dir)/model.py', - '<(api_gen_dir)/util_cc_helper.py', - ], + 'impl_dir%': 'chrome/browser/extensions/api', }, 'actions': [ { - 'action_name': 'genapi_bundle_schema', + # GN version: //extensions/generated_extensions_api.gni + 'action_name': 'genapi_bundle', 'inputs': [ - '<@(generator_files)', + '<(api_gen_dir)/cc_generator.py', + '<(api_gen_dir)/code.py', + '<(api_gen_dir)/compiler.py', + '<(api_gen_dir)/cpp_bundle_generator.py', + '<(api_gen_dir)/cpp_type_generator.py', + '<(api_gen_dir)/cpp_util.py', + '<(api_gen_dir)/h_generator.py', + '<(api_gen_dir)/idl_schema.py', + '<(api_gen_dir)/json_schema.py', + '<(api_gen_dir)/model.py', + '<(api_gen_dir)/util_cc_helper.py', '<@(schema_files)', '<@(non_compiled_schema_files)', ], 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/generated_api.h', + '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/generated_api.cc', '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/generated_schemas.h', '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/generated_schemas.cc', ], @@ -51,15 +52,14 @@ '--root=<(DEPTH)', '--destdir=<(SHARED_INTERMEDIATE_DIR)', '--namespace=<(root_namespace)', - '--generator=cpp-bundle-schema', + '--generator=cpp-bundle', + '--impl-dir=<(impl_dir)', '<@(schema_files)', '<@(non_compiled_schema_files)', ], - 'message': 'Generating C++ API bundle code for schemas', + 'message': 'Generating C++ API bundle code', 'process_outputs_as_sources': 1, - # Avoid running MIDL compiler on IDL input files. - 'explicit_idl_action': 1, - }, + } ], 'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)', diff --git a/build/json_schema_bundle_registration_compile.gypi b/build/json_schema_bundle_registration_compile.gypi deleted file mode 100644 index 5a013bc..0000000 --- a/build/json_schema_bundle_registration_compile.gypi +++ /dev/null @@ -1,78 +0,0 @@ -# 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. - -{ - 'variables': { - # When including this gypi, the following variables must be set: - # schema_files: - # An array of json or idl files that comprise the api model. - # impl_dir_: - # The root path of API implementations; also used for the - # output location. (N.B. Named as such to prevent gyp from - # expanding it as a relative path.) - # root_namespace: - # A Python string substituion pattern used to generate the C++ - # namespace for each API. Use %(namespace)s to replace with the API - # namespace, like "toplevel::%(namespace)s_api". - # - # Functions and namespaces can be excluded by setting "nocompile" to true. - 'api_gen_dir': '<(DEPTH)/tools/json_schema_compiler', - 'api_gen': '<(api_gen_dir)/compiler.py', - 'generator_files': [ - '<(api_gen_dir)/cc_generator.py', - '<(api_gen_dir)/code.py', - '<(api_gen_dir)/compiler.py', - '<(api_gen_dir)/cpp_bundle_generator.py', - '<(api_gen_dir)/cpp_type_generator.py', - '<(api_gen_dir)/cpp_util.py', - '<(api_gen_dir)/h_generator.py', - '<(api_gen_dir)/idl_schema.py', - '<(api_gen_dir)/json_schema.py', - '<(api_gen_dir)/model.py', - '<(api_gen_dir)/util_cc_helper.py', - ], - }, - 'actions': [ - { - # GN version: //extensions/generated_extensions_api.gni - 'action_name': 'genapi_bundle_registration', - 'inputs': [ - '<@(generator_files)', - '<@(schema_files)', - '<@(non_compiled_schema_files)', - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/<(impl_dir_)/generated_api_registration.h', - '<(SHARED_INTERMEDIATE_DIR)/<(impl_dir_)/generated_api_registration.cc', - ], - 'action': [ - 'python', - '<(api_gen)', - '--root=<(DEPTH)', - '--destdir=<(SHARED_INTERMEDIATE_DIR)', - '--namespace=<(root_namespace)', - '--generator=cpp-bundle-registration', - '--impl-dir=<(impl_dir_)', - '<@(schema_files)', - '<@(non_compiled_schema_files)', - ], - 'message': 'Generating C++ API bundle code for function registration', - 'process_outputs_as_sources': 1, - # Avoid running MIDL compiler on IDL input files. - 'explicit_idl_action': 1, - }, - ], - 'include_dirs': [ - '<(SHARED_INTERMEDIATE_DIR)', - '<(DEPTH)', - ], - 'direct_dependent_settings': { - 'include_dirs': [ - '<(SHARED_INTERMEDIATE_DIR)', - ] - }, - # This target exports a hard dependency because it generates header - # files. - 'hard_dependency': 1, -} diff --git a/build/json_schema_compile.gypi b/build/json_schema_compile.gypi index 9672f79..d164748 100644 --- a/build/json_schema_compile.gypi +++ b/build/json_schema_compile.gypi @@ -15,8 +15,11 @@ # namespace, like "toplevel::%(namespace)s_api". # # Functions and namespaces can be excluded by setting "nocompile" to true. + # The default root path of API implementation sources is + # chrome/browser/extensions/api and can be overridden by setting "impl_dir". 'api_gen_dir': '<(DEPTH)/tools/json_schema_compiler', 'api_gen': '<(api_gen_dir)/compiler.py', + 'impl_dir%': 'chrome/browser/extensions/api', }, 'rules': [ { @@ -54,6 +57,7 @@ '--destdir=<(SHARED_INTERMEDIATE_DIR)', '--namespace=<(root_namespace)', '--generator=cpp', + '--impl-dir=<(impl_dir)' ], 'message': 'Generating C++ code from <(RULE_INPUT_PATH) json files', 'process_outputs_as_sources': 1, @@ -92,6 +96,7 @@ '--destdir=<(SHARED_INTERMEDIATE_DIR)', '--namespace=<(root_namespace)', '--generator=cpp', + '--impl-dir=<(impl_dir)' ], 'message': 'Generating C++ code from <(RULE_INPUT_PATH) IDL files', 'process_outputs_as_sources': 1, diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 15ae840..d2bbd09 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn @@ -143,8 +143,7 @@ static_library("browser") { "//cc", "//chrome/browser/devtools", "//chrome/browser/performance_monitor", - "//chrome/common/extensions/api", - "//chrome/common/extensions/api:api_registration", + "//chrome/common/extensions/api:api", "//chrome/installer/util", "//components/autofill/content/browser", "//components/dom_distiller/content", diff --git a/chrome/browser/devtools/BUILD.gn b/chrome/browser/devtools/BUILD.gn index 7565b9e..683e330 100644 --- a/chrome/browser/devtools/BUILD.gn +++ b/chrome/browser/devtools/BUILD.gn @@ -64,7 +64,6 @@ static_library("devtools") { "//chrome:strings", "//chrome/app/theme:theme_resources", "//chrome/common/extensions/api", - "//chrome/common/extensions/api:api_registration", "//net:http_server", "//skia", "//third_party/icu", diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index d2b4565..453b1a0 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn @@ -39,7 +39,6 @@ static_library("extensions") { "//chrome/browser/history:in_memory_url_index_cache_proto", "//chrome/common", "//chrome/common/extensions/api", - "//chrome/common/extensions/api:api_registration", "//chrome/common/net", "//chrome/common/safe_browsing:proto", "//chrome/installer/util", @@ -56,7 +55,6 @@ static_library("extensions") { "//device/hid", "//extensions/browser", "//extensions/common/api", - "//extensions/common/api:api_registration", "//extensions/strings", "//net", "//skia", diff --git a/chrome/browser/extensions/api/api_registration.gyp b/chrome/browser/extensions/api/api_registration.gyp deleted file mode 100644 index 6bbad07..0000000 --- a/chrome/browser/extensions/api/api_registration.gyp +++ /dev/null @@ -1,41 +0,0 @@ -# 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. - -{ - 'targets': [ - { - # GN version: //chrome/browser/extensions/api:api_registration - 'target_name': 'chrome_api_registration', - 'type': 'static_library', - # TODO(jschuh): http://crbug.com/167187 size_t -> int - 'msvs_disabled_warnings': [ 4267 ], - 'includes': [ - '../../../../build/json_schema_bundle_registration_compile.gypi', - '../../../common/extensions/api/schemas.gypi', - ], - 'dependencies': [ - '<(DEPTH)/chrome/common/extensions/api/api.gyp:chrome_api', - # 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. - '<(DEPTH)/components/components.gyp:component_metrics_proto', - '<(DEPTH)/skia/skia.gyp:skia', - '<(DEPTH)/sync/sync.gyp:sync', - '<(DEPTH)/ui/accessibility/accessibility.gyp:ax_gen', - ], - 'conditions': [ - ['OS != "ios" and OS != "android"', { - 'dependencies': [ - '<(DEPTH)/components/components.gyp:copresence_proto', - ], - }], - ['chromeos==1', { - 'dependencies': [ - '<(DEPTH)/chrome/chrome.gyp:drive_proto', - ], - }], - ], - }, - ], -} diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.cc b/chrome/browser/extensions/chrome_extensions_browser_client.cc index c2cd4cf..a118f05 100644 --- a/chrome/browser/extensions/chrome_extensions_browser_client.cc +++ b/chrome/browser/extensions/chrome_extensions_browser_client.cc @@ -12,7 +12,6 @@ #include "chrome/browser/extensions/activity_log/activity_log.h" #include "chrome/browser/extensions/api/chrome_extensions_api_client.h" #include "chrome/browser/extensions/api/content_settings/content_settings_service.h" -#include "chrome/browser/extensions/api/generated_api_registration.h" #include "chrome/browser/extensions/api/preference/chrome_direct_setting.h" #include "chrome/browser/extensions/api/preference/preference_api.h" #include "chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.h" @@ -30,12 +29,13 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version_info.h" +#include "chrome/common/extensions/api/generated_api.h" #include "chrome/common/extensions/features/feature_channel.h" #include "chrome/common/pref_names.h" -#include "extensions/browser/api/generated_api_registration.h" #include "extensions/browser/extension_function_registry.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/pref_names.h" +#include "extensions/common/api/generated_api.h" #if defined(OS_CHROMEOS) #include "chromeos/chromeos_switches.h" diff --git a/chrome/browser/performance_monitor/BUILD.gn b/chrome/browser/performance_monitor/BUILD.gn index a763a6c..d3250bc 100644 --- a/chrome/browser/performance_monitor/BUILD.gn +++ b/chrome/browser/performance_monitor/BUILD.gn @@ -7,5 +7,4 @@ import("//extensions/generated_extensions_api.gni") generated_extensions_api("performance_monitor") { sources = [ "events.json" ] root_namespace = "performance_monitor::%(namespace)s" - schemas = true } diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index f11a1cc..6a7b936 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn @@ -85,8 +85,7 @@ static_library("ui") { "//chrome/browser/devtools", "//chrome/browser/performance_monitor", "//chrome/browser/ui/webui/omnibox:mojo_bindings", - "//chrome/common/extensions/api", - "//chrome/common/extensions/api:api_registration", + "//chrome/common/extensions/api:api", "//chrome/installer/util", "//components/autofill/content/browser:risk_proto", "//device/bluetooth", diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 4e4538c..4995c7c 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2914,7 +2914,6 @@ 'dependencies': [ 'apps', 'browser/performance_monitor/performance_monitor.gyp:performance_monitor', - 'browser/extensions/api/api_registration.gyp:chrome_api_registration', 'common/extensions/api/api.gyp:chrome_api', 'debugger', 'installer_util', diff --git a/chrome/chrome_browser_chromeos.gypi b/chrome/chrome_browser_chromeos.gypi index 3162b18..9a053ba 100644 --- a/chrome/chrome_browser_chromeos.gypi +++ b/chrome/chrome_browser_chromeos.gypi @@ -23,7 +23,6 @@ 'dependencies': [ # TODO(tbarzic): Cleanup this list. 'attestation_proto', - 'browser/extensions/api/api_registration.gyp:chrome_api_registration', 'browser/performance_monitor/performance_monitor.gyp:performance_monitor', 'browser_extensions', 'cert_logger_proto', @@ -117,7 +116,6 @@ ], }, 'export_dependent_settings': [ - 'browser/extensions/api/api_registration.gyp:chrome_api_registration', 'common/extensions/api/api.gyp:chrome_api', '../sync/sync.gyp:sync', ], diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index e42a52a..15a05db 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -965,7 +965,6 @@ # have the same dependencies. Once browser_extensions is untangled from # browser, then we can clean up these dependencies. 'dependencies': [ - 'browser/extensions/api/api_registration.gyp:chrome_api_registration', 'chrome_resources.gyp:chrome_extra_resources', 'chrome_resources.gyp:chrome_resources', 'chrome_resources.gyp:chrome_strings', @@ -989,7 +988,6 @@ '../crypto/crypto.gyp:crypto', '../device/bluetooth/bluetooth.gyp:device_bluetooth', '../device/hid/hid.gyp:device_hid', - '../extensions/browser/api/api_registration.gyp:extensions_api_registration', '../extensions/common/api/api.gyp:extensions_api', '../extensions/extensions.gyp:extensions_browser', '../extensions/extensions_strings.gyp:extensions_strings', @@ -1017,7 +1015,6 @@ '<(INTERMEDIATE_DIR)', ], 'export_dependent_settings': [ - 'browser/extensions/api/api_registration.gyp:chrome_api_registration', 'common/extensions/api/api.gyp:chrome_api', '../content/content.gyp:content_browser', ], diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index 7db0322..7e4cba4 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -2614,7 +2614,6 @@ '<(SHARED_INTERMEDIATE_DIR)/chrome/browser/ui/webui/omnibox/omnibox.mojom.cc', ], 'dependencies': [ - 'browser/extensions/api/api_registration.gyp:chrome_api_registration', 'browser/performance_monitor/performance_monitor.gyp:performance_monitor', 'chrome_web_ui_mojo_bindings.gyp:web_ui_mojo_bindings', 'common/extensions/api/api.gyp:chrome_api', diff --git a/chrome/common/extensions/api/BUILD.gn b/chrome/common/extensions/api/BUILD.gn index 758cc0f..d4362fb 100644 --- a/chrome/common/extensions/api/BUILD.gn +++ b/chrome/common/extensions/api/BUILD.gn @@ -2,33 +2,53 @@ # 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("//extensions/generated_extensions_api.gni") -import("schemas.gni") +gypi_values = exec_script( + "//build/gypi_to_gn.py", + [ rebase_path("api.gyp") ], + "scope", + [ "api.gyp" ]) + +# Common sources that are both bundled and compiled. # GYP version: chrome/common/extensions/api/api.gyp:chrome_api generated_extensions_api("api") { - schemas = true - bundle = true -} + if (is_android) { + # Should be eliminated. See crbug.com/305852. + sources = gypi_values.android_schema_files + } else { + sources = gypi_values.main_schema_files + if (is_chromeos) { + sources += gypi_values.chromeos_schema_files + if (is_chrome_branded) { + sources += gypi_values.chromeos_branded_schema_files + } + } + if (enable_webrtc) { + sources += gypi_values.webrtc_schema_files + } + } + + if (!is_android) { + uncompiled_sources = gypi_values.main_non_compiled_schema_files + } -# GYP version: chrome/browser/extensions/api/api.gyp:chrome_api_registration -generated_extensions_api("api_registration") { impl_dir = "//chrome/browser/extensions/api" - bundle_registration = true + root_namespace = "extensions::api::%(namespace)s" + bundle = true 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. "//components/metrics/proto", + + "//content/public/browser", "//skia", "//sync", - "//ui/accessibility:ax_gen", ] - if (!is_ios && !is_android) { - deps += ["//components/copresence/proto"] - } if (is_chromeos) { - # deps += [ "<(DEPTH)/chrome/chrome.gyp:drive_proto" ] TODO(GYP) + # deps += [ "<(DEPTH)/chrome/chrome.gyp:drive_proto" ] TODO)GYP) } } diff --git a/chrome/common/extensions/api/api.gyp b/chrome/common/extensions/api/api.gyp index 19b28fa..ef1a2c5 100644 --- a/chrome/common/extensions/api/api.gyp +++ b/chrome/common/extensions/api/api.gyp @@ -3,6 +3,160 @@ # found in the LICENSE file. { + # All files are stored in these lists which are referenced in the target + # below so that the GN build of this target can read in this dictionary and + # duplicate the same logic without the lists getting out-of-sync. The GN + # .gypi reader can not process conditions and does not know about targets, + # etc., it just reads Python dictionaries. + # + # If you add a new category, also add it to the BUILD.gn file in this + # directory. + 'variables': { + # These duplicate other lists and are the only ones used on Android. They + # should be eliminated. See crbug.com/305852. + 'android_schema_files': [ + 'manifest_types.json', + ], + + # These are used everywhere except Android. + 'main_schema_files': [ + 'accessibility_private.json', + 'activity_log_private.json', + 'alarms.idl', + 'app_current_window_internal.idl', + 'app_window.idl', + 'audio.idl', + 'automation.idl', + 'automation_internal.idl', + 'autotest_private.idl', + 'bluetooth.idl', + 'bluetooth_low_energy.idl', + 'bluetooth_private.json', + 'bluetooth_socket.idl', + 'bookmark_manager_private.json', + 'bookmarks.json', + 'braille_display_private.idl', + 'browser.idl', + 'cloud_print_private.json', + 'command_line_private.json', + 'content_settings.json', + 'context_menus_internal.json', + 'context_menus.json', + 'cookies.json', + 'copresence.idl', + 'copresence_private.idl', + 'debugger.json', + 'desktop_capture.json', + 'developer_private.idl', + 'dial.idl', + 'downloads.idl', + 'downloads_internal.idl', + 'easy_unlock_private.idl', + 'echo_private.json', + 'enterprise_platform_keys_private.json', + 'events.json', + 'experience_sampling_private.json', + 'extension_options_internal.idl', + 'feedback_private.idl', + 'file_browser_private.idl', + 'file_browser_private_internal.idl', + 'file_system.idl', + 'file_system_provider.idl', + 'file_system_provider_internal.idl', + 'font_settings.json', + 'gcd_private.idl', + 'gcm.json', + 'guest_view_internal.json', + 'hangouts_private.idl', + 'history.json', + 'hotword_private.idl', + 'i18n.json', + 'identity.idl', + 'identity_private.idl', + 'idle.json', + 'image_writer_private.idl', + 'input_ime.json', + 'location.idl', + 'management.json', + 'manifest_types.json', + 'mdns.idl', + 'media_galleries.idl', + 'media_galleries_private.idl', + 'metrics_private.json', + 'networking_private.json', + 'notification_provider.idl', + 'notifications.idl', + 'omnibox.json', + 'page_capture.json', + 'permissions.json', + 'preferences_private.json', + 'push_messaging.idl', + 'reading_list_private.json', + 'screenlock_private.idl', + 'sessions.json', + 'signed_in_devices.idl', + 'streams_private.idl', + 'synced_notifications_private.idl', + 'sync_file_system.idl', + 'system_cpu.idl', + 'system_display.idl', + 'system_indicator.idl', + 'system_memory.idl', + 'system_network.idl', + 'system_private.json', + 'system_storage.idl', + 'tab_capture.idl', + 'tabs.json', + 'terminal_private.json', + 'types.json', + 'virtual_keyboard_private.json', + 'web_navigation.json', + 'web_request.json', + # Despite the name, this API does not rely on any + # WebRTC-specific bits and as such does not belong in + # the enable_webrtc==0 section below. + 'webrtc_audio_private.idl', + 'webrtc_logging_private.idl', + 'webstore_private.json', + 'web_view_internal.json', + 'windows.json', + ], + 'main_non_compiled_schema_files': [ + 'browsing_data.json', + 'chromeos_info_private.json', + 'extension.json', + 'idltest.idl', + 'infobars.json', + 'media_player_private.json', + 'music_manager_private.idl', + 'principals_private.idl', + 'top_sites.json', + 'web_request_internal.json', + ], + + # ChromeOS-specific schemas. + 'chromeos_schema_files': [ + 'accessibility_features.json', + 'diagnostics.idl', + 'enterprise_platform_keys.idl', + 'enterprise_platform_keys_internal.idl', + 'file_browser_handler_internal.json', + 'first_run_private.json', + 'log_private.idl', + 'wallpaper.json', + 'wallpaper_private.json', + 'webcam_private.idl', + ], + 'chromeos_branded_schema_files': [ + 'ledger/ledger.idl', + ], + + 'webrtc_schema_files': [ + 'cast_streaming_rtp_stream.idl', + 'cast_streaming_session.idl', + 'cast_streaming_udp_transport.idl', + ], + }, 'targets': [ { # GN version: //chrome/common/extensions/api:api @@ -16,7 +170,62 @@ 'includes': [ '../../../../build/json_schema_bundle_compile.gypi', '../../../../build/json_schema_compile.gypi', - 'schemas.gypi', + ], + 'variables': { + 'chromium_code': 1, + # Disable schema compiler to generate model extension API code. + # Only register the extension functions in extension system. + 'conditions': [ + ['enable_extensions==1', { + 'non_compiled_schema_files': [ + '<@(main_non_compiled_schema_files)', + ], + 'schema_files': [ + '<@(main_schema_files)', + ], + }, { # enable_extensions==0 + 'non_compiled_schema_files': [ + ], + 'schema_files': [ + # These should be eliminated. See crbug.com/305852. + '<@(android_schema_files)', + ], + }], + ['chromeos==1', { + 'schema_files': [ + '<@(chromeos_schema_files)', + ], + }], + ['enable_extensions==1 and enable_webrtc==1', { + 'schema_files': [ + '<@(webrtc_schema_files)', + ], + }], + ['branding=="Chrome" and chromeos==1', { + 'schema_files': [ + '<@(chromeos_branded_schema_files)', + ], + }], + ], + 'cc_dir': 'chrome/common/extensions/api', + 'root_namespace': 'extensions::api::%(namespace)s', + }, + 'dependencies': [ + # 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. + '<(DEPTH)/components/components.gyp:component_metrics_proto', + + '<(DEPTH)/content/content.gyp:content_browser', + '<(DEPTH)/skia/skia.gyp:skia', + '<(DEPTH)/sync/sync.gyp:sync', + ], + 'conditions': [ + ['chromeos==1', { + 'dependencies': [ + '<(DEPTH)/chrome/chrome.gyp:drive_proto', + ], + }], ], }, ], diff --git a/chrome/common/extensions/api/schemas.gni b/chrome/common/extensions/api/schemas.gni deleted file mode 100644 index 452c1df..0000000 --- a/chrome/common/extensions/api/schemas.gni +++ /dev/null @@ -1,34 +0,0 @@ -# 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") - -gypi_values = exec_script( - "//build/gypi_to_gn.py", - [ rebase_path("schemas.gypi") ], - "scope", - [ "schemas.gypi" ]) - -# Common sources that are both bundled and compiled. -if (is_android) { - # Should be eliminated. See crbug.com/305852. - sources = gypi_values.android_schema_files -} else { - sources = gypi_values.main_schema_files - if (is_chromeos) { - sources += gypi_values.chromeos_schema_files - if (is_chrome_branded) { - sources += gypi_values.chromeos_branded_schema_files - } - } - if (enable_webrtc) { - sources += gypi_values.webrtc_schema_files - } -} - -if (!is_android) { - uncompiled_sources = gypi_values.main_non_compiled_schema_files -} - -root_namespace = "extensions::api::%(namespace)s" diff --git a/chrome/common/extensions/api/schemas.gypi b/chrome/common/extensions/api/schemas.gypi deleted file mode 100644 index 41134e9..0000000 --- a/chrome/common/extensions/api/schemas.gypi +++ /dev/null @@ -1,194 +0,0 @@ -# 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. - -{ - 'sources': [ - '<@(schema_files)', - ], - 'variables': { - # These duplicate other lists and are the only ones used on Android. They - # should be eliminated. See crbug.com/305852. - 'android_schema_files': [ - 'manifest_types.json', - ], - - # These are used everywhere except Android. - 'main_schema_files': [ - 'accessibility_private.json', - 'activity_log_private.json', - 'alarms.idl', - 'app_current_window_internal.idl', - 'app_window.idl', - 'audio.idl', - 'automation.idl', - 'automation_internal.idl', - 'autotest_private.idl', - 'bluetooth.idl', - 'bluetooth_low_energy.idl', - 'bluetooth_private.json', - 'bluetooth_socket.idl', - 'bookmark_manager_private.json', - 'bookmarks.json', - 'braille_display_private.idl', - 'browser.idl', - 'cloud_print_private.json', - 'command_line_private.json', - 'content_settings.json', - 'context_menus_internal.json', - 'context_menus.json', - 'cookies.json', - 'copresence.idl', - 'copresence_private.idl', - 'debugger.json', - 'desktop_capture.json', - 'developer_private.idl', - 'dial.idl', - 'downloads.idl', - 'downloads_internal.idl', - 'easy_unlock_private.idl', - 'echo_private.json', - 'enterprise_platform_keys_private.json', - 'events.json', - 'experience_sampling_private.json', - 'extension_options_internal.idl', - 'feedback_private.idl', - 'file_browser_private.idl', - 'file_browser_private_internal.idl', - 'file_system.idl', - 'file_system_provider.idl', - 'file_system_provider_internal.idl', - 'font_settings.json', - 'gcd_private.idl', - 'gcm.json', - 'guest_view_internal.json', - 'hangouts_private.idl', - 'history.json', - 'hotword_private.idl', - 'i18n.json', - 'identity.idl', - 'identity_private.idl', - 'idle.json', - 'image_writer_private.idl', - 'input_ime.json', - 'location.idl', - 'management.json', - 'manifest_types.json', - 'mdns.idl', - 'media_galleries.idl', - 'media_galleries_private.idl', - 'metrics_private.json', - 'networking_private.json', - 'notification_provider.idl', - 'notifications.idl', - 'omnibox.json', - 'page_capture.json', - 'permissions.json', - 'preferences_private.json', - 'push_messaging.idl', - 'reading_list_private.json', - 'screenlock_private.idl', - 'sessions.json', - 'signed_in_devices.idl', - 'streams_private.idl', - 'synced_notifications_private.idl', - 'sync_file_system.idl', - 'system_cpu.idl', - 'system_display.idl', - 'system_indicator.idl', - 'system_memory.idl', - 'system_network.idl', - 'system_private.json', - 'system_storage.idl', - 'tab_capture.idl', - 'tabs.json', - 'terminal_private.json', - 'types.json', - 'virtual_keyboard_private.json', - 'web_navigation.json', - 'web_request.json', - # Despite the name, this API does not rely on any - # WebRTC-specific bits and as such does not belong in - # the enable_webrtc==0 section below. - 'webrtc_audio_private.idl', - 'webrtc_logging_private.idl', - 'webstore_private.json', - 'web_view_internal.json', - 'windows.json', - ], - 'main_non_compiled_schema_files': [ - 'browsing_data.json', - 'chromeos_info_private.json', - 'extension.json', - 'idltest.idl', - 'infobars.json', - 'media_player_private.json', - 'music_manager_private.idl', - 'principals_private.idl', - 'top_sites.json', - 'web_request_internal.json', - ], - - # ChromeOS-specific schemas. - 'chromeos_schema_files': [ - 'accessibility_features.json', - 'diagnostics.idl', - 'enterprise_platform_keys.idl', - 'enterprise_platform_keys_internal.idl', - 'file_browser_handler_internal.json', - 'first_run_private.json', - 'log_private.idl', - 'wallpaper.json', - 'wallpaper_private.json', - 'webcam_private.idl', - ], - 'chromeos_branded_schema_files': [ - 'ledger/ledger.idl', - ], - - 'webrtc_schema_files': [ - 'cast_streaming_rtp_stream.idl', - 'cast_streaming_session.idl', - 'cast_streaming_udp_transport.idl', - ], - - 'chromium_code': 1, - # Disable schema compiler to generate model extension API code. - # Only register the extension functions in extension system. - 'conditions': [ - ['enable_extensions==1', { - 'non_compiled_schema_files': [ - '<@(main_non_compiled_schema_files)', - ], - 'schema_files': [ - '<@(main_schema_files)', - ], - }, { # enable_extensions==0 - 'non_compiled_schema_files': [ - ], - 'schema_files': [ - # These should be eliminated. See crbug.com/305852. - '<@(android_schema_files)', - ], - }], - ['chromeos==1', { - 'schema_files': [ - '<@(chromeos_schema_files)', - ], - }], - ['enable_extensions==1 and enable_webrtc==1', { - 'schema_files': [ - '<@(webrtc_schema_files)', - ], - }], - ['branding=="Chrome" and chromeos==1', { - 'schema_files': [ - '<@(chromeos_branded_schema_files)', - ], - }], - ], - 'cc_dir': 'chrome/common/extensions/api', - 'root_namespace': 'extensions::api::%(namespace)s', - 'impl_dir_': 'chrome/browser/extensions/api', - }, -} diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc index 32dd24e..5827ae2 100644 --- a/content/app/content_main_runner.cc +++ b/content/app/content_main_runner.cc @@ -125,11 +125,8 @@ extern int UtilityMain(const MainFunctionParams&); namespace content { -#if !defined(CHROME_MULTIPLE_DLL_CHILD) base::LazyInstance<ContentBrowserClient> g_empty_content_browser_client = LAZY_INSTANCE_INITIALIZER; -#endif // !CHROME_MULTIPLE_DLL_CHILD - #if !defined(OS_IOS) && !defined(CHROME_MULTIPLE_DLL_BROWSER) base::LazyInstance<ContentPluginClient> g_empty_content_plugin_client = LAZY_INSTANCE_INITIALIZER; @@ -245,14 +242,12 @@ class ContentClientInitializer { static void Set(const std::string& process_type, ContentMainDelegate* delegate) { ContentClient* content_client = GetContentClient(); -#if !defined(CHROME_MULTIPLE_DLL_CHILD) if (process_type.empty()) { if (delegate) content_client->browser_ = delegate->CreateContentBrowserClient(); if (!content_client->browser_) content_client->browser_ = &g_empty_content_browser_client.Get(); } -#endif // !CHROME_MULTIPLE_DLL_CHILD #if !defined(OS_IOS) && !defined(CHROME_MULTIPLE_DLL_BROWSER) if (process_type == switches::kPluginProcess || @@ -354,7 +349,7 @@ int RunZygote(const MainFunctionParams& main_function_params, #if !defined(OS_IOS) static void RegisterMainThreadFactories() { -#if !defined(CHROME_MULTIPLE_DLL_BROWSER) && !defined(CHROME_MULTIPLE_DLL_CHILD) +#if !defined(CHROME_MULTIPLE_DLL_BROWSER) UtilityProcessHostImpl::RegisterUtilityMainThreadFactory( CreateInProcessUtilityThread); RenderProcessHostImpl::RegisterRendererMainThreadFactory( @@ -371,7 +366,7 @@ static void RegisterMainThreadFactories() { LOG(FATAL) << "--in-process-gpu is not supported in chrome multiple dll browser."; } -#endif // !CHROME_MULTIPLE_DLL_BROWSER && !CHROME_MULTIPLE_DLL_CHILD +#endif } // Run the FooMain() for a given process type. diff --git a/extensions/BUILD.gn b/extensions/BUILD.gn index d2b733f..3eba645 100644 --- a/extensions/BUILD.gn +++ b/extensions/BUILD.gn @@ -14,7 +14,7 @@ group("extensions_resources") { } # GYP version: extensions/extensions_resources.gyp:extensions_resources -# (extensions_resources action) +# (exntensions_resources action) grit("extensions_resources_grd") { source = "extensions_resources.grd" outputs = [ @@ -75,7 +75,6 @@ source_set("test_support") { "//extensions/browser", "//extensions/common", "//extensions/common/api", - "//extensions/common/api:api_registration", "//net:test_support", "//testing/gmock", "//testing/gtest", diff --git a/extensions/browser/BUILD.gn b/extensions/browser/BUILD.gn index f948e3d..73f3690 100644 --- a/extensions/browser/BUILD.gn +++ b/extensions/browser/BUILD.gn @@ -18,7 +18,6 @@ source_set("browser") { "//content/public/browser", "//extensions/common", "//extensions/common/api", - "//extensions/common/api:api_registration", "//extensions/strings", "//skia", "//third_party/leveldatabase", diff --git a/extensions/browser/api/api_registration.gyp b/extensions/browser/api/api_registration.gyp deleted file mode 100644 index c374f8b..0000000 --- a/extensions/browser/api/api_registration.gyp +++ /dev/null @@ -1,28 +0,0 @@ -# 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. - -{ - 'targets': [ - { - # GN version: //extensions/browser/api - 'target_name': 'extensions_api_registration', - 'type': 'static_library', - # TODO(jschuh): http://crbug.com/167187 size_t -> int - 'msvs_disabled_warnings': [ 4267 ], - 'includes': [ - '../../../build/json_schema_bundle_registration_compile.gypi', - '../../common/api/schemas.gypi', - ], - 'conditions': [ - ['enable_extensions==1', { - 'dependencies': [ - '<(DEPTH)/extensions/common/api/api.gyp:extensions_api', - '<(DEPTH)/device/serial/serial.gyp:device_serial_mojo', - '<(DEPTH)/skia/skia.gyp:skia', - ], - }], - ], - }, - ], -} diff --git a/extensions/common/api/BUILD.gn b/extensions/common/api/BUILD.gn index 10a69fa..1c924bd 100644 --- a/extensions/common/api/BUILD.gn +++ b/extensions/common/api/BUILD.gn @@ -3,19 +3,31 @@ # found in the LICENSE file. import("//extensions/generated_extensions_api.gni") -import("schemas.gni") # GYP version: extensions/common/api/api.gyp:extensions_api generated_extensions_api("api") { - schemas = true - bundle = true -} - -# GYP version: extensions/browser/api/api_registration.gyp:extensions_api_registration -generated_extensions_api("api_registration") { + sources = [ + "app_runtime.idl", + "app_view_internal.json", + "cast_channel.idl", + "dns.idl", + "extensions_manifest_types.json", + "hid.idl", + "power.idl", + "runtime.json", + "serial.idl", + "socket.idl", + "sockets_tcp.idl", + "sockets_tcp_server.idl", + "sockets_udp.idl", + "storage.json", + "test.json", + "usb.idl", + "usb_private.idl", + ] + root_namespace = "extensions::core_api::%(namespace)s" impl_dir = "//extensions/browser/api" - bundle_registration = true - + bundle = true deps = [ "//device/serial", "//skia", diff --git a/extensions/common/api/api.gyp b/extensions/common/api/api.gyp index f66baef..c95217c 100644 --- a/extensions/common/api/api.gyp +++ b/extensions/common/api/api.gyp @@ -8,12 +8,59 @@ # GN version: //extensions/common/api 'target_name': 'extensions_api', 'type': 'static_library', + 'sources': [ + '<@(schema_files)', + ], # TODO(jschuh): http://crbug.com/167187 size_t -> int 'msvs_disabled_warnings': [ 4267 ], 'includes': [ '../../../build/json_schema_bundle_compile.gypi', '../../../build/json_schema_compile.gypi', - 'schemas.gypi', + ], + 'variables': { + 'chromium_code': 1, + 'non_compiled_schema_files': [ + ], + 'conditions': [ + ['enable_extensions==1', { + # Note: file list duplicated in GN build. + 'schema_files': [ + 'app_runtime.idl', + 'app_view_internal.json', + 'cast_channel.idl', + 'dns.idl', + 'extensions_manifest_types.json', + 'hid.idl', + 'power.idl', + 'runtime.json', + 'serial.idl', + 'socket.idl', + 'sockets_tcp.idl', + 'sockets_tcp_server.idl', + 'sockets_udp.idl', + 'storage.json', + 'test.json', + 'usb.idl', + 'usb_private.idl', + ], + }, { + # TODO: Eliminate these on Android. See crbug.com/305852. + 'schema_files': [ + 'runtime.json', + ], + }], + ], + 'cc_dir': 'extensions/common/api', + 'root_namespace': 'extensions::core_api::%(namespace)s', + 'impl_dir': 'extensions/browser/api', + }, + 'conditions': [ + ['enable_extensions==1', { + 'dependencies': [ + '<(DEPTH)/device/serial/serial.gyp:device_serial', + '<(DEPTH)/skia/skia.gyp:skia', + ], + }], ], }, ], diff --git a/extensions/common/api/schemas.gni b/extensions/common/api/schemas.gni deleted file mode 100644 index 2227b71..0000000 --- a/extensions/common/api/schemas.gni +++ /dev/null @@ -1,17 +0,0 @@ -# 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. - -gypi_values = exec_script( - "//build/gypi_to_gn.py", - [ rebase_path("schemas.gypi") ], - "scope", - [ "schemas.gypi" ]) - -if (is_android) { - sources = gypi_values.android_schema_files -} else { - sources = gypi_values.main_schema_files -} - -root_namespace = "extensions::core_api::%(namespace)s" diff --git a/extensions/common/api/schemas.gypi b/extensions/common/api/schemas.gypi deleted file mode 100644 index e595e5d..0000000 --- a/extensions/common/api/schemas.gypi +++ /dev/null @@ -1,51 +0,0 @@ -# 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. - -{ - 'sources': [ - '<@(schema_files)', - ], - 'variables': { - 'chromium_code': 1, - # TODO: Eliminate these on Android. See crbug.com/305852. - 'android_schema_files': [ - 'runtime.json', - ], - 'main_schema_files': [ - 'app_runtime.idl', - 'app_view_internal.json', - 'cast_channel.idl', - 'dns.idl', - 'extensions_manifest_types.json', - 'hid.idl', - 'power.idl', - 'runtime.json', - 'serial.idl', - 'socket.idl', - 'sockets_tcp.idl', - 'sockets_tcp_server.idl', - 'sockets_udp.idl', - 'storage.json', - 'test.json', - 'usb.idl', - 'usb_private.idl', - ], - 'non_compiled_schema_files': [ - ], - 'conditions': [ - ['enable_extensions==1', { - 'schema_files': [ - '<@(main_schema_files)', - ], - }, { - 'schema_files': [ - '<@(android_schema_files)', - ], - }], - ], - 'cc_dir': 'extensions/common/api', - 'root_namespace': 'extensions::core_api::%(namespace)s', - 'impl_dir_': 'extensions/browser/api', - }, -} diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp index 8edeb11..f43aa10 100644 --- a/extensions/extensions.gyp +++ b/extensions/extensions.gyp @@ -262,7 +262,6 @@ '../device/serial/serial.gyp:device_serial', '../skia/skia.gyp:skia', '../third_party/leveldatabase/leveldatabase.gyp:leveldatabase', - 'browser/api/api_registration.gyp:extensions_api_registration', 'cast_channel_proto', 'common/api/api.gyp:extensions_api', 'extensions_common', @@ -771,7 +770,6 @@ '../base/base.gyp:base', '../net/net.gyp:net_test_support', '../testing/gtest.gyp:gtest', - 'browser/api/api_registration.gyp:extensions_api_registration', 'common/api/api.gyp:extensions_api', 'extensions_browser', 'extensions_common', diff --git a/extensions/generated_extensions_api.gni b/extensions/generated_extensions_api.gni index 98ddc77..5360711e 100644 --- a/extensions/generated_extensions_api.gni +++ b/extensions/generated_extensions_api.gni @@ -16,23 +16,16 @@ # namespace for each API. Use %(namespace)s to replace with the API # namespace, like "toplevel::%(namespace)s_api". # -# schemas [optional, default = false] -# Boolean indicating if the schema files should be generated. -# # bundle [optional, default = false] -# Boolean indicating if the schema bundle files should be generated. -# -# bundle_registration [optional, default = false] -# Boolean indicating if the API registration bundle files should be generated. +# Boolean indicating if the schema files should be bundled or not. # -# impl_dir [required if bundle_registration = true, otherwise unused] +# impl_dir [required if bundle = true, otherwise unused] # The path containing C++ implementations of API functions. This path is # used as the root path when looking for {schema}/{schema}_api.h headers -# when generating API registration bundles. Such headers, if found, are +# during the API bundle generation phase. Such headers, if found, are # automatically included by the generated code. # -# uncompiled_sources [optional, only used when bundle = true or -# bundle_registration = true] +# uncompiled_sources [optional, only used when bundle = true] # A list of schema files which should not be compiled, but which should still # be processed for API bundle generation. # @@ -40,7 +33,7 @@ # If any deps are specified they will be inherited by the static library # target. # -# The static library target also inherits the visibility and output_name +# The static libarary target also inherits the visibility and output_name # of its invoker. template("generated_extensions_api") { @@ -49,10 +42,7 @@ template("generated_extensions_api") { assert(defined(invoker.root_namespace), "\"root_namespace\" must be defined for the $target_name template.") - schemas = defined(invoker.schemas) && invoker.schemas bundle = defined(invoker.bundle) && invoker.bundle - bundle_registration = defined(invoker.bundle_registration) && - invoker.bundle_registration # Keep a copy of the target_name here since it will be trampled # in nested targets. @@ -64,7 +54,7 @@ template("generated_extensions_api") { visibility = target_visibility } - sources = invoker.sources + schemas = invoker.sources root_namespace = invoker.root_namespace compiler_root = "//tools/json_schema_compiler" @@ -82,36 +72,41 @@ template("generated_extensions_api") { "$compiler_root/util_cc_helper.py", ] - if (schemas) { - schema_generator_name = target_name + "_schema_generator" - action_foreach(schema_generator_name) { - script = compiler_script - inputs = compiler_sources - outputs = [ - "$target_gen_dir/{{source_name_part}}.cc", - "$target_gen_dir/{{source_name_part}}.h", - ] - args = [ - "{{source}}", - "--root=" + rebase_path("//", root_build_dir), - "--destdir=" + rebase_path(root_gen_dir, root_build_dir), - "--namespace=$root_namespace", - "--generator=cpp" ] - visibility = target_visibility - } + schema_generator_name = target_name + "_schema_generator" + action_foreach(schema_generator_name) { + script = compiler_script + inputs = compiler_sources + sources = schemas + outputs = [ + "$target_gen_dir/{{source_name_part}}.cc", + "$target_gen_dir/{{source_name_part}}.h", + ] + args = [ + "{{source}}", + "--root=" + rebase_path("//", root_build_dir), + "--destdir=" + rebase_path(root_gen_dir, root_build_dir), + "--namespace=$root_namespace", + "--generator=cpp" ] + visibility = target_visibility } if (bundle) { - uncompiled_sources = [] + assert(defined(invoker.impl_dir), + "\"impl_dir\" must be defined for the $target_name template.") + impl_dir = invoker.impl_dir + + uncompiled_schemas = [] if (defined(invoker.uncompiled_sources)) { - uncompiled_sources = invoker.uncompiled_sources + uncompiled_schemas = invoker.uncompiled_sources } - bundle_generator_schema_name = target_name + "_bundle_generator_schema" - action(bundle_generator_schema_name) { + bundle_generator_name = target_name + "_bundle_generator" + action(bundle_generator_name) { script = compiler_script - inputs = compiler_sources + sources + uncompiled_sources + inputs = compiler_sources + schemas + uncompiled_schemas outputs = [ + "$target_gen_dir/generated_api.cc", + "$target_gen_dir/generated_api.h", "$target_gen_dir/generated_schemas.cc", "$target_gen_dir/generated_schemas.h", ] @@ -119,64 +114,25 @@ template("generated_extensions_api") { "--root=" + rebase_path("//", root_build_dir), "--destdir=" + rebase_path(root_gen_dir, root_build_dir), "--namespace=$root_namespace", - "--generator=cpp-bundle-schema", - ] + - rebase_path(sources, root_build_dir) + - rebase_path(uncompiled_sources, root_build_dir) - } - } - - if (bundle_registration) { - uncompiled_sources = [] - if (defined(invoker.uncompiled_sources)) { - uncompiled_sources = invoker.uncompiled_sources - } - - assert(defined(invoker.impl_dir), - "\"impl_dir\" must be defined for the $target_name template.") - impl_dir = invoker.impl_dir - - bundle_generator_registration_name = target_name + - "_bundle_generator_registration" - action(bundle_generator_registration_name) { - script = compiler_script - inputs = compiler_sources + sources + uncompiled_sources - outputs = [ - "$root_gen_dir/$impl_dir/generated_api_registration.cc", - "$root_gen_dir/$impl_dir/generated_api_registration.h", - ] - args = [ - "--root=" + rebase_path("//", root_build_dir), - "--destdir=" + rebase_path(root_gen_dir, root_build_dir), - "--namespace=$root_namespace", - "--generator=cpp-bundle-registration", + "--generator=cpp-bundle", "--impl-dir=" + rebase_path(impl_dir, "//"), ] + - rebase_path(sources, root_build_dir) + - rebase_path(uncompiled_sources, root_build_dir) + rebase_path(schemas, root_build_dir) + + rebase_path(uncompiled_schemas, root_build_dir) } } source_set(target_name) { - sources = [] - deps = [] - - if (schemas) { - sources += get_target_outputs(":$schema_generator_name") - deps += [ - ":$schema_generator_name", - "//tools/json_schema_compiler:generated_api_util", - ] - } + sources = get_target_outputs(":$schema_generator_name") - if (bundle) { - sources += get_target_outputs(":$bundle_generator_schema_name") - deps += [ ":$bundle_generator_schema_name" ] - } + deps = [ + ":$schema_generator_name", + "//tools/json_schema_compiler:generated_api_util", + ] - if (bundle_registration) { - sources += get_target_outputs(":$bundle_generator_registration_name") - deps += [ ":$bundle_generator_registration_name" ] + if (bundle) { + sources += get_target_outputs(":$bundle_generator_name") + deps += [ ":$bundle_generator_name" ] } if (defined(invoker.deps)) { diff --git a/extensions/shell/app_shell.gyp b/extensions/shell/app_shell.gyp index f236163..29bcd08 100644 --- a/extensions/shell/app_shell.gyp +++ b/extensions/shell/app_shell.gyp @@ -23,14 +23,12 @@ '<(DEPTH)/content/content.gyp:content_ppapi_plugin', '<(DEPTH)/content/content_shell_and_tests.gyp:content_shell_lib', '<(DEPTH)/device/hid/hid.gyp:device_hid', - '<(DEPTH)/extensions/browser/api/api_registration.gyp:extensions_api_registration', '<(DEPTH)/extensions/common/api/api.gyp:extensions_api', '<(DEPTH)/extensions/extensions.gyp:extensions_browser', '<(DEPTH)/extensions/extensions.gyp:extensions_common', '<(DEPTH)/extensions/extensions.gyp:extensions_renderer', '<(DEPTH)/extensions/extensions.gyp:extensions_shell_and_test_pak', '<(DEPTH)/extensions/extensions_resources.gyp:extensions_resources', - '<(DEPTH)/extensions/shell/browser/api/api_registration.gyp:shell_api_registration', '<(DEPTH)/extensions/shell/common/api/api.gyp:shell_api', '<(DEPTH)/mojo/mojo_base.gyp:mojo_environment_chromium', '<(DEPTH)/mojo/mojo_base.gyp:mojo_system_impl', diff --git a/extensions/shell/browser/api/api_registration.gyp b/extensions/shell/browser/api/api_registration.gyp deleted file mode 100644 index cc9174f..0000000 --- a/extensions/shell/browser/api/api_registration.gyp +++ /dev/null @@ -1,21 +0,0 @@ -# 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. - -{ - 'targets': [ - { - 'target_name': 'shell_api_registration', - 'type': 'static_library', - # TODO(jschuh): http://crbug.com/167187 size_t -> int - 'msvs_disabled_warnings': [ 4267 ], - 'includes': [ - '../../../../build/json_schema_bundle_registration_compile.gypi', - '../../common/api/schemas.gypi', - ], - 'dependencies': [ - '<(DEPTH)/skia/skia.gyp:skia', - ], - }, - ], -} diff --git a/extensions/shell/browser/shell_extensions_browser_client.cc b/extensions/shell/browser/shell_extensions_browser_client.cc index 84e757c..eee57b6 100644 --- a/extensions/shell/browser/shell_extensions_browser_client.cc +++ b/extensions/shell/browser/shell_extensions_browser_client.cc @@ -9,16 +9,16 @@ #include "base/prefs/testing_pref_store.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/user_prefs/user_prefs.h" -#include "extensions/browser/api/generated_api_registration.h" #include "extensions/browser/app_sorting.h" #include "extensions/browser/extension_function_registry.h" #include "extensions/browser/extension_prefs.h" -#include "extensions/shell/browser/api/generated_api_registration.h" +#include "extensions/common/api/generated_api.h" #include "extensions/shell/browser/api/shell_extensions_api_client.h" #include "extensions/shell/browser/shell_app_sorting.h" #include "extensions/shell/browser/shell_extension_host_delegate.h" #include "extensions/shell/browser/shell_extension_system_factory.h" #include "extensions/shell/browser/shell_runtime_api_delegate.h" +#include "extensions/shell/common/api/generated_api.h" using content::BrowserContext; diff --git a/extensions/shell/common/api/api.gyp b/extensions/shell/common/api/api.gyp index 3421f05..0353410 100644 --- a/extensions/shell/common/api/api.gyp +++ b/extensions/shell/common/api/api.gyp @@ -7,12 +7,29 @@ { 'target_name': 'shell_api', 'type': 'static_library', + 'sources': [ + '<@(schema_files)', + ], # TODO(jschuh): http://crbug.com/167187 size_t -> int 'msvs_disabled_warnings': [ 4267 ], 'includes': [ '../../../../build/json_schema_bundle_compile.gypi', '../../../../build/json_schema_compile.gypi', - 'schemas.gypi', + ], + 'variables': { + 'chromium_code': 1, + 'non_compiled_schema_files': [ + ], + # TODO(thestig): Eliminate these on Android. See crbug.com/305852. + 'schema_files': [ + 'shell.idl', + ], + 'cc_dir': 'extensions/shell/common/api', + 'root_namespace': 'extensions::shell_api::%(namespace)s', + 'impl_dir': 'extensions/shell/browser/api', + }, + 'dependencies': [ + '<(DEPTH)/skia/skia.gyp:skia', ], }, ], diff --git a/extensions/shell/common/api/schemas.gypi b/extensions/shell/common/api/schemas.gypi deleted file mode 100644 index 0524e13..0000000 --- a/extensions/shell/common/api/schemas.gypi +++ /dev/null @@ -1,20 +0,0 @@ -# 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. - -{ - 'sources': [ - '<@(schema_files)', - ], - 'variables': { - 'chromium_code': 1, - 'non_compiled_schema_files': [ - ], - 'schema_files': [ - 'shell.idl', - ], - 'cc_dir': 'extensions/shell/common/api', - 'root_namespace': 'extensions::shell_api::%(namespace)s', - 'impl_dir_': 'extensions/shell/browser/api', - }, -} diff --git a/tools/json_schema_compiler/compiler.py b/tools/json_schema_compiler/compiler.py index 38899286..ff91ccf 100755 --- a/tools/json_schema_compiler/compiler.py +++ b/tools/json_schema_compiler/compiler.py @@ -30,9 +30,9 @@ from schema_loader import SchemaLoader # Names of supported code generators, as specified on the command-line. # First is default. -GENERATORS = ['cpp', 'cpp-bundle-registration', 'cpp-bundle-schema', 'dart'] +GENERATORS = ['cpp', 'cpp-bundle', 'dart'] -def GenerateSchema(generator_name, +def GenerateSchema(generator, file_paths, root, destdir, @@ -49,7 +49,7 @@ def GenerateSchema(generator_name, api_def = schema_loader.LoadSchema(os.path.split(schema)[1]) # If compiling the C++ model code, delete 'nocompile' nodes. - if generator_name == 'cpp': + if generator == 'cpp': api_def = json_schema.DeleteNodes(api_def, 'nocompile') api_defs.extend(api_def) @@ -85,7 +85,7 @@ def GenerateSchema(generator_name, type_generator = CppTypeGenerator(api_model, schema_loader, default_namespace) - if generator_name in ('cpp-bundle-registration', 'cpp-bundle-schema'): + if generator == 'cpp-bundle': cpp_bundle_generator = CppBundleGenerator(root, api_model, api_defs, @@ -93,24 +93,19 @@ def GenerateSchema(generator_name, cpp_namespace_pattern, src_path, impl_dir) - if generator_name == 'cpp-bundle-registration': - generators = [ - ('generated_api_registration.cc', - cpp_bundle_generator.api_cc_generator), - ('generated_api_registration.h', cpp_bundle_generator.api_h_generator), - ] - elif generator_name == 'cpp-bundle-schema': - generators = [ - ('generated_schemas.cc', cpp_bundle_generator.schemas_cc_generator), - ('generated_schemas.h', cpp_bundle_generator.schemas_h_generator) - ] - elif generator_name == 'cpp': + generators = [ + ('generated_api.cc', cpp_bundle_generator.api_cc_generator), + ('generated_api.h', cpp_bundle_generator.api_h_generator), + ('generated_schemas.cc', cpp_bundle_generator.schemas_cc_generator), + ('generated_schemas.h', cpp_bundle_generator.schemas_h_generator) + ] + elif generator == 'cpp': cpp_generator = CppGenerator(type_generator, cpp_namespace_pattern) generators = [ ('%s.h' % filename_base, cpp_generator.h_generator), ('%s.cc' % filename_base, cpp_generator.cc_generator) ] - elif generator_name == 'dart': + elif generator == 'dart': generators = [ ('%s.dart' % namespace.unix_name, DartGenerator( dart_overrides_dir)) @@ -122,12 +117,7 @@ def GenerateSchema(generator_name, for filename, generator in generators: code = generator.Generate(namespace).Render() if destdir: - if generator_name == 'cpp-bundle-registration': - # Function registrations must be output to impl_dir, since they link in - # API implementations. - output_dir = os.path.join(destdir, impl_dir) - else: - output_dir = os.path.join(destdir, src_path) + output_dir = os.path.join(destdir, src_path) if not os.path.exists(output_dir): os.makedirs(output_dir) with open(os.path.join(output_dir, filename), 'w') as f: @@ -163,8 +153,7 @@ if __name__ == '__main__': sys.exit(0) # This is OK as a no-op # Unless in bundle mode, only one file should be specified. - if (opts.generator not in ('cpp-bundle-registration', 'cpp-bundle-schema') and - len(file_paths) > 1): + if opts.generator != 'cpp-bundle' and len(file_paths) > 1: # TODO(sashab): Could also just use file_paths[0] here and not complain. raise Exception( "Unless in bundle mode, only one file can be specified at a time.") diff --git a/tools/json_schema_compiler/cpp_bundle_generator.py b/tools/json_schema_compiler/cpp_bundle_generator.py index 0a4f9a6..62c754b 100644 --- a/tools/json_schema_compiler/cpp_bundle_generator.py +++ b/tools/json_schema_compiler/cpp_bundle_generator.py @@ -183,9 +183,8 @@ class _APICCGenerator(object): c = code.Code() c.Append(cpp_util.CHROMIUM_LICENSE) c.Append() - c.Append('#include "%s"' % ( - os.path.join(self._bundle._impl_dir, - 'generated_api_registration.h'))) + c.Append('#include "%s"' % (os.path.join(self._bundle._source_file_dir, + 'generated_api.h'))) c.Append() for namespace in self._bundle._model.namespaces.values(): namespace_name = namespace.unix_name.replace("experimental_", "") diff --git a/ui/accessibility/BUILD.gn b/ui/accessibility/BUILD.gn index 2628bce..32a4f71 100644 --- a/ui/accessibility/BUILD.gn +++ b/ui/accessibility/BUILD.gn @@ -77,5 +77,6 @@ generated_extensions_api("ax_gen") { sources = [ "ax_enums.idl" ] deps = [ "//base/third_party/dynamic_annotations" ] root_namespace = "ui" - schemas = true + impl_dir = "." + bundle = true } diff --git a/ui/accessibility/accessibility.gyp b/ui/accessibility/accessibility.gyp index 086f194..33032d7a 100644 --- a/ui/accessibility/accessibility.gyp +++ b/ui/accessibility/accessibility.gyp @@ -97,6 +97,7 @@ ], 'msvs_disabled_warnings': [ 4267 ], 'includes': [ + '../../build/json_schema_bundle_compile.gypi', '../../build/json_schema_compile.gypi', ], 'variables': { |