Skip to content

Commit da4c460

Browse files
committed
Adding script to apply base patches and overrides
1 parent a51e966 commit da4c460

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

scripts/prepare-src.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
apply_changes() {
6+
7+
# Use custom path if provided, otherwise default to ./vscode
8+
local patched_src_dir="${1:-$(pwd)/vscode}"
9+
echo "Creating patched source in directory: ${patched_src_dir}"
10+
11+
code_editor_module_path="$(dirname "$(dirname "${BASH_SOURCE[0]}")")"
12+
patch_dir="${code_editor_module_path}/patches"
13+
14+
export QUILT_PATCHES="${patch_dir}"
15+
export QUILT_SERIES="web-server.series"
16+
17+
# Clean out the build directory
18+
echo "Cleaning build src dir"
19+
rm -rf "${patched_src_dir}"
20+
21+
# Copy third party source
22+
rsync -a "${code_editor_module_path}/third-party-src/" "${patched_src_dir}"
23+
24+
echo "Applying base patches"
25+
pushd "${patched_src_dir}"
26+
quilt push -a
27+
popd
28+
29+
echo "Applying overrides"
30+
rsync -a "${code_editor_module_path}/overrides/" "${patched_src_dir}"
31+
32+
}
33+
34+
custom_path=""
35+
while [[ $# -gt 0 ]]; do
36+
case $1 in
37+
--path)
38+
if [[ -z "${2:-}" ]]; then
39+
echo "Error: --path requires a value"
40+
exit 1
41+
fi
42+
custom_path="$2"
43+
shift 2
44+
;;
45+
-h|--help)
46+
echo "Usage: $0 [--path <directory>]"
47+
echo " --path: Custom build directory (default: ./vscode)"
48+
exit 0
49+
;;
50+
*)
51+
echo "Invalid parameter - '$1'"
52+
echo "Use --help for usage information"
53+
exit 1
54+
;;
55+
esac
56+
done
57+
apply_changes "${custom_path}"

0 commit comments

Comments
 (0)