From fef4a9aa03643e936b86ee494f8f7585093002bc Mon Sep 17 00:00:00 2001 From: Baptiste Augrain Date: Mon, 6 Jan 2025 15:40:23 +0100 Subject: [PATCH] refactor: reorganize files (#2185) --- .github/workflows/insider-linux.yml | 6 +++--- .github/workflows/insider-spearhead.yml | 4 ++-- .github/workflows/insider-windows.yml | 2 +- .github/workflows/stable-linux.yml | 6 +++--- .github/workflows/stable-spearhead.yml | 4 ++-- .github/workflows/stable-windows.yml | 2 +- CONTRIBUTING.md | 2 +- .../alpine/package_reh.sh | 0 .../linux/loong64/electron.sh | 0 .../linux/loong64/electron.sha256sums | 0 .../linux/loong64/ripgrep.sh | 0 .../linux/package_bin.sh | 12 +++++------ .../linux/package_reh.sh | 0 .../linux/ppc64le/electron.sh | 0 .../linux/ppc64le/electron.sha256sums | 0 .../linux/riscv64/electron.sh | 0 .../linux/riscv64/electron.sha256sums | 0 .../linux/riscv64/ripgrep.sh | 0 include_osx.gypi => build/osx/include.gypi | 0 .../windows/package.sh | 0 .../windows/prepare_assets.sh | 0 {build => dev}/build.ps1 | 2 +- {build => dev}/build.sh | 8 ++++---- {build => dev}/build_docker.sh | 0 patch.sh => dev/patch.sh | 0 {build => dev}/update_api.sh | 0 {build => dev}/update_patches.sh | 0 docs/howto-build.md | 20 +++++++++---------- get_repo.sh | 10 +++++----- update_qualityjson.sh => update_upstream.sh | 4 ++-- insider.json => upstream/insider.json | 0 stable.json => upstream/stable.json | 0 32 files changed, 41 insertions(+), 41 deletions(-) rename package_alpine_reh.sh => build/alpine/package_reh.sh (100%) rename electron_linux_loong64.sh => build/linux/loong64/electron.sh (100%) rename electron_linux_loong64.sha256sums => build/linux/loong64/electron.sha256sums (100%) rename ripgrep_linux_loong64.sh => build/linux/loong64/ripgrep.sh (100%) rename package_linux_bin.sh => build/linux/package_bin.sh (88%) rename package_linux_reh.sh => build/linux/package_reh.sh (100%) rename electron_linux_ppc64le.sh => build/linux/ppc64le/electron.sh (100%) rename electron_linux_ppc64le.sha256sums => build/linux/ppc64le/electron.sha256sums (100%) rename electron_linux_riscv64.sh => build/linux/riscv64/electron.sh (100%) rename electron_linux_riscv64.sha256sums => build/linux/riscv64/electron.sha256sums (100%) rename ripgrep_linux_riscv64.sh => build/linux/riscv64/ripgrep.sh (100%) rename include_osx.gypi => build/osx/include.gypi (100%) rename package_windows.sh => build/windows/package.sh (100%) rename prepare_assets.sh => build/windows/prepare_assets.sh (100%) rename {build => dev}/build.ps1 (89%) rename {build => dev}/build.sh (90%) rename {build => dev}/build_docker.sh (100%) rename patch.sh => dev/patch.sh (100%) rename {build => dev}/update_api.sh (100%) rename {build => dev}/update_patches.sh (100%) rename update_qualityjson.sh => update_upstream.sh (79%) rename insider.json => upstream/insider.json (100%) rename stable.json => upstream/stable.json (100%) diff --git a/.github/workflows/insider-linux.yml b/.github/workflows/insider-linux.yml index 8df9ea24455..f5eba0020bc 100644 --- a/.github/workflows/insider-linux.yml +++ b/.github/workflows/insider-linux.yml @@ -232,7 +232,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} npm_config_arch: ${{ matrix.npm_arch }} - run: ./package_linux_bin.sh + run: ./build/linux/package_bin.sh if: env.DISABLED != 'yes' && env.SHOULD_BUILD == 'yes' - name: Prepare assets @@ -362,7 +362,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} npm_config_arch: ${{ matrix.npm_arch }} - run: ./package_linux_reh.sh + run: ./build/linux/package_reh.sh if: env.DISABLED != 'yes' && (env.SHOULD_BUILD_REH != 'no' || env.SHOULD_BUILD_REH_WEB != 'no' || github.event.inputs.generate_assets == 'true') - name: Release @@ -444,7 +444,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} npm_config_arch: ${{ matrix.npm_arch }} - run: ./package_alpine_reh.sh + run: ./build/alpine/package_reh.sh if: env.SHOULD_BUILD_REH != 'no' || github.event.inputs.generate_assets == 'true' - name: Release diff --git a/.github/workflows/insider-spearhead.yml b/.github/workflows/insider-spearhead.yml index 1a487cbf390..71b09ea69b2 100644 --- a/.github/workflows/insider-spearhead.yml +++ b/.github/workflows/insider-spearhead.yml @@ -56,8 +56,8 @@ jobs: run: ./build.sh if: env.SHOULD_BUILD == 'yes' - - name: Update .json - run: ./update_qualityjson.sh + - name: Update upstream version + run: ./update_upstream.sh env: GITHUB_TOKEN: ${{ secrets.STRONGER_GITHUB_TOKEN }} GITHUB_USERNAME: ${{ github.repository_owner }} diff --git a/.github/workflows/insider-windows.yml b/.github/workflows/insider-windows.yml index 72fd4c2a2eb..2df4b48a6ce 100644 --- a/.github/workflows/insider-windows.yml +++ b/.github/workflows/insider-windows.yml @@ -214,7 +214,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} npm_config_arch: ${{ matrix.vscode_arch }} npm_config_target_arch: ${{ matrix.vscode_arch }} - run: ./package_windows.sh + run: ./build/windows/package.sh if: env.SHOULD_BUILD == 'yes' - name: Prepare assets diff --git a/.github/workflows/stable-linux.yml b/.github/workflows/stable-linux.yml index 65779233354..7ee9e460c04 100644 --- a/.github/workflows/stable-linux.yml +++ b/.github/workflows/stable-linux.yml @@ -231,7 +231,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} npm_config_arch: ${{ matrix.npm_arch }} - run: ./package_linux_bin.sh + run: ./build/linux/package_bin.sh if: env.DISABLED != 'yes' && env.SHOULD_BUILD == 'yes' - name: Prepare assets @@ -361,7 +361,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} npm_config_arch: ${{ matrix.npm_arch }} - run: ./package_linux_reh.sh + run: ./build/linux/package_reh.sh if: env.DISABLED != 'yes' && (env.SHOULD_BUILD_REH != 'no' || env.SHOULD_BUILD_REH_WEB != 'no' || github.event.inputs.generate_assets == 'true') - name: Release @@ -443,7 +443,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} npm_config_arch: ${{ matrix.npm_arch }} - run: ./package_alpine_reh.sh + run: ./build/alpine/package_reh.sh if: env.SHOULD_BUILD_REH != 'no' || github.event.inputs.generate_assets == 'true' - name: Release diff --git a/.github/workflows/stable-spearhead.yml b/.github/workflows/stable-spearhead.yml index c975b44e418..2a5c7b59ded 100644 --- a/.github/workflows/stable-spearhead.yml +++ b/.github/workflows/stable-spearhead.yml @@ -51,8 +51,8 @@ jobs: run: ./build.sh if: env.SHOULD_BUILD == 'yes' - - name: Update .json - run: ./update_qualityjson.sh + - name: Update upstream version + run: ./update_upstream.sh env: GITHUB_TOKEN: ${{ secrets.STRONGER_GITHUB_TOKEN }} GITHUB_USERNAME: ${{ github.repository_owner }} diff --git a/.github/workflows/stable-windows.yml b/.github/workflows/stable-windows.yml index 0ca7ff6a844..de01c16d12b 100644 --- a/.github/workflows/stable-windows.yml +++ b/.github/workflows/stable-windows.yml @@ -213,7 +213,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} npm_config_arch: ${{ matrix.vscode_arch }} npm_config_target_arch: ${{ matrix.vscode_arch }} - run: ./package_windows.sh + run: ./build/windows/package.sh if: env.SHOULD_BUILD == 'yes' - name: Prepare assets diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8ce05e3e719..1b7452b2698 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,7 +34,7 @@ If you want to update the existing patches, please follow the section [`Patch Up ### Add a new patch - first, you need to build VSCodium -- then use the command `patch.sh `, to initiate a new patch +- then use the command `./dev/patch.sh `, to initiate a new patch - when the script pauses at `Press any key when the conflict have been resolved...`, open `vscode` directory in **VSCodium** - run `yarn watch` - run `./script/code.sh` diff --git a/package_alpine_reh.sh b/build/alpine/package_reh.sh similarity index 100% rename from package_alpine_reh.sh rename to build/alpine/package_reh.sh diff --git a/electron_linux_loong64.sh b/build/linux/loong64/electron.sh similarity index 100% rename from electron_linux_loong64.sh rename to build/linux/loong64/electron.sh diff --git a/electron_linux_loong64.sha256sums b/build/linux/loong64/electron.sha256sums similarity index 100% rename from electron_linux_loong64.sha256sums rename to build/linux/loong64/electron.sha256sums diff --git a/ripgrep_linux_loong64.sh b/build/linux/loong64/ripgrep.sh similarity index 100% rename from ripgrep_linux_loong64.sh rename to build/linux/loong64/ripgrep.sh diff --git a/package_linux_bin.sh b/build/linux/package_bin.sh similarity index 88% rename from package_linux_bin.sh rename to build/linux/package_bin.sh index f239c7b6640..dcf4c37887f 100755 --- a/package_linux_bin.sh +++ b/build/linux/package_bin.sh @@ -41,16 +41,16 @@ elif [[ "${VSCODE_ARCH}" == "loong64" ]]; then export VSCODE_SKIP_SETUPENV=1 fi -if [[ -f "../electron_linux_${VSCODE_ARCH}.sh" ]]; then +if [[ -f "../build/linux/${VSCODE_ARCH}/electron.sh" ]]; then # add newline at the end of the file echo "" >> build/checksums/electron.txt - if [[ -f "../electron_linux_${VSCODE_ARCH}.sha256sums" ]]; then - cat "../electron_linux_${VSCODE_ARCH}.sha256sums" >> build/checksums/electron.txt + if [[ -f "../build/linux/${VSCODE_ARCH}/electron.sha256sums" ]]; then + cat "../build/linux/${VSCODE_ARCH}/electron.sha256sums" >> build/checksums/electron.txt fi # shellcheck disable=SC1090 - source "../electron_linux_${VSCODE_ARCH}.sh" + source "../build/linux/${VSCODE_ARCH}/electron.sh" if [[ "${ELECTRON_VERSION}" != "$( yarn config get target )" ]]; then # Fail the pipeline if electron target doesn't match what is used. @@ -124,8 +124,8 @@ node build/azure-pipelines/distro/mixin-npm yarn gulp "vscode-linux-${VSCODE_ARCH}-min-ci" -if [[ -f "../ripgrep_${VSCODE_PLATFORM}_${VSCODE_ARCH}.sh" ]]; then - bash "../ripgrep_${VSCODE_PLATFORM}_${VSCODE_ARCH}.sh" "../VSCode-linux-${VSCODE_ARCH}/resources/app/node_modules" +if [[ -f "../build/linux/${VSCODE_ARCH}/ripgrep.sh" ]]; then + bash "../build/linux/${VSCODE_ARCH}/ripgrep.sh" "../VSCode-linux-${VSCODE_ARCH}/resources/app/node_modules" fi find "../VSCode-linux-${VSCODE_ARCH}" -print0 | xargs -0 touch -c diff --git a/package_linux_reh.sh b/build/linux/package_reh.sh similarity index 100% rename from package_linux_reh.sh rename to build/linux/package_reh.sh diff --git a/electron_linux_ppc64le.sh b/build/linux/ppc64le/electron.sh similarity index 100% rename from electron_linux_ppc64le.sh rename to build/linux/ppc64le/electron.sh diff --git a/electron_linux_ppc64le.sha256sums b/build/linux/ppc64le/electron.sha256sums similarity index 100% rename from electron_linux_ppc64le.sha256sums rename to build/linux/ppc64le/electron.sha256sums diff --git a/electron_linux_riscv64.sh b/build/linux/riscv64/electron.sh similarity index 100% rename from electron_linux_riscv64.sh rename to build/linux/riscv64/electron.sh diff --git a/electron_linux_riscv64.sha256sums b/build/linux/riscv64/electron.sha256sums similarity index 100% rename from electron_linux_riscv64.sha256sums rename to build/linux/riscv64/electron.sha256sums diff --git a/ripgrep_linux_riscv64.sh b/build/linux/riscv64/ripgrep.sh similarity index 100% rename from ripgrep_linux_riscv64.sh rename to build/linux/riscv64/ripgrep.sh diff --git a/include_osx.gypi b/build/osx/include.gypi similarity index 100% rename from include_osx.gypi rename to build/osx/include.gypi diff --git a/package_windows.sh b/build/windows/package.sh similarity index 100% rename from package_windows.sh rename to build/windows/package.sh diff --git a/prepare_assets.sh b/build/windows/prepare_assets.sh similarity index 100% rename from prepare_assets.sh rename to build/windows/prepare_assets.sh diff --git a/build/build.ps1 b/dev/build.ps1 similarity index 89% rename from build/build.ps1 rename to dev/build.ps1 index 74c1e6167cc..b3351bc6a26 100755 --- a/build/build.ps1 +++ b/dev/build.ps1 @@ -3,4 +3,4 @@ # first so `bash` is the one installed with `git`, avoid conflict with WSL $env:Path = "C:\Program Files\Git\bin;" + $env:Path -bash ./build/build.sh +bash ./dev/build.sh diff --git a/build/build.sh b/dev/build.sh similarity index 90% rename from build/build.sh rename to dev/build.sh index 1ab707508d8..e84248da46c 100755 --- a/build/build.sh +++ b/dev/build.sh @@ -2,7 +2,7 @@ # shellcheck disable=SC1091,SC2129 ### Windows -# to run with Bash: "C:\Program Files\Git\bin\bash.exe" ./build/build.sh +# to run with Bash: "C:\Program Files\Git\bin\bash.exe" ./dev/build.sh ### export APP_NAME="VSCodium" @@ -124,7 +124,7 @@ if [[ "${SKIP_BUILD}" == "no" ]]; then echo "{}" > ~/.gyp/include.gypi.pre-vscodium fi - cp ./include_osx.gypi ~/.gyp/include.gypi + cp ./build/osx/include.gypi ~/.gyp/include.gypi fi . build.sh @@ -134,8 +134,8 @@ if [[ "${SKIP_BUILD}" == "no" ]]; then fi if [[ "${VSCODE_LATEST}" == "yes" ]]; then - jsonTmp=$( cat "${VSCODE_QUALITY}.json" | jq --arg 'tag' "${MS_TAG/\-insider/}" --arg 'commit' "${MS_COMMIT}" '. | .tag=$tag | .commit=$commit' ) - echo "${jsonTmp}" > "${VSCODE_QUALITY}.json" && unset jsonTmp + jsonTmp=$( cat "./upstream/${VSCODE_QUALITY}.json" | jq --arg 'tag' "${MS_TAG/\-insider/}" --arg 'commit' "${MS_COMMIT}" '. | .tag=$tag | .commit=$commit' ) + echo "${jsonTmp}" > "./upstream/${VSCODE_QUALITY}.json" && unset jsonTmp fi fi diff --git a/build/build_docker.sh b/dev/build_docker.sh similarity index 100% rename from build/build_docker.sh rename to dev/build_docker.sh diff --git a/patch.sh b/dev/patch.sh similarity index 100% rename from patch.sh rename to dev/patch.sh diff --git a/build/update_api.sh b/dev/update_api.sh similarity index 100% rename from build/update_api.sh rename to dev/update_api.sh diff --git a/build/update_patches.sh b/dev/update_patches.sh similarity index 100% rename from build/update_patches.sh rename to dev/update_patches.sh diff --git a/docs/howto-build.md b/docs/howto-build.md index 07d25a75a82..55b49499448 100644 --- a/docs/howto-build.md +++ b/docs/howto-build.md @@ -51,21 +51,21 @@ see [the common dependencies](#dependencies) ## Build Scripts -A build helper script can be found at `build/build.sh`. +A build helper script can be found at `dev/build.sh`. -- Linux: `./build/build.sh` -- MacOS: `./build/build.sh` -- Windows: `powershell -ExecutionPolicy ByPass -File .\build\build.ps1` or `"C:\Program Files\Git\bin\bash.exe" ./build/build.sh` +- Linux: `./dev/build.sh` +- MacOS: `./dev/build.sh` +- Windows: `powershell -ExecutionPolicy ByPass -File .\dev\build.ps1` or `"C:\Program Files\Git\bin\bash.exe" ./dev/build.sh` ### Insider -The `insider` version can be built with `./build/build.sh -i` on the `insider` branch. +The `insider` version can be built with `./dev/build.sh -i` on the `insider` branch. -You can try the latest version with the command `./build/build.sh -il` but the patches might not be up to date. +You can try the latest version with the command `./dev/build.sh -il` but the patches might not be up to date. ### Flags -The script `build/build.sh` provides several flags: +The script `dev/build.sh` provides several flags: - `-i`: build the Insiders version - `-l`: build with latest version of Visual Studio Code @@ -93,8 +93,8 @@ review-tools.snap-review --allow-classic codium*.snap ## Semi-Automated -- run `./build/build_.sh`, if a patch is failing then, -- run `./build/update_patches.sh` +- run `./dev/build.sh`, if a patch is failing then, +- run `./dev/update_patches.sh` - when the script pauses at `Press any key when the conflict have been resolved...`, open `vscode` directory in **VSCodium** - fix all the `*.rej` files - run `yarn watch` @@ -103,7 +103,7 @@ review-tools.snap-review --allow-classic codium*.snap ## Manual -- run `./build/build_.sh`, if a patch is failing then, +- run `./dev/build.sh`, if a patch is failing then, - open `vscode` directory in **VSCodium** - revert all changes - run `git apply --reject ../patches/.patch` diff --git a/get_repo.sh b/get_repo.sh index e600bc59daa..37a424aef32 100755 --- a/get_repo.sh +++ b/get_repo.sh @@ -9,13 +9,13 @@ if [[ "${CI_BUILD}" != "no" ]]; then fi if [[ -z "${RELEASE_VERSION}" ]]; then - if [[ "${VSCODE_LATEST}" == "yes" ]] || [[ ! -f "${VSCODE_QUALITY}.json" ]]; then + if [[ "${VSCODE_LATEST}" == "yes" ]] || [[ ! -f "./upstream/${VSCODE_QUALITY}.json" ]]; then echo "Retrieve lastest version" UPDATE_INFO=$( curl --silent --fail "https://update.code.visualstudio.com/api/update/darwin/${VSCODE_QUALITY}/0000000000000000000000000000000000000000" ) else echo "Get version from ${VSCODE_QUALITY}.json" - MS_COMMIT=$( jq -r '.commit' "${VSCODE_QUALITY}.json" ) - MS_TAG=$( jq -r '.tag' "${VSCODE_QUALITY}.json" ) + MS_COMMIT=$( jq -r '.commit' "./upstream/${VSCODE_QUALITY}.json" ) + MS_TAG=$( jq -r '.tag' "./upstream/${VSCODE_QUALITY}.json" ) fi if [[ -z "${MS_COMMIT}" ]]; then @@ -53,8 +53,8 @@ else fi fi - if [[ "${MS_TAG}" == "$( jq -r '.tag' "${VSCODE_QUALITY}".json )" ]]; then - MS_COMMIT=$( jq -r '.commit' "${VSCODE_QUALITY}".json ) + if [[ "${MS_TAG}" == "$( jq -r '.tag' "./upstream/${VSCODE_QUALITY}.json" )" ]]; then + MS_COMMIT=$( jq -r '.commit' "./upstream/${VSCODE_QUALITY}.json" ) else echo "Error: No MS_COMMIT for ${RELEASE_VERSION}" exit 1 diff --git a/update_qualityjson.sh b/update_upstream.sh similarity index 79% rename from update_qualityjson.sh rename to update_upstream.sh index b948cf9aa2e..eceff8b1130 100755 --- a/update_qualityjson.sh +++ b/update_upstream.sh @@ -12,8 +12,8 @@ if [[ -z "${GH_TOKEN}" ]] && [[ -z "${GITHUB_TOKEN}" ]] && [[ -z "${GH_ENTERPRIS exit 0 fi -jsonTmp=$( cat "${VSCODE_QUALITY}.json" | jq --arg 'tag' "${MS_TAG/\-insider/}" --arg 'commit' "${MS_COMMIT}" '. | .tag=$tag | .commit=$commit' ) -echo "${jsonTmp}" > "${VSCODE_QUALITY}.json" && unset jsonTmp +jsonTmp=$( cat "./upstream/${VSCODE_QUALITY}.json" | jq --arg 'tag' "${MS_TAG/\-insider/}" --arg 'commit' "${MS_COMMIT}" '. | .tag=$tag | .commit=$commit' ) +echo "${jsonTmp}" > "./upstream/${VSCODE_QUALITY}.json" && unset jsonTmp git config user.email "$( echo "${GITHUB_USERNAME}" | awk '{print tolower($0)}' )-ci@not-real.com" git config user.name "${GITHUB_USERNAME} CI" diff --git a/insider.json b/upstream/insider.json similarity index 100% rename from insider.json rename to upstream/insider.json diff --git a/stable.json b/upstream/stable.json similarity index 100% rename from stable.json rename to upstream/stable.json