Skip to content

Commit

Permalink
cli: cleanup build
Browse files Browse the repository at this point in the history
- Remove the `prepare` script entirely
- Variables are now populated from the product.json during build. Most
  variables are mapped automatically, with some special handling in a
	few cases. `build.rs` is now much more self-contained.
- Look for the `product.overrides.json` for vscode developers instead of
  looking for a peer `vscode-distro` folder

Fixes #178691
  • Loading branch information
connor4312 committed Aug 9, 2023
1 parent 1094b5d commit 1b3791e
Show file tree
Hide file tree
Showing 14 changed files with 218 additions and 424 deletions.
9 changes: 2 additions & 7 deletions build/azure-pipelines/alpine/cli-build-alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,6 @@ steps:
sudo ln -s "/usr/bin/g++" "/usr/bin/musl-g++" || echo "link exists"
displayName: Install musl build dependencies
- script: node build/azure-pipelines/cli/prepare.js
displayName: Prepare CLI build
env:
VSCODE_CLI_PREPARE_ROOT: $(Build.SourcesDirectory)/.build/distro
VSCODE_QUALITY: ${{ parameters.VSCODE_QUALITY }}
GITHUB_TOKEN: "$(github-distro-mixin-password)"

- template: ../cli/install-rust-posix.yml
parameters:
targets:
Expand All @@ -76,6 +69,7 @@ steps:
parameters:
VSCODE_CLI_TARGET: aarch64-unknown-linux-musl
VSCODE_CLI_ARTIFACT: vscode_cli_alpine_arm64_cli
VSCODE_QUALITY: ${{ parameters.VSCODE_QUALITY }}
VSCODE_CLI_ENV:
CXX_aarch64-unknown-linux-musl: musl-g++
CC_aarch64-unknown-linux-musl: musl-gcc
Expand All @@ -88,6 +82,7 @@ steps:
parameters:
VSCODE_CLI_TARGET: x86_64-unknown-linux-musl
VSCODE_CLI_ARTIFACT: vscode_cli_alpine_x64_cli
VSCODE_QUALITY: ${{ parameters.VSCODE_QUALITY }}
VSCODE_CLI_ENV:
CXX_aarch64-unknown-linux-musl: musl-g++
CC_aarch64-unknown-linux-musl: musl-gcc
Expand Down
19 changes: 18 additions & 1 deletion build/azure-pipelines/cli/cli-compile-and-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
parameters:
- name: VSCODE_QUALITY
type: string
- name: VSCODE_CLI_TARGET
type: string
- name: VSCODE_CLI_ARTIFACT
Expand All @@ -11,6 +13,13 @@ parameters:
default: false

steps:
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
- script: echo "##vso[task.setvariable variable=VSCODE_CLI_PRODUCT_JSON]$(Build.SourcesDirectory)/product.json"
displayName: Set product.json path
- ${{ else }}:
- script: echo "##vso[task.setvariable variable=VSCODE_CLI_PRODUCT_JSON]$(Build.SourcesDirectory)/.build/distro/mixin/${{ parameters.VSCODE_QUALITY }}/product.json"
displayName: Set product.json path

- ${{ if parameters.VSCODE_CHECK_ONLY }}:
- script: rustup component add clippy && cargo clippy --target ${{ parameters.VSCODE_CLI_TARGET }} --bin=code
displayName: Lint ${{ parameters.VSCODE_CLI_TARGET }}
Expand All @@ -33,6 +42,11 @@ steps:
- powershell: |
. build/azure-pipelines/win32/exec.ps1
$ErrorActionPreference = "Stop"
$AppProductJson = Get-Content -Raw -Path "$env:VSCODE_CLI_PRODUCT_JSON" | ConvertFrom-Json
$env:VSCODE_CLI_APPLICATION_NAME = $AppProductJson.tunnelApplicationName
Write-Host "##vso[task.setvariable variable=VSCODE_CLI_APPLICATION_NAME]$env:VSCODE_CLI_APPLICATION_NAME"
Move-Item -Path $(Build.SourcesDirectory)/cli/target/${{ parameters.VSCODE_CLI_TARGET }}/release/code.exe -Destination "$(Build.ArtifactStagingDirectory)/${env:VSCODE_CLI_APPLICATION_NAME}.exe"
- task: ArchiveFiles@2
Expand All @@ -49,7 +63,10 @@ steps:
- ${{ else }}:
- script: |
set -e
mv $(Build.SourcesDirectory)/cli/target/${{ parameters.VSCODE_CLI_TARGET }}/release/code $(Build.ArtifactStagingDirectory)/$(VSCODE_CLI_APPLICATION_NAME)
VSCODE_CLI_APPLICATION_NAME=$(node -p "require(\"$VSCODE_CLI_PRODUCT_JSON\").applicationName")
echo "##vso[task.setvariable variable=VSCODE_CLI_APPLICATION_NAME]$VSCODE_CLI_APPLICATION_NAME"
mv $(Build.SourcesDirectory)/cli/target/${{ parameters.VSCODE_CLI_TARGET }}/release/code $(Build.ArtifactStagingDirectory)/$VSCODE_CLI_APPLICATION_NAME
- ${{ if contains(parameters.VSCODE_CLI_TARGET, '-darwin') }}:
- task: ArchiveFiles@2
Expand Down
93 changes: 0 additions & 93 deletions build/azure-pipelines/cli/prepare.js

This file was deleted.

99 changes: 0 additions & 99 deletions build/azure-pipelines/cli/prepare.ts

This file was deleted.

9 changes: 2 additions & 7 deletions build/azure-pipelines/darwin/cli-build-darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ steps:
tar -xvzf $(Build.ArtifactStagingDirectory)/vscode-internal-openssl-prebuilt-0.0.8.tgz --strip-components=1 --directory=$(Build.ArtifactStagingDirectory)/openssl
displayName: Extract openssl prebuilt
- script: node build/azure-pipelines/cli/prepare.js
displayName: Prepare CLI build
env:
VSCODE_CLI_PREPARE_ROOT: $(Build.SourcesDirectory)/.build/distro
VSCODE_QUALITY: ${{ parameters.VSCODE_QUALITY }}
GITHUB_TOKEN: "$(github-distro-mixin-password)"

- template: ../cli/install-rust-posix.yml
parameters:
targets:
Expand All @@ -52,6 +45,7 @@ steps:
- ${{ if eq(parameters.VSCODE_BUILD_MACOS, true) }}:
- template: ../cli/cli-compile-and-publish.yml
parameters:
VSCODE_QUALITY: ${{ parameters.VSCODE_QUALITY }}
VSCODE_CLI_TARGET: x86_64-apple-darwin
VSCODE_CLI_ARTIFACT: unsigned_vscode_cli_darwin_x64_cli
VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }}
Expand All @@ -62,6 +56,7 @@ steps:
- ${{ if eq(parameters.VSCODE_BUILD_MACOS_ARM64, true) }}:
- template: ../cli/cli-compile-and-publish.yml
parameters:
VSCODE_QUALITY: ${{ parameters.VSCODE_QUALITY }}
VSCODE_CLI_TARGET: aarch64-apple-darwin
VSCODE_CLI_ARTIFACT: unsigned_vscode_cli_darwin_arm64_cli
VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }}
Expand Down
10 changes: 3 additions & 7 deletions build/azure-pipelines/linux/cli-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@ steps:
- bash: sudo apt-get install -yq gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
displayName: Install arm64 toolchains

- script: node build/azure-pipelines/cli/prepare.js
displayName: Prepare CLI build
env:
VSCODE_CLI_PREPARE_ROOT: $(Build.SourcesDirectory)/.build/distro
VSCODE_QUALITY: ${{ parameters.VSCODE_QUALITY }}
GITHUB_TOKEN: "$(github-distro-mixin-password)"

- template: ../cli/install-rust-posix.yml
parameters:
targets:
Expand All @@ -65,6 +58,7 @@ steps:
- ${{ if eq(parameters.VSCODE_BUILD_LINUX_ARM64, true) }}:
- template: ../cli/cli-compile-and-publish.yml
parameters:
VSCODE_QUALITY: ${{ parameters.VSCODE_QUALITY }}
VSCODE_CLI_TARGET: aarch64-unknown-linux-gnu
VSCODE_CLI_ARTIFACT: vscode_cli_linux_arm64_cli
VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }}
Expand All @@ -76,6 +70,7 @@ steps:
- ${{ if eq(parameters.VSCODE_BUILD_LINUX, true) }}:
- template: ../cli/cli-compile-and-publish.yml
parameters:
VSCODE_QUALITY: ${{ parameters.VSCODE_QUALITY }}
VSCODE_CLI_TARGET: x86_64-unknown-linux-gnu
VSCODE_CLI_ARTIFACT: vscode_cli_linux_x64_cli
VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }}
Expand All @@ -86,6 +81,7 @@ steps:
- ${{ if eq(parameters.VSCODE_BUILD_LINUX_ARMHF, true) }}:
- template: ../cli/cli-compile-and-publish.yml
parameters:
VSCODE_QUALITY: ${{ parameters.VSCODE_QUALITY }}
VSCODE_CLI_TARGET: armv7-unknown-linux-gnueabihf
VSCODE_CLI_ARTIFACT: vscode_cli_linux_armhf_cli
VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }}
Expand Down
Loading

0 comments on commit 1b3791e

Please sign in to comment.