From 4fe56d2d3638871698cf66b3dcb3bda320a9bccc Mon Sep 17 00:00:00 2001 From: Saumitra Sharma Date: Wed, 2 Jul 2025 07:50:37 +0000 Subject: [PATCH] Adding script to apply base patches and overrides --- scripts/prepare-src.sh | 57 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 scripts/prepare-src.sh diff --git a/scripts/prepare-src.sh b/scripts/prepare-src.sh new file mode 100644 index 00000000..9c76010b --- /dev/null +++ b/scripts/prepare-src.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +set -euo pipefail + +apply_changes() { + + # Use custom path if provided, otherwise default to ./vscode + local patched_src_dir="${1:-$(pwd)/vscode}" + echo "Creating patched source in directory: ${patched_src_dir}" + + code_editor_module_path="$(dirname "$(dirname "${BASH_SOURCE[0]}")")" + patch_dir="${code_editor_module_path}/patches" + + export QUILT_PATCHES="${patch_dir}" + export QUILT_SERIES="web-server.series" + + # Clean out the build directory + echo "Cleaning build src dir" + rm -rf "${patched_src_dir}" + + # Copy third party source + rsync -a "${code_editor_module_path}/third-party-src/" "${patched_src_dir}" + + echo "Applying base patches" + pushd "${patched_src_dir}" + quilt push -a + popd + + echo "Applying overrides" + rsync -a "${code_editor_module_path}/overrides/" "${patched_src_dir}" + +} + +custom_path="" +while [[ $# -gt 0 ]]; do + case $1 in + --path) + if [[ -z "${2:-}" ]]; then + echo "Error: --path requires a value" + exit 1 + fi + custom_path="$2" + shift 2 + ;; + -h|--help) + echo "Usage: $0 [--path ]" + echo " --path: Custom build directory (default: ./vscode)" + exit 0 + ;; + *) + echo "Invalid parameter - '$1'" + echo "Use --help for usage information" + exit 1 + ;; + esac +done +apply_changes "${custom_path}" \ No newline at end of file