| # Copyright 2020 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/config/apple/swift_source_set.gni") |
| import("//build/config/ios/ios_sdk.gni") |
| import("//build/config/locales.gni") |
| import("//ios/build/chrome_build.gni") |
| import("//ios/chrome/extension_repack.gni") |
| import("//ios/chrome/tools/strings/generate_localizable_strings.gni") |
| |
| config("ios_available_lockscreen_widget") { |
| swiftflags = [ "-DIOS_AVAILABLE_LOCKSCREEN_WIDGET" ] |
| } |
| |
| config("ios_enable_lockscreen_widget") { |
| swiftflags = [ "-DIOS_ENABLE_LOCKSCREEN_WIDGET" ] |
| } |
| |
| config("ios_enable_widgets_for_mim") { |
| swiftflags = [ "-DIOS_ENABLE_WIDGETS_FOR_MIM" ] |
| } |
| |
| source_set("crash_helper") { |
| sources = [ |
| "crash_helper.h", |
| "crash_helper.mm", |
| ] |
| |
| deps = [ "//ios/chrome/common/crash_report" ] |
| frameworks = [ "Foundation.framework" ] |
| } |
| |
| swift_source_set("widget_kit_extension_swift") { |
| sources = [ |
| "compat_util.swift", |
| "deleted_account_views.swift", |
| "dino_game_widget.swift", |
| "lockscreen_launcher_widget.swift", |
| "main.swift", |
| "quick_actions_widget.swift", |
| "search_passwords_widget.swift", |
| "search_widget.swift", |
| "select_profile_intent.swift", |
| "shortcuts_widget.swift", |
| "timeline_provider_util.swift", |
| "widget_urls.swift", |
| ] |
| generate_intents = true |
| bridge_header = "widget_kit_swift_bridge.h" |
| |
| deps = [ |
| ":crash_helper", |
| ":system_strings", |
| "//ios/chrome/common/app_group:helper", |
| "//ios/chrome/common/ntp_tile", |
| "//ios/chrome/widget_kit_extension/resources", |
| "//ui/base", |
| ] |
| |
| # Swift does not have the equivalent of __IPHONE_16_0, so use a |
| # custom define instead. |
| if (xcode_version_int >= 1400) { |
| configs += [ ":ios_available_lockscreen_widget" ] |
| } |
| |
| if (ios_enable_lockscreen_widget) { |
| configs += [ ":ios_enable_lockscreen_widget" ] |
| } |
| |
| if (ios_enable_widgets_for_mim) { |
| configs += [ ":ios_enable_widgets_for_mim" ] |
| } |
| |
| frameworks = [ |
| "WidgetKit.framework", |
| "Foundation.framework", |
| "SwiftUI.framework", |
| "AppIntents.framework", |
| ] |
| } |
| |
| extension_repack_all_locales("packed_resources") { |
| extension = "widget_kit_extension" |
| input_locales = platform_pak_locales |
| output_locales = locales_as_apple_outputs |
| } |
| |
| generate_localizable_strings("system_strings") { |
| visibility = [ ":*" ] |
| _packed_resources_target = ":packed_resources" |
| config_file = "widget_kit_extension_localize_strings_config.plist" |
| datapack_dir = get_label_info(_packed_resources_target, "target_gen_dir") |
| packed_locales = locales_as_apple_outputs |
| output_filenames = [ "Localizable.strings" ] |
| deps = [ _packed_resources_target ] |
| } |