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 10, 2023
1 parent 1094b5d commit 1623060
Show file tree
Hide file tree
Showing 16 changed files with 242 additions and 429 deletions.
14 changes: 3 additions & 11 deletions build/azure-pipelines/alpine/cli-build-alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ steps:
versionSpec: "18.x"

- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
- template: ../distro/download-distro.yml

# Install yarn as the ARM64 build agent is using vanilla Ubuntu
- ${{ if eq(parameters.VSCODE_BUILD_ALPINE_ARM64, true) }}:
- task: Npm@1
Expand All @@ -30,8 +28,7 @@ steps:
workingDirectory: build
displayName: Install pipeline build
- script: node .build/distro/cli-patches/index.js
displayName: Apply distro patches
- template: ../cli/cli-apply-patches.yml

- task: Npm@1
displayName: Download openssl prebuilt
Expand All @@ -56,13 +53,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 +66,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 +79,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
3 changes: 3 additions & 0 deletions build/azure-pipelines/cli/cli-apply-patches.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
steps:
- template: ../distro/download-distro.yml

- script: node build/azure-pipelines/distro/mixin-quality
displayName: Mixin distro quality

- script: node .build/distro/cli-patches/index.js
displayName: Apply distro patches
20 changes: 19 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') }}:
- pwsh: Write-Host "##vso[task.setvariable variable=VSCODE_CLI_PRODUCT_JSON]$(Build.SourcesDirectory)/product.json"
displayName: Set product.json path
- ${{ else }}:
- pwsh: Write-Host "##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 @@ -26,13 +35,19 @@ steps:
workingDirectory: $(Build.SourcesDirectory)/cli
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
VSCODE_CLI_COMMIT: $(Build.SourceVersion)
${{ each pair in parameters.VSCODE_CLI_ENV }}:
${{ pair.key }}: ${{ pair.value }}

- ${{ if contains(parameters.VSCODE_CLI_TARGET, '-windows-') }}:
- 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.applicationName
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 +64,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
Loading

0 comments on commit 1623060

Please sign in to comment.