# Copyright 2016 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/ios/ios_sdk.gni") import("//build/config/ios/rules.gni") import("//components/grpc_support/include/headers.gni") import("//ios/build/config.gni") import("//ios/web_view/features.gni") import("//testing/test.gni") import("//tools/grit/repack.gni") config("config") { defines = [ "CWV_IMPLEMENTATION" ] libs = [ "CoreGraphics.framework", "Foundation.framework", "MobileCoreServices.framework", "UIKit.framework", ] } # These variables are used to share framework sources with both ChromeWebView # and CrNetChromeWebView frameworks. ios_web_view_public_headers = [ "public/ChromeWebView.h", "public/cwv_export.h", "public/cwv_html_element.h", "public/cwv_navigation_action.h", "public/cwv_navigation_delegate.h", "public/cwv_navigation_type.h", "public/cwv_preferences.h", "public/cwv_preview_element_info.h", "public/cwv_scroll_view.h", "public/cwv_scroll_view_delegate.h", "public/cwv_translation_controller.h", "public/cwv_translation_controller_delegate.h", "public/cwv_translation_language.h", "public/cwv_translation_policy.h", "public/cwv_ui_delegate.h", "public/cwv_user_content_controller.h", "public/cwv_user_script.h", "public/cwv_web_view.h", "public/cwv_web_view_configuration.h", ] if (ios_web_view_enable_sync) { ios_web_view_public_headers += [ "public/ChromeSync.h", "public/cwv_authentication_controller.h", "public/cwv_authentication_controller_delegate.h", "public/cwv_identity.h", "public/cwv_web_view_configuration+sync.h", ] } ios_web_view_sources = [ "internal/app/application_context.cc", "internal/app/application_context.h", "internal/app/web_view_io_thread.h", "internal/app/web_view_io_thread.mm", "internal/content_settings/web_view_cookie_settings_factory.cc", "internal/content_settings/web_view_cookie_settings_factory.h", "internal/content_settings/web_view_host_content_settings_map_factory.cc", "internal/content_settings/web_view_host_content_settings_map_factory.h", "internal/cwv_html_element.mm", "internal/cwv_html_element_internal.h", "internal/cwv_navigation_action.mm", "internal/cwv_navigation_action_internal.h", "internal/cwv_navigation_type.mm", "internal/cwv_navigation_type_internal.h", "internal/cwv_preferences.mm", "internal/cwv_preferences_internal.h", "internal/cwv_preview_element_info.mm", "internal/cwv_preview_element_info_internal.h", "internal/cwv_scroll_view.mm", "internal/cwv_scroll_view_internal.h", "internal/cwv_user_content_controller.mm", "internal/cwv_user_content_controller_internal.h", "internal/cwv_user_script.mm", "internal/cwv_web_view.mm", "internal/cwv_web_view_configuration.mm", "internal/cwv_web_view_configuration_internal.h", "internal/ios_global_state_web_view_configuration.cc", "internal/pref_names.cc", "internal/pref_names.h", "internal/signin/ios_web_view_signin_client.h", "internal/signin/ios_web_view_signin_client.mm", "internal/signin/web_view_account_fetcher_service_factory.cc", "internal/signin/web_view_account_fetcher_service_factory.h", "internal/signin/web_view_account_tracker_service_factory.cc", "internal/signin/web_view_account_tracker_service_factory.h", "internal/signin/web_view_gaia_cookie_manager_service_factory.cc", "internal/signin/web_view_gaia_cookie_manager_service_factory.h", "internal/signin/web_view_oauth2_token_service_factory.h", "internal/signin/web_view_oauth2_token_service_factory.mm", "internal/signin/web_view_profile_oauth2_token_service_ios_provider_impl.h", "internal/signin/web_view_profile_oauth2_token_service_ios_provider_impl.mm", "internal/signin/web_view_signin_client_factory.cc", "internal/signin/web_view_signin_client_factory.h", "internal/signin/web_view_signin_error_controller_factory.cc", "internal/signin/web_view_signin_error_controller_factory.h", "internal/signin/web_view_signin_manager_factory.cc", "internal/signin/web_view_signin_manager_factory.h", "internal/translate/cwv_translation_controller.mm", "internal/translate/cwv_translation_controller_internal.h", "internal/translate/cwv_translation_language_internal.h", "internal/translate/cwv_translation_language.mm", "internal/translate/cwv_translation_policy.mm", "internal/translate/web_view_translate_accept_languages_factory.cc", "internal/translate/web_view_translate_accept_languages_factory.h", "internal/translate/web_view_translate_client.h", "internal/translate/web_view_translate_client.mm", "internal/translate/web_view_translate_ranker_factory.cc", "internal/translate/web_view_translate_ranker_factory.h", "internal/translate/web_view_translate_service.cc", "internal/translate/web_view_translate_service.h", "internal/web_view_browser_state.h", "internal/web_view_browser_state.mm", "internal/web_view_early_page_script_provider.h", "internal/web_view_early_page_script_provider.mm", "internal/web_view_global_state_util.h", "internal/web_view_global_state_util.mm", "internal/web_view_java_script_dialog_presenter.h", "internal/web_view_java_script_dialog_presenter.mm", "internal/web_view_network_delegate.cc", "internal/web_view_network_delegate.h", "internal/web_view_url_request_context_getter.h", "internal/web_view_url_request_context_getter.mm", "internal/web_view_web_client.h", "internal/web_view_web_client.mm", "internal/web_view_web_main_delegate.h", "internal/web_view_web_main_delegate.mm", "internal/web_view_web_main_parts.h", "internal/web_view_web_main_parts.mm", "internal/web_view_web_state_policy_decider.h", "internal/web_view_web_state_policy_decider.mm", ] ios_web_view_sources += ios_web_view_public_headers if (ios_web_view_enable_sync) { ios_web_view_sources += [ "internal/cwv_web_view_configuration+sync.mm", "internal/signin/cwv_authentication_controller.mm", "internal/signin/cwv_authentication_controller_internal.h", "internal/signin/cwv_identity.mm", ] } ios_web_view_deps = [ ":packed_resources", "//base", "//components/content_settings/core/browser", "//components/flags_ui", "//components/infobars/core", "//components/keyed_service/core", "//components/keyed_service/ios", "//components/net_log", "//components/pref_registry", "//components/prefs", "//components/proxy_config", "//components/signin/core/browser", "//components/signin/ios/browser", "//components/signin/ios/browser:active_state_manager", "//components/ssl_config", "//components/translate/core/browser", "//components/translate/core/common", "//components/translate/ios/browser", "//components/web_resource", "//google_apis", "//ios/components/io_thread", "//ios/net", "//ios/web", "//ios/web:reload_type", "//ios/web:user_agent", "//ios/web/public/app", "//ios/web/public/global_state", "//net", "//net:extras", "//ui/base", "//url", ] ios_framework_bundle("web_view") { output_name = ios_web_view_output_name info_plist = "Info.plist" public_headers = ios_web_view_public_headers if (ios_web_view_include_cronet) { public_headers += [ "//components/cronet/ios/Cronet.h" ] public_headers += grpc_public_headers } public = [ "public/ChromeWebView.h", ] if (ios_web_view_enable_sync) { public += [ "public/ChromeSync.h" ] } sources = ios_web_view_sources if (ios_web_view_include_cronet) { sources += [ "//components/cronet/ios/Cronet.h" ] } deps = ios_web_view_deps if (ios_web_view_include_cronet) { deps += [ "//components/cronet/ios:cronet_sources" ] } configs += [ ":config", "//build/config/compiler:enable_arc", ] if (ios_web_view_include_cronet) { configs -= [ "//build/config/compiler:default_symbols" ] configs += [ "//build/config/compiler:symbols" ] } } test("ios_web_view_unittests") { testonly = true sources = [ "internal/cwv_html_element_unittest.mm", "internal/cwv_preview_element_info_unittest.mm", ] sources += ios_web_view_sources deps = [ "test:test_support", "//base/test:run_all_unittests", "//ios/testing:ios_test_support", "//testing/gtest", ] deps += ios_web_view_deps configs += [ "//build/config/compiler:enable_arc" ] assert_no_deps = ios_assert_no_deps } repack("repack_resources") { visibility = [ ":packed_resources" ] deps = [ "//components/resources:components_resources", "//ios/web:resources", ] sources = [ "$root_gen_dir/components/components_resources.pak", "$root_gen_dir/ios/web/ios_web_resources.pak", ] output = "$target_gen_dir/web_view_resources.pak" } bundle_data("packed_resources") { visibility = [ "//ios/web_view:*" ] public_deps = [ ":repack_resources", ] sources = [ "$target_gen_dir/web_view_resources.pak", ] outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}", ] } if (additional_toolchains == [] || current_toolchain == default_toolchain) { _package_dir = "$root_out_dir/ios_web_view" action("ios_web_view_generate_license") { _license_path = "$_package_dir/LICENSE" script = "//tools/licenses.py" inputs = [ "//buildtools/$host_os/gn", ] outputs = [ _license_path, ] args = [ "license_file", rebase_path(_license_path, root_build_dir), "--gn-target", "//ios/web_view", "--gn-out-dir", ".", ] } copy("ios_web_view_package_copy") { sources = [ "$root_out_dir/$ios_web_view_output_name.framework", "//AUTHORS", "//chrome/VERSION", ] outputs = [ "$_package_dir/{{source_file_part}}", ] deps = [ ":web_view", ] } if (enable_dsyms) { action("ios_web_view_dsym_archive") { script = "//chrome/tools/build/mac/archive_symbols.py" # These are the dSYMs that will be archived. The sources list must be # the target outputs that correspond to the dSYMs (since a dSYM is a # directory it cannot be listed as a source file). The targets that # generate both the dSYM and binary image are listed in deps. _dsyms = [ "$root_out_dir/$ios_web_view_output_name.dSYM" ] sources = [ "$root_out_dir/$ios_web_view_output_name.framework", ] _output = "$_package_dir/$ios_web_view_output_name.dSYM.tar.bz2" outputs = [ _output, ] args = [ rebase_path(_output, root_out_dir) ] + rebase_path(_dsyms, root_out_dir) deps = [ ":web_view", ] } } else { group("ios_web_view_dsym_archive") { } } group("ios_web_view_package") { deps = [ ":ios_web_view_dsym_archive", ":ios_web_view_generate_license", ":ios_web_view_package_copy", ] } }