diff --git a/WORKSPACE b/WORKSPACE index 330d06cb04..4d8f944355 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,15 +1,13 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file") -'''http_archive( - name = "com_google_protobuf", - urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v22.2/protobuf-22.2.zip"], - sha256 = "bf1f92aebd619651220711e97b3d560cdc2484718cd56d95161bfb2fadb8628e", - strip_prefix = "protobuf-22.2", - type = "zip", +http_archive( + name = "bazel_features", + sha256 = "9fcb3d7cbe908772462aaa52f02b857a225910d30daa3c252f670e3af6d8036d", + strip_prefix = "bazel_features-1.0.0", + url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.0.0/bazel_features-v1.0.0.tar.gz", ) - -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") -protobuf_deps()''' +load("@bazel_features//:deps.bzl", "bazel_features_deps") +bazel_features_deps() local_repository( name = "build_bazel_rules_apple", diff --git a/submodules/TelegramPresentationData/Sources/PresentationsResourceCache.swift b/submodules/TelegramPresentationData/Sources/PresentationsResourceCache.swift index 2d59cc9eec..234dde2c49 100644 --- a/submodules/TelegramPresentationData/Sources/PresentationsResourceCache.swift +++ b/submodules/TelegramPresentationData/Sources/PresentationsResourceCache.swift @@ -2,9 +2,48 @@ import Foundation import UIKit import SwiftSignalKit +#if DEBUG +private final class CacheStats { + var totalSize: Int = 0 + var reportSize: Int = 0 + + func logImage(image: UIImage, added: Bool) { + let sign = added ? 1 : -1 + + self.totalSize += sign * Int(image.size.width * image.scale) * Int(image.size.height * image.scale) * 4 + if abs(self.totalSize - self.reportSize) >= 1024 * 1024 { + self.reportSize = self.totalSize + print("UI resource cache: \((self.totalSize) / (1024 * 1024)) MB") + } + } +} +private let cacheStats = Atomic(value: CacheStats()) +#endif + private final class PresentationsResourceCacheHolder { var images: [Int32: UIImage] = [:] var parameterImages: [PresentationResourceParameterKey: UIImage] = [:] + + deinit { + #if DEBUG + cacheStats.with { cacheStats in + for (_, image) in self.images { + cacheStats.logImage(image: image, added: false) + } + for (_, image) in self.parameterImages { + cacheStats.logImage(image: image, added: false) + } + } + #endif + } + + func logAddedImage(image: UIImage) { + #if DEBUG + cacheStats.with { cacheStats in + cacheStats.logImage(image: image, added: true) + } + #endif + } } private final class PresentationsResourceAnyCacheHolder { @@ -26,6 +65,7 @@ public final class PresentationsResourceCache { if let image = generate(theme) { self.imageCache.with { holder -> Void in holder.images[key] = image + holder.logAddedImage(image: image) } return image } else { @@ -44,6 +84,7 @@ public final class PresentationsResourceCache { if let image = generate(theme) { self.imageCache.with { holder -> Void in holder.parameterImages[key] = image + holder.logAddedImage(image: image) } return image } else { diff --git a/submodules/TelegramUI/BUILD b/submodules/TelegramUI/BUILD index dd2452c540..64bda2944a 100644 --- a/submodules/TelegramUI/BUILD +++ b/submodules/TelegramUI/BUILD @@ -341,7 +341,6 @@ swift_library( "//submodules/TelegramUI/Components/Chat/ForwardAccessoryPanelNode", "//submodules/TelegramUI/Components/LegacyMessageInputPanel", ] + select({ - "@build_bazel_rules_apple//apple:ios_armv7": [], "@build_bazel_rules_apple//apple:ios_arm64": appcenter_targets, "//build-system:ios_sim_arm64": [], "@build_bazel_rules_apple//apple:ios_x86_64": [], diff --git a/submodules/TgVoip/BUILD b/submodules/TgVoip/BUILD index b239ef7609..6ddbb134f0 100644 --- a/submodules/TgVoip/BUILD +++ b/submodules/TgVoip/BUILD @@ -56,7 +56,6 @@ objc_library( "-Drtc=rtc1", "-Dwebrtc=webrtc1", ] + select({ - "@build_bazel_rules_apple//apple:ios_armv7": copts_arm, "@build_bazel_rules_apple//apple:ios_arm64": copts_arm, "//build-system:ios_sim_arm64": copts_arm, "@build_bazel_rules_apple//apple:ios_x86_64": copts_x86, diff --git a/third-party/boringssl/BUILD b/third-party/boringssl/BUILD index d7972a8355..85afad8f8c 100644 --- a/third-party/boringssl/BUILD +++ b/third-party/boringssl/BUILD @@ -60,14 +60,12 @@ posix_copts = [ ] boringssl_copts = select({ - "@build_bazel_rules_apple//apple:ios_armv7": posix_copts, "@build_bazel_rules_apple//apple:ios_arm64": posix_copts, "//build-system:ios_sim_arm64": posix_copts, "@build_bazel_rules_apple//apple:ios_x86_64": posix_copts, }) crypto_sources_asm = select({ - "@build_bazel_rules_apple//apple:ios_armv7": crypto_sources_ios_arm, "@build_bazel_rules_apple//apple:ios_arm64": crypto_sources_ios_aarch64, "//build-system:ios_sim_arm64": crypto_sources_ios_aarch64, "@build_bazel_rules_apple//apple:ios_x86_64": crypto_sources_mac_x86_64, @@ -82,7 +80,6 @@ posix_copts_c11 = [ ] boringssl_copts_c11 = boringssl_copts + select({ - "@build_bazel_rules_apple//apple:ios_armv7": posix_copts_c11, "@build_bazel_rules_apple//apple:ios_arm64": posix_copts_c11, "//build-system:ios_sim_arm64": posix_copts_c11, "@build_bazel_rules_apple//apple:ios_x86_64": posix_copts_c11, @@ -95,7 +92,6 @@ posix_copts_cxx = [ ] boringssl_copts_cxx = boringssl_copts + select({ - "@build_bazel_rules_apple//apple:ios_armv7": posix_copts_cxx, "@build_bazel_rules_apple//apple:ios_arm64": posix_copts_cxx, "//build-system:ios_sim_arm64": posix_copts_cxx, "@build_bazel_rules_apple//apple:ios_x86_64": posix_copts_cxx, @@ -108,7 +104,6 @@ cc_library( copts = boringssl_copts_c11, includes = ["src/include"], linkopts = select({ - "@build_bazel_rules_apple//apple:ios_armv7": [], "@build_bazel_rules_apple//apple:ios_arm64": [], "//build-system:ios_sim_arm64": [], "@build_bazel_rules_apple//apple:ios_x86_64": [], diff --git a/third-party/libyuv/BUILD b/third-party/libyuv/BUILD index 9936c678c3..772c506702 100644 --- a/third-party/libyuv/BUILD +++ b/third-party/libyuv/BUILD @@ -26,7 +26,6 @@ x86_64_specific_flags = [ ] arch_specific_cflags = select({ - "@build_bazel_rules_apple//apple:ios_armv7": common_flags + arm_specific_flags, "@build_bazel_rules_apple//apple:ios_arm64": common_flags + arm64_specific_flags, "//build-system:ios_sim_arm64": common_flags + arm64_specific_flags, "@build_bazel_rules_apple//apple:ios_x86_64": common_flags + x86_64_specific_flags, diff --git a/third-party/openh264/BUILD b/third-party/openh264/BUILD index 0fde708c6f..10be893db9 100644 --- a/third-party/openh264/BUILD +++ b/third-party/openh264/BUILD @@ -54,21 +54,18 @@ arm_specific_copts = [ ] arch_specific_sources = select({ - "@build_bazel_rules_apple//apple:ios_armv7": arm_specific_sources, "@build_bazel_rules_apple//apple:ios_arm64": arm64_specific_sources, "//build-system:ios_sim_arm64": arm64_specific_sources, "@build_bazel_rules_apple//apple:ios_x86_64": [], }) arch_specific_copts = select({ - "@build_bazel_rules_apple//apple:ios_armv7": arm_specific_copts, "@build_bazel_rules_apple//apple:ios_arm64": arm64_specific_copts, "//build-system:ios_sim_arm64": arm64_specific_copts, "@build_bazel_rules_apple//apple:ios_x86_64": [], }) arch_specific_textual_hdrs = select({ - "@build_bazel_rules_apple//apple:ios_armv7": arm_specific_textual_hdrs, "@build_bazel_rules_apple//apple:ios_arm64": arm64_specific_textual_hdrs, "//build-system:ios_sim_arm64": arm64_specific_textual_hdrs, "@build_bazel_rules_apple//apple:ios_x86_64": [], diff --git a/third-party/webrtc/BUILD b/third-party/webrtc/BUILD index 8ef1a237c7..ab4946e7f8 100644 --- a/third-party/webrtc/BUILD +++ b/third-party/webrtc/BUILD @@ -3254,7 +3254,6 @@ x86_specific_sources = [webrtc_source_dir + "/" + path for path in [ ]] arch_specific_sources = select({ - "@build_bazel_rules_apple//apple:ios_armv7": common_arm_specific_sources + armv7_specific_sources, "@build_bazel_rules_apple//apple:ios_arm64": common_arm_specific_sources + arm64_specific_sources, "//build-system:ios_sim_arm64": common_arm_specific_sources + arm64_specific_sources, "@build_bazel_rules_apple//apple:ios_x86_64": x86_specific_sources, @@ -3307,15 +3306,12 @@ x86_64_specific_flags = [ ] arch_specific_cflags = select({ - "@build_bazel_rules_apple//apple:ios_armv7": common_flags + arm_specific_flags, "@build_bazel_rules_apple//apple:ios_arm64": common_flags + arm64_specific_flags, "//build-system:ios_sim_arm64": common_flags + arm64_specific_flags, "@build_bazel_rules_apple//apple:ios_x86_64": common_flags + x86_64_specific_flags, }) arch_specific_crc32c_sources = select({ - "@build_bazel_rules_apple//apple:ios_armv7": [ - ], "@build_bazel_rules_apple//apple:ios_arm64": [ "dependencies/third_party/crc32c/src/crc32c_arm64.cc", ],