# 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_shortcuts_widget") {
swiftflags = [ "-DIOS_ENABLE_SHORTCUTS_WIDGET" ]
}
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",
"dino_game_widget.swift",
"lockscreen_launcher_widget.swift",
"main.swift",
"quick_actions_widget.swift",
"search_passwords_widget.swift",
"search_widget.swift",
"widget_constants.swift",
]
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: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_shortcuts_widget) {
configs += [ ":ios_enable_shortcuts_widget" ]
sources += [ "shortcuts_widget.swift" ]
}
frameworks = [
"WidgetKit.framework",
"Foundation.framework",
"SwiftUI.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 ]
}