Fix build

This commit is contained in:
Peter 2019-06-06 17:46:02 +01:00
parent e3d3922fbc
commit 0be79b443f
16 changed files with 110 additions and 68 deletions

View File

@ -1,14 +1,14 @@
[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)
cflags = -g -fmodules -fobjc-arc -D BUCK -D DEBUG -w $(config custom.other_cflags)
cxxflags = -fobjc-arc -std=c++14 -D BUCK -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)
compiler_flags = -DBUCK -enable-testing -enable-batch-mode -g -Onone $(config custom.other_swift_compiler_flags)
use_filelist = true
[apple]

2
.gitmodules vendored
View File

@ -9,7 +9,7 @@ url=../Display.git
url=../HockeySDK-iOS.git
[submodule "submodules/libtgvoip"]
path = submodules/libtgvoip
url=https://github.com/grishka/libtgvoip.git
url=../libtgvoip.git
[submodule "submodules/lottie-ios"]
path = submodules/lottie-ios
url=../lottie-ios.git

4
BUCK
View File

@ -51,6 +51,10 @@ apple_binary(
'//submodules/HockeySDK-iOS:HockeySDK',
'//submodules/lottie-ios:Lottie',
'//submodules/libtgvoip:tgvoip',
'//submodules/webp:WebP',
'//submodules/ffmpeg:FFMpeg',
'//submodules/TelegramUI:TelegramUI',
'//submodules/TelegramUI:TelegramUIPrivateModule',
],
)

View File

@ -1,5 +1,9 @@
import Foundation
#if BUCK
import MtProtoKit
#else
import MtProtoKitDynamic
#endif
struct ImageResource {
let datacenterId: Int

View File

@ -1,6 +1,10 @@
import Foundation
import UserNotifications
#if BUCK
import MtProtoKit
#else
import MtProtoKitDynamic
#endif
import WebP
private var sharedLogger: Logger?

View File

@ -1,5 +1,9 @@
import Foundation
#if BUCK
import MtProtoKit
#else
import MtProtoKitDynamic
#endif
public class BoxedMessage: NSObject {
public let body: Any

View File

@ -2,7 +2,11 @@ import Foundation
import SwiftSignalKit
import Postbox
import TelegramCore
#if BUCK
import MtProtoKit
#else
import MtProtoKitDynamic
#endif
import Display
import TelegramUI

View File

@ -2,7 +2,11 @@ import Foundation
import TelegramCore
import SwiftSignalKit
import Postbox
#if BUCK
import MtProtoKit
#else
import MtProtoKitDynamic
#endif
enum AccountImportError: Error {
case generic

View File

@ -2,7 +2,11 @@ import Foundation
import TelegramCore
import SwiftSignalKit
import Postbox
#if BUCK
import MtProtoKit
#else
import MtProtoKitDynamic
#endif
import TelegramUI
import LegacyComponents

View File

@ -9,6 +9,9 @@ import TelegramCore
import LegacyComponents
import HockeySDK
import Lottie
import WebP
import FFMpeg
import TelegramUIPrivateModule
func test() {
let _ = ASDisplayNode()

@ -1 +1 @@
Subproject commit a9e374131912f68bb599f6c87b9da26a3687513e
Subproject commit 4fe76fd53bb0b561fde9aad5e32bd4d0ddca305c

@ -1 +1 @@
Subproject commit a56806593c21485c474f1077feb588dfd2adc4a9
Subproject commit 242ad146b04051d6ff4ec5300d4c63dc457e5d8e

@ -1 +1 @@
Subproject commit 33a1ee7e9ee60a7393ef58a3103cc6bce213bfe4
Subproject commit 36e789c8847a62fd9c369aa0a86376b0d6178893

@ -1 +1 @@
Subproject commit 0495e4606b6a109f951f963c95b3d57ed5e031ff
Subproject commit 66818a3563789f475899ad9dd2e3c88e6af82895

@ -1 +1 @@
Subproject commit 16711e202393ae7e1b160436f4291c5f06a3d375
Subproject commit a1ddd03c71fd318a3c81820c431a0a5e6563f9d4

View File

@ -29,69 +29,80 @@ def configs_with_config(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]:
def merge_maps(dicts):
result = dict()
for d in dicts:
for key in d:
if key in result and result[key] != d[key]:
fail(
"Conflicting files in file search paths. " +
"\"%s\" maps to both \"%s\" and \"%s\"." %
(key, result[key], file_map[key]),
(key, result[key], d[key]),
)
result[key] = file_map[key]
result.update(d)
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
def basename(p):
"""Returns the basename (i.e., the file portion) of a path.
Note that if `p` ends with a slash, this function returns an empty string.
This matches the behavior of Python's `os.path.basename`, but differs from
the Unix `basename` command (which would return the path segment preceding
the final slash).
Args:
p: The path whose basename should be returned.
Returns:
The basename of the path, which includes the extension.
"""
return p.rpartition("/")[-1]
return results
def glob_map(glob_results):
result = dict()
for path in glob_results:
file_name = basename(path)
if file_name in result:
fail('\"%s\" maps to both \"%s\" and \"%s\"' % (file_name, result[file_name], path))
result[file_name] = path
return result
def glob_sub_map(prefix, glob_specs):
result = dict()
for path in native.glob(glob_specs):
if not path.startswith(prefix):
fail('\"%s\" does not start with \"%s\"' % (path, prefix))
file_key = path[len(prefix):]
if file_key in result:
fail('\"%s\" maps to both \"%s\" and \"%s\"' % (file_key, result[file_key], path))
result[file_key] = path
return result
def gen_header_targets(header_paths, prefix, source_rule, source_path):
result = dict()
for header_path in header_paths:
name = prefix + header_path.replace('/', '_sub_')
native.genrule(
name = name,
cmd = 'cp $(location :' + source_rule + ')/' + source_path + '/' + header_path + ' $OUT',
out = name,
)
result[header_path] = ':' + name
return result
def lib_basename(name):
result = name
if result.startswith('lib'):
result = result[3:]
if result.endswith('.a'):
result = result[:-2]
return result
def gen_lib_targets(lib_paths, prefix, source_rule, source_path):
result = []
for lib_path in lib_paths:
name = lib_path.replace('/', '_sub_')
native.genrule(
name = name,
cmd = 'cp $(location :' + source_rule + ')/' + source_path + '/' + lib_path + ' $OUT',
out = name
)
result.append(name)
return result