Skip to content

Commit f0de386

Browse files
committed
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
2 parents 7463fb9 + 326fe35 commit f0de386

File tree

1,477 files changed

+837640
-535
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,477 files changed

+837640
-535
lines changed

.bazelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,9 @@ build --spawn_strategy=standalone
2222
build --strategy=SwiftCompile=standalone
2323
build --define RULES_SWIFT_BUILD_DUMMY_WORKER=1
2424

25+
common:index_build --experimental_convenience_symlinks=ignore
26+
common:index_build --bes_backend= --bes_results_url=
27+
common:index_build --nolegacy_important_outputs
28+
common:index_build --show_result=0
29+
common:index_build --define=buildNumber=10000
30+
common:index_build --define=telegramVersion=12.2.2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,4 @@ buildServer.json
7474
Telegram.LSP.json
7575
**/.build/**
7676
spm-files
77+
.bsp/**

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ url=../tgcalls.git
3535
[submodule "third-party/XcodeGen"]
3636
path = third-party/XcodeGen
3737
url = https://github.com/yonaskolb/XcodeGen.git
38+
[submodule "build-system/bazel-rules/sourcekit-bazel-bsp"]
39+
path = build-system/bazel-rules/sourcekit-bazel-bsp
40+
url=https://github.com/ali-fareed/sourcekit-bazel-bsp.git

.sourcekit-lsp/config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"backgroundIndexing": true,
3+
"backgroundPreparationMode": "build",
4+
"defaultWorkspaceType": "buildServer",
5+
"logging": {
6+
"level": "error",
7+
"privacyLevel": "sensitive"
8+
}
9+
}

.vscode/launch.json

Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,19 @@
11
{
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5-
"version": "0.2.0",
62
"configurations": [
73
{
8-
"type": "swift",
9-
"request": "launch",
10-
"args": [],
11-
"cwd": "${workspaceFolder:telegram-ios}",
124
"name": "Debug Telegram",
13-
"program": "${workspaceFolder:telegram-ios}/.build/debug/Telegram",
14-
"preLaunchTask": "swift: Build Debug Telegram"
5+
"type": "lldb-dap",
6+
"request": "attach",
7+
"preLaunchTask": "_launch_telegram",
8+
"debuggerRoot": "${workspaceFolder}",
9+
"attachCommands": [
10+
"process connect connect://localhost:6667"
11+
],
12+
"internalConsoleOptions": "openOnSessionStart",
13+
"timeout": 1000
1514
},
16-
{
17-
"type": "swift",
18-
"request": "launch",
19-
"args": [],
20-
"cwd": "${workspaceFolder:telegram-ios}",
21-
"name": "Release Telegram",
22-
"program": "${workspaceFolder:telegram-ios}/.build/release/Telegram",
23-
"preLaunchTask": "swift: Build Release Telegram"
24-
},
25-
{
26-
"type": "swift",
27-
"request": "launch",
28-
"args": [],
29-
"cwd": "${workspaceFolder:telegram-ios}",
30-
"name": "Debug telegram-ios",
31-
"program": "${workspaceFolder:telegram-ios}/.build/debug/telegram-ios",
32-
"preLaunchTask": "swift: Build Debug telegram-ios"
33-
},
34-
{
35-
"type": "swift",
36-
"request": "launch",
37-
"args": [],
38-
"cwd": "${workspaceFolder:telegram-ios}",
39-
"name": "Release telegram-ios",
40-
"program": "${workspaceFolder:telegram-ios}/.build/release/telegram-ios",
41-
"preLaunchTask": "swift: Build Release telegram-ios"
42-
}
43-
]
15+
],
16+
"options": {
17+
"console": "integratedTerminal",
18+
}
4419
}

.vscode/tasks.json

Lines changed: 78 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,79 @@
11
{
2-
"version": "2.0.0",
3-
"tasks": [
4-
]
5-
}
6-
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Build Telegram",
6+
"type": "shell",
7+
"command": "${workspaceFolder}/build-input/bazel-8.3.1-darwin-arm64",
8+
"args": [
9+
"build",
10+
"Telegram/Telegram",
11+
"--features=swift.use_global_module_cache",
12+
"--verbose_failures",
13+
"--remote_cache_async",
14+
"--features=swift.skip_function_bodies_for_derived_files",
15+
"--jobs=16",
16+
"--define=buildNumber=10000",
17+
"--define=telegramVersion=12.2.2",
18+
"--disk_cache=${HOME}/telegram-bazel-cache",
19+
"-c",
20+
"dbg",
21+
"--ios_multi_cpus=sim_arm64",
22+
"--watchos_cpus=arm64_32",
23+
"--features=swift.enable_batch_mode"
24+
],
25+
"group": {
26+
"kind": "build",
27+
"isDefault": true
28+
},
29+
"problemMatcher": [],
30+
"runOptions": {
31+
"instanceLimit": 1
32+
}
33+
},
34+
// Hidden never-ending task that handles the launch / debugging bits for Cmd+Shift+D.
35+
// The problemMatcher field defines when the task is effectively ready to be debugged
36+
// by the attach task in launch.json.
37+
{
38+
"label": "_launch_telegram",
39+
"type": "shell",
40+
"command": "./scripts/launch_and_debug.sh",
41+
"presentation": {
42+
"reveal": "always"
43+
},
44+
"hide": true,
45+
"isBackground": true,
46+
"problemMatcher": [
47+
{
48+
"pattern": [
49+
{
50+
"regexp": "\\b\\B",
51+
"file": 1,
52+
"location": 2,
53+
"message": 3
54+
}
55+
],
56+
"background": {
57+
"activeOnStart": true,
58+
"beginsPattern": "^.*Building....*",
59+
"endsPattern": "^.*Listening to port 6667 for a connection from .*"
60+
}
61+
}
62+
],
63+
"runOptions": {
64+
"instanceLimit": 1
65+
}
66+
},
67+
{
68+
"label": "Stream SourceKitBazelBSP Logs",
69+
"type": "shell",
70+
"command": "log stream --process sourcekit-bazel-bsp --debug",
71+
"problemMatcher": [],
72+
"isBackground": false,
73+
"presentation": {
74+
"reveal": "always",
75+
"panel": "dedicated"
76+
}
77+
}
78+
]
79+
}

BUILD.bazel

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
load("@sourcekit_bazel_bsp//rules:setup_sourcekit_bsp.bzl", "setup_sourcekit_bsp")
2+
3+
setup_sourcekit_bsp(
4+
name = "setup_sourcekit_bsp_telegram_project",
5+
bazel_wrapper = "./build-input/bazel-8.3.1-darwin-arm64",
6+
files_to_watch = [
7+
"**/*.swift",
8+
],
9+
index_flags = [
10+
"config=index_build",
11+
],
12+
targets = [
13+
"//Telegram:Telegram",
14+
],
15+
)

MODULE.bazel

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ local_path_override(
3030

3131
http_file(
3232
name = "cmake_tar_gz",
33-
urls = ["https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-macos-universal.tar.gz"],
34-
sha256 = "f794ed92ccb4e9b6619a77328f313497d7decf8fb7e047ba35a348b838e0e1e2",
33+
urls = ["https://github.com/Kitware/CMake/releases/download/v4.1.2/cmake-4.1.2-macos-universal.tar.gz"],
34+
sha256 = "3be85f5b999e327b1ac7d804cbc9acd767059e9f603c42ec2765f6ab68fbd367",
3535
)
3636

3737
http_file(
@@ -62,3 +62,9 @@ local_path_override(
6262
module_name = "build_configuration",
6363
path = "./build-input/configuration-repository",
6464
)
65+
66+
bazel_dep(name = "sourcekit_bazel_bsp", version = "0.3.0")
67+
local_path_override(
68+
module_name = "sourcekit_bazel_bsp",
69+
path = "build-system/bazel-rules/sourcekit-bazel-bsp",
70+
)

Telegram/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@ associated_domains_fragment = "" if telegram_bundle_id not in official_bundle_id
495495
<string>applinks:telegram.me</string>
496496
<string>applinks:t.me</string>
497497
<string>applinks:*.t.me</string>
498+
<string>webcredentials:t.me</string>
498499
</array>
499500
"""
500501

build-system/Make/Make.py

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def __init__(self, bazel, override_bazel_version, override_xcode_version, bazel_
4040
self.additional_args = None
4141
self.build_number = None
4242
self.configuration_args = None
43-
self.configuration_path = None
4443
self.split_submodules = False
4544
self.custom_target = None
4645
self.continue_on_error = False
@@ -68,7 +67,7 @@ def __init__(self, bazel, override_bazel_version, override_xcode_version, bazel_
6867
'--verbose_failures',
6968

7069
# Asynchronously upload cache artifacts
71-
'--experimental_remote_cache_async',
70+
'--remote_cache_async',
7271
]
7372

7473
self.common_build_args = [
@@ -89,12 +88,6 @@ def __init__(self, bazel, override_bazel_version, override_xcode_version, bazel_
8988
# invoking a smaller number of frontend processes and passing them batches of
9089
# source files.
9190
'--features=swift.enable_batch_mode',
92-
93-
# https://docs.bazel.build/versions/master/command-line-reference.html
94-
# Set the number of parallel jobs per module to saturate the available CPU resources.
95-
#'--swiftcopt=-j{}'.format(os.cpu_count() - 1),
96-
'--@build_bazel_rules_swift//swift:copt="-j{}"'.format(os.cpu_count() - 1),
97-
'--@build_bazel_rules_swift//swift:copt="-whole-module-optimization"',
9891
]
9992

10093
self.common_release_args = [
@@ -147,9 +140,6 @@ def set_enable_sandbox(self, enable_sandbox):
147140
def set_split_swiftmodules(self, value):
148141
self.split_submodules = value
149142

150-
def set_configuration_path(self, path):
151-
self.configuration_path = path
152-
153143
def set_disable_provisioning_profiles(self):
154144
self.disable_provisioning_profiles = True
155145

@@ -203,8 +193,6 @@ def set_configuration(self, configuration):
203193

204194
# Require DSYM files as build output.
205195
'--output_groups=+dsyms',
206-
207-
#'--@build_bazel_rules_swift//swift:copt="-num-threads 0"',
208196
] + self.common_release_args
209197
else:
210198
raise Exception('Unknown configuration {}'.format(configuration))
@@ -296,13 +284,6 @@ def invoke_build(self):
296284
if self.disable_provisioning_profiles:
297285
combined_arguments += ['--//Telegram:disableProvisioningProfiles']
298286

299-
if self.configuration_path is None:
300-
raise Exception('configuration_path is not defined')
301-
302-
combined_arguments += [
303-
'--override_repository=build_configuration={}'.format(self.configuration_path)
304-
]
305-
306287
combined_arguments += self.common_args
307288
combined_arguments += self.common_build_args
308289
combined_arguments += self.get_define_arguments()
@@ -336,13 +317,6 @@ def invoke_test(self):
336317

337318
combined_arguments += ['Tests/AllTests']
338319

339-
if self.configuration_path is None:
340-
raise Exception('configuration_path is not defined')
341-
342-
combined_arguments += [
343-
'--override_repository=build_configuration={}'.format(self.configuration_path)
344-
]
345-
346320
combined_arguments += self.common_args
347321
combined_arguments += self.common_build_args
348322
combined_arguments += self.get_define_arguments()
@@ -371,13 +345,6 @@ def invoke_query(self, query_args):
371345
combined_arguments += self.get_startup_bazel_arguments()
372346
combined_arguments += ['aquery']
373347

374-
if self.configuration_path is None:
375-
raise Exception('configuration_path is not defined')
376-
377-
combined_arguments += [
378-
'--override_repository=build_configuration={}'.format(self.configuration_path)
379-
]
380-
381348
combined_arguments += [
382349
'-c', 'dbg',
383350
'--ios_multi_cpus=sim_arm64',
@@ -425,13 +392,6 @@ def get_spm_aspect_invocation(self):
425392
if self.disable_provisioning_profiles:
426393
combined_arguments += ['--//Telegram:disableProvisioningProfiles']
427394

428-
if self.configuration_path is None:
429-
raise Exception('configuration_path is not defined')
430-
431-
combined_arguments += [
432-
'--override_repository=build_configuration={}'.format(self.configuration_path)
433-
]
434-
435395
combined_arguments += self.common_args
436396
combined_arguments += self.common_build_args
437397
combined_arguments += self.get_define_arguments()
@@ -562,9 +522,6 @@ def resolve_configuration(base_path, bazel_command_line: BazelCommandLine, argum
562522
file.write(' "{}",\n'.format(file_name))
563523
file.write('])\n')
564524

565-
if bazel_command_line is not None:
566-
bazel_command_line.set_configuration_path(configuration_repository_path)
567-
568525

569526
def generate_project(bazel, arguments):
570527
bazel_command_line = BazelCommandLine(
@@ -617,7 +574,6 @@ def generate_project(bazel, arguments):
617574
disable_provisioning_profiles=disable_provisioning_profiles,
618575
include_release=project_include_release,
619576
generate_dsym=generate_dsym,
620-
configuration_path=bazel_command_line.configuration_path,
621577
bazel_app_arguments=bazel_command_line.get_project_generation_arguments(),
622578
target_name=target_name
623579
)
@@ -1006,14 +962,10 @@ def add_project_and_build_common_arguments(current_parser: argparse.ArgumentPars
1006962
buildParser.add_argument(
1007963
'--configuration',
1008964
choices=[
1009-
'debug_universal',
1010965
'debug_arm64',
1011-
'debug_armv7',
1012966
'debug_sim_arm64',
1013967
'release_sim_arm64',
1014968
'release_arm64',
1015-
'release_armv7',
1016-
'release_universal'
1017969
],
1018970
required=True,
1019971
help='Build configuration'
@@ -1254,14 +1206,10 @@ def add_project_and_build_common_arguments(current_parser: argparse.ArgumentPars
12541206
spm_parser.add_argument(
12551207
'--configuration',
12561208
choices=[
1257-
'debug_universal',
12581209
'debug_arm64',
1259-
'debug_armv7',
12601210
'debug_sim_arm64',
12611211
'release_sim_arm64',
12621212
'release_arm64',
1263-
'release_armv7',
1264-
'release_universal'
12651213
],
12661214
required=True,
12671215
help='Build configuration'

0 commit comments

Comments
 (0)