Skip to content

Commit 3e00eaf

Browse files
committed
chore: improve vsc build tasks
1 parent 9e434be commit 3e00eaf

File tree

4 files changed

+102
-42
lines changed

4 files changed

+102
-42
lines changed

.vscode/build-actions.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/sh
2+
set -euo pipefail
3+
4+
ACTION="${1:-Package}"
5+
echo ">> action: ${ACTION}"
6+
7+
icloud_dir="$HOME/Library/Mobile Documents/com~apple~CloudDocs"
8+
9+
build_package() {
10+
rm -rf packages
11+
gmake clean package
12+
}
13+
14+
clean_dest() {
15+
local srcs=("$@")
16+
for s in "${srcs[@]}"; do
17+
[[ -n "$s" && -e "$s" ]] || continue
18+
local base
19+
base=$(basename "$s")
20+
local dest="$icloud_dir/$base"
21+
if [[ -e "$dest" ]]; then
22+
rm -f "$dest" || { echo "Failed to remove existing $dest" >&2; exit 1; }
23+
echo "Removed existing $dest"
24+
fi
25+
done
26+
}
27+
28+
case "$ACTION" in
29+
Package)
30+
build_package
31+
;;
32+
"AirDrop Tweak")
33+
build_package
34+
shortcuts run AirDrop -i ./packages/*.deb
35+
;;
36+
"Build IPA")
37+
build_package
38+
chmod +x build-local.sh
39+
./build-local.sh
40+
;;
41+
".dylib -> iCloud Drive")
42+
build_package
43+
DYLIB=$(ls .theos/obj/*.dylib 2>/dev/null | head -n1 || true)
44+
if [[ -n "$DYLIB" && -f "$DYLIB" ]]; then
45+
[[ -d "$icloud_dir" ]] || { echo "Destination directory missing: $icloud_dir" >&2; exit 1; }
46+
clean_dest "$DYLIB"
47+
cp -v "$DYLIB" "$icloud_dir/" || { echo "Copy failed" >&2; exit 1; }
48+
else
49+
echo "No dylib found in .theos/obj" >&2
50+
exit 1
51+
fi
52+
;;
53+
".deb -> iCloud Drive")
54+
build_package
55+
[[ -d "$icloud_dir" ]] || { echo "Destination directory missing: $icloud_dir" >&2; exit 1; }
56+
debs=(packages/*.deb)
57+
if [[ ${debs[1]} == 'packages/*.deb' ]]; then echo "No .deb artifacts found" >&2; exit 1; fi
58+
clean_dest "${debs[@]}"
59+
cp -v "${debs[@]}" "$icloud_dir/" || { echo "Copy failed" >&2; exit 1; }
60+
;;
61+
".ipa -> iCloud Drive")
62+
build_package
63+
chmod +x build-local.sh
64+
./build-local.sh
65+
IPA=$(ls *.ipa 2>/dev/null | head -n1 || true)
66+
if [[ -n "${IPA}" ]]; then
67+
[[ -d "$icloud_dir" ]] || { echo "Destination directory missing: $icloud_dir" >&2; exit 1; }
68+
clean_dest "$IPA"
69+
cp -v "$IPA" "$icloud_dir/" || { echo "Copy failed" >&2; exit 1; }
70+
else
71+
echo "No IPA found" >&2
72+
exit 1
73+
fi
74+
;;
75+
*)
76+
echo "Unknown action: $ACTION" >&2
77+
exit 1
78+
;;
79+
esac

.vscode/settings.json

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,7 @@
88
{
99
"label": "$(tools) Build Tweak",
1010
"task": "Build Tweak",
11-
"tooltip": "Build Tweak"
12-
},
13-
{
14-
"label": "$(cloud-upload) AirDrop Tweak",
15-
"task": "AirDrop Tweak",
16-
"tooltip": "AirDrop Tweak"
17-
},
18-
{
19-
"label": "$(package) Build IPA",
20-
"task": "Build IPA",
21-
"tooltip": "Build IPA locally"
11+
"tooltip": "Default / AirDrop Tweak / Build IPA"
2212
}
2313
],
2414
"externalFormatters.languages": {
@@ -44,4 +34,4 @@
4434
},
4535
"editor.formatOnSave": true,
4636
"markdown.validate.enabled": true
47-
}
37+
}

.vscode/tasks.json

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
11
{
22
"version": "2.0.0",
3+
"inputs": [
4+
{
5+
"id": "inputAction",
6+
"type": "pickString",
7+
"description": "build actions",
8+
"options": [
9+
"Package",
10+
"AirDrop Tweak",
11+
"Build IPA",
12+
".dylib -> iCloud Drive",
13+
".deb -> iCloud Drive",
14+
".ipa -> iCloud Drive"
15+
],
16+
"default": "Package"
17+
}
18+
],
319
"tasks": [
420
{
521
"type": "shell",
622
"label": "Build Tweak",
723
"command": "zsh",
824
"args": [
925
"-c",
10-
"rm -rf packages && gmake clean package"
26+
"chmod +x '${workspaceFolder}/.vscode/build-actions.sh' 2>/dev/null || true; '${workspaceFolder}/.vscode/build-actions.sh' \"${input:inputAction}\""
1127
],
1228
"problemMatcher": {
1329
"owner": "cpp",
@@ -28,34 +44,9 @@
2844
"panel": "shared",
2945
"showReuseMessage": false,
3046
"clear": true,
31-
"close": true
32-
}
33-
},
34-
{
35-
"type": "shell",
36-
"label": "AirDrop Tweak",
37-
"command": "zsh",
38-
"args": [
39-
"-c",
40-
"shortcuts run 'AirDrop' -i ./packages/*.deb"
41-
],
42-
"presentation": {
43-
"panel": "shared",
44-
"showReuseMessage": false,
45-
"clear": true,
46-
"close": true
47-
},
48-
"dependsOn": ["Build Tweak"]
49-
},
50-
{
51-
"type": "shell",
52-
"label": "Build IPA",
53-
"command": "chmod +x build-local.sh && ./build-local.sh",
54-
"presentation": {
55-
"panel": "shared",
56-
"showReuseMessage": false,
57-
"clear": true,
58-
"reveal": "always"
47+
"close": true,
48+
"reveal": "always",
49+
"focus": true
5950
}
6051
}
6152
]

sources/Updater.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ + (NSURL *)getDownloadURL
7171
}
7272
}
7373

74-
[Logger warn:LOG_CATEGORY_UPDATER
74+
[Logger error:LOG_CATEGORY_UPDATER
7575
format:@"Failed to fetch manifest, falling back to JavaScript bundle"];
7676
return [NSURL URLWithString:[baseURL stringByAppendingString:@"unbound.js"]];
7777
}

0 commit comments

Comments
 (0)