BUCK configuration

This commit is contained in:
Peter 2019-06-06 00:17:51 +01:00
parent e09df60796
commit 124eaea2b7
28 changed files with 320 additions and 47 deletions

38
.buckconfig Normal file
View File

@ -0,0 +1,38 @@
[cxx]
default_platform = iphonesimulator-x86_64
cflags = -g -fmodules -fobjc-arc -D BUCK -w $(config custom.other_cflags)
cxxflags = -fobjc-arc -std=c++14 -D DEBUG -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 = 4.0
compiler_flags = -DBUCK -enable-testing -g -Onone $(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 = 8.0
iphoneos_target_sdk_version = 8.0
provisioning_profile_read_command = security cms -Di
xctool_default_destination_specifier = platform=iOS Simulator,OS=latest
;provisioning_profile_search_path = ./
;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, \
[build]
thread_core_ratio = 2.0

2
.gitignore vendored
View File

@ -24,3 +24,5 @@ DerivedData
*.dSYM.zip
*.ipa
*/xcuserdata/*
buck-out/*
.buckd/*

76
BUCK Normal file
View File

@ -0,0 +1,76 @@
load('//tools:buck_utils.bzl', 'config_with_updated_linker_flags', 'configs_with_config')
load('//tools:buck_defs.bzl', 'SHARED_CONFIGS')
# Adding `-all_load` to our binaries works around https://bugs.swift.org/browse/SR-6004. See the
# longer comment in `ViewController.swift` for more details.
ALL_LOAD_LINKER_FLAG = '-all_load'
APP_CONFIGS = {
'ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES': 'YES',
'DEVELOPMENT_LANGUAGE': 'Swift',
'PRODUCT_BUNDLE_IDENTIFIER': 'ph.telegra.Telegraph',
'PROVISIONING_PROFILE_SPECIFIER': 'match Development ph.telegra.Telegraph',
'TARGETED_DEVICE_FAMILY': '1,2',
}
APP_CONFIGS.update(SHARED_CONFIGS)
apple_resource(
name = 'LaunchScreenXib',
files = [
'Telegram-iOS/Base.lproj/LaunchScreen.xib',
],
)
apple_asset_catalog(
name = 'Images',
dirs = [
'Telegram-iOS/Images.xcassets',
],
app_icon = 'AppIconLLC',
)
apple_binary(
name = 'AppBinary',
configs = configs_with_config(config_with_updated_linker_flags(APP_CONFIGS, ALL_LOAD_LINKER_FLAG)),
swift_version = '4.2',
srcs = [
'Telegram-iOS/TempRoot.swift',
'Telegram-iOS/TempMain.m',
],
deps = [
':LaunchScreenXib',
':Images',
'//submodules/AsyncDisplayKit:AsyncDisplayKit',
'//submodules/MtProtoKit:MtProtoKit',
'//submodules/SSignalKit:SwiftSignalKit',
'//submodules/SSignalKit:SSignalKit',
'//submodules/Display:Display',
'//submodules/Postbox:Postbox',
'//submodules/TelegramCore:TelegramCore',
'//submodules/LegacyComponents:LegacyComponents',
'//submodules/HockeySDK-iOS:HockeySDK',
'//submodules/lottie-ios:Lottie',
'//submodules/libtgvoip:tgvoip',
],
)
apple_bundle(
name = 'AppBundle',
extension = 'app',
binary = ':AppBinary',
product_name = 'Telegram',
info_plist = 'Info.plist',
info_plist_substitutions = {
'DEVELOPMENT_LANGUAGE': 'en-us',
'EXECUTABLE_NAME': 'TelegramApp',
'PRODUCT_BUNDLE_IDENTIFIER': 'ph.telegra.Telegraph',
'PRODUCT_NAME': 'TelegramApp',
'VERSION': '5.8',
'BUILD_NUMBER': '2001',
},
)
apple_package(
name = 'AppPackage',
bundle = ':AppBundle',
)

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>5.7</string>
<string>5.7.1</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>NSExtension</key>

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>5.7</string>
<string>5.7.1</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>NSExtension</key>

View File

@ -10,7 +10,7 @@ public class BoxedMessage: NSObject {
public class Serialization: NSObject, MTSerialization {
public func currentLayer() -> UInt {
return 100
return 102
}
public func parseMessage(_ data: Data!) -> Any! {

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>5.7</string>
<string>5.7.1</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>NSExtension</key>

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>5.7</string>
<string>5.7.1</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>NSExtension</key>

View File

@ -1053,6 +1053,8 @@
D073E51E21FF7CE900742DDD /* Crypto.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Crypto.h; sourceTree = "<group>"; };
D073E51F21FF7CE900742DDD /* Crypto.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Crypto.m; sourceTree = "<group>"; };
D073E52122003E1E00742DDD /* Data.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Data.swift; sourceTree = "<group>"; };
D07477B522A72B1F002737C4 /* TempRoot.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TempRoot.swift; sourceTree = "<group>"; };
D07477B722A732F1002737C4 /* TempMain.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TempMain.m; sourceTree = "<group>"; };
D079FD001F06BBD10038FADE /* Telegram-iOS-AppStore.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = "Telegram-iOS-AppStore.entitlements"; sourceTree = "<group>"; };
D084023120E1883500065674 /* ApplicationShortcutItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplicationShortcutItem.swift; sourceTree = "<group>"; };
D08410431FABDC5B008FFE92 /* TGItemProviderSignals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGItemProviderSignals.h; sourceTree = "<group>"; };
@ -2000,6 +2002,8 @@
D0B21B0E220438E9003F741D /* SharedNotificationManager.swift */,
D09B79C42219C784003B1F9D /* SharedAccountInfo.swift */,
D09B79C72219C7AE003B1F9D /* ManageSharedAccountInfo.swift */,
D07477B522A72B1F002737C4 /* TempRoot.swift */,
D07477B722A732F1002737C4 /* TempMain.m */,
);
path = "Telegram-iOS";
sourceTree = "<group>";

View File

@ -23,33 +23,33 @@
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>Blue</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlueIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlackFilled</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlackFilledIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlueFilled</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlueFilledIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlackFilled</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlackFilledIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>Blue</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlueIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
<key>BlueFilled</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>BlueFilledIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
@ -68,7 +68,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>5.7</string>
<string>5.7.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>

View File

@ -41,7 +41,7 @@ private enum PreferencesProvider {
private func loadLegacyCustomProperyData(database: SqliteInterface, key: String) -> Data? {
var result: Data?
database.select("SELECT value FROM service_v29 WHERE key=\(murMurHash32(key))", { cursor in
database.select("SELECT value FROM service_v29 WHERE key=\(HashFunctions.murMurHash32(key))", { cursor in
result = cursor.getData(at: 0)
return false
})

7
Telegram-iOS/TempMain.m Normal file
View File

@ -0,0 +1,7 @@
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, @"Application", @"AppDelegate");
}
}

View File

@ -0,0 +1,29 @@
import Foundation
import AsyncDisplayKit
import MtProtoKit
import SwiftSignalKit
import SSignalKit
import Display
import Postbox
import TelegramCore
import LegacyComponents
import HockeySDK
import Lottie
func test() {
let _ = ASDisplayNode()
let _ = MTProto()
let _ = Signal<Never, NoError> { subscriber in
return ActionDisposable {
}
}
let _ = SSignal(generator: { subscriber in
return SBlockDisposable {
}
})
let _ = ListView()
let _ = SqliteValueBox(basePath: "", queue: .mainQueue(), encryptionParameters: nil, upgradeProgress: { _ in }, inMemory: true)
initializeAccountManagement()
BITHockeyManager.shared().crashManager.crashManagerStatus = .alwaysAsk
let _ = LOTComposition(json: [:])
}

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>5.7</string>
<string>5.7.1</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>UISupportedInterfaceOrientations</key>

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>5.7</string>
<string>5.7.1</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>NSExtension</key>

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>5.7</string>
<string>5.7.1</string>
<key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string>
<key>NSExtension</key>

@ -1 +1 @@
Subproject commit 75d4f47c24dbaf1ddf25be6cf7c636d5162f1425
Subproject commit 2bfec3d11d47ea93522dce1fb380bffff5b7e828

@ -1 +1 @@
Subproject commit ffb131ac55bed21c37052a09c27150d5d380321e
Subproject commit a9e374131912f68bb599f6c87b9da26a3687513e

@ -1 +1 @@
Subproject commit 95615527a9946b0efe6bd593f83f90946ad195b9
Subproject commit 923ee1b409eb1c4dbe836196740fd662c8f3ddb6

@ -1 +1 @@
Subproject commit 62c8606f554cbd96e981e186f95cc4a0f77b1f5a
Subproject commit 270d32faef878aa39dc3c8b5cbb6edf2c3856492

@ -1 +1 @@
Subproject commit 3c271bb1446bafe39bb460dfaa926ccc7ffb20d9
Subproject commit ab27f2f195fbf8c3ea9df18c8bc37c7facc1cf1d

@ -1 +1 @@
Subproject commit 20e6e10a50e4e4ab2ffe1d161ef13f122ffbd8c9
Subproject commit 08820b13cfdd014dc8a1de94a84b5b311e621c43

@ -1 +1 @@
Subproject commit 09c1d8049d38fdbe9ba829d6c07ee85a9338308f
Subproject commit bbf43c967cd7b87e00f18f7fd16b4a66a26c0513

@ -1 +1 @@
Subproject commit ef5cdf919f7b996218e089705abdf31b68ce0cd8
Subproject commit a56806593c21485c474f1077feb588dfd2adc4a9

@ -1 +1 @@
Subproject commit fc95b3e572ea0c9d59fbb63df3ad8c1cb5fee4cd
Subproject commit 33a1ee7e9ee60a7393ef58a3103cc6bce213bfe4

@ -1 +1 @@
Subproject commit 279b805ad5fcbaae029bbf195b375a40f5e14a36
Subproject commit 8de8984ef02d8f302b358b69c74ac3696d8c614d

20
tools/buck_defs.bzl Normal file
View File

@ -0,0 +1,20 @@
SHARED_CONFIGS = {
'IPHONEOS_DEPLOYMENT_TARGET': '8.0', # common target version
'SDKROOT': 'iphoneos', # platform
'GCC_OPTIMIZATION_LEVEL': '0', # clang optimization
'SWIFT_OPTIMIZATION_LEVEL': '-Onone', # swiftc optimization
'SWIFT_WHOLE_MODULE_OPTIMIZATION': 'NO', # for build performance
'ONLY_ACTIVE_ARCH': 'YES',
'LD_RUNPATH_SEARCH_PATHS': '@executable_path/Frameworks', # To allow source files in binary
}
LIB_SPECIFIC_CONFIG = {
'SKIP_INSTALL': 'YES',
'APPLICATION_EXTENSION_API_ONLY': 'YES',
}
def combined_config(dicts):
result = dict()
for d in dicts:
result.update(d)
return result

97
tools/buck_utils.bzl Normal file
View File

@ -0,0 +1,97 @@
OTHER_LINKER_FLAGS_KEY = 'OTHER_LDFLAGS'
# Either appends or assigns `other_linker_flags` to `config` under `config_key`.
# Params:
# - config: A dictionary of config names and their values
# - additional_linker_flags: A string-representable value of additional linker flags
# - config_key: The key to which to append or assign the additional linker flags
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
# Creates a dictionary where the top level keys are the supported build configurations and the value of each key is `config`.
def configs_with_config(config):
return {
"Debug": config,
"Profile": config,
"Release": config,
}
def subdir_glob(glob_specs, exclude = None, prefix = ""):
"""Returns a dict of sub-directory relative paths to full paths.
The subdir_glob() function is useful for defining header maps for C/C++
libraries which should be relative the given sub-directory.
Given a list of tuples, the form of (relative-sub-directory, glob-pattern),
it returns a dict of sub-directory relative paths to full paths.
Please refer to native.glob() for explanations and examples of the pattern.
Args:
glob_specs: The array of tuples in form of
(relative-sub-directory, glob-pattern inside relative-sub-directory).
type: List[Tuple[str, str]]
exclude: A list of patterns to identify files that should be removed
from the set specified by the first argument. Defaults to [].
type: Optional[List[str]]
prefix: If is not None, prepends it to each key in the dictionary.
Defaults to None.
type: Optional[str]
Returns:
A dict of sub-directory relative paths to full paths.
"""
if exclude == None:
exclude = []
results = []
for dirpath, glob_pattern in glob_specs:
results.append(
_single_subdir_glob(dirpath, glob_pattern, exclude, prefix),
)
return _merge_maps(*results)
def _merge_maps(*file_maps):
result = {}
for file_map in file_maps:
for key in file_map:
if key in result and result[key] != file_map[key]:
fail(
"Conflicting files in file search paths. " +
"\"%s\" maps to both \"%s\" and \"%s\"." %
(key, result[key], file_map[key]),
)
result[key] = file_map[key]
return result
def _single_subdir_glob(dirpath, glob_pattern, exclude = None, prefix = None):
if exclude == None:
exclude = []
results = {}
files = native.glob([dirpath + '/' + glob_pattern], exclude = exclude)
for f in files:
if dirpath:
key = f[len(dirpath) + 1:]
else:
key = f
if prefix:
key =prefix + '/' + key
results[key] = f
return results