Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin 2020-12-27 21:22:04 +04:00
commit 21e5d80ed6
27 changed files with 1814 additions and 1991 deletions

View File

@ -1,16 +1,17 @@
build --experimental_guard_against_concurrent_changes
build --action_env=ZERO_AR_DATE=1
build --strategy=Genrule=local
build --apple_platform_type=ios
build --cxxopt='-std=c++14'
build --per_file_copt="third-party/webrtc/.*\.cpp$","@-std=c++14"
build --per_file_copt="third-party/webrtc/.*\.cc$","@-std=c++14"
build --per_file_copt="third-party/webrtc/.*\.mm$","@-std=c++14"
build --spawn_strategy=local
build --strategy=SwiftCompile=local
build --features=debug_prefix_map_pwd_is_dot
build --features=swift.cacheable_swiftmodules
build --features=swift.debug_prefix_map
build --features=swift.enable_vfsoverlays
build --strategy=Genrule=standalone
build --spawn_strategy=standalone
build --strategy=SwiftCompile=standalone

View File

@ -1,35 +0,0 @@
[cxx]
default_platform = iphonesimulator-x86_64
cflags = -g -fmodules -fobjc-arc -D BUCK -DTARGET_OS_IOS=1 -g -w $(config custom.other_cflags)
cxxflags = -fobjc-arc -std=c++14 -D BUCK -DTARGET_OS_IOS=1 -g $(config custom.other_cxxflags)
combined_preprocess_and_compile = true
pch_enabled = false
ldflags = -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime $(config custom.other_cxxflags)
[swift]
version = 5
compiler_flags = -g -DBUCK $(config custom.optimization) $(config custom.config_swift_compiler_flags) $(config custom.other_swift_compiler_flags)
use_filelist = true
[apple]
use_swift_delegate = false
use_header_maps_in_xcode = false
generate_missing_umbrella_headers = true
iphonesimulator_target_sdk_version = 9.0
iphoneos_target_sdk_version = 9.0
watchos_target_sdk_version = 5.0
provisioning_profile_read_command = security cms -Di
xctool_default_destination_specifier = platform=iOS Simulator,OS=latest
xctool_path = tools/xctool/bin/xctool
[parser]
polyglot_parsing_enabled = true
default_build_file_syntax = SKYLARK
[project]
ide_force_kill = always
project_schemes = true
ide = xcode
allow_symlinks = forbid
ignore = tools, \
.git, \

14
.gitattributes vendored
View File

@ -1,14 +0,0 @@
# Linguist overrides for vendored code
submodules/AsyncDisplayKit/* linguist-vendored
submodules/ffmpeg/* linguist-vendored
submodules/HockeySDK-iOS/* linguist-vendored
submodules/libphonenumber/* linguist-vendored
submodules/libtgvoip/* linguist-vendored
submodules/lottie-ios/* linguist-vendored
submodules/Opus/* linguist-vendored
submodules/OpusBinding/* linguist-vendored
submodules/rlottie/rlottie/* linguist-vendored
submodules/sqlcipher/* linguist-vendored
submodules/Stripe/* linguist-vendored
submodules/ton/tonlib-src/* linguist-vendored
submodules/webp/include/* linguist-vendored

View File

@ -1 +0,0 @@
General fixes and stability improvements

View File

View File

@ -1,20 +0,0 @@
def appConfig():
apiId = native.read_config("custom", "apiId")
apiHash = native.read_config("custom", "apiHash")
appCenterId = native.read_config("custom", "appCenterId")
isInternalBuild = native.read_config("custom", "isInternalBuild")
isAppStoreBuild = native.read_config("custom", "isAppStoreBuild")
appStoreId = native.read_config("custom", "appStoreId")
appSpecificUrlScheme = native.read_config("custom", "appSpecificUrlScheme")
buildNumber = native.read_config("custom", "buildNumber")
return {
"apiId": apiId,
"apiHash": apiHash,
"appCenterId": appCenterId,
"isInternalBuild": isInternalBuild,
"isAppStoreBuild": isAppStoreBuild,
"appStoreId": appStoreId,
"appSpecificUrlScheme": appSpecificUrlScheme,
"buildNumber": buildNumber,
}

View File

@ -1,318 +0,0 @@
load("//Config:utils.bzl",
"config_with_updated_linker_flags",
"configs_with_config",
"merge_dict",
"DEVELOPMENT_LANGUAGE",
"SHARED_CONFIGS",
"ALL_LOAD_LINKER_FLAG",
"read_config_nonempty",
"optimization_config",
"add_provisioning_profile_specifier",
"add_codesign_identity",
"get_build_number",
"get_short_version",
"bundle_identifier",
"get_development_team",
"get_provisioning_profile",
"get_codesign_entitlements",
)
load("//Config:app_configuration.bzl",
"appConfig",
)
def app_binary_configs():
config = {
"ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES": "YES",
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(suffix=""),
"CODE_SIGN_ENTITLEMENTS": get_codesign_entitlements("app"),
"DEVELOPMENT_TEAM": get_development_team(),
"ASSETCATALOG_COMPILER_APPICON_NAME": "AppIcon",
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
"APP_NAME": "Telegram",
"PRODUCT_NAME": "Telegram",
"TARGETED_DEVICE_FAMILY": "1,2",
}
config = merge_dict(SHARED_CONFIGS, config)
config = merge_dict(config, optimization_config())
config = config_with_updated_linker_flags(config, ALL_LOAD_LINKER_FLAG)
configs = configs_with_config(config)
configs = add_provisioning_profile_specifier(configs, "app")
configs = add_codesign_identity(configs)
return configs
def share_extension_configs():
config = {
"ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES": "NO",
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(suffix=".Share"),
"CODE_SIGN_ENTITLEMENTS": get_codesign_entitlements("share"),
"DEVELOPMENT_TEAM": get_development_team(),
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
"APP_NAME": "Telegram",
"PRODUCT_NAME": "ShareExtension",
}
config = merge_dict(SHARED_CONFIGS, config)
config = merge_dict(config, optimization_config())
config = config_with_updated_linker_flags(config, ALL_LOAD_LINKER_FLAG)
configs = configs_with_config(config)
configs = add_provisioning_profile_specifier(configs, "share")
configs = add_codesign_identity(configs)
return configs
def widget_extension_configs():
config = {
"ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES": "NO",
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(suffix=".Widget"),
"CODE_SIGN_ENTITLEMENTS": get_codesign_entitlements("widget"),
"DEVELOPMENT_TEAM": get_development_team(),
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
"APP_NAME": "Telegram",
"PRODUCT_NAME": "WidgetExtension",
}
config = merge_dict(SHARED_CONFIGS, config)
config = merge_dict(config, optimization_config())
config = config_with_updated_linker_flags(config, ALL_LOAD_LINKER_FLAG)
configs = configs_with_config(config)
configs = add_provisioning_profile_specifier(configs, "widget")
configs = add_codesign_identity(configs)
return configs
def notification_content_extension_configs():
config = {
"ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES": "NO",
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(suffix=".NotificationContent"),
"CODE_SIGN_ENTITLEMENTS": get_codesign_entitlements("notification_content"),
"DEVELOPMENT_TEAM": get_development_team(),
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
"APP_NAME": "Telegram",
"PRODUCT_NAME": "NotificationContentExtension",
}
config = merge_dict(SHARED_CONFIGS, config)
config = merge_dict(config, optimization_config())
config = config_with_updated_linker_flags(config, ALL_LOAD_LINKER_FLAG)
configs = configs_with_config(config)
configs = add_provisioning_profile_specifier(configs, "notification_content")
configs = add_codesign_identity(configs)
return configs
def notification_service_extension_configs():
config = {
"ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES": "NO",
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(suffix=".NotificationService"),
"CODE_SIGN_ENTITLEMENTS": get_codesign_entitlements("notification_service"),
"DEVELOPMENT_TEAM": get_development_team(),
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
"APP_NAME": "Telegram",
"PRODUCT_NAME": "NotificationServiceExtension",
}
config = merge_dict(SHARED_CONFIGS, config)
config = merge_dict(config, optimization_config())
config = config_with_updated_linker_flags(config, ALL_LOAD_LINKER_FLAG)
configs = configs_with_config(config)
configs = add_provisioning_profile_specifier(configs, "notification_service")
configs = add_codesign_identity(configs)
return configs
def intents_extension_configs():
config = {
"ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES": "NO",
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(suffix=".SiriIntents"),
"CODE_SIGN_ENTITLEMENTS": get_codesign_entitlements("intents"),
"DEVELOPMENT_TEAM": get_development_team(),
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
"APP_NAME": "Telegram",
"PRODUCT_NAME": "IntentsExtension",
}
config = merge_dict(SHARED_CONFIGS, config)
config = merge_dict(config, optimization_config())
config = config_with_updated_linker_flags(config, ALL_LOAD_LINKER_FLAG)
configs = configs_with_config(config)
configs = add_provisioning_profile_specifier(configs, "intents")
configs = add_codesign_identity(configs)
return configs
def watch_extension_binary_configs():
config = {
"SDKROOT": "watchos",
"WATCHOS_DEPLOYMENT_TARGET": "5.0",
"TARGETED_DEVICE_FAMILY": "4",
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(suffix=".watchkitapp.watchkitextension"),
"DEVELOPMENT_TEAM": get_development_team(),
"LD_RUNPATH_SEARCH_PATHS": "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks",
"WK_COMPANION_APP_BUNDLE_IDENTIFIER": bundle_identifier(suffix=""),
"WK_APP_BUNDLE_IDENTIFIER": bundle_identifier(suffix=".watchkitapp"),
"APP_NAME": "Telegram",
"APP_BUNDLE_ID": bundle_identifier(suffix=""),
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
"ENABLE_BITCODE": "YES",
}
config = config_with_updated_linker_flags(config, ALL_LOAD_LINKER_FLAG)
configs = configs_with_config(config)
configs = add_provisioning_profile_specifier(configs, "watch_extension")
configs = add_codesign_identity(configs)
return configs
def watch_binary_configs():
config = {
"SDKROOT": "watchos",
"WATCHOS_DEPLOYMENT_TARGET": "5.0",
"TARGETED_DEVICE_FAMILY": "4",
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(suffix=".watchkitapp"),
"DEVELOPMENT_TEAM": get_development_team(),
"LD_RUNPATH_SEARCH_PATHS": "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks",
"WK_COMPANION_APP_BUNDLE_IDENTIFIER": bundle_identifier(suffix=""),
"WK_APP_BUNDLE_IDENTIFIER": bundle_identifier(suffix=".watchkitapp"),
"APP_NAME": "Telegram",
"APP_BUNDLE_ID": bundle_identifier(suffix=""),
"ASSETCATALOG_COMPILER_APPICON_NAME": "AppIcon",
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
"ENABLE_BITCODE": "YES",
}
config = config_with_updated_linker_flags(config, ALL_LOAD_LINKER_FLAG)
configs = configs_with_config(config)
configs = add_provisioning_profile_specifier(configs, "watch_app")
configs = add_codesign_identity(configs)
return configs
def info_plist_substitutions(name):
substitutions = {
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"EXECUTABLE_NAME": name,
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(name),
"PRODUCT_NAME": name,
"CURRENT_PROJECT_VERSION": "1",
}
return substitutions
def app_info_plist_substitutions():
substitutions = {
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"EXECUTABLE_NAME": "Telegram",
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(suffix=""),
"PRODUCT_NAME": "Telegram",
"APP_NAME": "Telegram",
"CURRENT_PROJECT_VERSION": "1",
"APP_SPECIFIC_URL_SCHEME": appConfig()["appSpecificUrlScheme"],
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
"ASSETCATALOG_COMPILER_APPICON_NAME": "AppIcon",
"TARGETED_DEVICE_FAMILY": "1,2",
}
return substitutions
def share_extension_info_plist_substitutions():
substitutions = {
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"EXECUTABLE_NAME": "ShareExtension",
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(suffix=".Share"),
"PRODUCT_NAME": "Share",
"APP_NAME": "Telegram",
"CURRENT_PROJECT_VERSION": "1",
"APP_SPECIFIC_URL_SCHEME": appConfig()["appSpecificUrlScheme"],
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
}
return substitutions
def widget_extension_info_plist_substitutions():
substitutions = {
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"EXECUTABLE_NAME": "WidgetExtension",
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(suffix=".Widget"),
"PRODUCT_NAME": "Widget",
"APP_NAME": "Telegram",
"CURRENT_PROJECT_VERSION": "1",
"APP_SPECIFIC_URL_SCHEME": appConfig()["appSpecificUrlScheme"],
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
"MinimumOSVersion": "9.0",
}
return substitutions
def notification_content_extension_info_plist_substitutions():
substitutions = {
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"EXECUTABLE_NAME": "NotificationContentExtension",
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(suffix=".NotificationContent"),
"PRODUCT_NAME": "Telegram",
"APP_NAME": "Telegram",
"CURRENT_PROJECT_VERSION": "1",
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
"MinimumOSVersion": "10.0",
}
return substitutions
def notification_service_extension_info_plist_substitutions():
substitutions = {
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"EXECUTABLE_NAME": "NotificationServiceExtension",
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(suffix=".NotificationService"),
"PRODUCT_NAME": "Telegram",
"APP_NAME": "Telegram",
"CURRENT_PROJECT_VERSION": "1",
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
"MinimumOSVersion": "10.0",
}
return substitutions
def intents_extension_info_plist_substitutions():
substitutions = {
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"EXECUTABLE_NAME": "IntentsExtension",
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(suffix=".SiriIntents"),
"PRODUCT_NAME": "Telegram",
"APP_NAME": "Telegram",
"CURRENT_PROJECT_VERSION": "1",
"APP_SPECIFIC_URL_SCHEME": appConfig()["appSpecificUrlScheme"],
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
"PRODUCT_MODULE_NAME": "SiriIntents",
"MinimumOSVersion": "10.0",
}
return substitutions
def watch_extension_info_plist_substitutions():
substitutions = {
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"EXECUTABLE_NAME": "WatchAppExtension",
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(suffix=".watchkitapp.watchkitextension"),
"APP_NAME": "Telegram",
"APP_BUNDLE_ID": bundle_identifier(suffix=""),
"PRODUCT_NAME": "Telegram",
"CURRENT_PROJECT_VERSION": "1",
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
"MinimumOSVersion": "5.0",
}
return substitutions
def watch_info_plist_substitutions():
substitutions = {
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"EXECUTABLE_NAME": "WatchApp",
"PRODUCT_BUNDLE_IDENTIFIER":bundle_identifier(suffix=".watchkitapp"),
"APP_NAME": "Telegram",
"APP_BUNDLE_ID": bundle_identifier(suffix=""),
"PRODUCT_NAME": "Telegram",
"CURRENT_PROJECT_VERSION": "1",
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
"MinimumOSVersion": "5.0",
}
return substitutions

View File

@ -1,31 +0,0 @@
def _impl(ctx):
output_dir = ctx.attr.name + "_ModuleHeaders"
dir = ctx.actions.declare_directory(output_dir)
files = []
files_command = ""
for file in ctx.files.headers:
outFile = ctx.actions.declare_file(output_dir + "/" + ctx.attr.module_name + "/" + file.basename)
files.append(outFile)
files_command = files_command + " && cp " + file.path + " " + outFile.path
ctx.actions.run_shell(
outputs = [dir] + files,
inputs = ctx.files.headers,
command = "mkdir -p " + dir.path + " " + files_command
)
return [
apple_common.new_objc_provider(
include_system = depset([dir.path]),
header = depset(files),
),
]
objc_module = rule(
implementation = _impl,
attrs = {
"module_name": attr.string(mandatory = True),
"headers": attr.label_list(
allow_files = [".h"],
),
},
)

View File

@ -1,202 +0,0 @@
OTHER_LINKER_FLAGS_KEY = 'OTHER_LDFLAGS'
def configs_with_config(config):
return {
"Debug": config,
"Profile": config,
"Release": config,
}
def configs_with_updated_linker_flags(configs, other_linker_flags):
if other_linker_flags == None:
return configs
else:
updated_configs = { }
for build_configuration in configs:
updated_configs[build_configuration] = config_with_updated_linker_flags(
configs[build_configuration],
other_linker_flags)
return updated_configs
def config_with_updated_linker_flags(config, other_linker_flags, config_key=OTHER_LINKER_FLAGS_KEY):
new_config = { }
config_key_found = False
for key in config:
if key == config_key:
new_config[key] = config[key] + (" %s" % other_linker_flags)
config_key_found = True
else:
new_config[key] = config[key]
if config_key_found == False:
# If `config` does not currently contain `config_key`, add it. Inherit for good measure.
new_config[config_key] = '$(inherited) ' + other_linker_flags
return new_config
def merge_dict(a, b):
d = {}
d.update(a)
d.update(b)
return d
DEVELOPMENT_LANGUAGE = "en"
SHARED_CONFIGS = {
"IPHONEOS_DEPLOYMENT_TARGET": "9.0",
"SDKROOT": "iphoneos",
"GCC_OPTIMIZATION_LEVEL": "0",
"SWIFT_WHOLE_MODULE_OPTIMIZATION": "NO",
"ONLY_ACTIVE_ARCH": "YES",
"LD_RUNPATH_SEARCH_PATHS": "@executable_path/Frameworks",
"ENABLE_BITCODE": "NO",
}
# Adding `-all_load` to our binaries works around https://bugs.swift.org/browse/SR-6004.
ALL_LOAD_LINKER_FLAG = "-all_load"
def optimization_config():
return {
"SWIFT_OPTIMIZATION_LEVEL": native.read_config("custom", "optimization"),
}
def read_config_nonempty(name):
value = native.read_config("custom", name)
if value == None:
fail("Configuration parameter custom.%s should be defined" % name)
elif len(value) == 0:
fail("Configuration parameter custom.%s should not be empty" % name)
else:
return value
def get_codesign_identity(environment):
if environment == "development":
return read_config_nonempty("developmentCodeSignIdentity")
elif environment == "distribution":
return read_config_nonempty("distributionCodeSignIdentity")
else:
fail("Unknown environment " + environment)
def get_development_team():
return read_config_nonempty("developmentTeam")
def add_item_to_subdict(superdict, key, subkey, item):
subdict = dict(superdict[key])
subdict[subkey] = item
superdict[key] = subdict
valid_configurations = ["Debug", "Profile", "Release"]
def add_provisioning_profile_specifier(configs, type):
for configuration in configs:
if configuration not in valid_configurations:
fail("Unknown configuration " + configuration)
configs = dict(configs)
for configuration in valid_configurations:
if configuration == "Debug":
add_item_to_subdict(configs, configuration, "PROVISIONING_PROFILE_SPECIFIER", get_provisioning_profile(environment="development", type=type))
elif configuration == "Profile":
add_item_to_subdict(configs, configuration, "PROVISIONING_PROFILE_SPECIFIER", get_provisioning_profile(environment="development", type=type))
elif configuration == "Release":
add_item_to_subdict(configs, configuration, "PROVISIONING_PROFILE_SPECIFIER", get_provisioning_profile(environment="distribution", type=type))
return configs
def add_codesign_identity(configs):
for configuration in configs:
if configuration not in valid_configurations:
fail("Unknown configuration " + configuration)
configs = dict(configs)
for configuration in valid_configurations:
if configuration == "Debug":
add_item_to_subdict(configs, configuration, "CODE_SIGN_IDENTITY", get_codesign_identity(environment="development"))
elif configuration == "Profile":
add_item_to_subdict(configs, configuration, "CODE_SIGN_IDENTITY", get_codesign_identity(environment="development"))
elif configuration == "Release":
add_item_to_subdict(configs, configuration, "CODE_SIGN_IDENTITY", get_codesign_identity(environment="distribution"))
return configs
def get_build_number():
return read_config_nonempty("buildNumber")
def get_short_version():
return read_config_nonempty("appVersion")
def bundle_identifier(suffix):
return read_config_nonempty("baseApplicationBundleId") + suffix
def library_configs():
lib_specific_config = {
"SWIFT_WHOLE_MODULE_OPTIMIZATION": "NO",
# Setting SKIP_INSTALL to NO for static library configs would create
# create a generic xcode archive which can not be uploaded the app store
# https://developer.apple.com/library/archive/technotes/tn2215/_index.html
"SKIP_INSTALL": "YES",
}
library_config = merge_dict(SHARED_CONFIGS, lib_specific_config)
library_config = merge_dict(library_config, optimization_config())
configs = {
"Debug": library_config,
"Profile": library_config,
"Release": library_config,
}
return configs
def dynamic_library_configs():
lib_specific_config = {
"SWIFT_WHOLE_MODULE_OPTIMIZATION": "NO",
# Setting SKIP_INSTALL to NO for static library configs would create
# create a generic xcode archive which can not be uploaded the app store
# https://developer.apple.com/library/archive/technotes/tn2215/_index.html
"SKIP_INSTALL": "YES",
"MACH_O_TYPE": "mh_dylib",
"CODE_SIGNING_ALLOWED": "NO",
}
library_config = merge_dict(SHARED_CONFIGS, lib_specific_config)
library_config = merge_dict(library_config, optimization_config())
configs = {
"Debug": library_config,
"Profile": library_config,
"Release": library_config,
}
return configs
def get_provisioning_profile(environment, type):
if type == "app":
return read_config_nonempty(environment + "ProvisioningProfileApp")
elif type == "share":
return read_config_nonempty(environment + "ProvisioningProfileExtensionShare")
elif type == "widget":
return read_config_nonempty(environment + "ProvisioningProfileExtensionWidget")
elif type == "notification_service":
return read_config_nonempty(environment + "ProvisioningProfileExtensionNotificationService")
elif type == "notification_content":
return read_config_nonempty(environment + "ProvisioningProfileExtensionNotificationContent")
elif type == "intents":
return read_config_nonempty(environment + "ProvisioningProfileExtensionIntents")
elif type == "watch_app":
return read_config_nonempty(environment + "ProvisioningProfileWatchApp")
elif type == "watch_extension":
return read_config_nonempty(environment + "ProvisioningProfileWatchExtension")
else:
fail("Unknown provisioning profile type " + type)
def get_codesign_entitlements(type):
if type == "app":
return read_config_nonempty("entitlementsApp")
elif type == "share":
return read_config_nonempty("entitlementsExtensionShare")
elif type == "widget":
return read_config_nonempty("entitlementsExtensionWidget")
elif type == "notification_service":
return read_config_nonempty("entitlementsExtensionNotificationService")
elif type == "notification_content":
return read_config_nonempty("entitlementsExtensionNotificationContent")
elif type == "intents":
return read_config_nonempty("entitlementsExtensionIntents")
else:
fail("unknown provisioning profile type")

View File

@ -1,59 +0,0 @@
load("//Config:utils.bzl",
"config_with_updated_linker_flags",
"configs_with_config",
"merge_dict",
"DEVELOPMENT_LANGUAGE",
"SHARED_CONFIGS",
"ALL_LOAD_LINKER_FLAG",
"optimization_config",
"add_provisioning_profile_specifier",
"add_codesign_identity",
"get_build_number",
"get_short_version",
"bundle_identifier",
"get_development_team",
"get_provisioning_profile",
"get_codesign_entitlements",
)
load("//Config:app_configuration.bzl",
"appConfig"
)
def app_binary_configs():
config = {
"ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES": "YES",
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"EXECUTABLE_NAME": "Wallet",
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(suffix=""),
"CODE_SIGN_ENTITLEMENTS": get_codesign_entitlements("app"),
"DEVELOPMENT_TEAM": get_development_team(),
"ASSETCATALOG_COMPILER_APPICON_NAME": "AppIconWallet",
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
"APP_NAME": "TON Wallet",
"PRODUCT_NAME": "TON Wallet",
"TARGETED_DEVICE_FAMILY": "1,2",
}
config = merge_dict(SHARED_CONFIGS, config)
config = merge_dict(config, optimization_config())
config = config_with_updated_linker_flags(config, ALL_LOAD_LINKER_FLAG)
configs = configs_with_config(config)
configs = add_provisioning_profile_specifier(configs, "app")
configs = add_codesign_identity(configs)
return configs
def app_info_plist_substitutions():
substitutions = {
"DEVELOPMENT_LANGUAGE": DEVELOPMENT_LANGUAGE,
"EXECUTABLE_NAME": "Wallet",
"PRODUCT_BUNDLE_IDENTIFIER": bundle_identifier(suffix=""),
"PRODUCT_NAME": "TON Wallet",
"APP_NAME": "TON Wallet",
"CURRENT_PROJECT_VERSION": "1",
"BUILD_NUMBER": get_build_number(),
"PRODUCT_BUNDLE_SHORT_VERSION": get_short_version(),
"ASSETCATALOG_COMPILER_APPICON_NAME": "AppIconWallet",
"TARGETED_DEVICE_FAMILY": "1,2",
}
return substitutions

398
Makefile
View File

@ -1,49 +1,9 @@
.PHONY : check_env build build_arm64 build_debug_arm64 package package_arm64 app app_arm64 app_debug_arm64 build_buckdebug build_verbose kill_xcode clean project project_buckdebug temp
include Utils.makefile
.PHONY : kill_xcode clean bazel_app_debug_arm64 bazel_app_debug_sim_arm64 bazel_app_arm64 bazel_app_armv7 bazel_app check_sandbox_debug_build bazel_project bazel_project_noextensions
APP_VERSION="7.3"
CORE_COUNT=$(shell sysctl -n hw.logicalcpu)
CORE_COUNT_MINUS_ONE=$(shell expr ${CORE_COUNT} \- 1)
BUCK_OPTIONS=\
--config custom.appVersion="${APP_VERSION}" \
--config custom.developmentCodeSignIdentity="${DEVELOPMENT_CODE_SIGN_IDENTITY}" \
--config custom.distributionCodeSignIdentity="${DISTRIBUTION_CODE_SIGN_IDENTITY}" \
--config custom.developmentTeam="${DEVELOPMENT_TEAM}" \
--config custom.baseApplicationBundleId="${BUNDLE_ID}" \
--config custom.apiId="${API_ID}" \
--config custom.apiHash="${API_HASH}" \
--config custom.appCenterId="${APP_CENTER_ID}" \
--config custom.isInternalBuild="${IS_INTERNAL_BUILD}" \
--config custom.isAppStoreBuild="${IS_APPSTORE_BUILD}" \
--config custom.appStoreId="${APPSTORE_ID}" \
--config custom.appSpecificUrlScheme="${APP_SPECIFIC_URL_SCHEME}" \
--config custom.buildNumber="${BUILD_NUMBER}" \
--config custom.entitlementsApp="${ENTITLEMENTS_APP}" \
--config custom.developmentProvisioningProfileApp="${DEVELOPMENT_PROVISIONING_PROFILE_APP}" \
--config custom.distributionProvisioningProfileApp="${DISTRIBUTION_PROVISIONING_PROFILE_APP}" \
--config custom.entitlementsExtensionShare="${ENTITLEMENTS_EXTENSION_SHARE}" \
--config custom.developmentProvisioningProfileExtensionShare="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_SHARE}" \
--config custom.distributionProvisioningProfileExtensionShare="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_SHARE}" \
--config custom.entitlementsExtensionWidget="${ENTITLEMENTS_EXTENSION_WIDGET}" \
--config custom.developmentProvisioningProfileExtensionWidget="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_WIDGET}" \
--config custom.distributionProvisioningProfileExtensionWidget="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_WIDGET}" \
--config custom.entitlementsExtensionNotificationService="${ENTITLEMENTS_EXTENSION_NOTIFICATIONSERVICE}" \
--config custom.developmentProvisioningProfileExtensionNotificationService="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE}" \
--config custom.distributionProvisioningProfileExtensionNotificationService="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE}" \
--config custom.entitlementsExtensionNotificationContent="${ENTITLEMENTS_EXTENSION_NOTIFICATIONCONTENT}" \
--config custom.developmentProvisioningProfileExtensionNotificationContent="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT}" \
--config custom.distributionProvisioningProfileExtensionNotificationContent="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT}" \
--config custom.entitlementsExtensionIntents="${ENTITLEMENTS_EXTENSION_INTENTS}" \
--config custom.developmentProvisioningProfileExtensionIntents="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_INTENTS}" \
--config custom.distributionProvisioningProfileExtensionIntents="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_INTENTS}" \
--config custom.developmentProvisioningProfileWatchApp="${DEVELOPMENT_PROVISIONING_PROFILE_WATCH_APP}" \
--config custom.distributionProvisioningProfileWatchApp="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_APP}" \
--config custom.developmentProvisioningProfileWatchExtension="${DEVELOPMENT_PROVISIONING_PROFILE_WATCH_EXTENSION}" \
--config custom.distributionProvisioningProfileWatchExtension="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_EXTENSION}"
BAZEL=$(shell which bazel)
ifneq ($(BAZEL_HTTP_CACHE_URL),)
@ -54,16 +14,30 @@ else ifneq ($(BAZEL_CACHE_DIR),)
--disk_cache="${BAZEL_CACHE_DIR}"
endif
ifneq ($(BAZEL_KEEP_GOING),)
export BAZEL_KEEP_GOING_FLAGS=\
-k
else ifneq ($(BAZEL_CACHE_DIR),)
export BAZEL_KEEP_GOING_FLAGS=
endif
BAZEL_COMMON_FLAGS=\
--announce_rc \
--features=swift.use_global_module_cache \
--features=swift.split_derived_files_generation \
--features=swift.skip_function_bodies_for_derived_files \
--jobs=${CORE_COUNT}
--jobs=${CORE_COUNT} \
${BAZEL_KEEP_GOING_FLAGS} \
BAZEL_DEBUG_FLAGS=\
--features=swift.enable_batch_mode \
--swiftcopt=-j${CORE_COUNT_MINUS_ONE} \
--experimental_guard_against_concurrent_changes \
BAZEL_SANDBOX_FLAGS=\
--strategy=Genrule=sandboxed \
--spawn_strategy=sandboxed \
--strategy=SwiftCompile=sandboxed \
# --num-threads 0 forces swiftc to generate one object file per module; it:
# 1. resolves issues with the linker caused by swift-objc mixing.
@ -76,328 +50,16 @@ BAZEL_OPT_FLAGS=\
--objc_enable_binary_stripping \
--apple_bitcode=watchos=embedded \
kill_xcode:
killall Xcode || true
build_arm64: check_env
$(BUCK) build \
//Telegram:AppPackage#iphoneos-arm64 \
//Telegram:Telegram#dwarf-and-dsym,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared,iphoneos-arm64 \
//submodules/Postbox:Postbox#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Postbox:Postbox#shared,iphoneos-arm64 \
//submodules/TelegramApi:TelegramApi#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramApi:TelegramApi#shared,iphoneos-arm64 \
//submodules/SyncCore:SyncCore#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SyncCore:SyncCore#shared,iphoneos-arm64 \
//submodules/TelegramCore:TelegramCore#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramCore:TelegramCore#shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#shared,iphoneos-arm64 \
//submodules/Display:Display#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Display:Display#shared,iphoneos-arm64 \
//submodules/TelegramUI:TelegramUI#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramUI:TelegramUI#shared,iphoneos-arm64 \
//Telegram:WatchAppExtension#dwarf-and-dsym,watchos-arm64_32,watchos-armv7k \
//Telegram:ShareExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:WidgetExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:NotificationContentExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:NotificationServiceExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:IntentsExtension#dwarf-and-dsym,iphoneos-arm64 \
${BUCK_OPTIONS} ${BUCK_RELEASE_OPTIONS} ${BUCK_THREADS_OPTIONS} ${BUCK_CACHE_OPTIONS}
build_debug_arm64: check_env
$(BUCK) build \
//Telegram:AppPackage#iphoneos-arm64 \
//Telegram:Telegram#dwarf-and-dsym,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared,iphoneos-arm64 \
//submodules/Postbox:Postbox#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Postbox:Postbox#shared,iphoneos-arm64 \
//submodules/TelegramApi:TelegramApi#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramApi:TelegramApi#shared,iphoneos-arm64 \
//submodules/SyncCore:SyncCore#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SyncCore:SyncCore#shared,iphoneos-arm64 \
//submodules/TelegramCore:TelegramCore#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramCore:TelegramCore#shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#shared,iphoneos-arm64 \
//submodules/Display:Display#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Display:Display#shared,iphoneos-arm64 \
//submodules/TelegramUI:TelegramUI#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramUI:TelegramUI#shared,iphoneos-arm64 \
//Telegram:WatchAppExtension#dwarf-and-dsym,watchos-arm64_32,watchos-armv7k \
//Telegram:ShareExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:WidgetExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:NotificationContentExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:NotificationServiceExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:IntentsExtension#dwarf-and-dsym,iphoneos-arm64 \
${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS} ${BUCK_THREADS_OPTIONS} ${BUCK_CACHE_OPTIONS}
build_wallet_debug_arm64: check_env
$(BUCK) build \
//Wallet:AppPackage#iphoneos-arm64 \
//Wallet:Wallet#dwarf-and-dsym,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#shared,iphoneos-arm64 \
//submodules/Display:Display#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Display:Display#shared,iphoneos-arm64 \
${WALLET_BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS} ${BUCK_THREADS_OPTIONS} ${BUCK_CACHE_OPTIONS}
build_debug_armv7: check_env
$(BUCK) build \
//Telegram:AppPackage#iphoneos-armv7 \
//Telegram:Telegram#dwarf-and-dsym,iphoneos-armv7 \
//submodules/MtProtoKit:MtProtoKit#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/MtProtoKit:MtProtoKit#shared,iphoneos-armv7 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared,iphoneos-armv7 \
//submodules/Postbox:Postbox#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/Postbox:Postbox#shared,iphoneos-armv7 \
//submodules/TelegramApi:TelegramApi#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/TelegramApi:TelegramApi#shared,iphoneos-armv7 \
//submodules/SyncCore:SyncCore#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/SyncCore:SyncCore#shared,iphoneos-armv7 \
//submodules/TelegramCore:TelegramCore#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/TelegramCore:TelegramCore#shared,iphoneos-armv7 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#shared,iphoneos-armv7 \
//submodules/Display:Display#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/Display:Display#shared,iphoneos-armv7 \
//submodules/TelegramUI:TelegramUI#dwarf-and-dsym,shared,iphoneos-armv7 \
//submodules/TelegramUI:TelegramUI#shared,iphoneos-armv7 \
//Telegram:WatchAppExtension#dwarf-and-dsym,watchos-armv7_32,watchos-armv7k \
//Telegram:ShareExtension#dwarf-and-dsym,iphoneos-armv7 \
//Telegram:WidgetExtension#dwarf-and-dsym,iphoneos-armv7 \
//Telegram:NotificationContentExtension#dwarf-and-dsym,iphoneos-armv7 \
//Telegram:NotificationServiceExtension#dwarf-and-dsym,iphoneos-armv7 \
//Telegram:IntentsExtension#dwarf-and-dsym,iphoneos-armv7 \
${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS} ${BUCK_THREADS_OPTIONS} ${BUCK_CACHE_OPTIONS}
build: check_env
$(BUCK) build \
//Telegram:AppPackage#iphoneos-arm64,iphoneos-armv7 \
//Telegram:Telegram#dwarf-and-dsym,iphoneos-arm64,iphoneos-armv7 \
//submodules/MtProtoKit:MtProtoKit#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/MtProtoKit:MtProtoKit#shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/Postbox:Postbox#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/Postbox:Postbox#shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/TelegramApi:TelegramApi#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/TelegramApi:TelegramApi#shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/SyncCore:SyncCore#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/SyncCore:SyncCore#shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/TelegramCore:TelegramCore#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/TelegramCore:TelegramCore#shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/Display:Display#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/Display:Display#shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/TelegramUI:TelegramUI#dwarf-and-dsym,shared,iphoneos-arm64,iphoneos-armv7 \
//submodules/TelegramUI:TelegramUI#shared,iphoneos-arm64,iphoneos-armv7 \
//Telegram:WatchAppExtension#dwarf-and-dsym,watchos-arm64_32,watchos-armv7k \
//Telegram:ShareExtension#dwarf-and-dsym,iphoneos-arm64,iphoneos-armv7 \
//Telegram:WidgetExtension#dwarf-and-dsym,iphoneos-arm64,iphoneos-armv7 \
//Telegram:NotificationContentExtension#dwarf-and-dsym,iphoneos-arm64,iphoneos-armv7 \
//Telegram:NotificationServiceExtension#dwarf-and-dsym,iphoneos-arm64,iphoneos-armv7 \
//Telegram:IntentsExtension#dwarf-and-dsym,iphoneos-arm64,iphoneos-armv7 \
${BUCK_OPTIONS} ${BUCK_RELEASE_OPTIONS} ${BUCK_THREADS_OPTIONS} ${BUCK_CACHE_OPTIONS}
package_arm64:
PACKAGE_DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}" \
PACKAGE_CODE_SIGN_IDENTITY="${DISTRIBUTION_CODE_SIGN_IDENTITY}" \
PACKAGE_PROVISIONING_PROFILE_APP="${DISTRIBUTION_PROVISIONING_PROFILE_APP}" \
PACKAGE_ENTITLEMENTS_APP="Telegram/${ENTITLEMENTS_APP}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Share="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_SHARE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Share="Telegram/${ENTITLEMENTS_EXTENSION_SHARE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Widget="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_WIDGET}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Widget="Telegram/${ENTITLEMENTS_EXTENSION_WIDGET}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationService="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationService="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationContent="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationContent="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Intents="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_INTENTS}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Intents="Telegram/${ENTITLEMENTS_EXTENSION_INTENTS}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_APP="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_APP}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_EXTENSION="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_EXTENSION}" \
PACKAGE_BUNDLE_ID="${BUNDLE_ID}" \
sh package_app.sh iphoneos-arm64 $(BUCK) "telegram" $(BUCK_OPTIONS) ${BUCK_RELEASE_OPTIONS}
package_armv7:
PACKAGE_DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}" \
PACKAGE_CODE_SIGN_IDENTITY="${DISTRIBUTION_CODE_SIGN_IDENTITY}" \
PACKAGE_PROVISIONING_PROFILE_APP="${DISTRIBUTION_PROVISIONING_PROFILE_APP}" \
PACKAGE_ENTITLEMENTS_APP="Telegram/${ENTITLEMENTS_APP}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Share="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_SHARE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Share="Telegram/${ENTITLEMENTS_EXTENSION_SHARE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Widget="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_WIDGET}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Widget="Telegram/${ENTITLEMENTS_EXTENSION_WIDGET}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationService="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationService="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationContent="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationContent="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Intents="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_INTENTS}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Intents="Telegram/${ENTITLEMENTS_EXTENSION_INTENTS}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_APP="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_APP}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_EXTENSION="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_EXTENSION}" \
PACKAGE_BUNDLE_ID="${BUNDLE_ID}" \
sh package_app.sh iphoneos-armv7 $(BUCK) "telegram" $(BUCK_OPTIONS) ${BUCK_RELEASE_OPTIONS}
package_debug_arm64:
PACKAGE_DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}" \
PACKAGE_CODE_SIGN_IDENTITY="${DEVELOPMENT_CODE_SIGN_IDENTITY}" \
PACKAGE_PROVISIONING_PROFILE_APP="${DEVELOPMENT_PROVISIONING_PROFILE_APP}" \
PACKAGE_ENTITLEMENTS_APP="Telegram/${ENTITLEMENTS_APP}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Share="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_SHARE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Share="Telegram/${ENTITLEMENTS_EXTENSION_SHARE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Widget="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_WIDGET}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Widget="Telegram/${ENTITLEMENTS_EXTENSION_WIDGET}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationService="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationService="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationContent="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationContent="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Intents="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_INTENTS}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Intents="Telegram/${ENTITLEMENTS_EXTENSION_INTENTS}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_APP="${DEVELOPMENT_PROVISIONING_PROFILE_WATCH_APP}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_EXTENSION="${DEVELOPMENT_PROVISIONING_PROFILE_WATCH_EXTENSION}" \
PACKAGE_BUNDLE_ID="${BUNDLE_ID}" \
ENABLE_GET_TASK_ALLOW=0 \
CODESIGNING_PROFILES_VARIANT="development" \
sh package_app.sh iphoneos-arm64 $(BUCK) "telegram" $(BUCK_OPTIONS) ${BUCK_RELEASE_OPTIONS}
package_debug_armv7:
PACKAGE_DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}" \
PACKAGE_CODE_SIGN_IDENTITY="${DEVELOPMENT_CODE_SIGN_IDENTITY}" \
PACKAGE_PROVISIONING_PROFILE_APP="${DEVELOPMENT_PROVISIONING_PROFILE_APP}" \
PACKAGE_ENTITLEMENTS_APP="Telegram/${ENTITLEMENTS_APP}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Share="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_SHARE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Share="Telegram/${ENTITLEMENTS_EXTENSION_SHARE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Widget="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_WIDGET}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Widget="Telegram/${ENTITLEMENTS_EXTENSION_WIDGET}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationService="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationService="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationContent="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationContent="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Intents="${DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_INTENTS}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Intents="Telegram/${ENTITLEMENTS_EXTENSION_INTENTS}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_APP="${DEVELOPMENT_PROVISIONING_PROFILE_WATCH_APP}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_EXTENSION="${DEVELOPMENT_PROVISIONING_PROFILE_WATCH_EXTENSION}" \
PACKAGE_BUNDLE_ID="${BUNDLE_ID}" \
ENABLE_GET_TASK_ALLOW=0 \
CODESIGNING_PROFILES_VARIANT="development" \
sh package_app.sh iphoneos-armv7 $(BUCK) "telegram" $(BUCK_OPTIONS) ${BUCK_RELEASE_OPTIONS}
package:
PACKAGE_DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}" \
PACKAGE_CODE_SIGN_IDENTITY="${DISTRIBUTION_CODE_SIGN_IDENTITY}" \
PACKAGE_PROVISIONING_PROFILE_APP="${DISTRIBUTION_PROVISIONING_PROFILE_APP}" \
PACKAGE_ENTITLEMENTS_APP="Telegram/${ENTITLEMENTS_APP}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Share="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_SHARE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Share="Telegram/${ENTITLEMENTS_EXTENSION_SHARE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Widget="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_WIDGET}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Widget="Telegram/${ENTITLEMENTS_EXTENSION_WIDGET}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationService="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationService="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONSERVICE}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_NotificationContent="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_ENTITLEMENTS_EXTENSION_NotificationContent="Telegram/${ENTITLEMENTS_EXTENSION_NOTIFICATIONCONTENT}" \
PACKAGE_PROVISIONING_PROFILE_EXTENSION_Intents="${DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_INTENTS}" \
PACKAGE_ENTITLEMENTS_EXTENSION_Intents="Telegram/${ENTITLEMENTS_EXTENSION_INTENTS}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_APP="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_APP}" \
PACKAGE_PROVISIONING_PROFILE_WATCH_EXTENSION="${DISTRIBUTION_PROVISIONING_PROFILE_WATCH_EXTENSION}" \
PACKAGE_BUNDLE_ID="${BUNDLE_ID}" \
sh package_app.sh iphoneos-arm64,iphoneos-armv7 $(BUCK) "telegram" $(BUCK_OPTIONS) ${BUCK_RELEASE_OPTIONS}
app: build package
app_arm64: build_arm64 package_arm64
app_debug_arm64: build_debug_arm64 package_debug_arm64
wallet_debug_arm64: build_wallet_debug_arm64
app_debug_armv7: build_debug_armv7 package_debug_armv7
build_buckdebug: check_env
BUCK_DEBUG_MODE=1 $(BUCK) build \
//Telegram:AppPackage#iphoneos-arm64 \
//Telegram:Telegram#dwarf-and-dsym,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared,iphoneos-arm64 \
//submodules/Postbox:Postbox#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Postbox:Postbox#shared,iphoneos-arm64 \
//submodules/TelegramApi:TelegramApi#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramApi:TelegramApi#shared,iphoneos-arm64 \
//submodules/SyncCore:SyncCore#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SyncCore:SyncCore#shared,iphoneos-arm64 \
//submodules/TelegramCore:TelegramCore#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramCore:TelegramCore#shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#shared,iphoneos-arm64 \
//submodules/Display:Display#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Display:Display#shared,iphoneos-arm64 \
//submodules/TelegramUI:TelegramUI#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramUI:TelegramUI#shared,iphoneos-arm64 \
//Telegram:WatchAppExtension#dwarf-and-dsym,watchos-arm64_32,watchos-armv7k \
//Telegram:ShareExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:WidgetExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:NotificationContentExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:NotificationServiceExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:IntentsExtension#dwarf-and-dsym,iphoneos-arm64 \
--verbose 7 ${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS}
build_verbose: check_env
$(BUCK) build \
//Telegram:AppPackage#iphoneos-arm64 \
//Telegram:Telegram#dwarf-and-dsym,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/MtProtoKit:MtProtoKit#shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared,iphoneos-arm64 \
//submodules/Postbox:Postbox#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Postbox:Postbox#shared,iphoneos-arm64 \
//submodules/TelegramApi:TelegramApi#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramApi:TelegramApi#shared,iphoneos-arm64 \
//submodules/SyncCore:SyncCore#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/SyncCore:SyncCore#shared,iphoneos-arm64 \
//submodules/TelegramCore:TelegramCore#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramCore:TelegramCore#shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/AsyncDisplayKit:AsyncDisplayKit#shared,iphoneos-arm64 \
//submodules/Display:Display#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/Display:Display#shared,iphoneos-arm64 \
//submodules/TelegramUI:TelegramUI#dwarf-and-dsym,shared,iphoneos-arm64 \
//submodules/TelegramUI:TelegramUI#shared,iphoneos-arm64 \
//Telegram:WatchAppExtension#dwarf-and-dsym,watchos-arm64_32,watchos-armv7k \
//Telegram:ShareExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:WidgetExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:NotificationContentExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:NotificationServiceExtension#dwarf-and-dsym,iphoneos-arm64 \
//Telegram:IntentsExtension#dwarf-and-dsym,iphoneos-arm64 \
--verbose 7 ${BUCK_OPTIONS} ${BUCK_THREADS_OPTIONS} ${BUCK_DEBUG_OPTIONS} ${BUCK_CACHE_OPTIONS}
deps: check_env
$(BUCK) query "deps(//Telegram:AppPackage)" --dot \
${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS}
clean: kill_xcode
sh clean.sh
project: check_env kill_xcode
$(BUCK) project //Telegram:workspace --config custom.mode=project ${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS}
open Telegram/Telegram_Buck.xcworkspace
clean:
"${BAZEL}" clean --expunge
bazel_app_debug_arm64:
APP_VERSION="${APP_VERSION}" \
BAZEL_CACHE_DIR="${BAZEL_CACHE_DIR}" \
BAZEL_HTTP_CACHE_URL="${BAZEL_HTTP_CACHE_URL}" \
TELEGRAM_DISABLE_EXTENSIONS="0" \
build-system/prepare-build.sh Telegram distribution
"${BAZEL}" build Telegram/Telegram ${BAZEL_CACHE_FLAGS} ${BAZEL_COMMON_FLAGS} ${BAZEL_DEBUG_FLAGS} \
@ -408,6 +70,8 @@ bazel_app_debug_arm64:
bazel_app_debug_sim_arm64:
APP_VERSION="${APP_VERSION}" \
BAZEL_CACHE_DIR="${BAZEL_CACHE_DIR}" \
BAZEL_HTTP_CACHE_URL="${BAZEL_HTTP_CACHE_URL}" \
TELEGRAM_DISABLE_EXTENSIONS="0" \
build-system/prepare-build.sh Telegram distribution
"${BAZEL}" build Telegram/Telegram ${BAZEL_CACHE_FLAGS} ${BAZEL_COMMON_FLAGS} ${BAZEL_DEBUG_FLAGS} \
@ -458,6 +122,20 @@ bazel_app:
--output_groups=+dsyms \
--verbose_failures
check_sandbox_debug_build:
APP_VERSION="${APP_VERSION}" \
BAZEL_CACHE_DIR="${BAZEL_CACHE_DIR}" \
BAZEL_HTTP_CACHE_URL="${BAZEL_HTTP_CACHE_URL}" \
TELEGRAM_DISABLE_EXTENSIONS="0" \
build-system/prepare-build.sh Telegram distribution
"${BAZEL}" build Telegram/Telegram ${BAZEL_CACHE_FLAGS} ${BAZEL_COMMON_FLAGS} ${BAZEL_DEBUG_FLAGS} ${BAZEL_SANDBOX_FLAGS} \
-c opt \
--ios_multi_cpus=arm64 \
--watchos_cpus=armv7k,arm64_32 \
--apple_generate_dsym \
--output_groups=+dsyms \
--verbose_failures
bazel_project: kill_xcode
APP_VERSION="${APP_VERSION}" \
BAZEL_CACHE_DIR="${BAZEL_CACHE_DIR}" \

View File

@ -1,37 +0,0 @@
export BUCK_DEBUG_OPTIONS=\
--config custom.other_cflags="-O0 -D DEBUG" \
--config custom.other_cxxflags="-O0 -D DEBUG" \
--config custom.optimization="-Onone" \
--config custom.config_swift_compiler_flags="-DDEBUG"
export BUCK_RELEASE_OPTIONS=\
--config custom.other_cflags="-Os" \
--config custom.other_cxxflags="-Os" \
--config custom.optimization="-Osize" \
--config custom.config_swift_compiler_flags="-whole-module-optimization"
export BUCK_THREADS_OPTIONS=--config build.threads=$(shell sysctl -n hw.logicalcpu)
ifneq ($(BUCK_HTTP_CACHE),)
ifeq ($(BUCK_CACHE_MODE),)
BUCK_CACHE_MODE=readwrite
endif
export BUCK_CACHE_OPTIONS=\
--config cache.mode=http \
--config cache.http_url="$(BUCK_HTTP_CACHE)" \
--config cache.http_mode="$(BUCK_CACHE_MODE)"
endif
ifneq ($(BUCK_DIR_CACHE),)
export BUCK_CACHE_OPTIONS=\
--config cache.mode=dir \
--config cache.dir="$(BUCK_DIR_CACHE)" \
--config cache.dir_mode="readwrite"
endif
check_env:
sh check_env.sh
kill_xcode:
killall Xcode || true

View File

@ -21,22 +21,16 @@ if [ -z "$BUILD_NUMBER" ]; then
exit 1
fi
export ENTITLEMENTS_APP="Telegram-iOS/Telegram-iOS-AppStoreLLC.entitlements"
export DEVELOPMENT_PROVISIONING_PROFILE_APP="match Development ph.telegra.Telegraph"
export DISTRIBUTION_PROVISIONING_PROFILE_APP="match AppStore ph.telegra.Telegraph"
export ENTITLEMENTS_EXTENSION_SHARE="Share/Share-AppStoreLLC.entitlements"
export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_SHARE="match Development ph.telegra.Telegraph.Share"
export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_SHARE="match AppStore ph.telegra.Telegraph.Share"
export ENTITLEMENTS_EXTENSION_WIDGET="Widget/Widget-AppStoreLLC.entitlements"
export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_WIDGET="match Development ph.telegra.Telegraph.Widget"
export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_WIDGET="match AppStore ph.telegra.Telegraph.Widget"
export ENTITLEMENTS_EXTENSION_NOTIFICATIONSERVICE="NotificationService/NotificationService-AppStoreLLC.entitlements"
export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE="match Development ph.telegra.Telegraph.NotificationService"
export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONSERVICE="match AppStore ph.telegra.Telegraph.NotificationService"
export ENTITLEMENTS_EXTENSION_NOTIFICATIONCONTENT="NotificationContent/NotificationContent-AppStoreLLC.entitlements"
export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT="match Development ph.telegra.Telegraph.NotificationContent"
export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_NOTIFICATIONCONTENT="match AppStore ph.telegra.Telegraph.NotificationContent"
export ENTITLEMENTS_EXTENSION_INTENTS="SiriIntents/SiriIntents-AppStoreLLC.entitlements"
export DEVELOPMENT_PROVISIONING_PROFILE_EXTENSION_INTENTS="match Development ph.telegra.Telegraph.SiriIntents"
export DISTRIBUTION_PROVISIONING_PROFILE_EXTENSION_INTENTS="match AppStore ph.telegra.Telegraph.SiriIntents"
export DEVELOPMENT_PROVISIONING_PROFILE_WATCH_APP="match Development ph.telegra.Telegraph.watchkitapp"
@ -47,6 +41,5 @@ export DISTRIBUTION_PROVISIONING_PROFILE_WATCH_EXTENSION="match AppStore ph.tele
BUILDBOX_DIR="buildbox"
export CODESIGNING_PROFILES_VARIANT="appstore"
export PACKAGE_METHOD="appstore"
$@

View File

@ -1,6 +0,0 @@
#!/bin/bash
if [ -z "$TELEGRAM_ENV_SET" ]; then
echo "Error: Telegram build environment is not set up. Use sh public.sh make ${command}"
exit 1
fi

View File

@ -1,4 +0,0 @@
rm -rf App/App.xcodeproj App/App.xcworkspace
rm -rf submodules/MtProtoKit/MtProtoKit.xcodeproj
rm -rf submodules/Emoji/Emoji.xcodeproj
rm -rf buck-out

View File

@ -1,94 +0,0 @@
import sys
import os
import re
import shutil
ignore_patterns_when_copying = [
"^\\.git$",
"^.*/\\.git$",
]
def mkdir_p(path):
if not os.path.isdir(path):
os.makedirs(path)
def clean_copy_files(dir, destination_dir):
for root, dirs, files in os.walk(dir, topdown=False):
for name in files:
skip_file = False
for pattern in ignore_patterns_when_copying:
if re.match(pattern, name):
skip_file = True
break
if skip_file:
continue
file_path = os.path.relpath(os.path.join(root, name), dir)
dir_path = os.path.dirname(file_path)
mkdir_p(destination_dir + "/" + dir_path)
shutil.copy(dir + "/" + file_path, destination_dir + "/" + file_path)
for name in dirs:
skip_file = False
for pattern in ignore_patterns_when_copying:
if re.match(pattern, name):
skip_file = True
break
if skip_file:
continue
dir_path = os.path.relpath(os.path.join(root, name), dir)
if os.path.islink(dir + "/" + dir_path):
continue
mkdir_p(destination_dir + "/" + dir_path)
if len(sys.argv) != 2:
print('Usage: extract_wallet_source.py destination')
sys.exit(1)
destination = sys.argv[1]
deps_data = os.popen("""bazel query 'kind("source file", deps(//Wallet:Wallet))'""").read().splitlines()
buildfile_deps_data = os.popen("""bazel query 'buildfiles(deps(//Wallet:Wallet))'""").read().splitlines()
directories = set()
for line in deps_data + buildfile_deps_data:
if len(line) == 0:
continue
if line[:1] == "@":
continue
if line[:2] != "//":
continue
file_path = line[2:].replace(":", "/")
if file_path.startswith("build-input"):
continue
if file_path.startswith("external"):
continue
file_name = os.path.basename(file_path)
file_dir = os.path.dirname(file_path)
mkdir_p(destination + "/" + file_dir)
shutil.copy(file_path, destination + '/' + file_path)
additional_paths = [
".gitignore",
"WORKSPACE",
"build-system/xcode_version",
"build-system/bazel_version",
"build-system/bazel-rules",
"build-system/tulsi",
"build-system/prepare-build.sh",
"build-system/generate-xcode-project.sh",
"build-system/copy-provisioning-profiles-Wallet.sh",
"build-system/prepare-build-variables-Wallet.sh",
".bazelrc",
"wallet_env.sh",
]
for file_path in additional_paths:
if os.path.isdir(file_path):
clean_copy_files(file_path, destination + "/" + file_path)
else:
shutil.copy(file_path, destination + "/" + file_path)
shutil.copy("Wallet.makefile", destination + "/" + "Makefile")
shutil.copy("Wallet/README.md", destination + "/" + "README.md")

View File

@ -1,522 +0,0 @@
#!/bin/sh
set -e
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
echo "Usage: sh package_app.sh path/to/buck platform-flavors type"
exit 1
fi
PLATFORM_FLAVORS="$1"
BUCK="$2"
APP_TYPE="$3"
shift
shift
shift
BUILD_PATH="build"
if [ "$APP_TYPE" == "wallet" ]; then
APP_NAME="TONWallet"
else
APP_NAME="Telegram"
fi
IPA_PATH="$BUILD_PATH/$APP_NAME.ipa"
DSYMS_FOLDER_NAME="DSYMs"
DSYMS_ZIP="$BUILD_PATH/$DSYMS_FOLDER_NAME.zip"
DSYMS_DIR="$BUILD_PATH/$DSYMS_FOLDER_NAME"
TEMP_PATH="$BUILD_PATH/temp"
TEMP_ENTITLEMENTS_PATH="$TEMP_PATH/entitlements"
KEYCHAIN_PATH="$TEMP_PATH/keychain"
if [ -z "$PACKAGE_BUNDLE_ID" ]; then
echo "PACKAGE_BUNDLE_ID not set"
exit 1
fi
BUNDLE_ID_PREFIX=$(echo "$PACKAGE_BUNDLE_ID" | grep -Eo "^.*?\\..*?\\." | head -1)
if [ -z "$BUNDLE_ID_PREFIX" ]; then
echo "Could not extract bundle id prefix from $PACKAGE_BUNDLE_ID"
exit 1
fi
mkdir -p "$BUILD_PATH"
rm -f "$IPA_PATH"
rm -f "$DSYMS_ZIP"
rm -rf "$DSYMS_DIR"
mkdir -p "$DSYMS_DIR"
rm -rf "$TEMP_PATH"
mkdir -p "$TEMP_PATH"
mkdir -p "$TEMP_ENTITLEMENTS_PATH"
if [ "$APP_TYPE" == "wallet" ]; then
cp "buck-out/gen/Wallet/AppPackage#$PLATFORM_FLAVORS.ipa" "$IPA_PATH.original"
else
cp "buck-out/gen/Telegram/AppPackage#$PLATFORM_FLAVORS.ipa" "$IPA_PATH.original"
fi
rm -rf "$IPA_PATH.original.unpacked"
rm -f "$BUILD_PATH/${APP_NAME}_signed.ipa"
mkdir -p "$IPA_PATH.original.unpacked"
echo "Unzipping original ipa..."
unzip "$IPA_PATH.original" -d "$IPA_PATH.original.unpacked/" 1>/dev/null
rm "$IPA_PATH.original"
UNPACKED_PATH="$IPA_PATH.original.unpacked"
if [ "$APP_TYPE" == "wallet" ]; then
APP_PATH="$UNPACKED_PATH/Payload/Wallet.app"
else
APP_PATH="$UNPACKED_PATH/Payload/Telegram.app"
fi
FRAMEWORKS_DIR="$APP_PATH/Frameworks"
rm -rf "$IPA_PATH.original.unpacked/SwiftSupport/iphoneos/"*
rm -rf "$IPA_PATH.original.unpacked/Symbols/"*
rm -rf "$FRAMEWORKS_DIR/"*
if [ -z "$PACKAGE_METHOD" ]; then
echo "PACKAGE_METHOD is not set"
exit 1
fi
if [ "$PACKAGE_METHOD" != "appstore" ] && [ "$PACKAGE_METHOD" != "enterprise" ]; then
echo "PACKAGE_METHOD $PACKAGE_METHOD should be in [appstore, enterprise]"
exit 1
fi
if [ -z "$PACKAGE_CODE_SIGN_IDENTITY" ]; then
echo "PACKAGE_CODE_SIGN_IDENTITY is not set"
exit 1
fi
if [ -z "$DEVELOPMENT_TEAM" ]; then
echo "DEVELOPMENT_TEAM is not set"
exit 1
fi
if [ ! -d "$CODESIGNING_DATA_PATH" ]; then
echo "CODESIGNING_DATA_PATH $CODESIGNING_DATA_PATH does not exist"
exit 1
fi
if [ -z "$CODESIGNING_CERTS_VARIANT" ]; then
echo "CODESIGNING_CERTS_VARIANT is not set"
exit 1
fi
if [ -z "$CODESIGNING_PROFILES_VARIANT" ]; then
echo "CODESIGNING_PROFILES_VARIANT is not set"
exit 1
fi
CERTS_PATH="$CODESIGNING_DATA_PATH/certs/$CODESIGNING_CERTS_VARIANT"
PROFILES_PATH="$CODESIGNING_DATA_PATH/profiles/$CODESIGNING_PROFILES_VARIANT"
if [ ! -d "$CERTS_PATH" ]; then
echo "$CERTS_PATH does not exist"
exit 1
fi
if [ ! -d "$PROFILES_PATH" ]; then
echo "$PROFILES_PATH does not exist"
exit 1
fi
rm -f "$KEYCHAIN_PATH"
if [ "$APP_TYPE" == "wallet" ]; then
APP_ITEMS_WITH_PROVISIONING_PROFILE="APP"
APP_ITEMS_WITH_ENTITLEMENTS="APP"
else
APP_ITEMS_WITH_PROVISIONING_PROFILE="APP EXTENSION_Share EXTENSION_Widget EXTENSION_NotificationService EXTENSION_NotificationContent EXTENSION_Intents WATCH_APP WATCH_EXTENSION"
APP_ITEMS_WITH_ENTITLEMENTS="APP EXTENSION_Share EXTENSION_Widget EXTENSION_NotificationService EXTENSION_NotificationContent EXTENSION_Intents"
fi
COMMON_IDENTITY_HASH=""
REMOVE_ENTITLEMENT_KEYS=(\
"com.apple.developer.icloud-container-development-container-identifiers" \
"com.apple.developer.ubiquity-kvstore-identifier" \
)
COPY_ENTITLEMENT_KEYS=(\
"com.apple.developer.associated-domains" \
"com.apple.developer.icloud-services" \
"com.apple.developer.pushkit.unrestricted-voip" \
)
REPLACE_TO_PRODUCTION_ENTITLEMENT_KEYS=(\
"com.apple.developer.icloud-container-environment" \
)
echo "Generating entitlements..."
for ITEM in $APP_ITEMS_WITH_PROVISIONING_PROFILE; do
PROFILE_VAR=PACKAGE_PROVISIONING_PROFILE_$ITEM
if [ -z "${!PROFILE_VAR}" ]; then
echo "$PROFILE_VAR is not set"
exit 1
fi
for PROFILE in "$PROFILES_PATH/"*; do
PROFILE_DATA=$(security cms -D -i "$PROFILE")
PROFILE_NAME=$(/usr/libexec/PlistBuddy -c "Print :Name" /dev/stdin <<< $(echo $PROFILE_DATA))
if [ "$PROFILE_NAME" == "${!PROFILE_VAR}" ]; then
TEAM_IDENTIFIER=$(/usr/libexec/PlistBuddy -c "Print :Entitlements:com.apple.developer.team-identifier" /dev/stdin <<< $(echo $PROFILE_DATA))
if [ "$TEAM_IDENTIFIER" != "$DEVELOPMENT_TEAM" ]; then
"Entitlements:com.apple.developer.team-identifier in $PROFILE does not match $DEVELOPMENT_TEAM"
fi
IDENTITY_NAME=$(/usr/libexec/PlistBuddy -c "Print :DeveloperCertificates:0 :data" /dev/stdin <<< $(echo $PROFILE_DATA) | openssl x509 -inform DER -subject -nameopt multiline -sha1 -noout | grep commonName | sed -e 's#[ ]*commonName[ ]*=[ ]*##g')
if [ ! -z "$IDENTITY_NAME" ]; then
IDENTITY_HASH=$(/usr/libexec/PlistBuddy -c "Print :DeveloperCertificates:0 :data" /dev/stdin <<< $(echo $PROFILE_DATA) | openssl x509 -inform DER -fingerprint -sha1 -noout | sed -e 's#SHA1 Fingerprint=##' | sed -e 's#:##g')
if [ -z "$COMMON_IDENTITY_HASH" ]; then
COMMON_IDENTITY_HASH="$IDENTITY_HASH"
elif [ "$COMMON_IDENTITY_HASH" != "$IDENTITY_HASH" ]; then
"Signing identity in $PROFILE ($IDENTITY_HASH) does not match $COMMON_IDENTITY_HASH from previously processed profiles"
fi
else
echo "Signing identity name in $PROFILE does not match $PACKAGE_CODE_SIGN_IDENTITY"
exit 1
fi
declare PROFILE_PATH_$ITEM="$PROFILE"
PROFILE_ENTITLEMENTS_PATH="$TEMP_ENTITLEMENTS_PATH/$ITEM.entitlements"
security cms -D -i "$PROFILE" > "$TEMP_PATH/temp.plist" && /usr/libexec/PlistBuddy -x -c 'Print:Entitlements' "$TEMP_PATH/temp.plist" > "$PROFILE_ENTITLEMENTS_PATH"
for KEY in "${REMOVE_ENTITLEMENT_KEYS[@]}"; do
/usr/libexec/PlistBuddy -c "Delete $KEY" "$PROFILE_ENTITLEMENTS_PATH" 2>/dev/null || true
done
for KEY in "${REPLACE_TO_PRODUCTION_ENTITLEMENT_KEYS[@]}"; do
VALUE=$(/usr/libexec/PlistBuddy -c "Print :$KEY" "$PROFILE_ENTITLEMENTS_PATH" 2>/dev/null || echo "")
if [ ! -z "$VALUE" ]; then
PLUTIL_KEY=$(echo "$KEY" | sed 's/\./\\\./g')
/usr/libexec/PlistBuddy -c "Delete $KEY" "$PROFILE_ENTITLEMENTS_PATH" 2>/dev/null
VALUE="<array><string>Production</string></array>"
plutil -insert "$PLUTIL_KEY" -xml "$VALUE" "$PROFILE_ENTITLEMENTS_PATH"
fi
done
if [ "$ENABLE_GET_TASK_ALLOW" == "1" ]; then
KEY="com.apple.security.get-task-allow"
PLUTIL_KEY=$(echo "$KEY" | sed 's/\./\\\./g')
plutil -insert "$PLUTIL_KEY" -xml "<true/>" "$PROFILE_ENTITLEMENTS_PATH"
fi
ENTITLEMENTS_VAR=PACKAGE_ENTITLEMENTS_$ITEM
if [ ! -z "${!ENTITLEMENTS_VAR}" ]; then
if [ ! -f "${!ENTITLEMENTS_VAR}" ]; then
echo "${!ENTITLEMENTS_VAR} does not exist"
exit 1
fi
for KEY in "${COPY_ENTITLEMENT_KEYS[@]}"; do
VALUE=$(/usr/libexec/PlistBuddy -c "Print :$KEY" "$PROFILE_ENTITLEMENTS_PATH" 2>/dev/null || echo "")
if [ ! -z "$VALUE" ]; then
PLUTIL_KEY=$(echo "$KEY" | sed 's/\./\\\./g')
TEST_VALUE=$(plutil -extract "$PLUTIL_KEY" xml1 -o - "${!ENTITLEMENTS_VAR}" 1>/dev/null || echo "error")
if [ "$TEST_VALUE" != "error" ]; then
VALUE=$(plutil -extract "$PLUTIL_KEY" xml1 -o - "${!ENTITLEMENTS_VAR}")
/usr/libexec/PlistBuddy -c "Delete $KEY" "$PROFILE_ENTITLEMENTS_PATH" 2>/dev/null
plutil -insert "$PLUTIL_KEY" -xml "$VALUE" "$PROFILE_ENTITLEMENTS_PATH"
fi
fi
done
fi
declare ENTITLEMENTS_PATH_$ITEM="$PROFILE_ENTITLEMENTS_PATH"
fi
done
done
for ITEM in $APP_ITEMS_WITH_PROVISIONING_PROFILE; do
PROFILE_PATH_VAR=PROFILE_PATH_$ITEM
if [ -z "${!PROFILE_PATH_VAR}" ]; then
echo "Provisioning profile for $ITEM was not found"
exit 1
fi
done
for ITEM in $APP_ITEMS_WITH_ENTITLEMENTS; do
ENTITLEMENTS_VAR=PACKAGE_ENTITLEMENTS_$ITEM
if [ -z "${!ENTITLEMENTS_VAR}" ]; then
echo "$ENTITLEMENTS_VAR is not set"
exit 1
fi
if [ ! -f "${!ENTITLEMENTS_VAR}" ]; then
echo "${!ENTITLEMENTS_VAR} does not exist"
exit 1
fi
done
if [ -z "$COMMON_IDENTITY_HASH" ]; then
echo "Failed to determine signing identity"
exit 1
fi
COPY_PLIST_KEYS=(\
"DTSDKName" \
"DTXcode" \
"DTSDKBuild" \
"CFBundleDevelopmentRegion" \
"BuildMachineOSBuild" \
"DTPlatformName" \
"CFBundleSupportedPlatforms" \
"CFBundleInfoDictionaryVersion" \
"DTCompiler" \
"MinimumOSVersion" \
"UIDeviceFamily" \
"DTPlatformVersion" \
"DTXcodeBuild" \
"DTPlatformBuild" \
)
APP_PLIST="$APP_PATH/Info.plist"
if [ "$APP_TYPE" == "wallet" ]; then
APP_BINARY_TARGET="//Wallet:Wallet"
else
APP_BINARY_TARGET="//Telegram:Telegram"
fi
echo "Repacking frameworks..."
for DEPENDENCY in $(${BUCK} query "kind('apple_library', deps('${APP_BINARY_TARGET}#$PLATFORM_FLAVORS', 1))" "$@"); do
DEPENDENCY_PATH=$(echo "$DEPENDENCY" | sed -e "s#^//##" | sed -e "s#:#/#")
DEPENDENCY_NAME=$(echo "$DEPENDENCY" | sed -e "s/#.*//" | sed -e "s/^.*\://")
DYLIB_PATH="buck-out/gen/$DEPENDENCY_PATH/lib$DEPENDENCY_NAME.dylib"
mkdir -p "$FRAMEWORKS_DIR/${DEPENDENCY_NAME}.framework"
TARGET_DYLIB_PATH="$FRAMEWORKS_DIR/${DEPENDENCY_NAME}.framework/$DEPENDENCY_NAME"
PLIST_FILE="$FRAMEWORKS_DIR/${DEPENDENCY_NAME}.framework/Info.plist"
/usr/libexec/PlistBuddy -c "Add :CFBundleName string \"${DEPENDENCY_NAME}\"" "$PLIST_FILE" 1>/dev/null
/usr/libexec/PlistBuddy -c "Add :CFBundleVersion string \"1\"" "$PLIST_FILE"
/usr/libexec/PlistBuddy -c "Add :CFBundleShortVersionString string \"1.0\"" "$PLIST_FILE"
/usr/libexec/PlistBuddy -c "Add :CFBundlePackageType string \"FMWK\"" "$PLIST_FILE"
/usr/libexec/PlistBuddy -c "Add :CFBundleExecutable string \"${DEPENDENCY_NAME}\"" "$PLIST_FILE"
/usr/libexec/PlistBuddy -c "Add :CFBundleIdentifier string \"${BUNDLE_ID_PREFIX}.${DEPENDENCY_NAME}\"" "$PLIST_FILE"
for KEY in "${COPY_PLIST_KEYS[@]}"; do
VALUE=$(/usr/libexec/PlistBuddy -c "Print :$KEY" "$APP_PLIST" 2>/dev/null || echo "")
if [ ! -z "$VALUE" ]; then
PLUTIL_KEY=$(echo "$KEY" | sed 's/\./\\\./g')
VALUE=$(plutil -extract "$PLUTIL_KEY" xml1 -o - "$APP_PLIST")
plutil -insert "$PLUTIL_KEY" -xml "$VALUE" "$PLIST_FILE"
fi
done
plutil -convert binary1 "$PLIST_FILE"
cp "$DYLIB_PATH" "$TARGET_DYLIB_PATH"
DSYM_PATH="buck-out/gen/$(echo "$DEPENDENCY" | sed -e "s/#/#apple-dsym,/" | sed -e "s#^//##" | sed -e "s#:#/#").dSYM"
cp -r "$DSYM_PATH" "$DSYMS_DIR/"
done
if [ "$APP_TYPE" == "wallet" ]; then
APP_BINARY_DSYM_PATH="buck-out/gen/Wallet/Wallet#dwarf-and-dsym,$PLATFORM_FLAVORS,no-include-frameworks/Wallet.app.dSYM"
else
APP_BINARY_DSYM_PATH="buck-out/gen/Telegram/Telegram#dwarf-and-dsym,$PLATFORM_FLAVORS,no-include-frameworks/Telegram.app.dSYM"
fi
cp -r "$APP_BINARY_DSYM_PATH" "$DSYMS_DIR/"
if [ "$APP_TYPE" == "wallet" ]; then
EXTENSIONS=""
else
EXTENSIONS="Share Widget Intents NotificationContent NotificationService"
fi
for EXTENSION in $EXTENSIONS; do
EXTENSION_DSYM_PATH="buck-out/gen/Telegram/${EXTENSION}Extension#dwarf-and-dsym,$PLATFORM_FLAVORS,no-include-frameworks/${EXTENSION}Extension.appex.dSYM"
cp -r "$EXTENSION_DSYM_PATH" "$DSYMS_DIR/"
done
if [ "$APP_TYPE" != "wallet" ]; then
WATCH_EXTENSION_DSYM_PATH="buck-out/gen/Telegram/WatchAppExtension#dwarf-and-dsym,no-include-frameworks,watchos-arm64_32,watchos-armv7k/WatchAppExtension.appex.dSYM"
cp -r "$WATCH_EXTENSION_DSYM_PATH" "$DSYMS_DIR/"
fi
TEMP_DYLIB_DIR="$TEMP_PATH/SwiftSupport"
rm -rf "$TEMP_DYLIB_DIR"
mkdir -p "$TEMP_DYLIB_DIR"
mkdir -p "$TEMP_DYLIB_DIR/out"
if [ "$APP_TYPE" == "wallet" ]; then
EXECUTABLE_NAME="Wallet"
else
EXECUTABLE_NAME="Telegram"
fi
XCODE_PATH="$(xcode-select -p)"
TOOLCHAIN_PATH="$XCODE_PATH/Toolchains/XcodeDefault.xctoolchain"
if [ -f "$TOOLCHAIN_PATH/usr/lib/swift/iphoneos/libswiftCore.dylib" ]; then
SOURCE_LIBRARIES_PATH="$TOOLCHAIN_PATH/usr/lib/swift/iphoneos"
else
SOURCE_LIBRARIES_PATH="$TOOLCHAIN_PATH/usr/lib/swift-5.0/iphoneos"
fi
echo "Copying swift support files..."
xcrun swift-stdlib-tool \
--copy \
--strip-bitcode \
--platform iphoneos \
--toolchain "$TOOLCHAIN_PATH" \
--source-libraries "$SOURCE_LIBRARIES_PATH" \
--scan-executable "$APP_PATH/$EXECUTABLE_NAME" \
--scan-folder "$APP_PATH/Frameworks" \
--scan-folder "$APP_PATH/PlugIns" \
--destination "$TEMP_DYLIB_DIR"
for dylib in "$TEMP_DYLIB_DIR"/*.dylib; do
FILE_NAME=$(basename "$dylib")
lipo -extract armv7 "$dylib" -output "$dylib.armv7"
lipo -extract arm64 "$dylib" -output "$dylib.arm64"
lipo "$dylib.armv7" "$dylib.arm64" -create -output "$dylib.unstripped"
if [ "$PACKAGE_METHOD" == "enterprise" ]; then
xcrun strip -ST -o "$TEMP_DYLIB_DIR/out/$FILE_NAME" - "$dylib.unstripped" 2>/dev/null
xcrun bitcode_strip -r "$TEMP_DYLIB_DIR/out/$FILE_NAME" -o "$TEMP_DYLIB_DIR/out/$FILE_NAME" 1>/dev/null
else
cp "$dylib.unstripped" "$TEMP_DYLIB_DIR/out/$FILE_NAME"
fi
done
cp "$TEMP_DYLIB_DIR/out/"*.dylib "$IPA_PATH.original.unpacked/SwiftSupport/iphoneos/"
cp "$IPA_PATH.original.unpacked/SwiftSupport/iphoneos/"*.dylib "$FRAMEWORKS_DIR/"
REMOVE_ARCHS="armv7s arm64e"
for framework in "$FRAMEWORKS_DIR"/*; do
if [[ "$framework" == *.framework || "$framework" == *.dylib ]]; then
if [[ "$framework" == *.framework ]]; then
FRAMEWORK_NAME=$(basename "$framework" | sed -e 's/\.framework//')
for ARCH in $REMOVE_ARCHS; do
lipo -remove "$ARCH" "$framework/$FRAMEWORK_NAME" -o "$framework/$FRAMEWORK_NAME" 2>/dev/null || true
done
xcrun bitcode_strip -r "$framework/$FRAMEWORK_NAME" -o "$framework/$FRAMEWORK_NAME" 1>/dev/null
xcrun strip -S -T -x "$framework/$FRAMEWORK_NAME" 1>/dev/null
/usr/bin/codesign ${VERBOSE} ${KEYCHAIN_FLAG} -f -s "$COMMON_IDENTITY_HASH" "$framework" 1>/dev/null
else
/usr/bin/codesign ${VERBOSE} ${KEYCHAIN_FLAG} -f -s "$COMMON_IDENTITY_HASH" "$framework" 1>/dev/null
fi
fi
done
echo "Signing..."
if [ "$APP_TYPE" == "wallet" ]; then
PLUGINS=""
else
PLUGINS="Share Widget Intents NotificationService NotificationContent"
fi
for PLUGIN in $PLUGINS; do
PLUGIN_PATH="$APP_PATH/PlugIns/${PLUGIN}Extension.appex"
if [ ! -d "$PLUGIN_PATH" ]; then
echo "Directory at $PLUGIN_PATH does not exist"
exit 1
fi
PROFILE_PATH_VAR="PROFILE_PATH_EXTENSION_$PLUGIN"
if [ -z "${!PROFILE_PATH_VAR}" ]; then
echo "$PROFILE_PATH_VAR is not defined"
exit 1
fi
if [ ! -f "${!PROFILE_PATH_VAR}" ]; then
echo "${!PROFILE_PATH_VAR} does not exist"
exit 1
fi
ENTITLEMENTS_PATH_VAR="ENTITLEMENTS_PATH_EXTENSION_$PLUGIN"
if [ -z "${!ENTITLEMENTS_PATH_VAR}" ]; then
echo "$ENTITLEMENTS_PATH_VAR is not defined"
exit 1
fi
if [ ! -f "${!ENTITLEMENTS_PATH_VAR}" ]; then
echo "${!ENTITLEMENTS_PATH_VAR} does not exist"
exit 1
fi
cp "${!PROFILE_PATH_VAR}" "$PLUGIN_PATH/embedded.mobileprovision"
/usr/bin/codesign ${VERBOSE} -f -s "$COMMON_IDENTITY_HASH" --entitlements "${!ENTITLEMENTS_PATH_VAR}" "$PLUGIN_PATH"
done
if [ "$APP_TYPE" != "wallet" ]; then
WATCH_APP_PATH="$APP_PATH/Watch/WatchApp.app"
WATCH_EXTENSION_PATH="$WATCH_APP_PATH/PlugIns/WatchAppExtension.appex"
WATCH_EXTENSION_PROFILE_PATH_VAR="PROFILE_PATH_WATCH_EXTENSION"
if [ -z "${!WATCH_EXTENSION_PROFILE_PATH_VAR}" ]; then
echo "$WATCH_EXTENSION_PROFILE_PATH_VAR is not defined"
exit 1
fi
if [ ! -f "${!WATCH_EXTENSION_PROFILE_PATH_VAR}" ]; then
echo "${!WATCH_EXTENSION_PROFILE_PATH_VAR} does not exist"
exit 1
fi
WATCH_EXTENSION_ENTITLEMENTS_PATH_VAR="ENTITLEMENTS_PATH_WATCH_EXTENSION"
if [ -z "${!WATCH_EXTENSION_ENTITLEMENTS_PATH_VAR}" ]; then
echo "$WATCH_EXTENSION_ENTITLEMENTS_PATH_VAR is not defined"
exit 1
fi
if [ ! -f "${!WATCH_EXTENSION_ENTITLEMENTS_PATH_VAR}" ]; then
echo "${!WATCH_EXTENSION_ENTITLEMENTS_PATH_VAR} does not exist"
exit 1
fi
cp "${!WATCH_EXTENSION_PROFILE_PATH_VAR}" "$WATCH_EXTENSION_PATH/embedded.mobileprovision"
/usr/bin/codesign ${VERBOSE} -f -s "$COMMON_IDENTITY_HASH" --entitlements "${!WATCH_EXTENSION_ENTITLEMENTS_PATH_VAR}" "$WATCH_EXTENSION_PATH" 2>/dev/null
WATCH_APP_PROFILE_PATH_VAR="PROFILE_PATH_WATCH_APP"
if [ -z "${!WATCH_APP_PROFILE_PATH_VAR}" ]; then
echo "$WATCH_APP_PROFILE_PATH_VAR is not defined"
exit 1
fi
if [ ! -f "${!WATCH_APP_PROFILE_PATH_VAR}" ]; then
echo "${!WATCH_APP_PROFILE_PATH_VAR} does not exist"
exit 1
fi
WATCH_APP_ENTITLEMENTS_PATH_VAR="ENTITLEMENTS_PATH_WATCH_APP"
if [ -z "${!WATCH_APP_ENTITLEMENTS_PATH_VAR}" ]; then
echo "$WATCH_APP_ENTITLEMENTS_PATH_VAR is not defined"
exit 1
fi
if [ ! -f "${!WATCH_APP_ENTITLEMENTS_PATH_VAR}" ]; then
echo "${!WATCH_APP_ENTITLEMENTS_PATH_VAR} does not exist"
exit 1
fi
cp "${!WATCH_APP_PROFILE_PATH_VAR}" "$WATCH_APP_PATH/embedded.mobileprovision"
/usr/bin/codesign ${VERBOSE} -f -s "$COMMON_IDENTITY_HASH" --entitlements "${!WATCH_APP_ENTITLEMENTS_PATH_VAR}" "$WATCH_APP_PATH" 2>/dev/null
fi
APP_PROFILE_PATH_VAR="PROFILE_PATH_APP"
if [ -z "${!APP_PROFILE_PATH_VAR}" ]; then
echo "$APP_PROFILE_PATH_VAR is not defined"
exit 1
fi
if [ ! -f "${!APP_PROFILE_PATH_VAR}" ]; then
echo "${!APP_PROFILE_PATH_VAR} does not exist"
exit 1
fi
APP_ENTITLEMENTS_PATH_VAR="ENTITLEMENTS_PATH_APP"
if [ -z "${!APP_ENTITLEMENTS_PATH_VAR}" ]; then
echo "$APP_ENTITLEMENTS_PATH_VAR is not defined"
exit 1
fi
if [ ! -f "${!APP_ENTITLEMENTS_PATH_VAR}" ]; then
echo "${!APP_ENTITLEMENTS_PATH_VAR} does not exist"
exit 1
fi
cp "${!APP_PROFILE_PATH_VAR}" "$APP_PATH/embedded.mobileprovision"
/usr/bin/codesign ${VERBOSE} -f -s "$COMMON_IDENTITY_HASH" --entitlements "${!APP_ENTITLEMENTS_PATH_VAR}" "$APP_PATH"
DIR=$(pwd)
cd "$UNPACKED_PATH"
if [ "$PACKAGE_METHOD" == "appstore" ]; then
zip -r "../${APP_NAME}_signed.ipa" Payload SwiftSupport WatchKitSupport2 1>/dev/null
elif [ "$PACKAGE_METHOD" == "enterprise" ]; then
zip -r "../${APP_NAME}_signed.ipa" Payload 1>/dev/null
fi
cd "$DIR"
cd "$BUILD_PATH"
zip -r "$DSYMS_FOLDER_NAME.zip" "$DSYMS_FOLDER_NAME" 1>/dev/null
cd "$DIR"
echo "Done"

View File

@ -5,6 +5,7 @@ objc_library(
module_name = "DeviceProximity",
srcs = glob([
"Sources/*.m",
"Sources/*.h",
]),
hdrs = glob([
"PublicHeaders/**/*.h",

View File

@ -599,6 +599,7 @@ struct AccountFinalState {
var state: AccountMutableState
var shouldPoll: Bool
var incomplete: Bool
var missingUpdatesFromChannels: Set<PeerId>
var discard: Bool
}

View File

@ -417,6 +417,19 @@ private func initialStateWithPeerIds(_ transaction: Transaction, peerIds: Set<Pe
if let notificationSettings = transaction.getPeerNotificationSettings(peerId) {
peerChatInfos[peerId] = PeerChatInfo(notificationSettings: notificationSettings)
}
} else {
if let peer = transaction.getPeer(peerId) {
if let _ = peer as? TelegramChannel {
if let notificationSettings = transaction.getPeerNotificationSettings(peerId) {
peerChatInfos[peerId] = PeerChatInfo(notificationSettings: notificationSettings)
Logger.shared.log("State", "Peer \(peerId) (\(peer.debugDisplayTitle) has no stored inclusion, using synthesized one")
}
} else {
Logger.shared.log("State", "Peer \(peerId) has no valid inclusion")
}
} else {
Logger.shared.log("State", "Peer \(peerId) has no valid inclusion")
}
}
if let readStates = transaction.getPeerReadStates(peerId) {
for (namespace, state) in readStates {
@ -582,7 +595,7 @@ func finalStateWithUpdateGroups(postbox: Postbox, network: Network, state: Accou
collectedUpdates.append(Api.Update.updateDeleteChannelMessages(channelId: channelId, messages: [], pts: pts, ptsCount: ptsCount))
}
return finalStateWithUpdates(postbox: postbox, network: network, state: updatedState, updates: collectedUpdates, shouldPoll: hadReset, missingUpdates: !ptsUpdatesAfterHole.isEmpty || !qtsUpdatesAfterHole.isEmpty || !seqGroupsAfterHole.isEmpty, shouldResetChannels: true, updatesDate: updatesDate)
return finalStateWithUpdates(postbox: postbox, network: network, state: updatedState, updates: collectedUpdates, shouldPoll: hadReset, missingUpdates: !ptsUpdatesAfterHole.isEmpty || !qtsUpdatesAfterHole.isEmpty || !seqGroupsAfterHole.isEmpty, shouldResetChannels: false, updatesDate: updatesDate)
}
func finalStateWithDifference(postbox: Postbox, network: Network, state: AccountMutableState, difference: Api.updates.Difference) -> Signal<AccountFinalState, NoError> {
@ -778,6 +791,8 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
channelsToPoll.formUnion(updatedState.initialState.channelsToPollExplicitely)
}
var missingUpdatesFromChannels = Set<PeerId>()
for update in sortedUpdates(updates) {
switch update {
case let .updateChannelTooLong(_, channelId, channelPts):
@ -798,10 +813,9 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
updatedState.deleteMessages(messages.map({ MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: $0) }))
updatedState.updateChannelState(peerId, pts: pts)
} else {
if !channelsToPoll.contains(peerId) {
Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) delete pts hole")
channelsToPoll.insert(peerId)
//updatedMissingUpdates = true
if !missingUpdatesFromChannels.contains(peerId) {
Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) delete pts hole \(previousState.pts) + \(ptsCount) != \(pts)")
missingUpdatesFromChannels.insert(peerId)
}
}
} else {
@ -827,10 +841,9 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
updatedState.editMessage(messageId, message: message.withUpdatedAttributes(attributes))
updatedState.updateChannelState(peerId, pts: pts)
} else {
if !channelsToPoll.contains(peerId) {
Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) edit message pts hole")
channelsToPoll.insert(peerId)
//updatedMissingUpdates = true
if !missingUpdatesFromChannels.contains(peerId) {
Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) edit message pts hole \(previousState.pts) + \(ptsCount) != \(pts)")
missingUpdatesFromChannels.insert(peerId)
}
}
} else {
@ -859,7 +872,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
updatedState.updateChannelState(peerId, pts: pts)
} else {
if !channelsToPoll.contains(peerId) {
Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) updateWebPage pts hole")
Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) updateWebPage pts hole \(previousState.pts) + \(ptsCount) != \(pts)")
channelsToPoll.insert(peerId)
}
}
@ -919,11 +932,10 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
updatedState.updateChannelSynchronizedUntilMessage(id.peerId, id: id.id)
}
} else {
if !channelsToPoll.contains(message.id.peerId) {
Logger.shared.log("State", "channel \(message.id.peerId) (\((updatedState.peers[message.id.peerId] as? TelegramChannel)?.title ?? "nil")) message pts hole")
if !missingUpdatesFromChannels.contains(message.id.peerId) {
Logger.shared.log("State", "channel \(message.id.peerId) (\((updatedState.peers[message.id.peerId] as? TelegramChannel)?.title ?? "nil")) message pts hole \(previousState.pts) + \(ptsCount) != \(pts)")
;
channelsToPoll.insert(message.id.peerId)
//updatedMissingUpdates = true
missingUpdatesFromChannels.insert(message.id.peerId)
}
}
} else {
@ -1134,10 +1146,9 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
}, pinned: (flags & (1 << 0)) != 0)
updatedState.updateChannelState(peerId, pts: pts)
} else {
if !channelsToPoll.contains(peerId) {
Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) pinned messages pts hole")
channelsToPoll.insert(peerId)
//updatedMissingUpdates = true
if !missingUpdatesFromChannels.contains(peerId) {
Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) pinned messages pts hole \(previousState.pts) + \(ptsCount) != \(pts)")
missingUpdatesFromChannels.insert(peerId)
}
}
} else {
@ -1417,7 +1428,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
pollChannelSignals = []
}
} else {
for peerId in channelsToPoll {
for peerId in channelsToPoll.union(missingUpdatesFromChannels) {
if let peer = updatedState.peers[peerId] {
pollChannelSignals.append(pollChannel(network: network, peer: peer, state: updatedState.branch()))
} else {
@ -1445,7 +1456,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
|> mapToSignal { resultingState -> Signal<AccountFinalState, NoError> in
return resolveMissingPeerChatInfos(network: network, state: resultingState)
|> map { resultingState, resolveError -> AccountFinalState in
return AccountFinalState(state: resultingState, shouldPoll: shouldPoll || hadError || resolveError, incomplete: missingUpdates, discard: resolveError)
return AccountFinalState(state: resultingState, shouldPoll: shouldPoll || hadError || resolveError, incomplete: missingUpdates, missingUpdatesFromChannels: Set(), discard: resolveError)
}
}
}
@ -1671,7 +1682,7 @@ func keepPollingChannel(postbox: Postbox, network: Network, peerId: PeerId, stat
|> mapToSignal { resultingState -> Signal<AccountFinalState, NoError> in
return resolveMissingPeerChatInfos(network: network, state: resultingState)
|> map { resultingState, _ -> AccountFinalState in
return AccountFinalState(state: resultingState, shouldPoll: false, incomplete: false, discard: false)
return AccountFinalState(state: resultingState, shouldPoll: false, incomplete: false, missingUpdatesFromChannels: Set(), discard: false)
}
}
|> mapToSignal { finalState -> Signal<Void, NoError> in
@ -1860,11 +1871,7 @@ private func resetChannels(network: Network, peers: [Peer], state: AccountMutabl
private func pollChannel(network: Network, peer: Peer, state: AccountMutableState) -> Signal<(AccountMutableState, Bool, Int32?), NoError> {
if let inputChannel = apiInputChannel(peer) {
let limit: Int32
#if DEBUG
limit = 1
#else
limit = 20
#endif
limit = 100
let pollPts: Int32
if let channelState = state.channelStates[peer.id] {
@ -2108,16 +2115,6 @@ private func verifyTransaction(_ transaction: Transaction, finalState: AccountMu
return !failed
}
private enum ReplayFinalStateIncomplete {
case MoreDataNeeded
case PollRequired
}
private enum ReplayFinalStateResult {
case Completed
case Incomplete(ReplayFinalStateIncomplete)
}
private final class OptimizeAddMessagesState {
var messages: [StoreMessage]
var location: AddMessagesLocation

View File

@ -605,7 +605,7 @@ public final class AccountStateManager {
if !events.isEmpty {
strongSelf.insertProcessEvents(events)
}
if finalState.incomplete {
if finalState.incomplete || !finalState.missingUpdatesFromChannels.isEmpty {
strongSelf.addOperation(.collectUpdateGroups(groups, 2.0), position: .last)
}
} else {
@ -622,9 +622,6 @@ public final class AccountStateManager {
assertionFailure()
}
}
}, error: { _ in
assertionFailure()
Logger.shared.log("AccountStateManager", "processUpdateGroups signal completed with error")
})
case let .custom(operationId, signal):
self.operationTimer?.invalidate()

View File

@ -60,7 +60,7 @@ private func dialogTopMessage(network: Network, postbox: Postbox, peerId: PeerId
if let message = apiMessages.first, let timestamp = message.timestamp {
return .single((message.rawId, timestamp))
} else {
return .fail(.retry)
return .single(nil)
}
}
}
@ -333,7 +333,7 @@ private func pushPeerReadState(network: Network, postbox: Postbox, stateManager:
return stateManager.addCustomOperation(postbox.transaction { transaction -> PeerReadStateValidationError? in
if let readStates = transaction.getPeerReadStates(peerId) {
for (namespace, currentReadState) in readStates where namespace == namespaceAndReadState.0 {
if currentReadState == namespaceAndReadState.1 {
if currentReadState.count == namespaceAndReadState.1.count {
transaction.confirmSynchronizedIncomingReadState(peerId)
return nil
}

View File

@ -28,14 +28,20 @@ objc_library(
"Sources/**/*.m",
"Sources/**/*.mm",
"Sources/**/*.h",
"libtgvoip/*.h",
"libtgvoip/*.hpp",
"libtgvoip/*.m",
"libtgvoip/*.mm",
"libtgvoip/*.cpp",
"libtgvoip/audio/*.h",
"libtgvoip/audio/*.cpp",
"libtgvoip/video/*.h",
"libtgvoip/video/*.cpp",
"libtgvoip/os/darwin/*.h",
"libtgvoip/os/darwin/*.m",
"libtgvoip/os/darwin/*.mm",
"libtgvoip/os/darwin/*.cpp",
"libtgvoip/os/posix/*.h",
"libtgvoip/os/posix/*.cpp",
], exclude = ["libtgvoip/os/darwin/*OSX*"]),
hdrs = glob([

View File

@ -84,7 +84,7 @@ objc_library(
name = "mozjpeg",
module_name = "mozjpeg",
enable_modules = True,
hdrs = [":Public/mozjpeg/" + x for x in headers],
hdrs = [":Public/mozjpeg/" + x for x in headers] + [":Public/mozjpeg/jconfig.h"],
includes = [
"Public",
"Public/mozjpeg",

1931
third-party/webrtc/BUILD vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +0,0 @@
#/bin/sh
set -x
set -e
BUILD_DIR="$(pwd)/$1"
ARCH="$2"
echo "BUILD_DIR=$BUILD_DIR"
echo "ARCH=$ARCH"
export PATH="$PATH:$BUILD_DIR/depot_tools"
rm -rf "$BUILD_DIR/src/openssl"
cp -R "$BUILD_DIR/openssl" "$BUILD_DIR/src/"
pushd "$BUILD_DIR/src"
OUT_DIR="ios"
if [ "$ARCH" == "x64" ]; then
OUT_DIR="ios_sim"
fi
buildtools/mac/gn gen out/$OUT_DIR --args="use_xcode_clang=true "" target_cpu=\"$ARCH\""' target_os="ios" is_debug=false is_component_build=false rtc_include_tests=false use_rtti=true rtc_use_x11=false use_custom_libcxx=false use_custom_libcxx_for_host=false rtc_build_ssl=false rtc_build_examples=false rtc_build_tools=false ios_deployment_target="9.0" ios_enable_code_signing=false is_unsafe_developer_build=false rtc_enable_protobuf=false rtc_include_builtin_video_codecs=true rtc_build_libvpx=true rtc_libvpx_build_vp9=true rtc_use_gtk=false rtc_use_metal_rendering=true'
ninja -C out/$OUT_DIR framework_objc_static
popd

@ -1 +1 @@
Subproject commit 2e909582b78f63911497dad823e5b5f247ecf1d9
Subproject commit eb9d68429a5805f904e9b7605f3900cef6453333