mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-01 16:06:59 +00:00
Bazel upgrade
This commit is contained in:
parent
610c051e38
commit
9d2aa61ea0
3
.bazelrc
3
.bazelrc
@ -19,7 +19,7 @@ build --per_file_copt="Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/.*\.
|
||||
build --per_file_copt="Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/.*\.mm$","@-std=c++17"
|
||||
build --per_file_copt="third-party/td/TdBinding/Sources/.*\.mm$","@-std=c++17"
|
||||
|
||||
build --swiftcopt=-whole-module-optimization
|
||||
#build --swiftcopt=-whole-module-optimization
|
||||
|
||||
build --per_file_copt=".*\.m$","@-fno-objc-msgsend-selector-stubs"
|
||||
build --per_file_copt=".*\.mm$","@-fno-objc-msgsend-selector-stubs"
|
||||
@ -37,4 +37,3 @@ build --spawn_strategy=standalone
|
||||
build --strategy=SwiftCompile=standalone
|
||||
build --define RULES_SWIFT_BUILD_DUMMY_WORKER=1
|
||||
|
||||
build --noenable_bzlmod
|
||||
|
70
MODULE.bazel
70
MODULE.bazel
@ -1,6 +1,64 @@
|
||||
###############################################################################
|
||||
# Bazel now uses Bzlmod by default to manage external dependencies.
|
||||
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
|
||||
#
|
||||
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
|
||||
###############################################################################
|
||||
http_file = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
|
||||
|
||||
bazel_dep(name = "bazel_features", version = "1.29.0")
|
||||
bazel_dep(name = "bazel_skylib", version = "1.7.1")
|
||||
bazel_dep(name = "platforms", version = "0.0.11")
|
||||
|
||||
bazel_dep(name = "rules_xcodeproj")
|
||||
local_path_override(
|
||||
module_name = "rules_xcodeproj",
|
||||
path = "./build-system/bazel-rules/rules_xcodeproj",
|
||||
)
|
||||
|
||||
bazel_dep(name = "rules_apple", repo_name = "build_bazel_rules_apple")
|
||||
local_path_override(
|
||||
module_name = "rules_apple",
|
||||
path = "./build-system/bazel-rules/rules_apple",
|
||||
)
|
||||
|
||||
bazel_dep(name = "rules_swift", repo_name = "build_bazel_rules_swift")
|
||||
local_path_override(
|
||||
module_name = "rules_swift",
|
||||
path = "./build-system/bazel-rules/rules_swift",
|
||||
)
|
||||
|
||||
bazel_dep(name = "apple_support", repo_name = "build_bazel_apple_support")
|
||||
local_path_override(
|
||||
module_name = "apple_support",
|
||||
path = "./build-system/bazel-rules/apple_support",
|
||||
)
|
||||
|
||||
http_file(
|
||||
name = "cmake_tar_gz",
|
||||
urls = ["https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-macos-universal.tar.gz"],
|
||||
sha256 = "f794ed92ccb4e9b6619a77328f313497d7decf8fb7e047ba35a348b838e0e1e2",
|
||||
)
|
||||
|
||||
http_file(
|
||||
name = "meson_tar_gz",
|
||||
urls = ["https://github.com/mesonbuild/meson/releases/download/1.6.0/meson-1.6.0.tar.gz"],
|
||||
sha256 = "999b65f21c03541cf11365489c1fad22e2418bb0c3d50ca61139f2eec09d5496",
|
||||
)
|
||||
|
||||
http_file(
|
||||
name = "ninja-mac_zip",
|
||||
urls = ["https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-mac.zip"],
|
||||
sha256 = "89a287444b5b3e98f88a945afa50ce937b8ffd1dcc59c555ad9b1baf855298c9",
|
||||
)
|
||||
|
||||
http_file(
|
||||
name = "flatbuffers_zip",
|
||||
urls = ["https://github.com/google/flatbuffers/archive/refs/tags/v24.12.23.zip"],
|
||||
sha256 = "c5cd6a605ff20350c7faa19d8eeb599df6117ea4aabd16ac58a7eb5ba82df4e7",
|
||||
)
|
||||
|
||||
provisioning_profile_repository = use_extension("@build_bazel_rules_apple//apple:apple.bzl", "provisioning_profile_repository_extension")
|
||||
#provisioning_profile_repository.setup(
|
||||
# fallback_profiles = "//path/to/some:filegroup", # Profiles to use if one isn't found locally
|
||||
#)
|
||||
|
||||
bazel_dep(name = "build_configuration")
|
||||
local_path_override(
|
||||
module_name = "build_configuration",
|
||||
path = "./build-input/configuration-repository",
|
||||
)
|
||||
|
1016
MODULE.bazel.lock
generated
1016
MODULE.bazel.lock
generated
File diff suppressed because it is too large
Load Diff
296
Telegram/BUILD
296
Telegram/BUILD
@ -16,11 +16,6 @@ load("@build_bazel_rules_apple//apple:resources.bzl",
|
||||
"swift_intent_library",
|
||||
)
|
||||
|
||||
load("@build_bazel_rules_apple//apple:watchos.bzl",
|
||||
"watchos_application",
|
||||
"watchos_extension",
|
||||
)
|
||||
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl",
|
||||
"swift_library",
|
||||
)
|
||||
@ -48,7 +43,6 @@ load(
|
||||
"telegram_team_id",
|
||||
"telegram_enable_icloud",
|
||||
"telegram_enable_siri",
|
||||
"telegram_enable_watch",
|
||||
)
|
||||
|
||||
load("@build_bazel_rules_apple//apple:resources.bzl",
|
||||
@ -145,7 +139,6 @@ genrule(
|
||||
)
|
||||
|
||||
minimum_os_version = "12.0"
|
||||
minimum_watchos_version="9.0"
|
||||
|
||||
notificationServiceExtensionVersion = "v1"
|
||||
|
||||
@ -259,13 +252,6 @@ filegroup(
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "WatchAppStringResources",
|
||||
srcs = glob([
|
||||
"Telegram-iOS/*.lproj/Localizable.strings",
|
||||
], exclude = ["Telegram-iOS/*.lproj/**/.*"]),
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "AppIntentVocabularyResources",
|
||||
srcs = glob([
|
||||
@ -301,13 +287,6 @@ filegroup(
|
||||
], exclude = ["Telegram-iOS/DefaultAppIcon.xcassets/**/.*"]),
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "BlackAppIcon",
|
||||
srcs = glob([
|
||||
"Telegram-iOS/BlackIcon.xcassets/**/*",
|
||||
], exclude = ["Telegram-iOS/BlackIcon.xcassets/**/.*"]),
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "DefaultIcon",
|
||||
srcs = glob([
|
||||
@ -315,13 +294,6 @@ filegroup(
|
||||
]),
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "AdditionalIcons",
|
||||
srcs = glob([
|
||||
"Telegram-iOS/*.png",
|
||||
]),
|
||||
)
|
||||
|
||||
alternate_icon_folders = [
|
||||
"BlackIcon",
|
||||
"BlackClassicIcon",
|
||||
@ -568,62 +540,6 @@ plist_fragment(
|
||||
])
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "TelegramWatchExtensionResources",
|
||||
srcs = glob([
|
||||
"Watch/Extension/Resources/**/*",
|
||||
], exclude = ["Watch/Extension/Resources/**/.*"]),
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "TelegramWatchAppResources",
|
||||
srcs = glob([
|
||||
"Watch/Extension/Resources/**/*.png",
|
||||
], exclude = ["Watch/Extension/Resources/**/.*"]),
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "TelegramWatchAppAssets",
|
||||
srcs = glob([
|
||||
"Watch/App/Assets.xcassets/**/*",
|
||||
], exclude = ["Watch/App/Assets.xcassets/**/.*"]),
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "TelegramWatchAppInterface",
|
||||
srcs = glob([
|
||||
"Watch/App/Base.lproj/Interface.storyboard",
|
||||
]),
|
||||
)
|
||||
|
||||
objc_library(
|
||||
name = "TelegramWatchLib",
|
||||
srcs = glob([
|
||||
"Watch/Extension/**/*.m",
|
||||
"Watch/SSignalKit/**/*.m",
|
||||
"Watch/Bridge/**/*.m",
|
||||
"Watch/WatchCommonWatch/**/*.m",
|
||||
"Watch/Extension/**/*.h",
|
||||
"Watch/SSignalKit/**/*.h",
|
||||
"Watch/Bridge/**/*.h",
|
||||
"Watch/WatchCommonWatch/**/*.h",
|
||||
]),
|
||||
copts = [
|
||||
"-DTARGET_OS_WATCH=1",
|
||||
"-ITelegram/Watch",
|
||||
"-ITelegram/Watch/Extension",
|
||||
"-ITelegram/Watch/Bridge",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"WatchKit",
|
||||
"WatchConnectivity",
|
||||
"ClockKit",
|
||||
"UserNotifications",
|
||||
"CoreLocation",
|
||||
"CoreGraphics",
|
||||
],
|
||||
)
|
||||
|
||||
plist_fragment(
|
||||
name = "VersionInfoPlist",
|
||||
extension = "plist",
|
||||
@ -656,162 +572,6 @@ plist_fragment(
|
||||
"""
|
||||
)
|
||||
|
||||
plist_fragment(
|
||||
name = "WatchExtensionNSExtensionInfoPlist",
|
||||
extension = "plist",
|
||||
template =
|
||||
"""
|
||||
<key>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionAttributes</key>
|
||||
<dict>
|
||||
<key>WKAppBundleIdentifier</key>
|
||||
<string>{telegram_bundle_id}.watchkitapp</string>
|
||||
</dict>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.watchkit</string>
|
||||
</dict>
|
||||
""".format(
|
||||
telegram_bundle_id = telegram_bundle_id,
|
||||
)
|
||||
)
|
||||
|
||||
plist_fragment(
|
||||
name = "WatchAppCompanionInfoPlist",
|
||||
extension = "plist",
|
||||
template =
|
||||
"""
|
||||
<key>WKCompanionAppBundleIdentifier</key>
|
||||
<string>{telegram_bundle_id}</string>
|
||||
""".format(
|
||||
telegram_bundle_id = telegram_bundle_id,
|
||||
)
|
||||
)
|
||||
|
||||
plist_fragment(
|
||||
name = "WatchExtensionInfoPlist",
|
||||
extension = "plist",
|
||||
template =
|
||||
"""
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>{telegram_bundle_id}.watchkitapp.watchkitextension</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Telegram</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>WKExtensionDelegateClassName</key>
|
||||
<string>TGExtensionDelegate</string>
|
||||
""".format(
|
||||
telegram_bundle_id = telegram_bundle_id,
|
||||
)
|
||||
)
|
||||
|
||||
plist_fragment(
|
||||
name = "WatchAppInfoPlist",
|
||||
extension = "plist",
|
||||
template =
|
||||
"""
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>{telegram_bundle_id}.watchkitapp</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Telegram</string>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
</array>
|
||||
<key>WKWatchKitApp</key>
|
||||
<true/>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
""".format(
|
||||
telegram_bundle_id = telegram_bundle_id,
|
||||
)
|
||||
)
|
||||
|
||||
watchos_extension(
|
||||
name = "TelegramWatchExtension",
|
||||
bundle_id = "{telegram_bundle_id}.watchkitapp.watchkitextension".format(
|
||||
telegram_bundle_id = telegram_bundle_id,
|
||||
),
|
||||
bundle_name = "TelegramWatchExtension",
|
||||
infoplists = [
|
||||
":WatchExtensionInfoPlist",
|
||||
":VersionInfoPlist",
|
||||
":BuildNumberInfoPlist",
|
||||
":AppNameInfoPlist",
|
||||
":WatchExtensionNSExtensionInfoPlist",
|
||||
],
|
||||
minimum_os_version = minimum_watchos_version,
|
||||
provisioning_profile = select({
|
||||
":disableProvisioningProfilesSetting": None,
|
||||
"//conditions:default": "@build_configuration//provisioning:WatchExtension.mobileprovision",
|
||||
}),
|
||||
resources = [
|
||||
":TelegramWatchExtensionResources",
|
||||
],
|
||||
strings = [
|
||||
":WatchAppStringResources",
|
||||
],
|
||||
deps = [
|
||||
":TelegramWatchLib",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
genrule(
|
||||
name = "StripWatchosStubBinary",
|
||||
cmd_bash =
|
||||
"""
|
||||
echo 'lipo -remove armv7k -remove arm64 -remove arm64e $$1/TelegramWatch.app/_WatchKitStub/WK -output $$1/TelegramWatch.app/_WatchKitStub/WK' > $(location StripWatchosStubBinary.sh)
|
||||
echo '' >> $(location StripWatchosStubBinary.sh)
|
||||
""",
|
||||
outs = [
|
||||
"StripWatchosStubBinary.sh",
|
||||
],
|
||||
executable = True,
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
]
|
||||
)
|
||||
|
||||
watchos_application(
|
||||
name = "TelegramWatchApp",
|
||||
bundle_id = "{telegram_bundle_id}.watchkitapp".format(
|
||||
telegram_bundle_id = telegram_bundle_id,
|
||||
),
|
||||
bundle_name = "TelegramWatch",
|
||||
extension = ":TelegramWatchExtension",
|
||||
infoplists = [
|
||||
":WatchAppInfoPlist",
|
||||
":VersionInfoPlist",
|
||||
":BuildNumberInfoPlist",
|
||||
":AppNameInfoPlist",
|
||||
":WatchAppCompanionInfoPlist",
|
||||
],
|
||||
minimum_os_version = minimum_watchos_version,
|
||||
provisioning_profile = select({
|
||||
":disableProvisioningProfilesSetting": None,
|
||||
"//conditions:default": "@build_configuration//provisioning:WatchApp.mobileprovision",
|
||||
}),
|
||||
ipa_post_processor = ":StripWatchosStubBinary",
|
||||
resources = [
|
||||
":TelegramWatchAppResources",
|
||||
":TelegramWatchAppAssets",
|
||||
],
|
||||
storyboards = [
|
||||
":TelegramWatchAppInterface",
|
||||
],
|
||||
strings = [
|
||||
],
|
||||
)
|
||||
|
||||
plist_fragment(
|
||||
name = "MtProtoKitInfoPlist",
|
||||
extension = "plist",
|
||||
@ -1942,11 +1702,9 @@ ios_application(
|
||||
alternate_icons = [
|
||||
":{}".format(name) for name in alternate_icon_folders
|
||||
],
|
||||
#ipa_post_processor = ":AddAlternateIcons",
|
||||
resources = [
|
||||
":LaunchScreen",
|
||||
":DefaultAppIcon",
|
||||
#":AdditionalIcons",
|
||||
],
|
||||
frameworks = [
|
||||
":MtProtoKitFramework",
|
||||
@ -1969,10 +1727,6 @@ ios_application(
|
||||
":BroadcastUploadExtension",
|
||||
],
|
||||
}),
|
||||
watch_application = select({
|
||||
":disableExtensionsSetting": None,
|
||||
"//conditions:default": None#":TelegramWatchApp",
|
||||
}) if telegram_enable_watch else None,
|
||||
deps = [
|
||||
":Main",
|
||||
":Lib",
|
||||
@ -2090,53 +1844,3 @@ ios_application(
|
||||
"//third-party/libvpx:vpx",
|
||||
],
|
||||
)
|
||||
|
||||
swift_library(
|
||||
name = "TelegramCoreBuildTestLib",
|
||||
module_name = "TelegramCoreBuildTestLib",
|
||||
srcs = glob([
|
||||
"Tests/TelegramCoreBuildTest/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
data = [
|
||||
":WidgetAssets",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/BuildConfig:BuildConfig",
|
||||
"//submodules/WidgetItems:WidgetItems_iOS14",
|
||||
"//submodules/WidgetItemsUtils:WidgetItemsUtils",
|
||||
"//submodules/AppLockState:AppLockState",
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/Postbox:Postbox",
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
"//submodules/OpenSSLEncryptionProvider:OpenSSLEncryptionProvider",
|
||||
"//Telegram:GeneratedSources",
|
||||
],
|
||||
)
|
||||
|
||||
ios_application(
|
||||
name = "TelegramCoreBuildTest",
|
||||
bundle_id = "{telegram_bundle_id}".format(
|
||||
telegram_bundle_id = telegram_bundle_id,
|
||||
),
|
||||
families = ["iphone", "ipad"],
|
||||
minimum_os_version = minimum_os_version,
|
||||
provisioning_profile = select({
|
||||
":disableProvisioningProfilesSetting": None,
|
||||
"//conditions:default": "@build_configuration//provisioning:Telegram.mobileprovision",
|
||||
}),
|
||||
entitlements = ":TelegramEntitlements.entitlements",
|
||||
infoplists = [
|
||||
":TelegramInfoPlist",
|
||||
":BuildNumberInfoPlist",
|
||||
":VersionInfoPlist",
|
||||
":RequiredDeviceCapabilitiesPlist",
|
||||
":UrlTypesInfoPlist",
|
||||
],
|
||||
frameworks = [
|
||||
":TelegramCoreFramework",
|
||||
],
|
||||
deps = [":TelegramCoreBuildTestLib"],
|
||||
)
|
||||
|
@ -90,7 +90,9 @@ class BazelCommandLine:
|
||||
|
||||
# https://docs.bazel.build/versions/master/command-line-reference.html
|
||||
# Set the number of parallel jobs per module to saturate the available CPU resources.
|
||||
'--swiftcopt=-j{}'.format(os.cpu_count() - 1),
|
||||
#'--swiftcopt=-j{}'.format(os.cpu_count() - 1),
|
||||
'--@build_bazel_rules_swift//swift:copt="-j{}"'.format(os.cpu_count() - 1),
|
||||
'--@build_bazel_rules_swift//swift:copt="-whole-module-optimization"',
|
||||
]
|
||||
|
||||
self.common_release_args = [
|
||||
@ -106,7 +108,7 @@ class BazelCommandLine:
|
||||
# 1. resolves issues with the linker caused by the swift-objc mixing.
|
||||
# 2. makes the resulting binaries significantly smaller (up to 9% for this project).
|
||||
#'--swiftcopt=-num-threads', '--swiftcopt=1',
|
||||
'--swiftcopt=-num-threads', '--swiftcopt=1',
|
||||
#'--@build_bazel_rules_swift//swift:copt="-num-threads 0"',
|
||||
|
||||
# Strip unsused code.
|
||||
'--features=dead_strip',
|
||||
@ -197,8 +199,7 @@ class BazelCommandLine:
|
||||
# Require DSYM files as build output.
|
||||
'--output_groups=+dsyms',
|
||||
|
||||
'--swiftcopt=-num-threads',
|
||||
'--swiftcopt=0',
|
||||
#'--@build_bazel_rules_swift//swift:copt="-num-threads 0"',
|
||||
] + self.common_release_args
|
||||
else:
|
||||
raise Exception('Unknown configuration {}'.format(configuration))
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"app": "11.11",
|
||||
"xcode": "16.2",
|
||||
"bazel": "7.3.1:981f82a470bad1349322b6f51c9c6ffa0aa291dab1014fac411543c12e661dff",
|
||||
"bazel": "8.2.1:22ff65b05869f6160e5157b1b425a14a62085d71d8baef571f462b8fe5a703a3",
|
||||
"macos": "15"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user