forked from microsoft/vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request microsoft#161640 from microsoft/build-integrated-cli
Update build process to include integrated CLI
- Loading branch information
Showing
85 changed files
with
7,441 additions
and
6,527 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
parameters: | ||
- name: VSCODE_CLI_TARGET | ||
type: string | ||
- name: VSCODE_CLI_ARTIFACT | ||
type: string | ||
- name: VSCODE_CLI_ENV | ||
type: object | ||
default: {} | ||
|
||
steps: | ||
- script: cargo build --release --target ${{ parameters.VSCODE_CLI_TARGET }} --bin=code-tunnel | ||
displayName: Compile ${{ parameters.VSCODE_CLI_TARGET }} | ||
workingDirectory: $(Build.SourcesDirectory)/cli | ||
env: | ||
VSCODE_CLI_VERSION: $(VSCODE_CLI_VERSION) | ||
VSCODE_CLI_REMOTE_LICENSE_TEXT: $(VSCODE_CLI_REMOTE_LICENSE_TEXT) | ||
VSCODE_CLI_REMOTE_LICENSE_PROMPT: $(VSCODE_CLI_REMOTE_LICENSE_PROMPT) | ||
VSCODE_CLI_ASSET_NAME: ${{ parameters.VSCODE_CLI_ARTIFACT }} | ||
VSCODE_CLI_AI_KEY: $(VSCODE_CLI_AI_KEY) | ||
VSCODE_CLI_AI_ENDPOINT: $(VSCODE_CLI_AI_ENDPOINT) | ||
${{ each pair in parameters.VSCODE_CLI_ENV }}: | ||
${{ pair.key }}: ${{ pair.value }} | ||
|
||
- ${{ if or(contains(parameters.VSCODE_CLI_TARGET, '-windows-'), contains(parameters.VSCODE_CLI_TARGET, '-darwin')) }}: | ||
- task: ArchiveFiles@2 | ||
inputs: | ||
${{ if contains(parameters.VSCODE_CLI_TARGET, '-windows-') }}: | ||
rootFolderOrFile: $(Build.SourcesDirectory)/cli/target/${{ parameters.VSCODE_CLI_TARGET }}/release/code-tunnel.exe | ||
${{ if contains(parameters.VSCODE_CLI_TARGET, '-darwin') }}: | ||
rootFolderOrFile: $(Build.SourcesDirectory)/cli/target/${{ parameters.VSCODE_CLI_TARGET }}/release/code-tunnel | ||
includeRootFolder: false | ||
archiveType: zip | ||
archiveFile: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.zip | ||
|
||
- publish: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.zip | ||
artifact: ${{ parameters.VSCODE_CLI_ARTIFACT }} | ||
displayName: Publish ${{ parameters.VSCODE_CLI_ARTIFACT }} artifact | ||
|
||
- ${{ else }}: | ||
- task: ArchiveFiles@2 | ||
inputs: | ||
rootFolderOrFile: $(Build.SourcesDirectory)/cli/target/${{ parameters.VSCODE_CLI_TARGET }}/release/code-tunnel | ||
includeRootFolder: false | ||
archiveType: tar | ||
tarCompression: gz | ||
archiveFile: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.tar.gz | ||
|
||
- publish: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.tar.gz | ||
artifact: ${{ parameters.VSCODE_CLI_ARTIFACT }} | ||
displayName: Publish ${{ parameters.VSCODE_CLI_ARTIFACT }} artifact |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
parameters: | ||
- name: VSCODE_CLI_ARTIFACTS | ||
type: object | ||
default: [] | ||
|
||
steps: | ||
- task: UseDotNet@2 | ||
inputs: | ||
version: 2.x | ||
|
||
- task: EsrpClientTool@1 | ||
displayName: Download ESRPClient | ||
|
||
- ${{ each target in parameters.VSCODE_CLI_ARTIFACTS }}: | ||
- task: DownloadPipelineArtifact@2 | ||
displayName: Download ${{ target }} | ||
inputs: | ||
artifact: ${{ target }} | ||
path: $(Build.ArtifactStagingDirectory)/pkg/${{ target }} | ||
|
||
- script: | | ||
set -e | ||
node build/azure-pipelines/common/sign "$(esrpclient.toolpath)/$(esrpclient.toolname)" darwin-sign $(ESRP-PKI) $(esrp-aad-username) $(esrp-aad-password) $(Build.ArtifactStagingDirectory)/pkg "*.zip" | ||
displayName: Codesign | ||
- script: | | ||
set -e | ||
node build/azure-pipelines/common/sign "$(esrpclient.toolpath)/$(esrpclient.toolname)" darwin-notarize $(ESRP-PKI) $(esrp-aad-username) $(esrp-aad-password) $(Build.ArtifactStagingDirectory)/pkg "*.zip" | ||
displayName: Notarize | ||
- ${{ each target in parameters.VSCODE_CLI_ARTIFACTS }}: | ||
- script: | | ||
set -e | ||
ASSET_ID=$(echo "${{ target }}" | sed "s/unsigned_//") | ||
mv $(Build.ArtifactStagingDirectory)/pkg/${{ target }}/${{ target }}.zip $(Build.ArtifactStagingDirectory)/pkg/${{ target }}/$ASSET_ID.zip | ||
echo "##vso[task.setvariable variable=ASSET_ID]$ASSET_ID" | ||
displayName: Set asset id variable | ||
- publish: $(Build.ArtifactStagingDirectory)/pkg/${{ target }}/$(ASSET_ID).zip | ||
artifact: $(ASSET_ID) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
parameters: | ||
- name: VSCODE_CLI_ARTIFACTS | ||
type: object | ||
default: [] | ||
|
||
steps: | ||
- task: AzureKeyVault@1 | ||
displayName: "Azure Key Vault: Get Secrets" | ||
inputs: | ||
azureSubscription: "vscode-builds-subscription" | ||
KeyVaultName: vscode | ||
SecretsFilter: "ESRP-PKI,esrp-aad-username,esrp-aad-password" | ||
|
||
- task: UseDotNet@2 | ||
displayName: "Use .NET" | ||
inputs: | ||
version: 3.x | ||
|
||
- task: EsrpClientTool@1 | ||
displayName: "Use ESRP client" | ||
|
||
- ${{ each target in parameters.VSCODE_CLI_ARTIFACTS }}: | ||
- task: DownloadPipelineArtifact@2 | ||
displayName: Download artifacts | ||
inputs: | ||
artifact: ${{ target }} | ||
path: $(Build.ArtifactStagingDirectory)/pkg/${{ target }} | ||
|
||
- task: ExtractFiles@1 | ||
inputs: | ||
archiveFilePatterns: $(Build.ArtifactStagingDirectory)/pkg/${{ target }}/*.zip | ||
destinationFolder: $(Build.ArtifactStagingDirectory)/sign/${{ target }} | ||
|
||
- powershell: | | ||
. build/azure-pipelines/win32/exec.ps1 | ||
$ErrorActionPreference = "Stop" | ||
$EsrpClientTool = (gci -directory -filter EsrpClientTool_* $(Agent.RootDirectory)\_tasks | Select-Object -last 1).FullName | ||
$EsrpCliZip = (gci -recurse -filter esrpcli.*.zip $EsrpClientTool | Select-Object -last 1).FullName | ||
mkdir -p $(Agent.TempDirectory)\esrpcli | ||
Expand-Archive -Path $EsrpCliZip -DestinationPath $(Agent.TempDirectory)\esrpcli | ||
$EsrpCliDllPath = (gci -recurse -filter esrpcli.dll $(Agent.TempDirectory)\esrpcli | Select-Object -last 1).FullName | ||
echo "##vso[task.setvariable variable=EsrpCliDllPath]$EsrpCliDllPath" | ||
displayName: Find ESRP CLI | ||
- powershell: | | ||
. build/azure-pipelines/win32/exec.ps1 | ||
$ErrorActionPreference = "Stop" | ||
exec { node build\azure-pipelines\common\sign $env:EsrpCliDllPath windows $(ESRP-PKI) $(esrp-aad-username) $(esrp-aad-password) $(Build.ArtifactStagingDirectory)/sign "*.exe" } | ||
displayName: "Code sign" | ||
- ${{ each target in parameters.VSCODE_CLI_ARTIFACTS }}: | ||
- powershell: | | ||
$ASSET_ID = "${{ target }}".replace("unsigned_", ""); | ||
echo "##vso[task.setvariable variable=ASSET_ID]$ASSET_ID" | ||
displayName: Set asset id variable | ||
- task: ArchiveFiles@2 | ||
inputs: | ||
rootFolderOrFile: $(Build.ArtifactStagingDirectory)/sign/${{ target }}/code-tunnel.exe | ||
includeRootFolder: false | ||
archiveType: zip | ||
archiveFile: $(Build.ArtifactStagingDirectory)/$(ASSET_ID).zip | ||
|
||
- publish: $(Build.ArtifactStagingDirectory)/$(ASSET_ID).zip | ||
artifact: $(ASSET_ID) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
parameters: | ||
- name: channel | ||
type: string | ||
default: stable | ||
- name: targets | ||
default: [] | ||
type: object | ||
|
||
# Todo: use 1ES pipeline once extension is installed in ADO | ||
|
||
steps: | ||
- script: | | ||
set -e | ||
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain $RUSTUP_TOOLCHAIN | ||
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" | ||
env: | ||
RUSTUP_TOOLCHAIN: ${{ parameters.channel }} | ||
displayName: "Install Rust" | ||
- script: | | ||
set -e | ||
rustup default $RUSTUP_TOOLCHAIN | ||
rustup update $RUSTUP_TOOLCHAIN | ||
env: | ||
RUSTUP_TOOLCHAIN: ${{ parameters.channel }} | ||
displayName: "Set Rust version" | ||
- ${{ each target in parameters.targets }}: | ||
- script: rustup target add ${{ target }} | ||
displayName: "Adding Rust target '${{ target }}'" | ||
|
||
- script: | | ||
set -e | ||
rustc --version | ||
cargo --version | ||
rustup --version | ||
displayName: "Check Rust versions" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
parameters: | ||
- name: channel | ||
type: string | ||
default: stable | ||
- name: targets | ||
default: [] | ||
type: object | ||
|
||
# Todo: use 1ES pipeline once extension is installed in ADO | ||
|
||
steps: | ||
- powershell: | | ||
. build/azure-pipelines/win32/exec.ps1 | ||
exec { curl -sSf -o rustup-init.exe https://win.rustup.rs } | ||
exec { rustup-init.exe -y --profile minimal --default-toolchain %RUSTUP_TOOLCHAIN% --default-host x86_64-pc-windows-msvc } | ||
echo "##vso[task.prependpath]$env:USERPROFILE\.cargo\bin" | ||
env: | ||
RUSTUP_TOOLCHAIN: ${{ parameters.channel }} | ||
displayName: "Install Rust" | ||
- powershell: | | ||
. build/azure-pipelines/win32/exec.ps1 | ||
exec { rustup default $RUSTUP_TOOLCHAIN } | ||
exec { rustup update $RUSTUP_TOOLCHAIN } | ||
env: | ||
RUSTUP_TOOLCHAIN: ${{ parameters.channel }} | ||
displayName: "Set Rust version" | ||
- ${{ each target in parameters.targets }}: | ||
- script: rustup target add ${{ target }} | ||
displayName: "Adding Rust target '${{ target }}'" | ||
|
||
- powershell: | | ||
. build/azure-pipelines/win32/exec.ps1 | ||
exec { rustc --version } | ||
exec { cargo --version } | ||
exec { rustup --version } | ||
displayName: "Check Rust versions" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"use strict"; | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const getVersion_1 = require("../../lib/getVersion"); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const packageJson = require("../../../package.json"); | ||
const root = path.dirname(path.dirname(path.dirname(__dirname))); | ||
const product = JSON.parse(fs.readFileSync(path.join(root, 'product.json'), 'utf8')); | ||
const commit = (0, getVersion_1.getVersion)(root); | ||
/** | ||
* Sets build environment variables for the CLI for current contextual info. | ||
*/ | ||
const setLauncherEnvironmentVars = () => { | ||
const vars = new Map([ | ||
['VSCODE_CLI_REMOTE_LICENSE_TEXT', product.serverLicense], | ||
['VSCODE_CLI_REMOTE_LICENSE_PROMPT', product.serverLicensePrompt], | ||
['VSCODE_CLI_VERSION', packageJson.version], | ||
['VSCODE_CLI_COMMIT', commit], | ||
]); | ||
for (const [key, value] of vars) { | ||
if (value) { | ||
console.log(`##vso[task.setvariable variable=${key}]${value}`); | ||
} | ||
} | ||
}; | ||
if (require.main === module) { | ||
setLauncherEnvironmentVars(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { getVersion } from '../../lib/getVersion'; | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
import * as packageJson from '../../../package.json'; | ||
|
||
const root = path.dirname(path.dirname(path.dirname(__dirname))); | ||
const product = JSON.parse(fs.readFileSync(path.join(root, 'product.json'), 'utf8')); | ||
const commit = getVersion(root); | ||
|
||
/** | ||
* Sets build environment variables for the CLI for current contextual info. | ||
*/ | ||
const setLauncherEnvironmentVars = () => { | ||
const vars = new Map([ | ||
['VSCODE_CLI_REMOTE_LICENSE_TEXT', product.serverLicense], | ||
['VSCODE_CLI_REMOTE_LICENSE_PROMPT', product.serverLicensePrompt], | ||
['VSCODE_CLI_VERSION', packageJson.version], | ||
['VSCODE_CLI_COMMIT', commit], | ||
]); | ||
|
||
for (const [key, value] of vars) { | ||
if (value) { | ||
console.log(`##vso[task.setvariable variable=${key}]${value}`); | ||
} | ||
} | ||
}; | ||
|
||
if (require.main === module) { | ||
setLauncherEnvironmentVars(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
parameters: | ||
- name: VSCODE_CLI_TARGETS | ||
default: [] | ||
type: object | ||
- name: VSCODE_CLI_RUST_CHANNEL | ||
type: string | ||
default: stable | ||
|
||
steps: | ||
- template: ./install-rust.yml | ||
parameters: | ||
targets: [] | ||
channel: ${{ parameters.VSCODE_CLI_RUST_CHANNEL }} | ||
|
||
- script: rustup component add clippy && cargo clippy -- -D warnings | ||
workingDirectory: cli | ||
displayName: Clippy lint | ||
|
||
- script: cargo test | ||
workingDirectory: cli | ||
displayName: Run unit tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
vcpkg_installed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "vscode-cli", | ||
"dependencies": [ | ||
{ | ||
"name": "openssl" | ||
} | ||
], | ||
"builtin-baseline": "23cc58477e200bb54c293ad76f3ce438dbabc86c" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.