From ca75be91fec97181df9137495eb91348b4ac5af3 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Fri, 1 Nov 2019 16:18:47 +0400 Subject: [PATCH] Temp --- .gitignore | 11 ++++ .gitmodules | 9 +++ WORKSPACE | 48 +++++++++++++++ Wallet/BUILD | 56 +++++++++++++++++ Wallet/Info.plist | 6 +- Wallet/SupportFiles/Empty.swift | 24 ++++++++ .../Wallet.tulsiproj/Configs/Default.tulsigen | 61 +++++++++++++++++++ Wallet/Wallet.tulsiproj/peter.tulsiconf-user | 10 +++ Wallet/Wallet.tulsiproj/project.tulsiconf | 14 +++++ submodules/AsyncDisplayKit/BUILD | 40 ++++++++++++ .../Source/Details/ASTraitCollection.mm | 1 + submodules/GZip/BUILD | 18 ++++++ 12 files changed, 293 insertions(+), 5 deletions(-) create mode 100644 WORKSPACE create mode 100644 Wallet/BUILD create mode 100644 Wallet/Wallet.tulsiproj/Configs/Default.tulsigen create mode 100644 Wallet/Wallet.tulsiproj/peter.tulsiconf-user create mode 100644 Wallet/Wallet.tulsiproj/project.tulsiconf create mode 100644 submodules/AsyncDisplayKit/BUILD create mode 100644 submodules/GZip/BUILD diff --git a/.gitignore b/.gitignore index c94428a8d5..f6393a74fe 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,14 @@ submodules/MtProtoKit/TON/macOS/lib/fift/Lisp.fif submodules/MtProtoKit/TON/macOS/lib/fift/Lists.fif submodules/MtProtoKit/TON/macOS/lib/fift/Stack.fif submodules/MtProtoKit/TON/macOS/lib/fift/TonUtil.fif +bazel-bin +bazel-bin/* +bazel-genfiles +bazel-genfiles/* +bazel-out +bazel-out/* +bazel-telegram-ios +bazel-telegram-ios/* +bazel-testlogs +bazel-testlogs/* +*/*.swp diff --git a/.gitmodules b/.gitmodules index f931b28d97..a221ebb907 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,3 +2,12 @@ [submodule "submodules/rlottie/rlottie"] path = submodules/rlottie/rlottie url = https://github.com/laktyushin/rlottie.git +[submodule "build-system/bazel-rules/rules_apple"] + path = build-system/bazel-rules/rules_apple + url = https://github.com/bazelbuild/rules_apple.git +[submodule "build-system/bazel-rules/rules_swift"] + path = build-system/bazel-rules/rules_swift + url = https://github.com/bazelbuild/rules_swift.git +[submodule "build-system/bazel-rules/apple_support"] + path = build-system/bazel-rules/apple_support + url = https://github.com/bazelbuild/apple_support.git diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000000..95027a82b6 --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,48 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "com_google_protobuf", + urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.8.0.zip"], + sha256 = "1e622ce4b84b88b6d2cdf1db38d1a634fe2392d74f0b7b74ff98f3a51838ee53", + strip_prefix = "protobuf-3.8.0", + type = "zip", +) + +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +protobuf_deps() + +local_repository( + name = "build_bazel_rules_apple", + path = "build-system/bazel-rules/rules_apple", +) + +local_repository( + name = "build_bazel_rules_swift", + path = "build-system/bazel-rules/rules_swift", +) + +local_repository( + name = "build_bazel_apple_support", + path = "build-system/bazel-rules/apple_support", +) + +load( + "@build_bazel_rules_apple//apple:repositories.bzl", + "apple_rules_dependencies", +) + +apple_rules_dependencies() + +load( + "@build_bazel_rules_swift//swift:repositories.bzl", + "swift_rules_dependencies", +) + +swift_rules_dependencies() + +load( + "@build_bazel_apple_support//lib:repositories.bzl", + "apple_support_dependencies", +) + +apple_support_dependencies() diff --git a/Wallet/BUILD b/Wallet/BUILD new file mode 100644 index 0000000000..383843f696 --- /dev/null +++ b/Wallet/BUILD @@ -0,0 +1,56 @@ +load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") + +version_info_plist_source = """ +echo \ +'' \ +'' \ +'' \ +'' \ +' CFBundleShortVersionString' \ +' %s' \ +' CFBundleVersion' \ +' %s' \ +'' \ +'' \ +> "$@" +""" % ("1.0", "30") + +genrule( + name = "VersionInfoPlist", + outs = ["VersionInfo.plist"], + cmd = version_info_plist_source, +) + +objc_library( + name = "Main", + srcs = [ + "Sources/main.m" + ], +) + +swift_library( + name = "Lib", + srcs = glob([ + "SupportFiles/**/*.swift", + ]), + deps = [ + "//submodules/GZip:GZip", + "//submodules/AsyncDisplayKit:AsyncDisplayKit", + ], +) + +ios_application( + name = "Wallet", + bundle_id = "org.telegram-iOS.Wallet", + families = ["iphone", "ipad"], + minimum_os_version = "9.0", + infoplists = [ + ":Info.plist", + ":VersionInfoPlist", + ], + deps = [ + ":Main", + ":Lib", + ], +) diff --git a/Wallet/Info.plist b/Wallet/Info.plist index 7646b3381e..e33b51058a 100644 --- a/Wallet/Info.plist +++ b/Wallet/Info.plist @@ -7,7 +7,7 @@ CFBundleDevelopmentRegion en CFBundleDisplayName - ${APP_NAME} + ${PRODUCT_NAME} CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIcons @@ -38,12 +38,8 @@ $(PRODUCT_NAME) CFBundlePackageType APPL - CFBundleShortVersionString - $(PRODUCT_BUNDLE_SHORT_VERSION) CFBundleSignature ???? - CFBundleVersion - ${BUILD_NUMBER} ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/Wallet/SupportFiles/Empty.swift b/Wallet/SupportFiles/Empty.swift index 8b13789179..555a316570 100644 --- a/Wallet/SupportFiles/Empty.swift +++ b/Wallet/SupportFiles/Empty.swift @@ -1 +1,25 @@ +import Foundation +import UIKit +import GZip +@objc(Application) +final class Application: UIApplication { +} + +@objc(AppDelegate) +final class AppDelegate: NSObject, UIApplicationDelegate { + var window: UIWindow? + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { + self.window = UIWindow(frame: UIScreen.main.bounds) + self.window?.rootViewController = UIViewController() + self.window?.rootViewController?.view.backgroundColor = .green + self.window?.makeKeyAndVisible() + + if #available(iOS 13.0, *) { + self.window?.rootViewController?.overrideUserInterfaceStyle = .dark + } + + return true + } +} diff --git a/Wallet/Wallet.tulsiproj/Configs/Default.tulsigen b/Wallet/Wallet.tulsiproj/Configs/Default.tulsigen new file mode 100644 index 0000000000..ab962d626b --- /dev/null +++ b/Wallet/Wallet.tulsiproj/Configs/Default.tulsigen @@ -0,0 +1,61 @@ +{ + "additionalFilePaths" : [ + "Wallet/BUILD" + ], + "buildTargets" : [ + "//Wallet:Lib", + "//Wallet:Main", + "//Wallet:Wallet", + ], + "optionSet" : { + "BazelBuildOptionsDebug" : { + "p" : "$(inherited)" + }, + "BazelBuildOptionsRelease" : { + "p" : "$(inherited)" + }, + "BazelBuildStartupOptionsDebug" : { + "p" : "$(inherited)" + }, + "BazelBuildStartupOptionsRelease" : { + "p" : "$(inherited)" + }, + "BuildActionPostActionScript" : { + "p" : "$(inherited)" + }, + "BuildActionPreActionScript" : { + "p" : "$(inherited)" + }, + "CommandlineArguments" : { + "p" : "$(inherited)" + }, + "EnvironmentVariables" : { + "p" : "$(inherited)" + }, + "LaunchActionPostActionScript" : { + "p" : "$(inherited)" + }, + "LaunchActionPreActionScript" : { + "p" : "$(inherited)" + }, + "ProjectGenerationBazelStartupOptions" : { + "p" : "$(inherited)" + }, + "ProjectPrioritizesSwift" : { + "p" : "YES" + }, + "TestActionPostActionScript" : { + "p" : "$(inherited)" + }, + "TestActionPreActionScript" : { + "p" : "$(inherited)" + } + }, + "projectName" : "Wallet", + "sourceFilters" : [ + "Wallet", + "Wallet/Sources", + "Wallet/SupportFiles", + "submodules/...", + ] +} diff --git a/Wallet/Wallet.tulsiproj/peter.tulsiconf-user b/Wallet/Wallet.tulsiproj/peter.tulsiconf-user new file mode 100644 index 0000000000..4cae5c3523 --- /dev/null +++ b/Wallet/Wallet.tulsiproj/peter.tulsiconf-user @@ -0,0 +1,10 @@ +{ + "optionSet" : { + "BazelPath" : { + "p" : "/usr/local/bin/bazel" + }, + "WorkspaceRootPath" : { + "p" : "/Users/peter/build/telegram-temp/telegram-ios" + } + } +} diff --git a/Wallet/Wallet.tulsiproj/project.tulsiconf b/Wallet/Wallet.tulsiproj/project.tulsiconf new file mode 100644 index 0000000000..59fbd3b6ac --- /dev/null +++ b/Wallet/Wallet.tulsiproj/project.tulsiconf @@ -0,0 +1,14 @@ +{ + "configDefaults" : { + "optionSet" : { + "ProjectPrioritizesSwift" : { + "p" : "YES" + } + } + }, + "packages" : [ + "Wallet" + ], + "projectName" : "Wallet", + "workspaceRoot" : "../.." +} diff --git a/submodules/AsyncDisplayKit/BUILD b/submodules/AsyncDisplayKit/BUILD new file mode 100644 index 0000000000..0a335db311 --- /dev/null +++ b/submodules/AsyncDisplayKit/BUILD @@ -0,0 +1,40 @@ + +ASYNCDISPLAYKIT_EXPORTED_HEADERS = glob([ + "Source/*.h", + "Source/Details/**/*.h", + "Source/Layout/*.h", + "Source/Base/*.h", + "Source/Debug/AsyncDisplayKit+Debug.h", + "Source/TextKit/ASTextNodeTypes.h", + "Source/TextKit/ASTextKitComponents.h" +]) + +ASYNCDISPLAYKIT_PRIVATE_HEADERS = glob([ + "Source/**/*.h" + ], + exclude = ASYNCDISPLAYKIT_EXPORTED_HEADERS, +) + +objc_library( + name = "AsyncDisplayKit", + enable_modules = True, + module_name = "AsyncDisplayKit", + srcs = glob([ + "Source/**/*.m", + "Source/**/*.mm", + "Source/Base/*.m", + ]) + ASYNCDISPLAYKIT_PRIVATE_HEADERS, + hdrs = ASYNCDISPLAYKIT_EXPORTED_HEADERS, + defines = [ + "MINIMAL_ASDK", + ], + sdk_frameworks = [ + "QuartzCore", + "CoreMedia", + "CoreText", + "CoreGraphics", + ], + visibility = [ + "//visibility:public", + ], +) diff --git a/submodules/AsyncDisplayKit/Source/Details/ASTraitCollection.mm b/submodules/AsyncDisplayKit/Source/Details/ASTraitCollection.mm index e885239211..8a65399dde 100644 --- a/submodules/AsyncDisplayKit/Source/Details/ASTraitCollection.mm +++ b/submodules/AsyncDisplayKit/Source/Details/ASTraitCollection.mm @@ -7,6 +7,7 @@ // Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // +#import #import #import #import diff --git a/submodules/GZip/BUILD b/submodules/GZip/BUILD new file mode 100644 index 0000000000..b94e8bfd2d --- /dev/null +++ b/submodules/GZip/BUILD @@ -0,0 +1,18 @@ + +objc_library( + name = "GZip", + enable_modules = True, + module_name = "GZip", + srcs = glob([ + "Sources/**/*.m", + ]), + hdrs = glob([ + "Sources/**/*.h", + ]), + sdk_dylibs = [ + "libz", + ], + visibility = [ + "//visibility:public", + ], +)