Skip to content

Commit 32660b3

Browse files
committed
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
2 parents 654ff9e + 73dfa5f commit 32660b3

35 files changed

+1501
-1192
lines changed

‎.bazelrc‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,20 @@ build --spawn_strategy=standalone
2020

2121
build --strategy=SwiftCompile=worker
2222

23-
common --registry=https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/
23+
#common --registry=https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/
24+
25+
# SourceKit BSP: Swift indexing features
26+
common --features=swift.index_while_building
27+
common --features=swift.use_global_index_store
28+
common --features=swift.use_global_module_cache
29+
common --features=oso_prefix_is_pwd
30+
31+
# SourceKit BSP: Index build config (used for background indexing)
32+
common:index_build --experimental_convenience_symlinks=ignore
33+
common:index_build --show_result=0
34+
common:index_build --noshow_loading_progress
35+
common:index_build --noshow_progress
36+
common:index_build --noannounce_rc
37+
common:index_build --noshow_timestamps
38+
common:index_build --curses=no
39+
common:index_build --color=no

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,6 @@ Telegram.LSP.json
7676
spm-files
7777
xcode-files
7878
.bsp/**
79+
.sourcekit-lsp/**
7980
/.claude/
8081
/buildbox/*

‎.gitmodules‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ url=../tgcalls.git
3737
url = https://github.com/yonaskolb/XcodeGen.git
3838
[submodule "build-system/bazel-rules/sourcekit-bazel-bsp"]
3939
path = build-system/bazel-rules/sourcekit-bazel-bsp
40-
url=https://github.com/ali-fareed/sourcekit-bazel-bsp.git
40+
url = https://github.com/spotify/sourcekit-bazel-bsp.git

‎.sourcekit-lsp/config.json‎

Lines changed: 0 additions & 11 deletions
This file was deleted.

‎.vscode/launch.json‎

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,19 @@
11
{
2-
"configurations": [
3-
{
4-
"name": "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
14-
},
15-
{
16-
"name": "Restart Debug Telegram",
17-
"type": "lldb-dap",
18-
"request": "attach",
19-
"preLaunchTask": "Restart Telegram Debug",
20-
"debuggerRoot": "${workspaceFolder}",
21-
"attachCommands": [
22-
"process connect connect://localhost:6667"
23-
],
24-
"internalConsoleOptions": "openOnSessionStart",
25-
"timeout": 1000
26-
},
27-
],
28-
"options": {
29-
"console": "integratedTerminal",
2+
"configurations": [
3+
{
4+
"name": "Debug Telegram",
5+
"type": "lldb-dap",
6+
"request": "attach",
7+
"preLaunchTask": "_launch_telegram",
8+
"debuggerRoot": "${workspaceFolder}",
9+
"attachCommands": [
10+
"command script import '${workspaceFolder}/scripts/lldb_attach.py'"
11+
],
12+
"terminateCommands": [
13+
"command script import '${workspaceFolder}/scripts/lldb_kill_app.py'"
14+
],
15+
"internalConsoleOptions": "openOnSessionStart",
16+
"timeout": 9999
3017
}
31-
}
18+
]
19+
}

‎.vscode/settings.json‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"swift.disableSwiftPackageManagerIntegration": true,
3+
"swift.autoGenerateLaunchConfigurations": false,
4+
"swift.disableAutoResolve": true,
25
"search.followSymlinks": false,
36
"files.exclude": {
47
".git/**": true
@@ -9,8 +12,6 @@
912
"search.exclude": {
1013
".git/**": true
1114
},
12-
"files.associations": {
13-
},
1415
"swift.sourcekit-lsp.backgroundIndexing": "on",
1516
"swift.sourcekit-lsp.trace.server": "messages",
1617
"terminal.integrated.profiles.osx": {
@@ -22,5 +23,5 @@
2223
]
2324
}
2425
},
25-
"swift.sourcekit-lsp.serverPath": "${workspaceFolder}/build-input/sourcekit-lsp",
26+
"swift.sourcekit-lsp.serverPath": "${workspaceFolder}/build-input/sourcekit-lsp"
2627
}

‎.vscode/tasks.json‎

Lines changed: 80 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,110 @@
11
{
22
"version": "2.0.0",
33
"tasks": [
4+
{
5+
"label": "Select Simulator for Apple Development",
6+
"type": "shell",
7+
"command": "./scripts/select_simulator.sh",
8+
"presentation": {
9+
"reveal": "always",
10+
"focus": true,
11+
"panel": "dedicated"
12+
},
13+
"problemMatcher": []
14+
},
415
{
516
"label": "Build Telegram",
617
"type": "shell",
7-
"command": "${workspaceFolder}/build-input/bazel-8.4.2-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-
],
18+
"command": "./scripts/lldb_build.sh",
19+
"options": {
20+
"env": {
21+
"BAZEL_LABEL_TO_RUN": "//Telegram:Telegram",
22+
"BAZEL_EXTRA_BUILD_FLAGS": ""
23+
}
24+
},
2525
"group": {
26-
"kind": "build",
27-
"isDefault": true
26+
"kind": "build"
2827
},
29-
"problemMatcher": [],
30-
"runOptions": {
31-
"instanceLimit": 1
32-
}
28+
"problemMatcher": [
29+
{
30+
"owner": "bazel",
31+
"source": "bazel",
32+
"fileLocation": [
33+
"relative",
34+
"${workspaceFolder}"
35+
],
36+
"pattern": {
37+
"regexp": "^(.+?):(\\d+):(\\d+):\\s+(error|warning|note):\\s+(.*)$",
38+
"file": 1,
39+
"line": 2,
40+
"column": 3,
41+
"severity": 4,
42+
"message": 5
43+
}
44+
}
45+
]
3346
},
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.
3747
{
3848
"label": "_launch_telegram",
3949
"type": "shell",
40-
"command": "./scripts/launch_and_debug.sh",
50+
"command": "./scripts/lldb_launch_and_debug.sh",
51+
"options": {
52+
"env": {
53+
"BAZEL_LABEL_TO_RUN": "//Telegram:Telegram",
54+
"BAZEL_EXTRA_BUILD_FLAGS": "",
55+
"BAZEL_LAUNCH_ARGS": ""
56+
}
57+
},
4158
"presentation": {
4259
"reveal": "always"
4360
},
4461
"hide": true,
4562
"isBackground": true,
4663
"problemMatcher": [
4764
{
48-
"pattern": [
49-
{
50-
"regexp": "\\b\\B",
51-
"file": 1,
52-
"location": 2,
53-
"message": 3
54-
}
65+
"owner": "bazel",
66+
"source": "bazel",
67+
"fileLocation": [
68+
"relative",
69+
"${workspaceFolder}"
5570
],
71+
"pattern": {
72+
"regexp": "launcher_error in (.*): (.*)",
73+
"kind": "file",
74+
"file": 1,
75+
"message": 2
76+
},
5677
"background": {
5778
"activeOnStart": true,
58-
"beginsPattern": "^.*Building....*",
59-
"endsPattern": "^.*Listening to port 6667 for a connection from .*"
79+
"beginsPattern": "^Starting launch task\\.\\.\\.$",
80+
"endsPattern": "^ph.telegra.Telegraph: .*"
81+
}
82+
},
83+
{
84+
"owner": "bazel",
85+
"source": "bazel",
86+
"fileLocation": [
87+
"relative",
88+
"${workspaceFolder}"
89+
],
90+
"pattern": {
91+
"regexp": "^(.+?):(\\d+):(\\d+):\\s+(error|warning|note):\\s+(.*)$",
92+
"file": 1,
93+
"line": 2,
94+
"column": 3,
95+
"severity": 4,
96+
"message": 5
97+
},
98+
"background": {
99+
"activeOnStart": true,
100+
"beginsPattern": "^Starting launch task\\.\\.\\.$",
101+
"endsPattern": "^ph.telegra.Telegraph: .*"
60102
}
61103
}
62104
],
63105
"runOptions": {
64106
"instanceLimit": 1
65107
}
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-
"label": "Stop Telegram Debug Session",
80-
"type": "shell",
81-
"command": "pkill -f 'launch_and_debug.sh' || true; lsof -ti:6667 | xargs kill -9 2>/dev/null || true",
82-
"problemMatcher": [],
83-
"presentation": {
84-
"reveal": "silent",
85-
"close": true
86-
}
87-
},
88-
{
89-
"label": "Restart Telegram Debug",
90-
"dependsOrder": "sequence",
91-
"dependsOn": [
92-
"Stop Telegram Debug Session",
93-
"_launch_telegram"
94-
],
95-
"problemMatcher": [],
96-
"presentation": {
97-
"reveal": "always"
98-
}
99108
}
100109
]
101-
}
110+
}

‎BUILD.bazel‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,34 @@
11
load("@sourcekit_bazel_bsp//rules:setup_sourcekit_bsp.bzl", "setup_sourcekit_bsp")
22

33
setup_sourcekit_bsp(
4-
name = "setup_sourcekit_bsp_telegram_project",
4+
name = "setup_sourcekit_bsp",
55
bazel_wrapper = "./build-input/bazel-8.4.2-darwin-arm64",
66
files_to_watch = [
7-
"**/*.swift",
7+
"Telegram/**/*.swift",
8+
"Telegram/**/*.h",
9+
"Telegram/**/*.m",
10+
"Telegram/**/*.mm",
11+
"Telegram/**/*.c",
12+
"Telegram/**/*.cpp",
13+
"submodules/**/*.swift",
14+
"submodules/**/*.h",
15+
"submodules/**/*.m",
16+
"submodules/**/*.mm",
17+
"submodules/**/*.c",
18+
"submodules/**/*.cpp",
19+
],
20+
aquery_flags = [
21+
"define=telegramVersion=12.5",
22+
"define=buildNumber=100000",
823
],
924
index_flags = [
1025
"config=index_build",
26+
"define=telegramVersion=12.5",
27+
"define=buildNumber=100000",
1128
],
29+
index_build_batch_size = 10,
1230
targets = [
1331
"//Telegram:Telegram",
1432
],
33+
merge_lsp_config = False,
1534
)

‎MODULE.bazel‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ local_path_override(
6363
path = "./build-input/configuration-repository",
6464
)
6565

66-
bazel_dep(name = "sourcekit_bazel_bsp", version = "0.3.0")
66+
bazel_dep(name = "sourcekit_bazel_bsp", version = "0.7.1")
6767
local_path_override(
6868
module_name = "sourcekit_bazel_bsp",
6969
path = "build-system/bazel-rules/sourcekit-bazel-bsp",
70-
)
70+
)

0 commit comments

Comments
 (0)