mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
This reverts commit 6bd0a17d3c.
This commit is contained in:
@@ -1 +1 @@
|
||||
2022-07-19T07:55:26.168Z
|
||||
2022-10-06T02:27:18.022Z
|
||||
|
||||
1
build/.gitignore
vendored
1
build/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
.yarnrc
|
||||
@@ -139,14 +139,6 @@ vscode-encrypt/binding.gyp
|
||||
vscode-encrypt/README.md
|
||||
!vscode-encrypt/build/Release/vscode-encrypt-native.node
|
||||
|
||||
vscode-policy-watcher/build/**
|
||||
vscode-policy-watcher/.husky/**
|
||||
vscode-policy-watcher/src/**
|
||||
vscode-policy-watcher/binding.gyp
|
||||
vscode-policy-watcher/README.md
|
||||
vscode-policy-watcher/index.d.ts
|
||||
!vscode-policy-watcher/build/Release/vscode-policy-watcher.node
|
||||
|
||||
vscode-windows-ca-certs/**/*
|
||||
!vscode-windows-ca-certs/package.json
|
||||
!vscode-windows-ca-certs/**/*.node
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
@@ -14,7 +14,7 @@ shasum.update(fs.readFileSync(path.join(ROOT, 'build/.cachesalt')));
|
||||
shasum.update(fs.readFileSync(path.join(ROOT, '.yarnrc')));
|
||||
shasum.update(fs.readFileSync(path.join(ROOT, 'remote/.yarnrc')));
|
||||
// Add `package.json` and `yarn.lock` files
|
||||
for (const dir of dirs) {
|
||||
for (let dir of dirs) {
|
||||
const packageJsonPath = path.join(ROOT, dir, 'package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath).toString());
|
||||
const relevantPackageJsonSections = {
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as crypto from 'crypto';
|
||||
@@ -17,7 +19,7 @@ shasum.update(fs.readFileSync(path.join(ROOT, '.yarnrc')));
|
||||
shasum.update(fs.readFileSync(path.join(ROOT, 'remote/.yarnrc')));
|
||||
|
||||
// Add `package.json` and `yarn.lock` files
|
||||
for (const dir of dirs) {
|
||||
for (let dir of dirs) {
|
||||
const packageJsonPath = path.join(ROOT, dir, 'package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath).toString());
|
||||
const relevantPackageJsonSections = {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = require("fs");
|
||||
const crypto = require("crypto");
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as fs from 'fs';
|
||||
import { Readable } from 'stream';
|
||||
import * as crypto from 'crypto';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const identity_1 = require("@azure/identity");
|
||||
const cosmos_1 = require("@azure/cosmos");
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { ClientSecretCredential } from '@azure/identity';
|
||||
import { CosmosClient } from '@azure/cosmos';
|
||||
import { retry } from './retry';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const identity_1 = require("@azure/identity");
|
||||
const cosmos_1 = require("@azure/cosmos");
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { ClientSecretCredential } from '@azure/identity';
|
||||
import { CosmosClient } from '@azure/cosmos';
|
||||
import { retry } from './retry';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.retry = void 0;
|
||||
async function retry(fn) {
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
export async function retry<T>(fn: () => Promise<T>): Promise<T> {
|
||||
let lastError: Error | undefined;
|
||||
|
||||
|
||||
@@ -35,66 +35,25 @@ steps:
|
||||
git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro")
|
||||
displayName: Merge distro
|
||||
|
||||
- script: |
|
||||
mkdir -p .build
|
||||
node build/azure-pipelines/common/computeNodeModulesCacheKey.js x64 $ENABLE_TERRAPIN > .build/yarnlockhash
|
||||
displayName: Prepare yarn cache flags
|
||||
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: "nodeModules | $(Agent.OS) | .build/yarnlockhash"
|
||||
path: .build/node_modules_cache
|
||||
cacheHitVar: NODE_MODULES_RESTORED
|
||||
displayName: Restore node_modules cache
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
tar -xzf .build/node_modules_cache/cache.tgz
|
||||
displayName: Extract node_modules cache
|
||||
condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
npm install -g node-gyp@latest
|
||||
node-gyp --version
|
||||
displayName: Update node-gyp
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
npx https://aka.ms/enablesecurefeed standAlone
|
||||
timeoutInMinutes: 5
|
||||
retryCountOnTaskFailure: 3
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), eq(variables['ENABLE_TERRAPIN'], 'true'))
|
||||
condition: and(succeeded(), eq(variables['ENABLE_TERRAPIN'], 'true'))
|
||||
displayName: Switch to Terrapin packages
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
export npm_config_arch=$(VSCODE_ARCH)
|
||||
export npm_config_node_gyp=$(which node-gyp)
|
||||
|
||||
for i in {1..3}; do # try 3 times, for Terrapin
|
||||
yarn --frozen-lockfile --check-files && break
|
||||
yarn --cwd build --frozen-lockfile --check-files && break
|
||||
if [ $i -eq 3 ]; then
|
||||
echo "Yarn failed too many times" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Yarn failed $i, trying again..."
|
||||
done
|
||||
env:
|
||||
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||
GITHUB_TOKEN: "$(github-distro-mixin-password)"
|
||||
displayName: Install dependencies
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt
|
||||
mkdir -p .build/node_modules_cache
|
||||
tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
displayName: Create node_modules archive
|
||||
displayName: Install build dependencies
|
||||
|
||||
- download: current
|
||||
artifact: unsigned_vscode_client_darwin_$(VSCODE_ARCH)_archive
|
||||
|
||||
@@ -1,213 +1,270 @@
|
||||
parameters:
|
||||
- name: VSCODE_QUALITY
|
||||
type: string
|
||||
- name: VSCODE_RUN_UNIT_TESTS
|
||||
type: boolean
|
||||
- name: VSCODE_RUN_INTEGRATION_TESTS
|
||||
type: boolean
|
||||
- name: VSCODE_RUN_SMOKE_TESTS
|
||||
type: boolean
|
||||
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "16.x"
|
||||
|
||||
- task: AzureKeyVault@1
|
||||
displayName: "Azure Key Vault: Get Secrets"
|
||||
inputs:
|
||||
azureSubscription: "vscode-builds-subscription"
|
||||
KeyVaultName: vscode
|
||||
SecretsFilter: "github-distro-mixin-password,macos-developer-certificate,macos-developer-certificate-key"
|
||||
|
||||
- task: DownloadPipelineArtifact@2
|
||||
inputs:
|
||||
artifact: Compilation
|
||||
path: $(Build.ArtifactStagingDirectory)
|
||||
displayName: Download compilation output
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
tar -xzf $(Build.ArtifactStagingDirectory)/compilation.tar.gz
|
||||
displayName: Extract compilation output
|
||||
|
||||
# Set up the credentials to retrieve distro repo and setup git persona
|
||||
# to create a merge commit for when we merge distro into oss
|
||||
- script: |
|
||||
set -e
|
||||
cat << EOF > ~/.netrc
|
||||
machine github.com
|
||||
login vscode
|
||||
password $(github-distro-mixin-password)
|
||||
EOF
|
||||
|
||||
git config user.email "vscode@microsoft.com"
|
||||
git config user.name "VSCode"
|
||||
displayName: Prepare tooling
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
git fetch https://github.com/$(VSCODE_MIXIN_REPO).git $VSCODE_DISTRO_REF
|
||||
echo "##vso[task.setvariable variable=VSCODE_DISTRO_COMMIT;]$(git rev-parse FETCH_HEAD)"
|
||||
git checkout FETCH_HEAD
|
||||
condition: and(succeeded(), ne(variables.VSCODE_DISTRO_REF, ' '))
|
||||
displayName: Checkout override commit
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro")
|
||||
displayName: Merge distro
|
||||
|
||||
- script: |
|
||||
mkdir -p .build
|
||||
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $ENABLE_TERRAPIN > .build/yarnlockhash
|
||||
displayName: Prepare yarn cache flags
|
||||
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: "nodeModules | $(Agent.OS) | .build/yarnlockhash"
|
||||
path: .build/node_modules_cache
|
||||
cacheHitVar: NODE_MODULES_RESTORED
|
||||
displayName: Restore node_modules cache
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
tar -xzf .build/node_modules_cache/cache.tgz
|
||||
condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
displayName: Extract node_modules cache
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
npm install -g node-gyp@latest
|
||||
node-gyp --version
|
||||
displayName: Update node-gyp
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
npx https://aka.ms/enablesecurefeed standAlone
|
||||
timeoutInMinutes: 5
|
||||
retryCountOnTaskFailure: 3
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), eq(variables['ENABLE_TERRAPIN'], 'true'))
|
||||
displayName: Switch to Terrapin packages
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
export npm_config_arch=$(VSCODE_ARCH)
|
||||
export npm_config_node_gyp=$(which node-gyp)
|
||||
|
||||
for i in {1..3}; do # try 3 times, for Terrapin
|
||||
yarn --frozen-lockfile --check-files && break
|
||||
if [ $i -eq 3 ]; then
|
||||
echo "Yarn failed too many times" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Yarn failed $i, trying again..."
|
||||
done
|
||||
env:
|
||||
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||
GITHUB_TOKEN: "$(github-distro-mixin-password)"
|
||||
displayName: Install dependencies
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt
|
||||
mkdir -p .build/node_modules_cache
|
||||
tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
displayName: Create node_modules archive
|
||||
|
||||
# This script brings in the right resources (images, icons, etc) based on the quality (insiders, stable, exploration)
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/mixin
|
||||
displayName: Mix in quality
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn gulp vscode-darwin-$(VSCODE_ARCH)-min-ci
|
||||
displayName: Build client
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/mixin --server
|
||||
displayName: Mix in server quality
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn gulp vscode-reh-darwin-$(VSCODE_ARCH)-min-ci
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn gulp vscode-reh-web-darwin-$(VSCODE_ARCH)-min-ci
|
||||
displayName: Build Server
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn npm-run-all -lp "electron $(VSCODE_ARCH)" "playwright-install"
|
||||
displayName: Download Electron and Playwright
|
||||
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_RUN_UNIT_TESTS, true) }}:
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
./scripts/test.sh --tfs "Unit Tests"
|
||||
displayName: Run unit tests (Electron)
|
||||
timeoutInMinutes: 15
|
||||
# Setting hardened entitlements is a requirement for:
|
||||
# * Running tests on Big Sur (because Big Sur has additional security precautions)
|
||||
- script: |
|
||||
set -e
|
||||
security create-keychain -p pwd $(agent.tempdirectory)/buildagent.keychain
|
||||
security default-keychain -s $(agent.tempdirectory)/buildagent.keychain
|
||||
security unlock-keychain -p pwd $(agent.tempdirectory)/buildagent.keychain
|
||||
echo "$(macos-developer-certificate)" | base64 -D > $(agent.tempdirectory)/cert.p12
|
||||
security import $(agent.tempdirectory)/cert.p12 -k $(agent.tempdirectory)/buildagent.keychain -P "$(macos-developer-certificate-key)" -T /usr/bin/codesign
|
||||
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k pwd $(agent.tempdirectory)/buildagent.keychain
|
||||
VSCODE_ARCH=$(VSCODE_ARCH) DEBUG=electron-osx-sign* node build/darwin/sign.js
|
||||
displayName: Set Hardened Entitlements
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn test-node
|
||||
displayName: Run unit tests (node.js)
|
||||
timeoutInMinutes: 15
|
||||
- script: |
|
||||
set -e
|
||||
./scripts/test.sh --build --tfs "Unit Tests"
|
||||
displayName: Run unit tests (Electron)
|
||||
timeoutInMinutes: 15
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
DEBUG=*browser* yarn test-browser-no-install --sequential --browser chromium --browser webkit --tfs "Browser Unit Tests"
|
||||
displayName: Run unit tests (Browser, Chromium & Webkit)
|
||||
timeoutInMinutes: 30
|
||||
- script: |
|
||||
set -e
|
||||
yarn test-node --build
|
||||
displayName: Run unit tests (node.js)
|
||||
timeoutInMinutes: 15
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
./scripts/test.sh --build --tfs "Unit Tests"
|
||||
displayName: Run unit tests (Electron)
|
||||
timeoutInMinutes: 15
|
||||
- script: |
|
||||
set -e
|
||||
DEBUG=*browser* yarn test-browser-no-install --sequential --build --browser chromium --browser webkit --tfs "Browser Unit Tests"
|
||||
displayName: Run unit tests (Browser, Chromium & Webkit)
|
||||
timeoutInMinutes: 30
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn test-node --build
|
||||
displayName: Run unit tests (node.js)
|
||||
timeoutInMinutes: 15
|
||||
- script: |
|
||||
# Figure out the full absolute path of the product we just built
|
||||
# including the remote server and configure the integration tests
|
||||
# to run with these builds instead of running out of sources.
|
||||
set -e
|
||||
APP_ROOT=$(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH)
|
||||
APP_NAME="`ls $APP_ROOT | head -n 1`"
|
||||
INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME/Contents/MacOS/Electron" \
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-darwin-$(VSCODE_ARCH)" \
|
||||
./scripts/test-integration.sh --build --tfs "Integration Tests"
|
||||
displayName: Run integration tests (Electron)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
DEBUG=*browser* yarn test-browser-no-install --sequential --build --browser chromium --browser webkit --tfs "Browser Unit Tests"
|
||||
displayName: Run unit tests (Browser, Chromium & Webkit)
|
||||
timeoutInMinutes: 30
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-darwin-$(VSCODE_ARCH)" \
|
||||
./scripts/test-web-integration.sh --browser webkit
|
||||
displayName: Run integration tests (Browser, Webkit)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true) }}:
|
||||
- script: |
|
||||
set -e
|
||||
yarn gulp \
|
||||
compile-extension:configuration-editing \
|
||||
compile-extension:css-language-features-server \
|
||||
compile-extension:emmet \
|
||||
compile-extension:git \
|
||||
compile-extension:github-authentication \
|
||||
compile-extension:html-language-features-server \
|
||||
compile-extension:ipynb \
|
||||
compile-extension:json-language-features-server \
|
||||
compile-extension:markdown-language-features-server \
|
||||
compile-extension:markdown-language-features \
|
||||
compile-extension-media \
|
||||
compile-extension:microsoft-authentication \
|
||||
compile-extension:typescript-language-features \
|
||||
compile-extension:vscode-api-tests \
|
||||
compile-extension:vscode-colorize-tests \
|
||||
compile-extension:vscode-notebook-tests \
|
||||
compile-extension:vscode-test-resolver
|
||||
displayName: Build integration tests
|
||||
- script: |
|
||||
set -e
|
||||
APP_ROOT=$(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH)
|
||||
APP_NAME="`ls $APP_ROOT | head -n 1`"
|
||||
INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME/Contents/MacOS/Electron" \
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-darwin-$(VSCODE_ARCH)" \
|
||||
./scripts/test-remote-integration.sh
|
||||
displayName: Run integration tests (Remote)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
./scripts/test-integration.sh --tfs "Integration Tests"
|
||||
displayName: Run integration tests (Electron)
|
||||
timeoutInMinutes: 20
|
||||
- script: |
|
||||
set -e
|
||||
ps -ef
|
||||
displayName: Diagnostics before smoke test run
|
||||
continueOnError: true
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
# Figure out the full absolute path of the product we just built
|
||||
# including the remote server and configure the integration tests
|
||||
# to run with these builds instead of running out of sources.
|
||||
set -e
|
||||
APP_ROOT=$(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH)
|
||||
APP_NAME="`ls $APP_ROOT | head -n 1`"
|
||||
INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME/Contents/MacOS/Electron" \
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-darwin-$(VSCODE_ARCH)" \
|
||||
./scripts/test-integration.sh --build --tfs "Integration Tests"
|
||||
displayName: Run integration tests (Electron)
|
||||
timeoutInMinutes: 20
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-darwin-$(VSCODE_ARCH)" \
|
||||
yarn smoketest-no-compile --web --tracing --headless
|
||||
timeoutInMinutes: 10
|
||||
displayName: Run smoke tests (Browser, Chromium)
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-darwin-$(VSCODE_ARCH)" \
|
||||
./scripts/test-web-integration.sh --browser webkit
|
||||
displayName: Run integration tests (Browser, Webkit)
|
||||
timeoutInMinutes: 20
|
||||
- script: |
|
||||
set -e
|
||||
APP_ROOT=$(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH)
|
||||
APP_NAME="`ls $APP_ROOT | head -n 1`"
|
||||
yarn smoketest-no-compile --tracing --build "$APP_ROOT/$APP_NAME"
|
||||
timeoutInMinutes: 20
|
||||
displayName: Run smoke tests (Electron)
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
APP_ROOT=$(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH)
|
||||
APP_NAME="`ls $APP_ROOT | head -n 1`"
|
||||
INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME/Contents/MacOS/Electron" \
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-darwin-$(VSCODE_ARCH)" \
|
||||
./scripts/test-remote-integration.sh
|
||||
displayName: Run integration tests (Remote)
|
||||
timeoutInMinutes: 20
|
||||
- script: |
|
||||
set -e
|
||||
APP_ROOT=$(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH)
|
||||
APP_NAME="`ls $APP_ROOT | head -n 1`"
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-darwin-$(VSCODE_ARCH)" \
|
||||
yarn smoketest-no-compile --tracing --remote --build "$APP_ROOT/$APP_NAME"
|
||||
timeoutInMinutes: 20
|
||||
displayName: Run smoke tests (Remote)
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_RUN_SMOKE_TESTS, true) }}:
|
||||
- script: |
|
||||
set -e
|
||||
ps -ef
|
||||
displayName: Diagnostics before smoke test run
|
||||
continueOnError: true
|
||||
condition: succeededOrFailed()
|
||||
- script: |
|
||||
set -e
|
||||
ps -ef
|
||||
displayName: Diagnostics after smoke test run
|
||||
continueOnError: true
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
yarn --cwd test/smoke compile
|
||||
displayName: Compile smoke tests
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
artifactName: crash-dump-macos-$(VSCODE_ARCH)
|
||||
targetPath: .build/crashes
|
||||
displayName: "Publish Crash Reports"
|
||||
continueOnError: true
|
||||
condition: failed()
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn smoketest-no-compile --tracing
|
||||
timeoutInMinutes: 20
|
||||
displayName: Run smoke tests (Electron)
|
||||
# In order to properly symbolify above crash reports
|
||||
# (if any), we need the compiled native modules too
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
artifactName: node-modules-macos-$(VSCODE_ARCH)
|
||||
targetPath: node_modules
|
||||
displayName: "Publish Node Modules"
|
||||
continueOnError: true
|
||||
condition: failed()
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
APP_ROOT=$(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH)
|
||||
APP_NAME="`ls $APP_ROOT | head -n 1`"
|
||||
yarn smoketest-no-compile --tracing --build "$APP_ROOT/$APP_NAME"
|
||||
timeoutInMinutes: 20
|
||||
displayName: Run smoke tests (Electron)
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-darwin-$(VSCODE_ARCH)" \
|
||||
yarn smoketest-no-compile --web --tracing --headless
|
||||
timeoutInMinutes: 20
|
||||
displayName: Run smoke tests (Browser, Chromium)
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn gulp compile-extension:vscode-test-resolver
|
||||
APP_ROOT=$(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH)
|
||||
APP_NAME="`ls $APP_ROOT | head -n 1`"
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-darwin-$(VSCODE_ARCH)" \
|
||||
yarn smoketest-no-compile --tracing --remote --build "$APP_ROOT/$APP_NAME"
|
||||
timeoutInMinutes: 20
|
||||
displayName: Run smoke tests (Remote)
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
ps -ef
|
||||
displayName: Diagnostics after smoke test run
|
||||
continueOnError: true
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- ${{ if or(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true), eq(parameters.VSCODE_RUN_SMOKE_TESTS, true)) }}:
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
targetPath: .build/crashes
|
||||
${{ if and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
artifactName: crash-dump-macos-$(VSCODE_ARCH)-integration-$(System.JobAttempt)
|
||||
${{ elseif and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, true)) }}:
|
||||
artifactName: crash-dump-macos-$(VSCODE_ARCH)-smoke-$(System.JobAttempt)
|
||||
${{ else }}:
|
||||
artifactName: crash-dump-macos-$(VSCODE_ARCH)-$(System.JobAttempt)
|
||||
displayName: "Publish Crash Reports"
|
||||
continueOnError: true
|
||||
condition: failed()
|
||||
|
||||
# In order to properly symbolify above crash reports
|
||||
# (if any), we need the compiled native modules too
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
targetPath: node_modules
|
||||
${{ if and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
artifactName: node-modules-macos-$(VSCODE_ARCH)-integration-$(System.JobAttempt)
|
||||
${{ elseif and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, true)) }}:
|
||||
artifactName: node-modules-macos-$(VSCODE_ARCH)-smoke-$(System.JobAttempt)
|
||||
${{ else }}:
|
||||
artifactName: node-modules-macos-$(VSCODE_ARCH)-$(System.JobAttempt)
|
||||
displayName: "Publish Node Modules"
|
||||
continueOnError: true
|
||||
condition: failed()
|
||||
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
targetPath: .build/logs
|
||||
${{ if and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
artifactName: logs-macos-$(VSCODE_ARCH)-integration-$(System.JobAttempt)
|
||||
${{ elseif and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, true)) }}:
|
||||
artifactName: logs-macos-$(VSCODE_ARCH)-smoke-$(System.JobAttempt)
|
||||
${{ else }}:
|
||||
artifactName: logs-macos-$(VSCODE_ARCH)-$(System.JobAttempt)
|
||||
displayName: "Publish Log Files"
|
||||
continueOnError: true
|
||||
condition: succeededOrFailed()
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
artifactName: logs-macos-$(VSCODE_ARCH)-$(System.JobAttempt)
|
||||
targetPath: .build/logs
|
||||
displayName: "Publish Log Files"
|
||||
continueOnError: true
|
||||
condition: failed()
|
||||
|
||||
- task: PublishTestResults@2
|
||||
displayName: Publish Tests Results
|
||||
|
||||
@@ -51,50 +51,6 @@ steps:
|
||||
set -e
|
||||
tar -xzf .build/node_modules_cache/cache.tgz
|
||||
displayName: Extract node_modules cache
|
||||
condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
npm install -g node-gyp@latest
|
||||
node-gyp --version
|
||||
displayName: Update node-gyp
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
npx https://aka.ms/enablesecurefeed standAlone
|
||||
timeoutInMinutes: 5
|
||||
retryCountOnTaskFailure: 3
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), eq(variables['ENABLE_TERRAPIN'], 'true'))
|
||||
displayName: Switch to Terrapin packages
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
export npm_config_arch=$(VSCODE_ARCH)
|
||||
export npm_config_node_gyp=$(which node-gyp)
|
||||
|
||||
for i in {1..3}; do # try 3 times, for Terrapin
|
||||
yarn --frozen-lockfile --check-files && break
|
||||
if [ $i -eq 3 ]; then
|
||||
echo "Yarn failed too many times" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Yarn failed $i, trying again..."
|
||||
done
|
||||
env:
|
||||
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||
GITHUB_TOKEN: "$(github-distro-mixin-password)"
|
||||
displayName: Install dependencies
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt
|
||||
mkdir -p .build/node_modules_cache
|
||||
tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
displayName: Create node_modules archive
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
|
||||
@@ -1,73 +1,50 @@
|
||||
parameters:
|
||||
- name: VSCODE_PUBLISH
|
||||
type: boolean
|
||||
- name: VSCODE_QUALITY
|
||||
type: string
|
||||
- name: VSCODE_RUN_UNIT_TESTS
|
||||
type: boolean
|
||||
- name: VSCODE_RUN_INTEGRATION_TESTS
|
||||
type: boolean
|
||||
- name: VSCODE_RUN_SMOKE_TESTS
|
||||
type: boolean
|
||||
|
||||
steps:
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- checkout: self
|
||||
fetchDepth: 1
|
||||
retryCountOnTaskFailure: 3
|
||||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "16.x"
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- task: AzureKeyVault@1
|
||||
displayName: "Azure Key Vault: Get Secrets"
|
||||
inputs:
|
||||
azureSubscription: "vscode-builds-subscription"
|
||||
KeyVaultName: vscode
|
||||
SecretsFilter: "github-distro-mixin-password,macos-developer-certificate,macos-developer-certificate-key"
|
||||
- task: AzureKeyVault@1
|
||||
displayName: "Azure Key Vault: Get Secrets"
|
||||
inputs:
|
||||
azureSubscription: "vscode-builds-subscription"
|
||||
KeyVaultName: vscode
|
||||
SecretsFilter: "github-distro-mixin-password,macos-developer-certificate,macos-developer-certificate-key"
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- task: DownloadPipelineArtifact@2
|
||||
inputs:
|
||||
artifact: Compilation
|
||||
path: $(Build.ArtifactStagingDirectory)
|
||||
displayName: Download compilation output
|
||||
- task: DownloadPipelineArtifact@2
|
||||
inputs:
|
||||
artifact: Compilation
|
||||
path: $(Build.ArtifactStagingDirectory)
|
||||
displayName: Download compilation output
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
tar -xzf $(Build.ArtifactStagingDirectory)/compilation.tar.gz
|
||||
displayName: Extract compilation output
|
||||
- script: |
|
||||
set -e
|
||||
tar -xzf $(Build.ArtifactStagingDirectory)/compilation.tar.gz
|
||||
displayName: Extract compilation output
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
cat << EOF > ~/.netrc
|
||||
machine github.com
|
||||
login vscode
|
||||
password $(github-distro-mixin-password)
|
||||
EOF
|
||||
- script: |
|
||||
set -e
|
||||
cat << EOF > ~/.netrc
|
||||
machine github.com
|
||||
login vscode
|
||||
password $(github-distro-mixin-password)
|
||||
EOF
|
||||
|
||||
git config user.email "vscode@microsoft.com"
|
||||
git config user.name "VSCode"
|
||||
displayName: Prepare tooling
|
||||
git config user.email "vscode@microsoft.com"
|
||||
git config user.name "VSCode"
|
||||
displayName: Prepare tooling
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
git fetch https://github.com/$(VSCODE_MIXIN_REPO).git $VSCODE_DISTRO_REF
|
||||
echo "##vso[task.setvariable variable=VSCODE_DISTRO_COMMIT;]$(git rev-parse FETCH_HEAD)"
|
||||
git checkout FETCH_HEAD
|
||||
condition: and(succeeded(), ne(variables.VSCODE_DISTRO_REF, ' '))
|
||||
displayName: Checkout override commit
|
||||
- script: |
|
||||
set -e
|
||||
git fetch https://github.com/$(VSCODE_MIXIN_REPO).git $VSCODE_DISTRO_REF
|
||||
echo "##vso[task.setvariable variable=VSCODE_DISTRO_COMMIT;]$(git rev-parse FETCH_HEAD)"
|
||||
git checkout FETCH_HEAD
|
||||
condition: and(succeeded(), ne(variables.VSCODE_DISTRO_REF, ' '))
|
||||
displayName: Checkout override commit
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro")
|
||||
displayName: Merge distro
|
||||
- script: |
|
||||
set -e
|
||||
git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro")
|
||||
displayName: Merge distro
|
||||
|
||||
- script: |
|
||||
mkdir -p .build
|
||||
@@ -87,6 +64,13 @@ steps:
|
||||
condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
displayName: Extract node_modules cache
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
npm install -g node-gyp@latest
|
||||
node-gyp --version
|
||||
displayName: Update node-gyp
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
npx https://aka.ms/enablesecurefeed standAlone
|
||||
@@ -123,142 +107,115 @@ steps:
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
displayName: Create node_modules archive
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
# This script brings in the right resources (images, icons, etc) based on the quality (insiders, stable, exploration)
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/mixin
|
||||
displayName: Mix in quality
|
||||
# This script brings in the right resources (images, icons, etc) based on the quality (insiders, stable, exploration)
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/mixin
|
||||
displayName: Mix in quality
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn gulp vscode-darwin-$(VSCODE_ARCH)-min-ci
|
||||
displayName: Build client
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn gulp vscode-darwin-$(VSCODE_ARCH)-min-ci
|
||||
displayName: Build client
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/mixin --server
|
||||
displayName: Mix in server quality
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/mixin --server
|
||||
displayName: Mix in server quality
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn gulp vscode-reh-darwin-$(VSCODE_ARCH)-min-ci
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn gulp vscode-reh-web-darwin-$(VSCODE_ARCH)-min-ci
|
||||
displayName: Build Server
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn gulp vscode-reh-darwin-$(VSCODE_ARCH)-min-ci
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn gulp vscode-reh-web-darwin-$(VSCODE_ARCH)-min-ci
|
||||
displayName: Build Server
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn gulp "transpile-client" "transpile-extensions"
|
||||
displayName: Transpile
|
||||
# Setting hardened entitlements is a requirement for:
|
||||
# * Apple notarization
|
||||
# * Running tests on Big Sur (because Big Sur has additional security precautions)
|
||||
- script: |
|
||||
set -e
|
||||
security create-keychain -p pwd $(agent.tempdirectory)/buildagent.keychain
|
||||
security default-keychain -s $(agent.tempdirectory)/buildagent.keychain
|
||||
security unlock-keychain -p pwd $(agent.tempdirectory)/buildagent.keychain
|
||||
echo "$(macos-developer-certificate)" | base64 -D > $(agent.tempdirectory)/cert.p12
|
||||
security import $(agent.tempdirectory)/cert.p12 -k $(agent.tempdirectory)/buildagent.keychain -P "$(macos-developer-certificate-key)" -T /usr/bin/codesign
|
||||
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k pwd $(agent.tempdirectory)/buildagent.keychain
|
||||
VSCODE_ARCH=$(VSCODE_ARCH) DEBUG=electron-osx-sign* node build/darwin/sign.js
|
||||
displayName: Set Hardened Entitlements
|
||||
|
||||
- ${{ if or(eq(parameters.VSCODE_RUN_UNIT_TESTS, true), eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true), eq(parameters.VSCODE_RUN_SMOKE_TESTS, true)) }}:
|
||||
- template: product-build-darwin-test.yml
|
||||
parameters:
|
||||
VSCODE_QUALITY: ${{ parameters.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: ${{ parameters.VSCODE_RUN_UNIT_TESTS }}
|
||||
VSCODE_RUN_INTEGRATION_TESTS: ${{ parameters.VSCODE_RUN_INTEGRATION_TESTS }}
|
||||
VSCODE_RUN_SMOKE_TESTS: ${{ parameters.VSCODE_RUN_SMOKE_TESTS }}
|
||||
- script: |
|
||||
set -e
|
||||
pushd $(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH) && zip -r -X -y $(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH).zip * && popd
|
||||
displayName: Archive build
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
# Setting hardened entitlements is a requirement for:
|
||||
# * Apple notarization
|
||||
# * Running tests on Big Sur (because Big Sur has additional security precautions)
|
||||
- script: |
|
||||
set -e
|
||||
security create-keychain -p pwd $(agent.tempdirectory)/buildagent.keychain
|
||||
security default-keychain -s $(agent.tempdirectory)/buildagent.keychain
|
||||
security unlock-keychain -p pwd $(agent.tempdirectory)/buildagent.keychain
|
||||
echo "$(macos-developer-certificate)" | base64 -D > $(agent.tempdirectory)/cert.p12
|
||||
security import $(agent.tempdirectory)/cert.p12 -k $(agent.tempdirectory)/buildagent.keychain -P "$(macos-developer-certificate-key)" -T /usr/bin/codesign
|
||||
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k pwd $(agent.tempdirectory)/buildagent.keychain
|
||||
VSCODE_ARCH=$(VSCODE_ARCH) DEBUG=electron-osx-sign* node build/darwin/sign.js
|
||||
displayName: Set Hardened Entitlements
|
||||
- script: |
|
||||
set -e
|
||||
|
||||
- ${{ if and(eq(parameters.VSCODE_PUBLISH, true), eq(parameters.VSCODE_RUN_UNIT_TESTS, false), eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
- script: |
|
||||
set -e
|
||||
pushd $(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH) && zip -r -X -y $(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH).zip * && popd
|
||||
displayName: Archive build
|
||||
# package Remote Extension Host
|
||||
pushd .. && mv vscode-reh-darwin-$(VSCODE_ARCH) vscode-server-darwin-$(VSCODE_ARCH) && zip -Xry vscode-server-darwin-$(VSCODE_ARCH).zip vscode-server-darwin-$(VSCODE_ARCH) && popd
|
||||
|
||||
- ${{ if and(eq(parameters.VSCODE_PUBLISH, true), eq(parameters.VSCODE_RUN_UNIT_TESTS, false), eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
- script: |
|
||||
set -e
|
||||
# package Remote Extension Host (Web)
|
||||
pushd .. && mv vscode-reh-web-darwin-$(VSCODE_ARCH) vscode-server-darwin-$(VSCODE_ARCH)-web && zip -Xry vscode-server-darwin-$(VSCODE_ARCH)-web.zip vscode-server-darwin-$(VSCODE_ARCH)-web && popd
|
||||
displayName: Prepare to publish servers
|
||||
|
||||
# package Remote Extension Host
|
||||
pushd .. && mv vscode-reh-darwin-$(VSCODE_ARCH) vscode-server-darwin-$(VSCODE_ARCH) && zip -Xry vscode-server-darwin-$(VSCODE_ARCH).zip vscode-server-darwin-$(VSCODE_ARCH) && popd
|
||||
- publish: $(Agent.BuildDirectory)/VSCode-darwin-$(VSCODE_ARCH).zip
|
||||
artifact: unsigned_vscode_client_darwin_$(VSCODE_ARCH)_archive
|
||||
displayName: Publish client archive
|
||||
|
||||
# package Remote Extension Host (Web)
|
||||
pushd .. && mv vscode-reh-web-darwin-$(VSCODE_ARCH) vscode-server-darwin-$(VSCODE_ARCH)-web && zip -Xry vscode-server-darwin-$(VSCODE_ARCH)-web.zip vscode-server-darwin-$(VSCODE_ARCH)-web && popd
|
||||
displayName: Prepare to publish servers
|
||||
- publish: $(Agent.BuildDirectory)/vscode-server-darwin-$(VSCODE_ARCH).zip
|
||||
artifact: vscode_server_darwin_$(VSCODE_ARCH)_archive-unsigned
|
||||
displayName: Publish server archive
|
||||
|
||||
- ${{ if and(eq(parameters.VSCODE_PUBLISH, true), eq(parameters.VSCODE_RUN_UNIT_TESTS, false), eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
|
||||
displayName: Generate SBOM (client)
|
||||
inputs:
|
||||
BuildDropPath: $(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH)
|
||||
PackageName: Visual Studio Code
|
||||
- publish: $(Agent.BuildDirectory)/vscode-server-darwin-$(VSCODE_ARCH)-web.zip
|
||||
artifact: vscode_web_darwin_$(VSCODE_ARCH)_archive-unsigned
|
||||
displayName: Publish web server archive
|
||||
|
||||
- ${{ if and(eq(parameters.VSCODE_PUBLISH, true), eq(parameters.VSCODE_RUN_UNIT_TESTS, false), eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
- publish: $(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH)/_manifest
|
||||
displayName: Publish SBOM (client)
|
||||
artifact: vscode_client_darwin_$(VSCODE_ARCH)_sbom
|
||||
- task: AzureCLI@2
|
||||
inputs:
|
||||
azureSubscription: "vscode-builds-subscription"
|
||||
scriptType: pscore
|
||||
scriptLocation: inlineScript
|
||||
addSpnToEnvironment: true
|
||||
inlineScript: |
|
||||
Write-Host "##vso[task.setvariable variable=AZURE_TENANT_ID]$env:tenantId"
|
||||
Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_ID]$env:servicePrincipalId"
|
||||
Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_SECRET;issecret=true]$env:servicePrincipalKey"
|
||||
|
||||
- ${{ if and(eq(parameters.VSCODE_PUBLISH, true), eq(parameters.VSCODE_RUN_UNIT_TESTS, false), eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
|
||||
displayName: Generate SBOM (server)
|
||||
inputs:
|
||||
BuildDropPath: $(agent.builddirectory)/vscode-server-darwin-$(VSCODE_ARCH)
|
||||
PackageName: Visual Studio Code Server
|
||||
- script: |
|
||||
set -e
|
||||
AZURE_STORAGE_ACCOUNT="ticino" \
|
||||
AZURE_TENANT_ID="$(AZURE_TENANT_ID)" \
|
||||
AZURE_CLIENT_ID="$(AZURE_CLIENT_ID)" \
|
||||
AZURE_CLIENT_SECRET="$(AZURE_CLIENT_SECRET)" \
|
||||
VSCODE_ARCH="$(VSCODE_ARCH)" \
|
||||
node build/azure-pipelines/upload-configuration
|
||||
displayName: Upload configuration (for Bing settings search)
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
continueOnError: true
|
||||
|
||||
- ${{ if and(eq(parameters.VSCODE_PUBLISH, true), eq(parameters.VSCODE_RUN_UNIT_TESTS, false), eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
- publish: $(agent.builddirectory)/vscode-server-darwin-$(VSCODE_ARCH)/_manifest
|
||||
displayName: Publish SBOM (server)
|
||||
artifact: vscode_server_darwin_$(VSCODE_ARCH)_sbom
|
||||
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
|
||||
displayName: Generate SBOM (client)
|
||||
inputs:
|
||||
BuildDropPath: $(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH)
|
||||
PackageName: Visual Studio Code
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- ${{ if and(eq(parameters.VSCODE_PUBLISH, true), eq(parameters.VSCODE_RUN_UNIT_TESTS, false), eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
- publish: $(Agent.BuildDirectory)/VSCode-darwin-$(VSCODE_ARCH).zip
|
||||
artifact: unsigned_vscode_client_darwin_$(VSCODE_ARCH)_archive
|
||||
displayName: Publish client archive
|
||||
- publish: $(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH)/_manifest
|
||||
displayName: Publish SBOM (client)
|
||||
artifact: vscode_client_darwin_$(VSCODE_ARCH)_sbom
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- ${{ if and(eq(parameters.VSCODE_PUBLISH, true), eq(parameters.VSCODE_RUN_UNIT_TESTS, false), eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
- publish: $(Agent.BuildDirectory)/vscode-server-darwin-$(VSCODE_ARCH).zip
|
||||
artifact: vscode_server_darwin_$(VSCODE_ARCH)_archive-unsigned
|
||||
displayName: Publish server archive
|
||||
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
|
||||
displayName: Generate SBOM (server)
|
||||
inputs:
|
||||
BuildDropPath: $(agent.builddirectory)/vscode-server-darwin-$(VSCODE_ARCH)
|
||||
PackageName: Visual Studio Code Server
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- ${{ if and(eq(parameters.VSCODE_PUBLISH, true), eq(parameters.VSCODE_RUN_UNIT_TESTS, false), eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
- publish: $(Agent.BuildDirectory)/vscode-server-darwin-$(VSCODE_ARCH)-web.zip
|
||||
artifact: vscode_web_darwin_$(VSCODE_ARCH)_archive-unsigned
|
||||
displayName: Publish web server archive
|
||||
|
||||
- ${{ if and(eq(parameters.VSCODE_PUBLISH, true), eq(parameters.VSCODE_RUN_UNIT_TESTS, false), eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
- task: AzureCLI@2
|
||||
inputs:
|
||||
azureSubscription: "vscode-builds-subscription"
|
||||
scriptType: pscore
|
||||
scriptLocation: inlineScript
|
||||
addSpnToEnvironment: true
|
||||
inlineScript: |
|
||||
Write-Host "##vso[task.setvariable variable=AZURE_TENANT_ID]$env:tenantId"
|
||||
Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_ID]$env:servicePrincipalId"
|
||||
Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_SECRET;issecret=true]$env:servicePrincipalKey"
|
||||
|
||||
- ${{ if and(eq(parameters.VSCODE_PUBLISH, true), eq(parameters.VSCODE_RUN_UNIT_TESTS, false), eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
- script: |
|
||||
set -e
|
||||
AZURE_STORAGE_ACCOUNT="ticino" \
|
||||
AZURE_TENANT_ID="$(AZURE_TENANT_ID)" \
|
||||
AZURE_CLIENT_ID="$(AZURE_CLIENT_ID)" \
|
||||
AZURE_CLIENT_SECRET="$(AZURE_CLIENT_SECRET)" \
|
||||
VSCODE_ARCH="$(VSCODE_ARCH)" \
|
||||
node build/azure-pipelines/upload-configuration
|
||||
displayName: Upload configuration (for Bing settings search)
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'))
|
||||
continueOnError: true
|
||||
- publish: $(agent.builddirectory)/vscode-server-darwin-$(VSCODE_ARCH)/_manifest
|
||||
displayName: Publish SBOM (server)
|
||||
artifact: vscode_server_darwin_$(VSCODE_ARCH)_sbom
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
@@ -112,19 +112,18 @@ steps:
|
||||
displayName: Run unit tests
|
||||
condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'))
|
||||
|
||||
# {{SQL CARBON TODO}} Reenable "Run Core Integration Tests"
|
||||
# - script: |
|
||||
# # Figure out the full absolute path of the product we just built
|
||||
# # including the remote server and configure the integration tests
|
||||
# # to run with these builds instead of running out of sources.
|
||||
# set -e
|
||||
# APP_ROOT=$(agent.builddirectory)/azuredatastudio-darwin-x64
|
||||
# APP_NAME="`ls $APP_ROOT | head -n 1`"
|
||||
# INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME/Contents/MacOS/Electron" \
|
||||
# VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/azuredatastudio-reh-darwin" \
|
||||
# ./scripts/test-integration.sh --build --tfs "Integration Tests"
|
||||
# displayName: Run core integration tests
|
||||
# condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'))
|
||||
- script: |
|
||||
# Figure out the full absolute path of the product we just built
|
||||
# including the remote server and configure the integration tests
|
||||
# to run with these builds instead of running out of sources.
|
||||
set -e
|
||||
APP_ROOT=$(agent.builddirectory)/azuredatastudio-darwin-x64
|
||||
APP_NAME="`ls $APP_ROOT | head -n 1`"
|
||||
INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME/Contents/MacOS/Electron" \
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/azuredatastudio-reh-darwin" \
|
||||
./scripts/test-integration.sh --build --tfs "Integration Tests"
|
||||
displayName: Run core integration tests
|
||||
condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
|
||||
@@ -4,7 +4,9 @@ pool:
|
||||
trigger:
|
||||
branches:
|
||||
include: ["main", "release/*"]
|
||||
pr: none
|
||||
pr:
|
||||
branches:
|
||||
include: ["main", "release/*"]
|
||||
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
|
||||
@@ -118,9 +118,7 @@ steps:
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
docker run -e VSCODE_QUALITY -e GITHUB_TOKEN -v $(pwd):/root/vscode -v ~/.netrc:/root/.netrc vscodehub.azurecr.io/vscode-linux-build-agent:alpine-$(VSCODE_ARCH) /root/vscode/build/azure-pipelines/linux/scripts/install-remote-dependencies.sh
|
||||
env:
|
||||
GITHUB_TOKEN: "$(github-distro-mixin-password)"
|
||||
docker run -e VSCODE_QUALITY -v $(pwd):/root/vscode -v ~/.netrc:/root/.netrc vscodehub.azurecr.io/vscode-linux-build-agent:alpine-$(VSCODE_ARCH) /root/vscode/build/azure-pipelines/linux/scripts/install-remote-dependencies.sh
|
||||
displayName: Prebuild
|
||||
|
||||
- script: |
|
||||
|
||||
@@ -1,272 +0,0 @@
|
||||
parameters:
|
||||
- name: VSCODE_QUALITY
|
||||
type: string
|
||||
- name: VSCODE_RUN_UNIT_TESTS
|
||||
type: boolean
|
||||
- name: VSCODE_RUN_INTEGRATION_TESTS
|
||||
type: boolean
|
||||
- name: VSCODE_RUN_SMOKE_TESTS
|
||||
type: boolean
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn npm-run-all -lp "electron $(VSCODE_ARCH)" "playwright-install"
|
||||
displayName: Download Electron and Playwright
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0 libgbm1
|
||||
sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
|
||||
sudo chmod +x /etc/init.d/xvfb
|
||||
sudo update-rc.d xvfb defaults
|
||||
sudo service xvfb start
|
||||
displayName: Setup build environment
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
APP_ROOT=$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)
|
||||
ELECTRON_ROOT=.build/electron
|
||||
sudo chown root $APP_ROOT/chrome-sandbox
|
||||
sudo chown root $ELECTRON_ROOT/chrome-sandbox
|
||||
sudo chmod 4755 $APP_ROOT/chrome-sandbox
|
||||
sudo chmod 4755 $ELECTRON_ROOT/chrome-sandbox
|
||||
stat $APP_ROOT/chrome-sandbox
|
||||
stat $ELECTRON_ROOT/chrome-sandbox
|
||||
displayName: Change setuid helper binary permission
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_RUN_UNIT_TESTS, true) }}:
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
DISPLAY=:10 ./scripts/test.sh --tfs "Unit Tests"
|
||||
displayName: Run unit tests (Electron)
|
||||
timeoutInMinutes: 15
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn test-node
|
||||
displayName: Run unit tests (node.js)
|
||||
timeoutInMinutes: 15
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
DEBUG=*browser* yarn test-browser-no-install --browser chromium --tfs "Browser Unit Tests"
|
||||
displayName: Run unit tests (Browser, Chromium)
|
||||
timeoutInMinutes: 15
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
./scripts/test.sh --build --tfs "Unit Tests"
|
||||
displayName: Run unit tests (Electron)
|
||||
timeoutInMinutes: 15
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn test-node --build
|
||||
displayName: Run unit tests (node.js)
|
||||
timeoutInMinutes: 15
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
DEBUG=*browser* yarn test-browser-no-install --build --browser chromium --tfs "Browser Unit Tests"
|
||||
displayName: Run unit tests (Browser, Chromium)
|
||||
timeoutInMinutes: 15
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true) }}:
|
||||
- script: |
|
||||
set -e
|
||||
yarn gulp \
|
||||
compile-extension:configuration-editing \
|
||||
compile-extension:css-language-features-server \
|
||||
compile-extension:emmet \
|
||||
compile-extension:git \
|
||||
compile-extension:github-authentication \
|
||||
compile-extension:html-language-features-server \
|
||||
compile-extension:ipynb \
|
||||
compile-extension:json-language-features-server \
|
||||
compile-extension:markdown-language-features-server \
|
||||
compile-extension:markdown-language-features \
|
||||
compile-extension-media \
|
||||
compile-extension:microsoft-authentication \
|
||||
compile-extension:typescript-language-features \
|
||||
compile-extension:vscode-api-tests \
|
||||
compile-extension:vscode-colorize-tests \
|
||||
compile-extension:vscode-notebook-tests \
|
||||
compile-extension:vscode-test-resolver
|
||||
displayName: Build integration tests
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true) }}:
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
DISPLAY=:10 ./scripts/test-integration.sh --tfs "Integration Tests"
|
||||
displayName: Run integration tests (Electron)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
./scripts/test-web-integration.sh --browser chromium
|
||||
displayName: Run integration tests (Browser, Chromium)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
./scripts/test-remote-integration.sh
|
||||
displayName: Run integration tests (Remote)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
# Figure out the full absolute path of the product we just built
|
||||
# including the remote server and configure the integration tests
|
||||
# to run with these builds instead of running out of sources.
|
||||
set -e
|
||||
APP_ROOT=$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)
|
||||
APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName")
|
||||
INTEGRATION_TEST_APP_NAME="$APP_NAME" \
|
||||
INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-linux-$(VSCODE_ARCH)" \
|
||||
./scripts/test-integration.sh --build --tfs "Integration Tests"
|
||||
displayName: Run integration tests (Electron)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-linux-$(VSCODE_ARCH)" \
|
||||
./scripts/test-web-integration.sh --browser chromium
|
||||
displayName: Run integration tests (Browser, Chromium)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
APP_ROOT=$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)
|
||||
APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName")
|
||||
INTEGRATION_TEST_APP_NAME="$APP_NAME" \
|
||||
INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-linux-$(VSCODE_ARCH)" \
|
||||
./scripts/test-remote-integration.sh
|
||||
displayName: Run integration tests (Remote)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_RUN_SMOKE_TESTS, true) }}:
|
||||
- script: |
|
||||
set -e
|
||||
ps -ef
|
||||
cat /proc/sys/fs/inotify/max_user_watches
|
||||
lsof | wc -l
|
||||
displayName: Diagnostics before smoke test run (processes, max_user_watches, number of opened file handles)
|
||||
continueOnError: true
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
yarn --cwd test/smoke compile
|
||||
displayName: Compile smoke tests
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn smoketest-no-compile --tracing
|
||||
timeoutInMinutes: 20
|
||||
displayName: Run smoke tests (Electron)
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn smoketest-no-compile --web --tracing --headless --electronArgs="--disable-dev-shm-usage"
|
||||
timeoutInMinutes: 20
|
||||
displayName: Run smoke tests (Browser, Chromium)
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn gulp compile-extension:vscode-test-resolver
|
||||
yarn smoketest-no-compile --remote --tracing
|
||||
timeoutInMinutes: 20
|
||||
displayName: Run smoke tests (Remote)
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
APP_PATH=$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)
|
||||
yarn smoketest-no-compile --tracing --build "$APP_PATH"
|
||||
timeoutInMinutes: 20
|
||||
displayName: Run smoke tests (Electron)
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-linux-$(VSCODE_ARCH)" \
|
||||
yarn smoketest-no-compile --web --tracing --headless --electronArgs="--disable-dev-shm-usage"
|
||||
timeoutInMinutes: 20
|
||||
displayName: Run smoke tests (Browser, Chromium)
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn gulp compile-extension:vscode-test-resolver
|
||||
APP_PATH=$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-linux-$(VSCODE_ARCH)" \
|
||||
yarn smoketest-no-compile --tracing --remote --build "$APP_PATH"
|
||||
timeoutInMinutes: 20
|
||||
displayName: Run smoke tests (Remote)
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
ps -ef
|
||||
cat /proc/sys/fs/inotify/max_user_watches
|
||||
lsof | wc -l
|
||||
displayName: Diagnostics after smoke test run (processes, max_user_watches, number of opened file handles)
|
||||
continueOnError: true
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- ${{ if or(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true), eq(parameters.VSCODE_RUN_SMOKE_TESTS, true)) }}:
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
targetPath: .build/crashes
|
||||
${{ if and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
artifactName: crash-dump-linux-$(VSCODE_ARCH)-integration-$(System.JobAttempt)
|
||||
${{ elseif and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, true)) }}:
|
||||
artifactName: crash-dump-linux-$(VSCODE_ARCH)-smoke-$(System.JobAttempt)
|
||||
${{ else }}:
|
||||
artifactName: crash-dump-linux-$(VSCODE_ARCH)-$(System.JobAttempt)
|
||||
displayName: "Publish Crash Reports"
|
||||
continueOnError: true
|
||||
condition: failed()
|
||||
|
||||
# In order to properly symbolify above crash reports
|
||||
# (if any), we need the compiled native modules too
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
targetPath: node_modules
|
||||
${{ if and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
artifactName: node-modules-linux-$(VSCODE_ARCH)-integration-$(System.JobAttempt)
|
||||
${{ elseif and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, true)) }}:
|
||||
artifactName: node-modules-linux-$(VSCODE_ARCH)-smoke-$(System.JobAttempt)
|
||||
${{ else }}:
|
||||
artifactName: node-modules-linux-$(VSCODE_ARCH)-$(System.JobAttempt)
|
||||
displayName: "Publish Node Modules"
|
||||
continueOnError: true
|
||||
condition: failed()
|
||||
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
targetPath: .build/logs
|
||||
${{ if and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
artifactName: logs-linux-$(VSCODE_ARCH)-integration-$(System.JobAttempt)
|
||||
${{ elseif and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, true)) }}:
|
||||
artifactName: logs-linux-$(VSCODE_ARCH)-smoke-$(System.JobAttempt)
|
||||
${{ else }}:
|
||||
artifactName: logs-linux-$(VSCODE_ARCH)-$(System.JobAttempt)
|
||||
displayName: "Publish Log Files"
|
||||
continueOnError: true
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- task: PublishTestResults@2
|
||||
displayName: Publish Tests Results
|
||||
inputs:
|
||||
testResultsFiles: "*-results.xml"
|
||||
searchFolder: "$(Build.ArtifactStagingDirectory)/test-results"
|
||||
condition: succeededOrFailed()
|
||||
@@ -1,113 +1,79 @@
|
||||
parameters:
|
||||
- name: VSCODE_PUBLISH
|
||||
type: boolean
|
||||
- name: VSCODE_QUALITY
|
||||
type: string
|
||||
- name: VSCODE_RUN_UNIT_TESTS
|
||||
type: boolean
|
||||
- name: VSCODE_RUN_INTEGRATION_TESTS
|
||||
type: boolean
|
||||
- name: VSCODE_RUN_SMOKE_TESTS
|
||||
type: boolean
|
||||
|
||||
steps:
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- checkout: self
|
||||
fetchDepth: 1
|
||||
retryCountOnTaskFailure: 3
|
||||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "16.x"
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- task: AzureKeyVault@1
|
||||
displayName: "Azure Key Vault: Get Secrets"
|
||||
inputs:
|
||||
azureSubscription: "vscode-builds-subscription"
|
||||
KeyVaultName: vscode
|
||||
SecretsFilter: "github-distro-mixin-password,ESRP-PKI,esrp-aad-username,esrp-aad-password"
|
||||
- task: AzureKeyVault@1
|
||||
displayName: "Azure Key Vault: Get Secrets"
|
||||
inputs:
|
||||
azureSubscription: "vscode-builds-subscription"
|
||||
KeyVaultName: vscode
|
||||
SecretsFilter: "github-distro-mixin-password,ESRP-PKI,esrp-aad-username,esrp-aad-password"
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- task: DownloadPipelineArtifact@2
|
||||
inputs:
|
||||
artifact: Compilation
|
||||
path: $(Build.ArtifactStagingDirectory)
|
||||
displayName: Download compilation output
|
||||
- task: DownloadPipelineArtifact@2
|
||||
inputs:
|
||||
artifact: Compilation
|
||||
path: $(Build.ArtifactStagingDirectory)
|
||||
displayName: Download compilation output
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- task: DownloadPipelineArtifact@2
|
||||
inputs:
|
||||
artifact: reh_node_modules-$(VSCODE_ARCH)
|
||||
path: $(Build.ArtifactStagingDirectory)
|
||||
displayName: Download server build dependencies
|
||||
condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'armhf'))
|
||||
- task: DownloadPipelineArtifact@2
|
||||
inputs:
|
||||
artifact: reh_node_modules-$(VSCODE_ARCH)
|
||||
path: $(Build.ArtifactStagingDirectory)
|
||||
displayName: Download server build dependencies
|
||||
condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'armhf'))
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
# Start X server
|
||||
/etc/init.d/xvfb start
|
||||
# Start dbus session
|
||||
DBUS_LAUNCH_RESULT=$(sudo dbus-daemon --config-file=/usr/share/dbus-1/system.conf --print-address)
|
||||
echo "##vso[task.setvariable variable=DBUS_SESSION_BUS_ADDRESS]$DBUS_LAUNCH_RESULT"
|
||||
displayName: Setup system services
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'))
|
||||
- script: |
|
||||
set -e
|
||||
# Start X server
|
||||
/etc/init.d/xvfb start
|
||||
# Start dbus session
|
||||
DBUS_LAUNCH_RESULT=$(sudo dbus-daemon --config-file=/usr/share/dbus-1/system.conf --print-address)
|
||||
echo "##vso[task.setvariable variable=DBUS_SESSION_BUS_ADDRESS]$DBUS_LAUNCH_RESULT"
|
||||
displayName: Setup system services
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'))
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
tar -xzf $(Build.ArtifactStagingDirectory)/compilation.tar.gz
|
||||
displayName: Extract compilation output
|
||||
- script: |
|
||||
set -e
|
||||
tar -xzf $(Build.ArtifactStagingDirectory)/compilation.tar.gz
|
||||
displayName: Extract compilation output
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
cat << EOF > ~/.netrc
|
||||
machine github.com
|
||||
login vscode
|
||||
password $(github-distro-mixin-password)
|
||||
EOF
|
||||
- script: |
|
||||
set -e
|
||||
cat << EOF > ~/.netrc
|
||||
machine github.com
|
||||
login vscode
|
||||
password $(github-distro-mixin-password)
|
||||
EOF
|
||||
|
||||
git config user.email "vscode@microsoft.com"
|
||||
git config user.name "VSCode"
|
||||
displayName: Prepare tooling
|
||||
git config user.email "vscode@microsoft.com"
|
||||
git config user.name "VSCode"
|
||||
displayName: Prepare tooling
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
git fetch https://github.com/$(VSCODE_MIXIN_REPO).git $VSCODE_DISTRO_REF
|
||||
echo "##vso[task.setvariable variable=VSCODE_DISTRO_COMMIT;]$(git rev-parse FETCH_HEAD)"
|
||||
git checkout FETCH_HEAD
|
||||
condition: and(succeeded(), ne(variables.VSCODE_DISTRO_REF, ' '))
|
||||
displayName: Checkout override commit
|
||||
- script: |
|
||||
set -e
|
||||
git fetch https://github.com/$(VSCODE_MIXIN_REPO).git $VSCODE_DISTRO_REF
|
||||
echo "##vso[task.setvariable variable=VSCODE_DISTRO_COMMIT;]$(git rev-parse FETCH_HEAD)"
|
||||
git checkout FETCH_HEAD
|
||||
condition: and(succeeded(), ne(variables.VSCODE_DISTRO_REF, ' '))
|
||||
displayName: Checkout override commit
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro")
|
||||
displayName: Merge distro
|
||||
- script: |
|
||||
set -e
|
||||
git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro")
|
||||
displayName: Merge distro
|
||||
|
||||
- script: |
|
||||
mkdir -p .build
|
||||
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $ENABLE_TERRAPIN > .build/yarnlockhash
|
||||
displayName: Prepare yarn cache flags
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: "genericNodeModules | $(Agent.OS) | .build/yarnlockhash"
|
||||
path: .build/node_modules_cache
|
||||
cacheHitVar: NODE_MODULES_RESTORED
|
||||
displayName: Restore node_modules cache
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: "nodeModules | $(Agent.OS) | .build/yarnlockhash"
|
||||
path: .build/node_modules_cache
|
||||
cacheHitVar: NODE_MODULES_RESTORED
|
||||
displayName: Restore node_modules cache
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: "nodeModules | $(Agent.OS) | .build/yarnlockhash"
|
||||
path: .build/node_modules_cache
|
||||
cacheHitVar: NODE_MODULES_RESTORED
|
||||
displayName: Restore node_modules cache
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
@@ -125,7 +91,6 @@ steps:
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
node build/npm/setupBuildYarnrc
|
||||
for i in {1..3}; do # try 3 times, for Terrapin
|
||||
yarn --cwd build --frozen-lockfile --check-files && break
|
||||
if [ $i -eq 3 ]; then
|
||||
@@ -138,16 +103,7 @@ steps:
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
if [ "$NPM_ARCH" = "armv7l" ]; then
|
||||
# There is no target_arch="armv7l" supported by node_gyp,
|
||||
# arm versions for compilation are decided based on the CC
|
||||
# macros.
|
||||
# Mapping value is based on
|
||||
# https://github.com/nodejs/node/blob/0903515e126c2697042d6546c6aa4b72e1a4b33e/configure.py#L49-L50
|
||||
export npm_config_arch="arm"
|
||||
else
|
||||
export npm_config_arch=$(NPM_ARCH)
|
||||
fi
|
||||
export npm_config_arch=$(NPM_ARCH)
|
||||
|
||||
if [ -z "$CC" ] || [ -z "$CXX" ]; then
|
||||
# Download clang based on chromium revision used by vscode
|
||||
@@ -187,13 +143,12 @@ steps:
|
||||
displayName: Install dependencies
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
rm -rf remote/node_modules
|
||||
tar -xzf $(Build.ArtifactStagingDirectory)/reh_node_modules-$(VSCODE_ARCH).tar.gz --directory $(Build.SourcesDirectory)/remote
|
||||
displayName: Extract server node_modules output
|
||||
condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'armhf'))
|
||||
- script: |
|
||||
set -e
|
||||
rm -rf remote/node_modules
|
||||
tar -xzf $(Build.ArtifactStagingDirectory)/reh_node_modules-$(VSCODE_ARCH).tar.gz --directory $(Build.SourcesDirectory)/remote
|
||||
displayName: Extract server node_modules output
|
||||
condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'armhf'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
@@ -203,136 +158,267 @@ steps:
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
displayName: Create node_modules archive
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/mixin
|
||||
displayName: Mix in quality
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/mixin
|
||||
displayName: Mix in quality
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn gulp vscode-linux-$(VSCODE_ARCH)-min-ci
|
||||
displayName: Build
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn gulp vscode-linux-$(VSCODE_ARCH)-min-ci
|
||||
displayName: Build
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/mixin --server
|
||||
displayName: Mix in server quality
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/mixin --server
|
||||
displayName: Mix in server quality
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn gulp vscode-reh-linux-$(VSCODE_ARCH)-min-ci
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn gulp vscode-reh-web-linux-$(VSCODE_ARCH)-min-ci
|
||||
displayName: Build Server
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn gulp vscode-reh-linux-$(VSCODE_ARCH)-min-ci
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn gulp vscode-reh-web-linux-$(VSCODE_ARCH)-min-ci
|
||||
displayName: Build Server
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn gulp "transpile-client" "transpile-extensions"
|
||||
displayName: Transpile
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn npm-run-all -lp "electron $(VSCODE_ARCH)" "playwright-install"
|
||||
displayName: Download Electron and Playwright
|
||||
|
||||
- ${{ if or(eq(parameters.VSCODE_RUN_UNIT_TESTS, true), eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true), eq(parameters.VSCODE_RUN_SMOKE_TESTS, true)) }}:
|
||||
- template: product-build-linux-client-test.yml
|
||||
parameters:
|
||||
VSCODE_QUALITY: ${{ parameters.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: ${{ parameters.VSCODE_RUN_UNIT_TESTS }}
|
||||
VSCODE_RUN_INTEGRATION_TESTS: ${{ parameters.VSCODE_RUN_INTEGRATION_TESTS }}
|
||||
VSCODE_RUN_SMOKE_TESTS: ${{ parameters.VSCODE_RUN_SMOKE_TESTS }}
|
||||
- script: |
|
||||
set -e
|
||||
APP_ROOT=$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)
|
||||
ELECTRON_ROOT=.build/electron
|
||||
sudo chown root $APP_ROOT/chrome-sandbox
|
||||
sudo chown root $ELECTRON_ROOT/chrome-sandbox
|
||||
sudo chmod 4755 $APP_ROOT/chrome-sandbox
|
||||
sudo chmod 4755 $ELECTRON_ROOT/chrome-sandbox
|
||||
stat $APP_ROOT/chrome-sandbox
|
||||
stat $ELECTRON_ROOT/chrome-sandbox
|
||||
displayName: Change setuid helper binary permission
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- script: |
|
||||
set -e
|
||||
yarn gulp "vscode-linux-$(VSCODE_ARCH)-build-deb"
|
||||
yarn gulp "vscode-linux-$(VSCODE_ARCH)-build-rpm"
|
||||
displayName: Build deb, rpm packages
|
||||
- script: |
|
||||
set -e
|
||||
./scripts/test.sh --build --tfs "Unit Tests"
|
||||
displayName: Run unit tests (Electron)
|
||||
timeoutInMinutes: 15
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- script: |
|
||||
set -e
|
||||
yarn gulp "vscode-linux-$(VSCODE_ARCH)-prepare-snap"
|
||||
displayName: Prepare snap package
|
||||
- script: |
|
||||
set -e
|
||||
yarn test-node --build
|
||||
displayName: Run unit tests (node.js)
|
||||
timeoutInMinutes: 15
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- task: UseDotNet@2
|
||||
inputs:
|
||||
version: 2.x
|
||||
- script: |
|
||||
set -e
|
||||
DEBUG=*browser* yarn test-browser-no-install --build --browser chromium --tfs "Browser Unit Tests"
|
||||
displayName: Run unit tests (Browser, Chromium)
|
||||
timeoutInMinutes: 15
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- task: EsrpClientTool@1
|
||||
displayName: Download ESRPClient
|
||||
- script: |
|
||||
# Figure out the full absolute path of the product we just built
|
||||
# including the remote server and configure the integration tests
|
||||
# to run with these builds instead of running out of sources.
|
||||
set -e
|
||||
APP_ROOT=$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)
|
||||
APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName")
|
||||
INTEGRATION_TEST_APP_NAME="$APP_NAME" \
|
||||
INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-linux-$(VSCODE_ARCH)" \
|
||||
./scripts/test-integration.sh --build --tfs "Integration Tests"
|
||||
displayName: Run integration tests (Electron)
|
||||
timeoutInMinutes: 20
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/common/sign "$(esrpclient.toolpath)/$(esrpclient.toolname)" rpm $(ESRP-PKI) $(esrp-aad-username) $(esrp-aad-password) .build/linux/rpm '*.rpm'
|
||||
displayName: Codesign rpm
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-linux-$(VSCODE_ARCH)" \
|
||||
./scripts/test-web-integration.sh --browser chromium
|
||||
displayName: Run integration tests (Browser, Chromium)
|
||||
timeoutInMinutes: 20
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_ARCH="$(VSCODE_ARCH)" \
|
||||
./build/azure-pipelines/linux/prepare-publish.sh
|
||||
displayName: Prepare for Publish
|
||||
- script: |
|
||||
set -e
|
||||
APP_ROOT=$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)
|
||||
APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName")
|
||||
INTEGRATION_TEST_APP_NAME="$APP_NAME" \
|
||||
INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-linux-$(VSCODE_ARCH)" \
|
||||
./scripts/test-remote-integration.sh
|
||||
displayName: Run integration tests (Remote)
|
||||
timeoutInMinutes: 20
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
|
||||
displayName: Generate SBOM (client)
|
||||
inputs:
|
||||
BuildDropPath: $(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)
|
||||
PackageName: Visual Studio Code
|
||||
- script: |
|
||||
set -e
|
||||
ps -ef
|
||||
cat /proc/sys/fs/inotify/max_user_watches
|
||||
lsof | wc -l
|
||||
displayName: Diagnostics before smoke test run (processes, max_user_watches, number of opened file handles)
|
||||
continueOnError: true
|
||||
condition: and(succeededOrFailed(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- publish: $(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)/_manifest
|
||||
displayName: Publish SBOM (client)
|
||||
artifact: vscode_client_linux_$(VSCODE_ARCH)_sbom
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-linux-$(VSCODE_ARCH)" \
|
||||
yarn smoketest-no-compile --web --tracing --headless --electronArgs="--disable-dev-shm-usage"
|
||||
timeoutInMinutes: 10
|
||||
displayName: Run smoke tests (Browser, Chromium)
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
|
||||
displayName: Generate SBOM (server)
|
||||
inputs:
|
||||
BuildDropPath: $(agent.builddirectory)/vscode-server-linux-$(VSCODE_ARCH)
|
||||
PackageName: Visual Studio Code Server
|
||||
- script: |
|
||||
set -e
|
||||
APP_PATH=$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)
|
||||
yarn smoketest-no-compile --tracing --build "$APP_PATH"
|
||||
timeoutInMinutes: 20
|
||||
displayName: Run smoke tests (Electron)
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- publish: $(agent.builddirectory)/vscode-server-linux-$(VSCODE_ARCH)/_manifest
|
||||
displayName: Publish SBOM (server)
|
||||
artifact: vscode_server_linux_$(VSCODE_ARCH)_sbom
|
||||
- script: |
|
||||
set -e
|
||||
APP_PATH=$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-linux-$(VSCODE_ARCH)" \
|
||||
yarn smoketest-no-compile --tracing --remote --build "$APP_PATH"
|
||||
timeoutInMinutes: 20
|
||||
displayName: Run smoke tests (Remote)
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- publish: $(DEB_PATH)
|
||||
artifact: vscode_client_linux_$(VSCODE_ARCH)_deb-package
|
||||
displayName: Publish deb package
|
||||
- script: |
|
||||
set -e
|
||||
ps -ef
|
||||
cat /proc/sys/fs/inotify/max_user_watches
|
||||
lsof | wc -l
|
||||
displayName: Diagnostics after smoke test run (processes, max_user_watches, number of opened file handles)
|
||||
continueOnError: true
|
||||
condition: and(succeededOrFailed(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- publish: $(RPM_PATH)
|
||||
artifact: vscode_client_linux_$(VSCODE_ARCH)_rpm-package
|
||||
displayName: Publish rpm package
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
artifactName: crash-dump-linux-$(VSCODE_ARCH)
|
||||
targetPath: .build/crashes
|
||||
displayName: "Publish Crash Reports"
|
||||
continueOnError: true
|
||||
condition: failed()
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- publish: $(TARBALL_PATH)
|
||||
artifact: vscode_client_linux_$(VSCODE_ARCH)_archive-unsigned
|
||||
displayName: Publish client archive
|
||||
# In order to properly symbolify above crash reports
|
||||
# (if any), we need the compiled native modules too
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
artifactName: node-modules-linux-$(VSCODE_ARCH)
|
||||
targetPath: node_modules
|
||||
displayName: "Publish Node Modules"
|
||||
continueOnError: true
|
||||
condition: failed()
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- publish: $(Agent.BuildDirectory)/vscode-server-linux-$(VSCODE_ARCH).tar.gz
|
||||
artifact: vscode_server_linux_$(VSCODE_ARCH)_archive-unsigned
|
||||
displayName: Publish server archive
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
artifactName: logs-linux-$(VSCODE_ARCH)-$(System.JobAttempt)
|
||||
targetPath: .build/logs
|
||||
displayName: "Publish Log Files"
|
||||
continueOnError: true
|
||||
condition: and(failed(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- publish: $(Agent.BuildDirectory)/vscode-server-linux-$(VSCODE_ARCH)-web.tar.gz
|
||||
artifact: vscode_web_linux_$(VSCODE_ARCH)_archive-unsigned
|
||||
displayName: Publish web server archive
|
||||
- task: PublishTestResults@2
|
||||
displayName: Publish Tests Results
|
||||
inputs:
|
||||
testResultsFiles: "*-results.xml"
|
||||
searchFolder: "$(Build.ArtifactStagingDirectory)/test-results"
|
||||
condition: and(succeededOrFailed(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: "Publish Pipeline Artifact"
|
||||
inputs:
|
||||
artifactName: "snap-$(VSCODE_ARCH)"
|
||||
targetPath: .build/linux/snap-tarball
|
||||
- script: |
|
||||
set -e
|
||||
yarn gulp "vscode-linux-$(VSCODE_ARCH)-build-deb"
|
||||
yarn gulp "vscode-linux-$(VSCODE_ARCH)-build-rpm"
|
||||
displayName: Build deb, rpm packages
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn gulp "vscode-linux-$(VSCODE_ARCH)-prepare-snap"
|
||||
displayName: Prepare snap package
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- task: UseDotNet@2
|
||||
inputs:
|
||||
version: 2.x
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- task: EsrpClientTool@1
|
||||
displayName: Download ESRPClient
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/common/sign "$(esrpclient.toolpath)/$(esrpclient.toolname)" rpm $(ESRP-PKI) $(esrp-aad-username) $(esrp-aad-password) .build/linux/rpm '*.rpm'
|
||||
displayName: Codesign rpm
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_ARCH="$(VSCODE_ARCH)" \
|
||||
./build/azure-pipelines/linux/prepare-publish.sh
|
||||
displayName: Prepare for Publish
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- publish: $(DEB_PATH)
|
||||
artifact: vscode_client_linux_$(VSCODE_ARCH)_deb-package
|
||||
displayName: Publish deb package
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- publish: $(RPM_PATH)
|
||||
artifact: vscode_client_linux_$(VSCODE_ARCH)_rpm-package
|
||||
displayName: Publish rpm package
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- publish: $(TARBALL_PATH)
|
||||
artifact: vscode_client_linux_$(VSCODE_ARCH)_archive-unsigned
|
||||
displayName: Publish client archive
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- publish: $(Agent.BuildDirectory)/vscode-server-linux-$(VSCODE_ARCH).tar.gz
|
||||
artifact: vscode_server_linux_$(VSCODE_ARCH)_archive-unsigned
|
||||
displayName: Publish server archive
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- publish: $(Agent.BuildDirectory)/vscode-server-linux-$(VSCODE_ARCH)-web.tar.gz
|
||||
artifact: vscode_web_linux_$(VSCODE_ARCH)_archive-unsigned
|
||||
displayName: Publish web server archive
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: "Publish Pipeline Artifact"
|
||||
inputs:
|
||||
artifactName: "snap-$(VSCODE_ARCH)"
|
||||
targetPath: .build/linux/snap-tarball
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
|
||||
displayName: Generate SBOM (client)
|
||||
inputs:
|
||||
BuildDropPath: $(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)
|
||||
PackageName: Visual Studio Code
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- publish: $(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)/_manifest
|
||||
displayName: Publish SBOM (client)
|
||||
artifact: vscode_client_linux_$(VSCODE_ARCH)_sbom
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
|
||||
displayName: Generate SBOM (server)
|
||||
inputs:
|
||||
BuildDropPath: $(agent.builddirectory)/vscode-server-linux-$(VSCODE_ARCH)
|
||||
PackageName: Visual Studio Code Server
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- publish: $(agent.builddirectory)/vscode-server-linux-$(VSCODE_ARCH)/_manifest
|
||||
displayName: Publish SBOM (server)
|
||||
artifact: vscode_server_linux_$(VSCODE_ARCH)_sbom
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
@@ -1,58 +1,49 @@
|
||||
parameters:
|
||||
- name: VSCODE_QUALITY
|
||||
type: string
|
||||
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "16.x"
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- task: AzureKeyVault@1
|
||||
displayName: "Azure Key Vault: Get Secrets"
|
||||
inputs:
|
||||
azureSubscription: "vscode-builds-subscription"
|
||||
KeyVaultName: vscode
|
||||
SecretsFilter: "github-distro-mixin-password,ESRP-PKI,esrp-aad-username,esrp-aad-password"
|
||||
- task: AzureKeyVault@1
|
||||
displayName: "Azure Key Vault: Get Secrets"
|
||||
inputs:
|
||||
azureSubscription: "vscode-builds-subscription"
|
||||
KeyVaultName: vscode
|
||||
SecretsFilter: "github-distro-mixin-password,ESRP-PKI,esrp-aad-username,esrp-aad-password"
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- task: Docker@1
|
||||
displayName: "Pull Docker image"
|
||||
inputs:
|
||||
azureSubscriptionEndpoint: "vscode-builds-subscription"
|
||||
azureContainerRegistry: vscodehub.azurecr.io
|
||||
command: "Run an image"
|
||||
imageName: "vscode-linux-build-agent:centos7-devtoolset8-arm64"
|
||||
containerCommand: uname
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'arm64'))
|
||||
- task: Docker@1
|
||||
displayName: "Pull Docker image"
|
||||
inputs:
|
||||
azureSubscriptionEndpoint: "vscode-builds-subscription"
|
||||
azureContainerRegistry: vscodehub.azurecr.io
|
||||
command: "Run an image"
|
||||
imageName: "vscode-linux-build-agent:centos7-devtoolset8-arm64"
|
||||
containerCommand: uname
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
cat << EOF > ~/.netrc
|
||||
machine github.com
|
||||
login vscode
|
||||
password $(github-distro-mixin-password)
|
||||
EOF
|
||||
- script: |
|
||||
set -e
|
||||
cat << EOF > ~/.netrc
|
||||
machine github.com
|
||||
login vscode
|
||||
password $(github-distro-mixin-password)
|
||||
EOF
|
||||
|
||||
git config user.email "vscode@microsoft.com"
|
||||
git config user.name "VSCode"
|
||||
displayName: Prepare tooling
|
||||
git config user.email "vscode@microsoft.com"
|
||||
git config user.name "VSCode"
|
||||
displayName: Prepare tooling
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
git fetch https://github.com/$(VSCODE_MIXIN_REPO).git $VSCODE_DISTRO_REF
|
||||
echo "##vso[task.setvariable variable=VSCODE_DISTRO_COMMIT;]$(git rev-parse FETCH_HEAD)"
|
||||
git checkout FETCH_HEAD
|
||||
condition: and(succeeded(), ne(variables.VSCODE_DISTRO_REF, ' '))
|
||||
displayName: Checkout override commit
|
||||
- script: |
|
||||
set -e
|
||||
git fetch https://github.com/$(VSCODE_MIXIN_REPO).git $VSCODE_DISTRO_REF
|
||||
echo "##vso[task.setvariable variable=VSCODE_DISTRO_COMMIT;]$(git rev-parse FETCH_HEAD)"
|
||||
git checkout FETCH_HEAD
|
||||
condition: and(succeeded(), ne(variables.VSCODE_DISTRO_REF, ' '))
|
||||
displayName: Checkout override commit
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro")
|
||||
displayName: Merge distro
|
||||
- script: |
|
||||
set -e
|
||||
git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro")
|
||||
displayName: Merge distro
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
@@ -70,19 +61,17 @@ steps:
|
||||
GITHUB_TOKEN: "$(github-distro-mixin-password)"
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'))
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
displayName: Register Docker QEMU
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'arm64'))
|
||||
- script: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
displayName: Register Docker QEMU
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
docker run -e VSCODE_QUALITY -e GITHUB_TOKEN -v $(pwd):/root/vscode -v ~/.netrc:/root/.netrc vscodehub.azurecr.io/vscode-linux-build-agent:centos7-devtoolset8-arm64 /root/vscode/build/azure-pipelines/linux/scripts/install-remote-dependencies.sh
|
||||
displayName: Install dependencies via qemu
|
||||
env:
|
||||
GITHUB_TOKEN: "$(github-distro-mixin-password)"
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'arm64'))
|
||||
- script: |
|
||||
set -e
|
||||
docker run -e VSCODE_QUALITY -e GITHUB_TOKEN -v $(pwd):/root/vscode -v ~/.netrc:/root/.netrc vscodehub.azurecr.io/vscode-linux-build-agent:centos7-devtoolset8-arm64 /root/vscode/build/azure-pipelines/linux/scripts/install-remote-dependencies.sh
|
||||
displayName: Install dependencies via qemu
|
||||
env:
|
||||
GITHUB_TOKEN: "$(github-distro-mixin-password)"
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
|
||||
@@ -136,56 +136,54 @@ steps:
|
||||
displayName: Run core integration tests
|
||||
condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'), ne(variables['EXTENSIONS_ONLY'], 'true'))
|
||||
|
||||
# {{SQL CARBON TODO}} Reenable "Run Extension Unit Tests (Continue on Error)" and "Run Extension Unit Tests (Fail on Error)" and "Archive Logs"
|
||||
# - script: |
|
||||
# # Figure out the full absolute path of the product we just built
|
||||
# # including the remote server and configure the unit tests
|
||||
# # to run with these builds instead of running out of sources.
|
||||
# set -e
|
||||
# APP_ROOT=$(agent.builddirectory)/azuredatastudio-linux-x64
|
||||
# APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName")
|
||||
# INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \
|
||||
# NO_CLEANUP=1 \
|
||||
# VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/azuredatastudio-reh-linux-x64" \
|
||||
# DISPLAY=:10 ./scripts/test-extensions-unit.sh --build --tfs "Extension Unit Tests"
|
||||
# displayName: Run Extension Unit Tests (Continue on Error)
|
||||
# continueOnError: true
|
||||
# condition: and(succeeded(), and(eq(variables['RUN_TESTS'], 'true'), eq(variables['EXTENSION_UNIT_TESTS_FAIL_ON_ERROR'], 'false')))
|
||||
- script: |
|
||||
# Figure out the full absolute path of the product we just built
|
||||
# including the remote server and configure the unit tests
|
||||
# to run with these builds instead of running out of sources.
|
||||
set -e
|
||||
APP_ROOT=$(agent.builddirectory)/azuredatastudio-linux-x64
|
||||
APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName")
|
||||
INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \
|
||||
NO_CLEANUP=1 \
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/azuredatastudio-reh-linux-x64" \
|
||||
DISPLAY=:10 ./scripts/test-extensions-unit.sh --build --tfs "Extension Unit Tests"
|
||||
displayName: Run Extension Unit Tests (Continue on Error)
|
||||
continueOnError: true
|
||||
condition: and(succeeded(), and(eq(variables['RUN_TESTS'], 'true'), eq(variables['EXTENSION_UNIT_TESTS_FAIL_ON_ERROR'], 'false')))
|
||||
|
||||
# - script: |
|
||||
# # Figure out the full absolute path of the product we just built
|
||||
# # including the remote server and configure the unit tests
|
||||
# # to run with these builds instead of running out of sources.
|
||||
# set -e
|
||||
# APP_ROOT=$(agent.builddirectory)/azuredatastudio-linux-x64
|
||||
# APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName")
|
||||
# INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \
|
||||
# NO_CLEANUP=1 \
|
||||
# VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/azuredatastudio-reh-linux-x64" \
|
||||
# DISPLAY=:10 ./scripts/test-extensions-unit.sh --build --tfs "Extension Unit Tests"
|
||||
# displayName: Run Extension Unit Tests (Fail on Error)
|
||||
# condition: and(succeeded(), and(eq(variables['RUN_TESTS'], 'true'), ne(variables['EXTENSION_UNIT_TESTS_FAIL_ON_ERROR'], 'false')))
|
||||
- script: |
|
||||
# Figure out the full absolute path of the product we just built
|
||||
# including the remote server and configure the unit tests
|
||||
# to run with these builds instead of running out of sources.
|
||||
set -e
|
||||
APP_ROOT=$(agent.builddirectory)/azuredatastudio-linux-x64
|
||||
APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName")
|
||||
INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \
|
||||
NO_CLEANUP=1 \
|
||||
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/azuredatastudio-reh-linux-x64" \
|
||||
DISPLAY=:10 ./scripts/test-extensions-unit.sh --build --tfs "Extension Unit Tests"
|
||||
displayName: Run Extension Unit Tests (Fail on Error)
|
||||
condition: and(succeeded(), and(eq(variables['RUN_TESTS'], 'true'), ne(variables['EXTENSION_UNIT_TESTS_FAIL_ON_ERROR'], 'false')))
|
||||
|
||||
# - bash: |
|
||||
# set -e
|
||||
# mkdir -p $(Build.ArtifactStagingDirectory)/logs/linux-x64
|
||||
# cd /tmp
|
||||
# for folder in adsuser*/
|
||||
# do
|
||||
# folder=${folder%/}
|
||||
# # Only archive directories we want for debugging purposes
|
||||
# tar -czvf $(Build.ArtifactStagingDirectory)/logs/linux-x64/$folder.tar.gz $folder/User $folder/logs
|
||||
# done
|
||||
# displayName: Archive Logs
|
||||
# continueOnError: true
|
||||
# condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'))
|
||||
- bash: |
|
||||
set -e
|
||||
mkdir -p $(Build.ArtifactStagingDirectory)/logs/linux-x64
|
||||
cd /tmp
|
||||
for folder in adsuser*/
|
||||
do
|
||||
folder=${folder%/}
|
||||
# Only archive directories we want for debugging purposes
|
||||
tar -czvf $(Build.ArtifactStagingDirectory)/logs/linux-x64/$folder.tar.gz $folder/User $folder/logs
|
||||
done
|
||||
displayName: Archive Logs
|
||||
continueOnError: true
|
||||
condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'))
|
||||
|
||||
# {{SQL CARBON TODO}} - Reenable
|
||||
# - script: |
|
||||
# set -e
|
||||
# yarn gulp vscode-linux-x64-build-deb
|
||||
# displayName: Build Deb
|
||||
# condition: and(succeeded(), ne(variables['EXTENSIONS_ONLY'], 'true'))
|
||||
- script: |
|
||||
set -e
|
||||
yarn gulp vscode-linux-x64-build-deb
|
||||
displayName: Build Deb
|
||||
condition: and(succeeded(), ne(variables['EXTENSIONS_ONLY'], 'true'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const json = require("gulp-json-editor");
|
||||
const buffer = require('gulp-buffer');
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as json from 'gulp-json-editor';
|
||||
const buffer = require('gulp-buffer');
|
||||
import * as filter from 'gulp-filter';
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
steps:
|
||||
- checkout: self
|
||||
fetchDepth: 1
|
||||
retryCountOnTaskFailure: 3
|
||||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "16.x"
|
||||
|
||||
- script: |
|
||||
mkdir -p .build
|
||||
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $ENABLE_TERRAPIN > .build/yarnlockhash
|
||||
displayName: Prepare yarn cache flags
|
||||
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: "genericNodeModules | $(Agent.OS) | .build/yarnlockhash"
|
||||
path: .build/node_modules_cache
|
||||
cacheHitVar: NODE_MODULES_RESTORED
|
||||
displayName: Restore node_modules cache
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
tar -xzf .build/node_modules_cache/cache.tgz
|
||||
condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
displayName: Extract node_modules cache
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
npx https://aka.ms/enablesecurefeed standAlone
|
||||
timeoutInMinutes: 5
|
||||
retryCountOnTaskFailure: 3
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), eq(variables['ENABLE_TERRAPIN'], 'true'))
|
||||
displayName: Switch to Terrapin packages
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
for i in {1..3}; do # try 3 times, for Terrapin
|
||||
yarn --frozen-lockfile --check-files && break
|
||||
if [ $i -eq 3 ]; then
|
||||
echo "Yarn failed too many times" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Yarn failed $i, trying again..."
|
||||
done
|
||||
env:
|
||||
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||
GITHUB_TOKEN: "$(github-distro-mixin-password)"
|
||||
displayName: Install dependencies
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt
|
||||
mkdir -p .build/node_modules_cache
|
||||
tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
displayName: Create node_modules archive
|
||||
@@ -1,189 +0,0 @@
|
||||
trigger:
|
||||
- main
|
||||
- release/*
|
||||
|
||||
pr:
|
||||
branches:
|
||||
include: ["main", "release/*"]
|
||||
|
||||
variables:
|
||||
- name: Codeql.SkipTaskAutoInjection
|
||||
value: true
|
||||
- name: skipComponentGovernanceDetection
|
||||
value: true
|
||||
- name: ENABLE_TERRAPIN
|
||||
value: false
|
||||
- name: VSCODE_CIBUILD
|
||||
value: ${{ in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI') }}
|
||||
- name: VSCODE_PUBLISH
|
||||
value: false
|
||||
- name: VSCODE_QUALITY
|
||||
value: oss
|
||||
- name: VSCODE_STEP_ON_IT
|
||||
value: false
|
||||
|
||||
jobs:
|
||||
- ${{ if ne(variables['VSCODE_CIBUILD'], true) }}:
|
||||
- job: Compile
|
||||
displayName: Compile & Hygiene
|
||||
pool: vscode-1es-vscode-linux-20.04
|
||||
timeoutInMinutes: 30
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
steps:
|
||||
- template: product-compile.yml
|
||||
parameters:
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
|
||||
- job: Linuxx64UnitTest
|
||||
displayName: Linux (Unit Tests)
|
||||
pool: vscode-1es-vscode-linux-20.04
|
||||
timeoutInMinutes: 30
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
NPM_ARCH: x64
|
||||
DISPLAY: ":10"
|
||||
steps:
|
||||
- template: linux/product-build-linux-client.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: true
|
||||
VSCODE_RUN_INTEGRATION_TESTS: false
|
||||
VSCODE_RUN_SMOKE_TESTS: false
|
||||
|
||||
- job: Linuxx64IntegrationTest
|
||||
displayName: Linux (Integration Tests)
|
||||
pool: vscode-1es-vscode-linux-20.04
|
||||
timeoutInMinutes: 30
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
NPM_ARCH: x64
|
||||
DISPLAY: ":10"
|
||||
steps:
|
||||
- template: linux/product-build-linux-client.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: false
|
||||
VSCODE_RUN_INTEGRATION_TESTS: true
|
||||
VSCODE_RUN_SMOKE_TESTS: false
|
||||
|
||||
- job: Linuxx64SmokeTest
|
||||
displayName: Linux (Smoke Tests)
|
||||
pool: vscode-1es-vscode-linux-20.04
|
||||
timeoutInMinutes: 30
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
NPM_ARCH: x64
|
||||
DISPLAY: ":10"
|
||||
steps:
|
||||
- template: linux/product-build-linux-client.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: false
|
||||
VSCODE_RUN_INTEGRATION_TESTS: false
|
||||
VSCODE_RUN_SMOKE_TESTS: true
|
||||
|
||||
- ${{ if eq(variables['VSCODE_CIBUILD'], true) }}:
|
||||
- job: Linuxx64MaintainNodeModulesCache
|
||||
displayName: Linux (Maintain node_modules cache)
|
||||
pool: vscode-1es-vscode-linux-20.04
|
||||
timeoutInMinutes: 30
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
steps:
|
||||
- template: product-build-pr-cache.yml
|
||||
|
||||
# - job: macOSUnitTest
|
||||
# displayName: macOS (Unit Tests)
|
||||
# pool:
|
||||
# vmImage: macOS-latest
|
||||
# timeoutInMinutes: 60
|
||||
# variables:
|
||||
# BUILDSECMON_OPT_IN: true
|
||||
# VSCODE_ARCH: x64
|
||||
# steps:
|
||||
# - template: darwin/product-build-darwin.yml
|
||||
# parameters:
|
||||
# VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
# VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
# VSCODE_RUN_UNIT_TESTS: true
|
||||
# VSCODE_RUN_INTEGRATION_TESTS: false
|
||||
# VSCODE_RUN_SMOKE_TESTS: false
|
||||
# - job: macOSIntegrationTest
|
||||
# displayName: macOS (Integration Tests)
|
||||
# pool:
|
||||
# vmImage: macOS-latest
|
||||
# timeoutInMinutes: 60
|
||||
# variables:
|
||||
# BUILDSECMON_OPT_IN: true
|
||||
# VSCODE_ARCH: x64
|
||||
# steps:
|
||||
# - template: darwin/product-build-darwin.yml
|
||||
# parameters:
|
||||
# VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
# VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
# VSCODE_RUN_UNIT_TESTS: false
|
||||
# VSCODE_RUN_INTEGRATION_TESTS: true
|
||||
# VSCODE_RUN_SMOKE_TESTS: false
|
||||
# - job: macOSSmokeTest
|
||||
# displayName: macOS (Smoke Tests)
|
||||
# pool:
|
||||
# vmImage: macOS-latest
|
||||
# timeoutInMinutes: 60
|
||||
# variables:
|
||||
# BUILDSECMON_OPT_IN: true
|
||||
# VSCODE_ARCH: x64
|
||||
# steps:
|
||||
# - template: darwin/product-build-darwin.yml
|
||||
# parameters:
|
||||
# VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
# VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
# VSCODE_RUN_UNIT_TESTS: false
|
||||
# VSCODE_RUN_INTEGRATION_TESTS: false
|
||||
# VSCODE_RUN_SMOKE_TESTS: true
|
||||
|
||||
# - job: WindowsUnitTests
|
||||
# displayName: Windows (Unit Tests)
|
||||
# pool: vscode-1es-vscode-windows-2019
|
||||
# timeoutInMinutes: 60
|
||||
# variables:
|
||||
# VSCODE_ARCH: x64
|
||||
# steps:
|
||||
# - template: win32/product-build-win32.yml
|
||||
# parameters:
|
||||
# VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
# VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
# VSCODE_RUN_UNIT_TESTS: true
|
||||
# VSCODE_RUN_INTEGRATION_TESTS: false
|
||||
# VSCODE_RUN_SMOKE_TESTS: false
|
||||
# - job: WindowsIntegrationTests
|
||||
# displayName: Windows (Integration Tests)
|
||||
# pool: vscode-1es-vscode-windows-2019
|
||||
# timeoutInMinutes: 60
|
||||
# variables:
|
||||
# VSCODE_ARCH: x64
|
||||
# steps:
|
||||
# - template: win32/product-build-win32.yml
|
||||
# parameters:
|
||||
# VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
# VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
# VSCODE_RUN_UNIT_TESTS: false
|
||||
# VSCODE_RUN_INTEGRATION_TESTS: true
|
||||
# VSCODE_RUN_SMOKE_TESTS: false
|
||||
# - job: WindowsSmokeTests
|
||||
# displayName: Windows (Smoke Tests)
|
||||
# pool: vscode-1es-vscode-windows-2019
|
||||
# timeoutInMinutes: 60
|
||||
# variables:
|
||||
# VSCODE_ARCH: x64
|
||||
# steps:
|
||||
# - template: win32/product-build-win32.yml
|
||||
# parameters:
|
||||
# VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
# VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
# VSCODE_RUN_UNIT_TESTS: false
|
||||
# VSCODE_RUN_INTEGRATION_TESTS: false
|
||||
# VSCODE_RUN_SMOKE_TESTS: true
|
||||
@@ -8,10 +8,6 @@ schedules:
|
||||
- main
|
||||
- joao/web
|
||||
|
||||
trigger:
|
||||
branches:
|
||||
include: ["main", "release/*"]
|
||||
|
||||
parameters:
|
||||
- name: VSCODE_DISTRO_REF
|
||||
displayName: Distro Ref (Private build)
|
||||
@@ -108,11 +104,9 @@ variables:
|
||||
- name: VSCODE_BUILD_STAGE_WINDOWS
|
||||
value: ${{ or(eq(parameters.VSCODE_BUILD_WIN32, true), eq(parameters.VSCODE_BUILD_WIN32_32BIT, true), eq(parameters.VSCODE_BUILD_WIN32_ARM64, true)) }}
|
||||
- name: VSCODE_BUILD_STAGE_LINUX
|
||||
value: ${{ or(eq(parameters.VSCODE_BUILD_LINUX, true), eq(parameters.VSCODE_BUILD_LINUX_ARMHF, true), eq(parameters.VSCODE_BUILD_LINUX_ARM64, true), eq(parameters.VSCODE_BUILD_LINUX_ALPINE, true), eq(parameters.VSCODE_BUILD_LINUX_ALPINE_ARM64, true)) }}
|
||||
value: ${{ or(eq(parameters.VSCODE_BUILD_LINUX, true), eq(parameters.VSCODE_BUILD_LINUX_ARMHF, true), eq(parameters.VSCODE_BUILD_LINUX_ARM64, true), eq(parameters.VSCODE_BUILD_LINUX_ALPINE, true), eq(parameters.VSCODE_BUILD_LINUX_ALPINE_ARM64, true), eq(parameters.VSCODE_BUILD_WEB, true)) }}
|
||||
- name: VSCODE_BUILD_STAGE_MACOS
|
||||
value: ${{ or(eq(parameters.VSCODE_BUILD_MACOS, true), eq(parameters.VSCODE_BUILD_MACOS_ARM64, true)) }}
|
||||
- name: VSCODE_BUILD_STAGE_WEB
|
||||
value: ${{ eq(parameters.VSCODE_BUILD_WEB, true) }}
|
||||
- name: VSCODE_CIBUILD
|
||||
value: ${{ in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI') }}
|
||||
- name: VSCODE_PUBLISH
|
||||
@@ -168,8 +162,6 @@ stages:
|
||||
VSCODE_ARCH: x64
|
||||
steps:
|
||||
- template: product-compile.yml
|
||||
parameters:
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
|
||||
- ${{ if and(eq(parameters.VSCODE_COMPILE_ONLY, false), eq(variables['VSCODE_BUILD_STAGE_WINDOWS'], true)) }}:
|
||||
- stage: Windows
|
||||
@@ -177,60 +169,13 @@ stages:
|
||||
- Compile
|
||||
pool: vscode-1es-windows
|
||||
jobs:
|
||||
- ${{ if eq(variables['VSCODE_CIBUILD'], true) }}:
|
||||
- job: WindowsUnitTests
|
||||
displayName: Unit Tests
|
||||
timeoutInMinutes: 60
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
steps:
|
||||
- template: win32/product-build-win32.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: true
|
||||
VSCODE_RUN_INTEGRATION_TESTS: false
|
||||
VSCODE_RUN_SMOKE_TESTS: false
|
||||
- job: WindowsIntegrationTests
|
||||
displayName: Integration Tests
|
||||
timeoutInMinutes: 60
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
steps:
|
||||
- template: win32/product-build-win32.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: false
|
||||
VSCODE_RUN_INTEGRATION_TESTS: true
|
||||
VSCODE_RUN_SMOKE_TESTS: false
|
||||
- job: WindowsSmokeTests
|
||||
displayName: Smoke Tests
|
||||
timeoutInMinutes: 60
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
steps:
|
||||
- template: win32/product-build-win32.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: false
|
||||
VSCODE_RUN_INTEGRATION_TESTS: false
|
||||
VSCODE_RUN_SMOKE_TESTS: true
|
||||
|
||||
- ${{ if and(eq(variables['VSCODE_CIBUILD'], false), eq(parameters.VSCODE_BUILD_WIN32, true)) }}:
|
||||
- ${{ if eq(parameters.VSCODE_BUILD_WIN32, true) }}:
|
||||
- job: Windows
|
||||
timeoutInMinutes: 120
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
steps:
|
||||
- template: win32/product-build-win32.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: ${{ eq(parameters.VSCODE_STEP_ON_IT, false) }}
|
||||
VSCODE_RUN_INTEGRATION_TESTS: ${{ eq(parameters.VSCODE_STEP_ON_IT, false) }}
|
||||
VSCODE_RUN_SMOKE_TESTS: ${{ eq(parameters.VSCODE_STEP_ON_IT, false) }}
|
||||
|
||||
- ${{ if and(eq(variables['VSCODE_CIBUILD'], false), eq(parameters.VSCODE_BUILD_WIN32_32BIT, true)) }}:
|
||||
- job: Windows32
|
||||
@@ -239,12 +184,6 @@ stages:
|
||||
VSCODE_ARCH: ia32
|
||||
steps:
|
||||
- template: win32/product-build-win32.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: ${{ eq(parameters.VSCODE_STEP_ON_IT, false) }}
|
||||
VSCODE_RUN_INTEGRATION_TESTS: ${{ eq(parameters.VSCODE_STEP_ON_IT, false) }}
|
||||
VSCODE_RUN_SMOKE_TESTS: ${{ eq(parameters.VSCODE_STEP_ON_IT, false) }}
|
||||
|
||||
- ${{ if and(eq(variables['VSCODE_CIBUILD'], false), eq(parameters.VSCODE_BUILD_WIN32_ARM64, true)) }}:
|
||||
- job: WindowsARM64
|
||||
@@ -253,12 +192,6 @@ stages:
|
||||
VSCODE_ARCH: arm64
|
||||
steps:
|
||||
- template: win32/product-build-win32.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: false
|
||||
VSCODE_RUN_INTEGRATION_TESTS: false
|
||||
VSCODE_RUN_SMOKE_TESTS: false
|
||||
|
||||
- ${{ if and(eq(parameters.VSCODE_COMPILE_ONLY, false), eq(variables['VSCODE_BUILD_STAGE_LINUX'], true)) }}:
|
||||
- stage: LinuxServerDependencies
|
||||
@@ -273,17 +206,13 @@ stages:
|
||||
NPM_ARCH: x64
|
||||
steps:
|
||||
- template: linux/product-build-linux-server.yml
|
||||
parameters:
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
|
||||
- ${{ if and(eq(variables['VSCODE_CIBUILD'], false), eq(parameters.VSCODE_BUILD_LINUX_ARM64, true)) }}:
|
||||
- ${{ if eq(parameters.VSCODE_BUILD_LINUX, true) }}:
|
||||
- job: arm64
|
||||
variables:
|
||||
VSCODE_ARCH: arm64
|
||||
steps:
|
||||
- template: linux/product-build-linux-server.yml
|
||||
parameters:
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
|
||||
- ${{ if and(eq(parameters.VSCODE_COMPILE_ONLY, false), eq(variables['VSCODE_BUILD_STAGE_LINUX'], true)) }}:
|
||||
- stage: Linux
|
||||
@@ -292,54 +221,7 @@ stages:
|
||||
- LinuxServerDependencies
|
||||
pool: vscode-1es-linux
|
||||
jobs:
|
||||
- ${{ if eq(variables['VSCODE_CIBUILD'], true) }}:
|
||||
- job: Linuxx64UnitTest
|
||||
displayName: Unit Tests
|
||||
container: vscode-bionic-x64
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
NPM_ARCH: x64
|
||||
DISPLAY: ":10"
|
||||
steps:
|
||||
- template: linux/product-build-linux-client.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: true
|
||||
VSCODE_RUN_INTEGRATION_TESTS: false
|
||||
VSCODE_RUN_SMOKE_TESTS: false
|
||||
- job: Linuxx64IntegrationTest
|
||||
displayName: Integration Tests
|
||||
container: vscode-bionic-x64
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
NPM_ARCH: x64
|
||||
DISPLAY: ":10"
|
||||
steps:
|
||||
- template: linux/product-build-linux-client.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: false
|
||||
VSCODE_RUN_INTEGRATION_TESTS: true
|
||||
VSCODE_RUN_SMOKE_TESTS: false
|
||||
- job: Linuxx64SmokeTest
|
||||
displayName: Smoke Tests
|
||||
container: vscode-bionic-x64
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
NPM_ARCH: x64
|
||||
DISPLAY: ":10"
|
||||
steps:
|
||||
- template: linux/product-build-linux-client.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: false
|
||||
VSCODE_RUN_INTEGRATION_TESTS: false
|
||||
VSCODE_RUN_SMOKE_TESTS: true
|
||||
|
||||
- ${{ if and(eq(variables['VSCODE_CIBUILD'], false), eq(parameters.VSCODE_BUILD_LINUX, true)) }}:
|
||||
- ${{ if eq(parameters.VSCODE_BUILD_LINUX, true) }}:
|
||||
- job: Linuxx64
|
||||
container: vscode-bionic-x64
|
||||
variables:
|
||||
@@ -348,12 +230,6 @@ stages:
|
||||
DISPLAY: ":10"
|
||||
steps:
|
||||
- template: linux/product-build-linux-client.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: ${{ eq(parameters.VSCODE_STEP_ON_IT, false) }}
|
||||
VSCODE_RUN_INTEGRATION_TESTS: ${{ eq(parameters.VSCODE_STEP_ON_IT, false) }}
|
||||
VSCODE_RUN_SMOKE_TESTS: ${{ eq(parameters.VSCODE_STEP_ON_IT, false) }}
|
||||
|
||||
- ${{ if and(eq(variables['VSCODE_CIBUILD'], false), eq(parameters.VSCODE_BUILD_LINUX, true), ne(variables['VSCODE_PUBLISH'], 'false')) }}:
|
||||
- job: LinuxSnap
|
||||
@@ -373,12 +249,6 @@ stages:
|
||||
NPM_ARCH: armv7l
|
||||
steps:
|
||||
- template: linux/product-build-linux-client.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: false
|
||||
VSCODE_RUN_INTEGRATION_TESTS: false
|
||||
VSCODE_RUN_SMOKE_TESTS: false
|
||||
|
||||
# TODO@joaomoreno: We don't ship ARM snaps for now
|
||||
- ${{ if and(false, eq(variables['VSCODE_CIBUILD'], false), eq(parameters.VSCODE_BUILD_LINUX_ARMHF, true)) }}:
|
||||
@@ -399,12 +269,6 @@ stages:
|
||||
NPM_ARCH: arm64
|
||||
steps:
|
||||
- template: linux/product-build-linux-client.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: false
|
||||
VSCODE_RUN_INTEGRATION_TESTS: false
|
||||
VSCODE_RUN_SMOKE_TESTS: false
|
||||
|
||||
# TODO@joaomoreno: We don't ship ARM snaps for now
|
||||
- ${{ if and(false, eq(variables['VSCODE_CIBUILD'], false), eq(parameters.VSCODE_BUILD_LINUX_ARM64, true)) }}:
|
||||
@@ -432,6 +296,13 @@ stages:
|
||||
steps:
|
||||
- template: linux/product-build-alpine.yml
|
||||
|
||||
- ${{ if and(eq(variables['VSCODE_CIBUILD'], false), eq(parameters.VSCODE_BUILD_WEB, true)) }}:
|
||||
- job: LinuxWeb
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
steps:
|
||||
- template: web/product-build-web.yml
|
||||
|
||||
- ${{ if and(eq(parameters.VSCODE_COMPILE_ONLY, false), eq(variables['VSCODE_BUILD_STAGE_MACOS'], true)) }}:
|
||||
- stage: macOS
|
||||
dependsOn:
|
||||
@@ -441,76 +312,20 @@ stages:
|
||||
variables:
|
||||
BUILDSECMON_OPT_IN: true
|
||||
jobs:
|
||||
- ${{ if eq(variables['VSCODE_CIBUILD'], true) }}:
|
||||
- job: macOSUnitTest
|
||||
displayName: Unit Tests
|
||||
- ${{ if eq(parameters.VSCODE_BUILD_MACOS, true) }}:
|
||||
- job: macOSTest
|
||||
timeoutInMinutes: 90
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
steps:
|
||||
- template: darwin/product-build-darwin.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: true
|
||||
VSCODE_RUN_INTEGRATION_TESTS: false
|
||||
VSCODE_RUN_SMOKE_TESTS: false
|
||||
- job: macOSIntegrationTest
|
||||
displayName: Integration Tests
|
||||
timeoutInMinutes: 90
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
steps:
|
||||
- template: darwin/product-build-darwin.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: false
|
||||
VSCODE_RUN_INTEGRATION_TESTS: true
|
||||
VSCODE_RUN_SMOKE_TESTS: false
|
||||
- job: macOSSmokeTest
|
||||
displayName: Smoke Tests
|
||||
timeoutInMinutes: 90
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
steps:
|
||||
- template: darwin/product-build-darwin.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: false
|
||||
VSCODE_RUN_INTEGRATION_TESTS: false
|
||||
VSCODE_RUN_SMOKE_TESTS: true
|
||||
|
||||
- ${{ if and(eq(variables['VSCODE_CIBUILD'], false), eq(parameters.VSCODE_BUILD_MACOS, true)) }}:
|
||||
- job: macOS
|
||||
timeoutInMinutes: 90
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
steps:
|
||||
- template: darwin/product-build-darwin.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: false
|
||||
VSCODE_RUN_INTEGRATION_TESTS: false
|
||||
VSCODE_RUN_SMOKE_TESTS: false
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_STEP_ON_IT, false) }}:
|
||||
- job: macOSTest
|
||||
- template: darwin/product-build-darwin-test.yml
|
||||
- ${{ if eq(variables['VSCODE_CIBUILD'], false) }}:
|
||||
- job: macOS
|
||||
timeoutInMinutes: 90
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
steps:
|
||||
- template: darwin/product-build-darwin.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: ${{ eq(parameters.VSCODE_STEP_ON_IT, false) }}
|
||||
VSCODE_RUN_INTEGRATION_TESTS: ${{ eq(parameters.VSCODE_STEP_ON_IT, false) }}
|
||||
VSCODE_RUN_SMOKE_TESTS: ${{ eq(parameters.VSCODE_STEP_ON_IT, false) }}
|
||||
|
||||
- ${{ if eq(variables['VSCODE_PUBLISH'], true) }}:
|
||||
- job: macOSSign
|
||||
dependsOn:
|
||||
- macOS
|
||||
@@ -527,14 +342,7 @@ stages:
|
||||
VSCODE_ARCH: arm64
|
||||
steps:
|
||||
- template: darwin/product-build-darwin.yml
|
||||
parameters:
|
||||
VSCODE_PUBLISH: ${{ variables.VSCODE_PUBLISH }}
|
||||
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: false
|
||||
VSCODE_RUN_INTEGRATION_TESTS: false
|
||||
VSCODE_RUN_SMOKE_TESTS: false
|
||||
|
||||
- ${{ if eq(variables['VSCODE_PUBLISH'], true) }}:
|
||||
- ${{ if eq(variables['VSCODE_CIBUILD'], false) }}:
|
||||
- job: macOSARM64Sign
|
||||
dependsOn:
|
||||
- macOSARM64
|
||||
@@ -554,8 +362,7 @@ stages:
|
||||
VSCODE_ARCH: universal
|
||||
steps:
|
||||
- template: darwin/product-build-darwin-universal.yml
|
||||
|
||||
- ${{ if eq(variables['VSCODE_PUBLISH'], true) }}:
|
||||
- ${{ if eq(variables['VSCODE_CIBUILD'], false) }}:
|
||||
- job: macOSUniversalSign
|
||||
dependsOn:
|
||||
- macOSUniversal
|
||||
@@ -565,19 +372,6 @@ stages:
|
||||
steps:
|
||||
- template: darwin/product-build-darwin-sign.yml
|
||||
|
||||
- ${{ if and(eq(variables['VSCODE_CIBUILD'], false), eq(parameters.VSCODE_COMPILE_ONLY, false), eq(variables['VSCODE_BUILD_STAGE_WEB'], true)) }}:
|
||||
- stage: Web
|
||||
dependsOn:
|
||||
- Compile
|
||||
pool: vscode-1es-linux
|
||||
jobs:
|
||||
- ${{ if eq(parameters.VSCODE_BUILD_WEB, true) }}:
|
||||
- job: Web
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
steps:
|
||||
- template: web/product-build-web.yml
|
||||
|
||||
- ${{ if and(eq(parameters.VSCODE_COMPILE_ONLY, false), ne(variables['VSCODE_PUBLISH'], 'false')) }}:
|
||||
- stage: Publish
|
||||
dependsOn:
|
||||
|
||||
@@ -1,47 +1,39 @@
|
||||
parameters:
|
||||
- name: VSCODE_QUALITY
|
||||
type: string
|
||||
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "16.x"
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- task: AzureKeyVault@1
|
||||
displayName: "Azure Key Vault: Get Secrets"
|
||||
inputs:
|
||||
azureSubscription: "vscode-builds-subscription"
|
||||
KeyVaultName: vscode
|
||||
SecretsFilter: "github-distro-mixin-password"
|
||||
- task: AzureKeyVault@1
|
||||
displayName: "Azure Key Vault: Get Secrets"
|
||||
inputs:
|
||||
azureSubscription: "vscode-builds-subscription"
|
||||
KeyVaultName: vscode
|
||||
SecretsFilter: "github-distro-mixin-password"
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
cat << EOF > ~/.netrc
|
||||
machine github.com
|
||||
login vscode
|
||||
password $(github-distro-mixin-password)
|
||||
EOF
|
||||
- script: |
|
||||
set -e
|
||||
cat << EOF > ~/.netrc
|
||||
machine github.com
|
||||
login vscode
|
||||
password $(github-distro-mixin-password)
|
||||
EOF
|
||||
|
||||
git config user.email "vscode@microsoft.com"
|
||||
git config user.name "VSCode"
|
||||
displayName: Prepare tooling
|
||||
git config user.email "vscode@microsoft.com"
|
||||
git config user.name "VSCode"
|
||||
displayName: Prepare tooling
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
git fetch https://github.com/$(VSCODE_MIXIN_REPO).git $VSCODE_DISTRO_REF
|
||||
echo "##vso[task.setvariable variable=VSCODE_DISTRO_COMMIT;]$(git rev-parse FETCH_HEAD)"
|
||||
git checkout FETCH_HEAD
|
||||
condition: and(succeeded(), ne(variables.VSCODE_DISTRO_REF, ' '))
|
||||
displayName: Checkout override commit
|
||||
- script: |
|
||||
set -e
|
||||
git fetch https://github.com/$(VSCODE_MIXIN_REPO).git $VSCODE_DISTRO_REF
|
||||
echo "##vso[task.setvariable variable=VSCODE_DISTRO_COMMIT;]$(git rev-parse FETCH_HEAD)"
|
||||
git checkout FETCH_HEAD
|
||||
condition: and(succeeded(), ne(variables.VSCODE_DISTRO_REF, ' '))
|
||||
displayName: Checkout override commit
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro")
|
||||
displayName: Merge distro
|
||||
- script: |
|
||||
set -e
|
||||
git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro")
|
||||
displayName: Merge distro
|
||||
|
||||
- script: |
|
||||
mkdir -p .build
|
||||
@@ -102,12 +94,11 @@ steps:
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
displayName: Create node_modules archive
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
# Mixin must run before optimize, because the CSS loader will inline small SVGs
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/mixin
|
||||
displayName: Mix in quality
|
||||
# Mixin must run before optimize, because the CSS loader will inline small SVGs
|
||||
- script: |
|
||||
set -e
|
||||
node build/azure-pipelines/mixin
|
||||
displayName: Mix in quality
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
@@ -116,65 +107,59 @@ steps:
|
||||
GITHUB_TOKEN: "$(github-distro-mixin-password)"
|
||||
displayName: Compile & Hygiene
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
yarn --cwd test/smoke compile
|
||||
yarn --cwd test/integration/browser compile
|
||||
displayName: Compile test suites
|
||||
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
- script: |
|
||||
set -e
|
||||
yarn --cwd test/smoke compile
|
||||
yarn --cwd test/integration/browser compile
|
||||
displayName: Compile test suites
|
||||
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- task: AzureCLI@2
|
||||
inputs:
|
||||
azureSubscription: "vscode-builds-subscription"
|
||||
scriptType: pscore
|
||||
scriptLocation: inlineScript
|
||||
addSpnToEnvironment: true
|
||||
inlineScript: |
|
||||
Write-Host "##vso[task.setvariable variable=AZURE_TENANT_ID]$env:tenantId"
|
||||
Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_ID]$env:servicePrincipalId"
|
||||
Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_SECRET;issecret=true]$env:servicePrincipalKey"
|
||||
- task: AzureCLI@2
|
||||
inputs:
|
||||
azureSubscription: "vscode-builds-subscription"
|
||||
scriptType: pscore
|
||||
scriptLocation: inlineScript
|
||||
addSpnToEnvironment: true
|
||||
inlineScript: |
|
||||
Write-Host "##vso[task.setvariable variable=AZURE_TENANT_ID]$env:tenantId"
|
||||
Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_ID]$env:servicePrincipalId"
|
||||
Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_SECRET;issecret=true]$env:servicePrincipalKey"
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
AZURE_STORAGE_ACCOUNT="ticino" \
|
||||
AZURE_TENANT_ID="$(AZURE_TENANT_ID)" \
|
||||
AZURE_CLIENT_ID="$(AZURE_CLIENT_ID)" \
|
||||
AZURE_CLIENT_SECRET="$(AZURE_CLIENT_SECRET)" \
|
||||
node build/azure-pipelines/upload-sourcemaps
|
||||
displayName: Upload sourcemaps
|
||||
- script: |
|
||||
set -e
|
||||
AZURE_STORAGE_ACCOUNT="ticino" \
|
||||
AZURE_TENANT_ID="$(AZURE_TENANT_ID)" \
|
||||
AZURE_CLIENT_ID="$(AZURE_CLIENT_ID)" \
|
||||
AZURE_CLIENT_SECRET="$(AZURE_CLIENT_SECRET)" \
|
||||
node build/azure-pipelines/upload-sourcemaps
|
||||
displayName: Upload sourcemaps
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -
|
||||
./build/azure-pipelines/common/extract-telemetry.sh
|
||||
displayName: Extract Telemetry
|
||||
- script: |
|
||||
set -
|
||||
./build/azure-pipelines/common/extract-telemetry.sh
|
||||
displayName: Extract Telemetry
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
tar -cz --ignore-failed-read -f $(Build.ArtifactStagingDirectory)/compilation.tar.gz .build out-* test/integration/browser/out test/smoke/out test/automation/out
|
||||
displayName: Compress compilation artifact
|
||||
- script: |
|
||||
set -e
|
||||
tar -cz --ignore-failed-read -f $(Build.ArtifactStagingDirectory)/compilation.tar.gz .build out-* test/integration/browser/out test/smoke/out test/automation/out
|
||||
displayName: Compress compilation artifact
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- task: PublishPipelineArtifact@1
|
||||
inputs:
|
||||
targetPath: $(Build.ArtifactStagingDirectory)/compilation.tar.gz
|
||||
artifactName: Compilation
|
||||
displayName: Publish compilation artifact
|
||||
- task: PublishPipelineArtifact@1
|
||||
inputs:
|
||||
targetPath: $(Build.ArtifactStagingDirectory)/compilation.tar.gz
|
||||
artifactName: Compilation
|
||||
displayName: Publish compilation artifact
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn download-builtin-extensions-cg
|
||||
displayName: Built-in extensions component details
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
|
||||
yarn download-builtin-extensions-cg
|
||||
displayName: Built-in extensions component details
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
|
||||
displayName: "Component Detection"
|
||||
inputs:
|
||||
sourceScanPath: $(Build.SourcesDirectory)
|
||||
continueOnError: true
|
||||
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
|
||||
displayName: "Component Detection"
|
||||
inputs:
|
||||
sourceScanPath: $(Build.SourcesDirectory)
|
||||
continueOnError: true
|
||||
|
||||
@@ -46,7 +46,6 @@ $stages = @(
|
||||
if ($env:VSCODE_BUILD_STAGE_WINDOWS -eq 'True') { 'Windows' }
|
||||
if ($env:VSCODE_BUILD_STAGE_LINUX -eq 'True') { 'Linux' }
|
||||
if ($env:VSCODE_BUILD_STAGE_MACOS -eq 'True') { 'macOS' }
|
||||
if ($env:VSCODE_BUILD_STAGE_WEB -eq 'True') { 'Web' }
|
||||
)
|
||||
|
||||
do {
|
||||
|
||||
@@ -109,7 +109,6 @@ steps:
|
||||
if ($env:VSCODE_BUILD_STAGE_WINDOWS -eq 'True') { 'Windows' }
|
||||
if ($env:VSCODE_BUILD_STAGE_LINUX -eq 'True') { 'Linux' }
|
||||
if ($env:VSCODE_BUILD_STAGE_MACOS -eq 'True') { 'macOS' }
|
||||
if ($env:VSCODE_BUILD_STAGE_WEB -eq 'True') { 'Web' }
|
||||
)
|
||||
Write-Host "Stages to check: $stages"
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const cp = require("child_process");
|
||||
let tag = '';
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as cp from 'child_process';
|
||||
|
||||
let tag = '';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = require("fs");
|
||||
const cp = require("child_process");
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as cp from 'child_process';
|
||||
import * as path from 'path';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const es = require("event-stream");
|
||||
const Vinyl = require("vinyl");
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as es from 'event-stream';
|
||||
import * as Vinyl from 'vinyl';
|
||||
import * as vfs from 'vinyl-fs';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getSettingsSearchBuildId = exports.shouldSetupSettingsSearch = void 0;
|
||||
const path = require("path");
|
||||
@@ -52,7 +52,7 @@ function generateVSCodeConfigurationTask() {
|
||||
const timer = setTimeout(() => {
|
||||
codeProc.kill();
|
||||
reject(new Error('export-default-configuration process timed out'));
|
||||
}, 60 * 1000);
|
||||
}, 12 * 1000);
|
||||
codeProc.on('error', err => {
|
||||
clearTimeout(timer);
|
||||
reject(err);
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as path from 'path';
|
||||
import * as os from 'os';
|
||||
import * as cp from 'child_process';
|
||||
@@ -61,7 +63,7 @@ function generateVSCodeConfigurationTask(): Promise<string | undefined> {
|
||||
const timer = setTimeout(() => {
|
||||
codeProc.kill();
|
||||
reject(new Error('export-default-configuration process timed out'));
|
||||
}, 60 * 1000);
|
||||
}, 12 * 1000);
|
||||
|
||||
codeProc.on('error', err => {
|
||||
clearTimeout(timer);
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const es = require("event-stream");
|
||||
const vfs = require("vinyl-fs");
|
||||
const merge = require("gulp-merge-json");
|
||||
const gzip = require("gulp-gzip");
|
||||
const identity_1 = require("@azure/identity");
|
||||
const path = require("path");
|
||||
const fs_1 = require("fs");
|
||||
const azure = require('gulp-azure-storage');
|
||||
const commit = process.env['VSCODE_DISTRO_COMMIT'] || process.env['BUILD_SOURCEVERSION'];
|
||||
const credential = new identity_1.ClientSecretCredential(process.env['AZURE_TENANT_ID'], process.env['AZURE_CLIENT_ID'], process.env['AZURE_CLIENT_SECRET']);
|
||||
@@ -20,8 +18,8 @@ function main() {
|
||||
.pipe(merge({
|
||||
fileName: 'combined.nls.metadata.json',
|
||||
jsonSpace: '',
|
||||
concatArrays: true,
|
||||
edit: (parsedJson, file) => {
|
||||
let key;
|
||||
if (file.base === 'out-vscode-web-min') {
|
||||
return { vscode: parsedJson };
|
||||
}
|
||||
@@ -65,11 +63,7 @@ function main() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Get extension id and use that as the key
|
||||
const folderPath = path.join(file.base, file.relative.split('/')[0]);
|
||||
const manifest = (0, fs_1.readFileSync)(path.join(folderPath, 'package.json'), 'utf-8');
|
||||
const manifestJson = JSON.parse(manifest);
|
||||
const key = manifestJson.publisher + '.' + manifestJson.name;
|
||||
key = 'vscode.' + file.relative.split('/')[0];
|
||||
return { [key]: parsedJson };
|
||||
},
|
||||
}))
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as es from 'event-stream';
|
||||
import * as Vinyl from 'vinyl';
|
||||
import * as vfs from 'vinyl-fs';
|
||||
import * as merge from 'gulp-merge-json';
|
||||
import * as gzip from 'gulp-gzip';
|
||||
import { ClientSecretCredential } from '@azure/identity';
|
||||
import path = require('path');
|
||||
import { readFileSync } from 'fs';
|
||||
const azure = require('gulp-azure-storage');
|
||||
|
||||
const commit = process.env['VSCODE_DISTRO_COMMIT'] || process.env['BUILD_SOURCEVERSION'];
|
||||
@@ -33,8 +33,8 @@ function main(): Promise<void> {
|
||||
.pipe(merge({
|
||||
fileName: 'combined.nls.metadata.json',
|
||||
jsonSpace: '',
|
||||
concatArrays: true,
|
||||
edit: (parsedJson, file) => {
|
||||
let key;
|
||||
if (file.base === 'out-vscode-web-min') {
|
||||
return { vscode: parsedJson };
|
||||
}
|
||||
@@ -82,12 +82,7 @@ function main(): Promise<void> {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Get extension id and use that as the key
|
||||
const folderPath = path.join(file.base, file.relative.split('/')[0]);
|
||||
const manifest = readFileSync(path.join(folderPath, 'package.json'), 'utf-8');
|
||||
const manifestJson = JSON.parse(manifest);
|
||||
const key = manifestJson.publisher + '.' + manifestJson.name;
|
||||
key = 'vscode.' + file.relative.split('/')[0];
|
||||
return { [key]: parsedJson };
|
||||
},
|
||||
}))
|
||||
@@ -118,3 +113,4 @@ main().catch(err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path = require("path");
|
||||
const es = require("event-stream");
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as path from 'path';
|
||||
import * as es from 'event-stream';
|
||||
import * as Vinyl from 'vinyl';
|
||||
|
||||
@@ -163,7 +163,6 @@ steps:
|
||||
|
||||
cd $ROOT && tar --owner=0 --group=0 -czf $WEB_TARBALL_PATH $WEB_BUILD_NAME
|
||||
displayName: Prepare for publish
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- publish: $(Agent.BuildDirectory)/vscode-web.tar.gz
|
||||
artifact: vscode_web_linux_standalone_archive-unsigned
|
||||
|
||||
@@ -1,247 +0,0 @@
|
||||
parameters:
|
||||
- name: VSCODE_QUALITY
|
||||
type: string
|
||||
- name: VSCODE_RUN_UNIT_TESTS
|
||||
type: boolean
|
||||
- name: VSCODE_RUN_INTEGRATION_TESTS
|
||||
type: boolean
|
||||
- name: VSCODE_RUN_SMOKE_TESTS
|
||||
type: boolean
|
||||
|
||||
steps:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$env:VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)"
|
||||
exec { yarn npm-run-all -lp "electron $(VSCODE_ARCH)" "playwright-install" }
|
||||
displayName: Download Electron and Playwright
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_RUN_UNIT_TESTS, true) }}:
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { yarn electron $(VSCODE_ARCH) }
|
||||
exec { .\scripts\test.bat --tfs "Unit Tests" }
|
||||
displayName: Run unit tests (Electron)
|
||||
timeoutInMinutes: 15
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { yarn test-node }
|
||||
displayName: Run unit tests (node.js)
|
||||
timeoutInMinutes: 15
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { node test/unit/browser/index.js --sequential --browser chromium --browser firefox --tfs "Browser Unit Tests" }
|
||||
displayName: Run unit tests (Browser, Chromium & Firefox)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { yarn electron $(VSCODE_ARCH) }
|
||||
exec { .\scripts\test.bat --build --tfs "Unit Tests" }
|
||||
displayName: Run unit tests (Electron)
|
||||
timeoutInMinutes: 15
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { yarn test-node --build }
|
||||
displayName: Run unit tests (node.js)
|
||||
timeoutInMinutes: 15
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { yarn test-browser-no-install --sequential --build --browser chromium --browser firefox --tfs "Browser Unit Tests" }
|
||||
displayName: Run unit tests (Browser, Chromium & Firefox)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true) }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { yarn gulp `
|
||||
compile-extension:configuration-editing `
|
||||
compile-extension:css-language-features-server `
|
||||
compile-extension:emmet `
|
||||
compile-extension:git `
|
||||
compile-extension:github-authentication `
|
||||
compile-extension:html-language-features-server `
|
||||
compile-extension:ipynb `
|
||||
compile-extension:json-language-features-server `
|
||||
compile-extension:markdown-language-features-server `
|
||||
compile-extension:markdown-language-features `
|
||||
compile-extension-media `
|
||||
compile-extension:microsoft-authentication `
|
||||
compile-extension:typescript-language-features `
|
||||
compile-extension:vscode-api-tests `
|
||||
compile-extension:vscode-colorize-tests `
|
||||
compile-extension:vscode-notebook-tests `
|
||||
compile-extension:vscode-test-resolver `
|
||||
}
|
||||
displayName: Build integration tests
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { .\scripts\test-integration.bat --tfs "Integration Tests" }
|
||||
displayName: Run integration tests (Electron)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { .\scripts\test-web-integration.bat --browser firefox }
|
||||
displayName: Run integration tests (Browser, Firefox)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { .\scripts\test-remote-integration.bat }
|
||||
displayName: Run integration tests (Remote)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- powershell: |
|
||||
# Figure out the full absolute path of the product we just built
|
||||
# including the remote server and configure the integration tests
|
||||
# to run with these builds instead of running out of sources.
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$AppRoot = "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)"
|
||||
$AppProductJson = Get-Content -Raw -Path "$AppRoot\resources\app\product.json" | ConvertFrom-Json
|
||||
$AppNameShort = $AppProductJson.nameShort
|
||||
exec { $env:INTEGRATION_TEST_ELECTRON_PATH = "$AppRoot\$AppNameShort.exe"; $env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-win32-$(VSCODE_ARCH)"; .\scripts\test-integration.bat --build --tfs "Integration Tests" }
|
||||
displayName: Run integration tests (Electron)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { $env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-web-win32-$(VSCODE_ARCH)"; .\scripts\test-web-integration.bat --browser firefox }
|
||||
displayName: Run integration tests (Browser, Firefox)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$AppRoot = "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)"
|
||||
$AppProductJson = Get-Content -Raw -Path "$AppRoot\resources\app\product.json" | ConvertFrom-Json
|
||||
$AppNameShort = $AppProductJson.nameShort
|
||||
exec { $env:INTEGRATION_TEST_ELECTRON_PATH = "$AppRoot\$AppNameShort.exe"; $env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-win32-$(VSCODE_ARCH)"; .\scripts\test-remote-integration.bat }
|
||||
displayName: Run integration tests (Remote)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_RUN_SMOKE_TESTS, true) }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
exec {.\build\azure-pipelines\win32\listprocesses.bat }
|
||||
displayName: Diagnostics before smoke test run
|
||||
continueOnError: true
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { yarn --cwd test/smoke compile }
|
||||
displayName: Compile smoke tests
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { yarn smoketest-no-compile --tracing }
|
||||
displayName: Run smoke tests (Electron)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$AppRoot = "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)"
|
||||
exec { yarn smoketest-no-compile --tracing --build "$AppRoot" }
|
||||
displayName: Run smoke tests (Electron)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-web-win32-$(VSCODE_ARCH)"
|
||||
exec { yarn smoketest-no-compile --web --tracing --headless }
|
||||
displayName: Run smoke tests (Browser, Chromium)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$AppRoot = "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)"
|
||||
$env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-win32-$(VSCODE_ARCH)"
|
||||
exec { yarn gulp compile-extension:vscode-test-resolver }
|
||||
exec { yarn smoketest-no-compile --tracing --remote --build "$AppRoot" }
|
||||
displayName: Run smoke tests (Remote)
|
||||
timeoutInMinutes: 20
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
exec {.\build\azure-pipelines\win32\listprocesses.bat }
|
||||
displayName: Diagnostics after smoke test run
|
||||
continueOnError: true
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- ${{ if or(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true), eq(parameters.VSCODE_RUN_SMOKE_TESTS, true)) }}:
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
targetPath: .build\crashes
|
||||
${{ if and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
artifactName: crash-dump-windows-$(VSCODE_ARCH)-integration-$(System.JobAttempt)
|
||||
${{ elseif and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, true)) }}:
|
||||
artifactName: crash-dump-windows-$(VSCODE_ARCH)-smoke-$(System.JobAttempt)
|
||||
${{ else }}:
|
||||
artifactName: crash-dump-windows-$(VSCODE_ARCH)-$(System.JobAttempt)
|
||||
displayName: "Publish Crash Reports"
|
||||
continueOnError: true
|
||||
condition: failed()
|
||||
|
||||
# In order to properly symbolify above crash reports
|
||||
# (if any), we need the compiled native modules too
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
targetPath: node_modules
|
||||
${{ if and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
artifactName: node-modules-windows-$(VSCODE_ARCH)-integration-$(System.JobAttempt)
|
||||
${{ elseif and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, true)) }}:
|
||||
artifactName: node-modules-windows-$(VSCODE_ARCH)-smoke-$(System.JobAttempt)
|
||||
${{ else }}:
|
||||
artifactName: node-modules-windows-$(VSCODE_ARCH)-$(System.JobAttempt)
|
||||
displayName: "Publish Node Modules"
|
||||
continueOnError: true
|
||||
condition: failed()
|
||||
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
targetPath: .build\logs
|
||||
${{ if and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true), eq(parameters.VSCODE_RUN_SMOKE_TESTS, false)) }}:
|
||||
artifactName: logs-windows-$(VSCODE_ARCH)-integration-$(System.JobAttempt)
|
||||
${{ elseif and(eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, false), eq(parameters.VSCODE_RUN_SMOKE_TESTS, true)) }}:
|
||||
artifactName: logs-windows-$(VSCODE_ARCH)-smoke-$(System.JobAttempt)
|
||||
${{ else }}:
|
||||
artifactName: logs-windows-$(VSCODE_ARCH)-$(System.JobAttempt)
|
||||
displayName: "Publish Log Files"
|
||||
continueOnError: true
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- task: PublishTestResults@2
|
||||
displayName: Publish Tests Results
|
||||
inputs:
|
||||
testResultsFiles: "*-results.xml"
|
||||
searchFolder: "$(Build.ArtifactStagingDirectory)/test-results"
|
||||
condition: succeededOrFailed()
|
||||
@@ -1,21 +1,4 @@
|
||||
parameters:
|
||||
- name: VSCODE_PUBLISH
|
||||
type: boolean
|
||||
- name: VSCODE_QUALITY
|
||||
type: string
|
||||
- name: VSCODE_RUN_UNIT_TESTS
|
||||
type: boolean
|
||||
- name: VSCODE_RUN_INTEGRATION_TESTS
|
||||
type: boolean
|
||||
- name: VSCODE_RUN_SMOKE_TESTS
|
||||
type: boolean
|
||||
|
||||
steps:
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- checkout: self
|
||||
fetchDepth: 1
|
||||
retryCountOnTaskFailure: 3
|
||||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "16.x"
|
||||
@@ -25,58 +8,51 @@ steps:
|
||||
versionSpec: "3.x"
|
||||
addToPath: true
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- task: AzureKeyVault@1
|
||||
displayName: "Azure Key Vault: Get Secrets"
|
||||
inputs:
|
||||
azureSubscription: "vscode-builds-subscription"
|
||||
KeyVaultName: vscode
|
||||
SecretsFilter: "github-distro-mixin-password,ESRP-PKI,esrp-aad-username,esrp-aad-password"
|
||||
- task: AzureKeyVault@1
|
||||
displayName: "Azure Key Vault: Get Secrets"
|
||||
inputs:
|
||||
azureSubscription: "vscode-builds-subscription"
|
||||
KeyVaultName: vscode
|
||||
SecretsFilter: "github-distro-mixin-password,ESRP-PKI,esrp-aad-username,esrp-aad-password"
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- task: DownloadPipelineArtifact@2
|
||||
inputs:
|
||||
artifact: Compilation
|
||||
path: $(Build.ArtifactStagingDirectory)
|
||||
displayName: Download compilation output
|
||||
- task: DownloadPipelineArtifact@2
|
||||
inputs:
|
||||
artifact: Compilation
|
||||
path: $(Build.ArtifactStagingDirectory)
|
||||
displayName: Download compilation output
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- task: ExtractFiles@1
|
||||
displayName: Extract compilation output
|
||||
inputs:
|
||||
archiveFilePatterns: "$(Build.ArtifactStagingDirectory)/compilation.tar.gz"
|
||||
cleanDestinationFolder: false
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
"machine github.com`nlogin vscode`npassword $(github-distro-mixin-password)" | Out-File "$env:USERPROFILE\_netrc" -Encoding ASCII
|
||||
|
||||
exec { git config user.email "vscode@microsoft.com" }
|
||||
exec { git config user.name "VSCode" }
|
||||
displayName: Prepare tooling
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
exec { git fetch https://github.com/$(VSCODE_MIXIN_REPO).git $(VSCODE_DISTRO_REF) }
|
||||
Write-Host "##vso[task.setvariable variable=VSCODE_DISTRO_COMMIT;]$(git rev-parse FETCH_HEAD)"
|
||||
exec { git checkout FETCH_HEAD }
|
||||
condition: and(succeeded(), ne(variables.VSCODE_DISTRO_REF, ' '))
|
||||
displayName: Checkout override commit
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro") }
|
||||
displayName: Merge distro
|
||||
- task: ExtractFiles@1
|
||||
displayName: Extract compilation output
|
||||
inputs:
|
||||
archiveFilePatterns: "$(Build.ArtifactStagingDirectory)/compilation.tar.gz"
|
||||
cleanDestinationFolder: false
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
"machine github.com`nlogin vscode`npassword $(github-distro-mixin-password)" | Out-File "$env:USERPROFILE\_netrc" -Encoding ASCII
|
||||
|
||||
exec { git config user.email "vscode@microsoft.com" }
|
||||
exec { git config user.name "VSCode" }
|
||||
displayName: Prepare tooling
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
exec { git fetch https://github.com/$(VSCODE_MIXIN_REPO).git $(VSCODE_DISTRO_REF) }
|
||||
Write-Host "##vso[task.setvariable variable=VSCODE_DISTRO_COMMIT;]$(git rev-parse FETCH_HEAD)"
|
||||
exec { git checkout FETCH_HEAD }
|
||||
condition: and(succeeded(), ne(variables.VSCODE_DISTRO_REF, ' '))
|
||||
displayName: Checkout override commit
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro") }
|
||||
displayName: Merge distro
|
||||
|
||||
- powershell: |
|
||||
if (!(Test-Path ".build")) { New-Item -Path ".build" -ItemType Directory }
|
||||
"$(VSCODE_ARCH)" | Out-File -Encoding ascii -NoNewLine .build\arch
|
||||
"$env:ENABLE_TERRAPIN" | Out-File -Encoding ascii -NoNewLine .build\terrapin
|
||||
node build/azure-pipelines/common/computeNodeModulesCacheKey.js > .build/yarnlockhash
|
||||
@@ -128,176 +104,291 @@ steps:
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
displayName: Create node_modules archive
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { node build/azure-pipelines/mixin }
|
||||
displayName: Mix in quality
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { node build/azure-pipelines/mixin }
|
||||
displayName: Mix in quality
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { node build\lib\policies }
|
||||
displayName: Generate Group Policy definitions
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$env:VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)"
|
||||
exec { yarn npm-run-all -lp "electron $(VSCODE_ARCH)" }
|
||||
displayName: Download Electron
|
||||
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$env:VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)"
|
||||
exec { yarn gulp "transpile-client" "transpile-extensions" }
|
||||
displayName: Transpile
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$env:VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)"
|
||||
exec { yarn gulp "vscode-win32-$(VSCODE_ARCH)-min-ci" }
|
||||
echo "##vso[task.setvariable variable=CodeSigningFolderPath]$(agent.builddirectory)/VSCode-win32-$(VSCODE_ARCH)"
|
||||
displayName: Build
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$env:VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)"
|
||||
exec { yarn gulp "vscode-win32-$(VSCODE_ARCH)-min-ci" }
|
||||
echo "##vso[task.setvariable variable=CodeSigningFolderPath]$(agent.builddirectory)/VSCode-win32-$(VSCODE_ARCH)"
|
||||
displayName: Build
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$env:VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)"
|
||||
exec { yarn gulp "vscode-win32-$(VSCODE_ARCH)-inno-updater" }
|
||||
displayName: Prepare Package
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$env:VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)"
|
||||
exec { yarn gulp "vscode-win32-$(VSCODE_ARCH)-inno-updater" }
|
||||
displayName: Prepare Package
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { node build/azure-pipelines/mixin --server }
|
||||
displayName: Mix in quality
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { node build/azure-pipelines/mixin --server }
|
||||
displayName: Mix in quality
|
||||
condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$env:VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)"
|
||||
exec { yarn gulp "vscode-reh-win32-$(VSCODE_ARCH)-min-ci" }
|
||||
exec { yarn gulp "vscode-reh-web-win32-$(VSCODE_ARCH)-min-ci" }
|
||||
echo "##vso[task.setvariable variable=CodeSigningFolderPath]$(CodeSigningFolderPath),$(agent.builddirectory)/vscode-reh-win32-$(VSCODE_ARCH)"
|
||||
displayName: Build Server
|
||||
condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$env:VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)"
|
||||
exec { yarn gulp "vscode-reh-win32-$(VSCODE_ARCH)-min-ci" }
|
||||
exec { yarn gulp "vscode-reh-web-win32-$(VSCODE_ARCH)-min-ci" }
|
||||
echo "##vso[task.setvariable variable=CodeSigningFolderPath]$(CodeSigningFolderPath),$(agent.builddirectory)/vscode-reh-win32-$(VSCODE_ARCH)"
|
||||
displayName: Build Server
|
||||
condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$env:VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)"
|
||||
exec { yarn npm-run-all -lp "playwright-install" }
|
||||
displayName: Download Playwright
|
||||
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- ${{ if or(eq(parameters.VSCODE_RUN_UNIT_TESTS, true), eq(parameters.VSCODE_RUN_INTEGRATION_TESTS, true), eq(parameters.VSCODE_RUN_SMOKE_TESTS, true)) }}:
|
||||
- template: product-build-win32-test.yml
|
||||
parameters:
|
||||
VSCODE_QUALITY: ${{ parameters.VSCODE_QUALITY }}
|
||||
VSCODE_RUN_UNIT_TESTS: ${{ parameters.VSCODE_RUN_UNIT_TESTS }}
|
||||
VSCODE_RUN_INTEGRATION_TESTS: ${{ parameters.VSCODE_RUN_INTEGRATION_TESTS }}
|
||||
VSCODE_RUN_SMOKE_TESTS: ${{ parameters.VSCODE_RUN_SMOKE_TESTS }}
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { yarn electron $(VSCODE_ARCH) }
|
||||
exec { .\scripts\test.bat --build --tfs "Unit Tests" }
|
||||
displayName: Run unit tests (Electron)
|
||||
timeoutInMinutes: 15
|
||||
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- task: UseDotNet@2
|
||||
inputs:
|
||||
version: 3.x
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { yarn test-node --build }
|
||||
displayName: Run unit tests (node.js)
|
||||
timeoutInMinutes: 15
|
||||
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- task: EsrpClientTool@1
|
||||
displayName: Download ESRPClient
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { yarn test-browser-no-install --sequential --build --browser chromium --browser firefox --tfs "Browser Unit Tests" }
|
||||
displayName: Run unit tests (Browser, Chromium & Firefox)
|
||||
timeoutInMinutes: 20
|
||||
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- 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: |
|
||||
# Figure out the full absolute path of the product we just built
|
||||
# including the remote server and configure the integration tests
|
||||
# to run with these builds instead of running out of sources.
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$AppRoot = "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)"
|
||||
$AppProductJson = Get-Content -Raw -Path "$AppRoot\resources\app\product.json" | ConvertFrom-Json
|
||||
$AppNameShort = $AppProductJson.nameShort
|
||||
exec { $env:INTEGRATION_TEST_ELECTRON_PATH = "$AppRoot\$AppNameShort.exe"; $env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-win32-$(VSCODE_ARCH)"; .\scripts\test-integration.bat --build --tfs "Integration Tests" }
|
||||
displayName: Run integration tests (Electron)
|
||||
timeoutInMinutes: 20
|
||||
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- 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) $(CodeSigningFolderPath) '*.dll,*.exe,*.node' }
|
||||
displayName: Codesign
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { $env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-web-win32-$(VSCODE_ARCH)"; .\scripts\test-web-integration.bat --browser firefox }
|
||||
displayName: Run integration tests (Browser, Firefox)
|
||||
timeoutInMinutes: 20
|
||||
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { yarn gulp "vscode-win32-$(VSCODE_ARCH)-archive" }
|
||||
displayName: Package archive
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$AppRoot = "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)"
|
||||
$AppProductJson = Get-Content -Raw -Path "$AppRoot\resources\app\product.json" | ConvertFrom-Json
|
||||
$AppNameShort = $AppProductJson.nameShort
|
||||
exec { $env:INTEGRATION_TEST_ELECTRON_PATH = "$AppRoot\$AppNameShort.exe"; $env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-win32-$(VSCODE_ARCH)"; .\scripts\test-remote-integration.bat }
|
||||
displayName: Run integration tests (Remote)
|
||||
timeoutInMinutes: 20
|
||||
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$env:ESRPPKI = "$(ESRP-PKI)"
|
||||
$env:ESRPAADUsername = "$(esrp-aad-username)"
|
||||
$env:ESRPAADPassword = "$(esrp-aad-password)"
|
||||
exec { yarn gulp "vscode-win32-$(VSCODE_ARCH)-system-setup" --sign }
|
||||
exec { yarn gulp "vscode-win32-$(VSCODE_ARCH)-user-setup" --sign }
|
||||
displayName: Package setups
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
exec {.\build\azure-pipelines\win32\listprocesses.bat }
|
||||
displayName: Diagnostics before smoke test run
|
||||
continueOnError: true
|
||||
condition: and(succeededOrFailed(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
.\build\azure-pipelines\win32\prepare-publish.ps1
|
||||
displayName: Publish
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-web-win32-$(VSCODE_ARCH)"
|
||||
exec { yarn smoketest-no-compile --web --tracing --headless }
|
||||
displayName: Run smoke tests (Browser, Chromium)
|
||||
timeoutInMinutes: 10
|
||||
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
|
||||
displayName: Generate SBOM (client)
|
||||
inputs:
|
||||
BuildDropPath: $(agent.builddirectory)/VSCode-win32-$(VSCODE_ARCH)
|
||||
PackageName: Visual Studio Code
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$AppRoot = "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)"
|
||||
exec { yarn smoketest-no-compile --tracing --build "$AppRoot" }
|
||||
displayName: Run smoke tests (Electron)
|
||||
timeoutInMinutes: 20
|
||||
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- publish: $(agent.builddirectory)/VSCode-win32-$(VSCODE_ARCH)/_manifest
|
||||
displayName: Publish SBOM (client)
|
||||
artifact: vscode_client_win32_$(VSCODE_ARCH)_sbom
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$AppRoot = "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)"
|
||||
$env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-win32-$(VSCODE_ARCH)"
|
||||
exec { yarn smoketest-no-compile --tracing --remote --build "$AppRoot" }
|
||||
displayName: Run smoke tests (Remote)
|
||||
timeoutInMinutes: 20
|
||||
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
|
||||
displayName: Generate SBOM (server)
|
||||
inputs:
|
||||
BuildDropPath: $(agent.builddirectory)/vscode-server-win32-$(VSCODE_ARCH)
|
||||
PackageName: Visual Studio Code Server
|
||||
condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
exec {.\build\azure-pipelines\win32\listprocesses.bat }
|
||||
displayName: Diagnostics after smoke test run
|
||||
continueOnError: true
|
||||
condition: and(succeededOrFailed(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- publish: $(agent.builddirectory)/vscode-server-win32-$(VSCODE_ARCH)/_manifest
|
||||
displayName: Publish SBOM (server)
|
||||
artifact: vscode_server_win32_$(VSCODE_ARCH)_sbom
|
||||
condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
artifactName: crash-dump-windows-$(VSCODE_ARCH)
|
||||
targetPath: .build\crashes
|
||||
displayName: "Publish Crash Reports"
|
||||
continueOnError: true
|
||||
condition: failed()
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- publish: $(System.DefaultWorkingDirectory)\.build\win32-$(VSCODE_ARCH)\archive\$(ARCHIVE_NAME)
|
||||
artifact: vscode_client_win32_$(VSCODE_ARCH)_archive
|
||||
displayName: Publish archive
|
||||
# In order to properly symbolify above crash reports
|
||||
# (if any), we need the compiled native modules too
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
artifactName: node-modules-windows-$(VSCODE_ARCH)
|
||||
targetPath: node_modules
|
||||
displayName: "Publish Node Modules"
|
||||
continueOnError: true
|
||||
condition: failed()
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- publish: $(System.DefaultWorkingDirectory)\.build\win32-$(VSCODE_ARCH)\system-setup\$(SYSTEM_SETUP_NAME)
|
||||
artifact: vscode_client_win32_$(VSCODE_ARCH)_setup
|
||||
displayName: Publish system setup
|
||||
- task: PublishPipelineArtifact@0
|
||||
inputs:
|
||||
artifactName: logs-windows-$(VSCODE_ARCH)-$(System.JobAttempt)
|
||||
targetPath: .build\logs
|
||||
displayName: "Publish Log Files"
|
||||
continueOnError: true
|
||||
condition: and(failed(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- publish: $(System.DefaultWorkingDirectory)\.build\win32-$(VSCODE_ARCH)\user-setup\$(USER_SETUP_NAME)
|
||||
artifact: vscode_client_win32_$(VSCODE_ARCH)_user-setup
|
||||
displayName: Publish user setup
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
- task: PublishTestResults@2
|
||||
displayName: Publish Tests Results
|
||||
inputs:
|
||||
testResultsFiles: "*-results.xml"
|
||||
searchFolder: "$(Build.ArtifactStagingDirectory)/test-results"
|
||||
condition: and(succeededOrFailed(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- publish: $(System.DefaultWorkingDirectory)\.build\vscode-server-win32-$(VSCODE_ARCH).zip
|
||||
artifact: vscode_server_win32_$(VSCODE_ARCH)_archive
|
||||
displayName: Publish server archive
|
||||
condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
- task: UseDotNet@2
|
||||
inputs:
|
||||
version: 3.x
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
|
||||
- publish: $(System.DefaultWorkingDirectory)\.build\vscode-server-win32-$(VSCODE_ARCH)-web.zip
|
||||
artifact: vscode_web_win32_$(VSCODE_ARCH)_archive
|
||||
displayName: Publish web server archive
|
||||
condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
- task: EsrpClientTool@1
|
||||
displayName: Download ESRPClient
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- 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
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- 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) $(CodeSigningFolderPath) '*.dll,*.exe,*.node' }
|
||||
displayName: Codesign
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { yarn gulp "vscode-win32-$(VSCODE_ARCH)-archive" }
|
||||
displayName: Package archive
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
$env:ESRPPKI = "$(ESRP-PKI)"
|
||||
$env:ESRPAADUsername = "$(esrp-aad-username)"
|
||||
$env:ESRPAADPassword = "$(esrp-aad-password)"
|
||||
exec { yarn gulp "vscode-win32-$(VSCODE_ARCH)-system-setup" --sign }
|
||||
exec { yarn gulp "vscode-win32-$(VSCODE_ARCH)-user-setup" --sign }
|
||||
displayName: Package setups
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
.\build\azure-pipelines\win32\prepare-publish.ps1
|
||||
displayName: Publish
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- publish: $(System.DefaultWorkingDirectory)\.build\win32-$(VSCODE_ARCH)\archive\$(ARCHIVE_NAME)
|
||||
artifact: vscode_client_win32_$(VSCODE_ARCH)_archive
|
||||
displayName: Publish archive
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- publish: $(System.DefaultWorkingDirectory)\.build\win32-$(VSCODE_ARCH)\system-setup\$(SYSTEM_SETUP_NAME)
|
||||
artifact: vscode_client_win32_$(VSCODE_ARCH)_setup
|
||||
displayName: Publish system setup
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- publish: $(System.DefaultWorkingDirectory)\.build\win32-$(VSCODE_ARCH)\user-setup\$(USER_SETUP_NAME)
|
||||
artifact: vscode_client_win32_$(VSCODE_ARCH)_user-setup
|
||||
displayName: Publish user setup
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- publish: $(System.DefaultWorkingDirectory)\.build\vscode-server-win32-$(VSCODE_ARCH).zip
|
||||
artifact: vscode_server_win32_$(VSCODE_ARCH)_archive
|
||||
displayName: Publish server archive
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- publish: $(System.DefaultWorkingDirectory)\.build\vscode-server-win32-$(VSCODE_ARCH)-web.zip
|
||||
artifact: vscode_web_win32_$(VSCODE_ARCH)_archive
|
||||
displayName: Publish web server archive
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
|
||||
displayName: Generate SBOM (client)
|
||||
inputs:
|
||||
BuildDropPath: $(agent.builddirectory)/VSCode-win32-$(VSCODE_ARCH)
|
||||
PackageName: Visual Studio Code
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- publish: $(agent.builddirectory)/VSCode-win32-$(VSCODE_ARCH)/_manifest
|
||||
displayName: Publish SBOM (client)
|
||||
artifact: vscode_client_win32_$(VSCODE_ARCH)_sbom
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
|
||||
|
||||
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
|
||||
displayName: Generate SBOM (server)
|
||||
inputs:
|
||||
BuildDropPath: $(agent.builddirectory)/vscode-server-win32-$(VSCODE_ARCH)
|
||||
PackageName: Visual Studio Code Server
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- publish: $(agent.builddirectory)/vscode-server-win32-$(VSCODE_ARCH)/_manifest
|
||||
displayName: Publish SBOM (server)
|
||||
artifact: vscode_server_win32_$(VSCODE_ARCH)_sbom
|
||||
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const vscode_universal_bundler_1 = require("vscode-universal-bundler");
|
||||
const cross_spawn_promise_1 = require("@malept/cross-spawn-promise");
|
||||
@@ -71,7 +71,7 @@ async function main() {
|
||||
outAppPath,
|
||||
force: true
|
||||
});
|
||||
const productJson = await fs.readJson(productJsonPath);
|
||||
let productJson = await fs.readJson(productJsonPath);
|
||||
Object.assign(productJson, {
|
||||
darwinUniversalAssetId: 'darwin-universal'
|
||||
});
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { makeUniversalApp } from 'vscode-universal-bundler';
|
||||
import { spawn } from '@malept/cross-spawn-promise';
|
||||
import * as fs from 'fs-extra';
|
||||
@@ -78,7 +80,7 @@ async function main() {
|
||||
force: true
|
||||
});
|
||||
|
||||
const productJson = await fs.readJson(productJsonPath);
|
||||
let productJson = await fs.readJson(productJsonPath);
|
||||
Object.assign(productJson, {
|
||||
darwinUniversalAssetId: 'darwin-universal'
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const codesign = require("electron-osx-sign");
|
||||
const path = require("path");
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as codesign from 'electron-osx-sign';
|
||||
import * as path from 'path';
|
||||
import * as util from '../lib/util';
|
||||
|
||||
@@ -52,6 +52,7 @@ module.exports.unicodeFilter = [
|
||||
'!extensions/typescript-language-features/test-workspace/**',
|
||||
'!extensions/vscode-api-tests/testWorkspace/**',
|
||||
'!extensions/vscode-api-tests/testWorkspace2/**',
|
||||
'!extensions/vscode-custom-editor-tests/test-workspace/**',
|
||||
'!extensions/**/dist/**',
|
||||
'!extensions/**/out/**',
|
||||
'!extensions/**/snippets/**',
|
||||
@@ -92,6 +93,7 @@ module.exports.indentationFilter = [
|
||||
'!extensions/markdown-math/notebook-out/**',
|
||||
'!extensions/vscode-api-tests/testWorkspace/**',
|
||||
'!extensions/vscode-api-tests/testWorkspace2/**',
|
||||
'!extensions/vscode-custom-editor-tests/test-workspace/**',
|
||||
'!build/monaco/**',
|
||||
'!build/win32/**',
|
||||
|
||||
|
||||
@@ -17,41 +17,34 @@ const compilation = require('./lib/compilation');
|
||||
const monacoapi = require('./lib/monaco-api');
|
||||
const fs = require('fs');
|
||||
|
||||
const root = path.dirname(__dirname);
|
||||
const sha1 = util.getVersion(root);
|
||||
const semver = require('./monaco/package.json').version;
|
||||
const headerVersion = semver + '(' + sha1 + ')';
|
||||
let root = path.dirname(__dirname);
|
||||
let sha1 = util.getVersion(root);
|
||||
let semver = require('./monaco/package.json').version;
|
||||
let headerVersion = semver + '(' + sha1 + ')';
|
||||
|
||||
// Build
|
||||
|
||||
const editorEntryPoints = [
|
||||
let editorEntryPoints = [
|
||||
{
|
||||
name: 'vs/editor/editor.main',
|
||||
include: [],
|
||||
exclude: ['vs/css', 'vs/nls'],
|
||||
prepend: [
|
||||
{ path: 'out-editor-build/vs/css.js', amdModuleId: 'vs/css' },
|
||||
{ path: 'out-editor-build/vs/nls.js', amdModuleId: 'vs/nls' }
|
||||
],
|
||||
prepend: ['out-editor-build/vs/css.js', 'out-editor-build/vs/nls.js'],
|
||||
},
|
||||
{
|
||||
name: 'vs/base/common/worker/simpleWorker',
|
||||
include: ['vs/editor/common/services/editorSimpleWorker'],
|
||||
exclude: ['vs/nls'],
|
||||
prepend: [
|
||||
{ path: 'vs/loader.js' },
|
||||
{ path: 'vs/nls.js', amdModuleId: 'vs/nls' },
|
||||
{ path: 'vs/base/worker/workerMain.js' }
|
||||
],
|
||||
prepend: ['vs/loader.js'],
|
||||
append: ['vs/base/worker/workerMain'],
|
||||
dest: 'vs/base/worker/workerMain.js'
|
||||
}
|
||||
];
|
||||
|
||||
const editorResources = [
|
||||
let editorResources = [
|
||||
'out-editor-build/vs/base/browser/ui/codicons/**/*.ttf'
|
||||
];
|
||||
|
||||
const BUNDLED_FILE_HEADER = [
|
||||
let BUNDLED_FILE_HEADER = [
|
||||
'/*!-----------------------------------------------------------',
|
||||
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
||||
' * Version: ' + headerVersion,
|
||||
@@ -116,6 +109,12 @@ const createESMSourcesAndResourcesTask = task.define('extract-editor-esm', () =>
|
||||
'inlineEntryPoint:0.ts',
|
||||
'inlineEntryPoint:1.ts',
|
||||
'vs/loader.js',
|
||||
'vs/nls.ts',
|
||||
'vs/nls.build.js',
|
||||
'vs/nls.d.ts',
|
||||
'vs/css.js',
|
||||
'vs/css.build.js',
|
||||
'vs/css.d.ts',
|
||||
'vs/base/worker/workerMain.ts',
|
||||
],
|
||||
renames: {
|
||||
@@ -225,7 +224,7 @@ const appendJSToESMImportsTask = task.define('append-js-to-esm-imports', () => {
|
||||
result.push(line);
|
||||
continue;
|
||||
}
|
||||
const modifiedLine = (
|
||||
let modifiedLine = (
|
||||
line
|
||||
.replace(/^import(.*)\'([^']+)\'/, `import$1'$2.js'`)
|
||||
.replace(/^export \* from \'([^']+)\'/, `export * from '$1.js'`)
|
||||
@@ -240,10 +239,10 @@ const appendJSToESMImportsTask = task.define('append-js-to-esm-imports', () => {
|
||||
* @param {string} contents
|
||||
*/
|
||||
function toExternalDTS(contents) {
|
||||
const lines = contents.split(/\r\n|\r|\n/);
|
||||
let lines = contents.split(/\r\n|\r|\n/);
|
||||
let killNextCloseCurlyBrace = false;
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i];
|
||||
let line = lines[i];
|
||||
|
||||
if (killNextCloseCurlyBrace) {
|
||||
if ('}' === line) {
|
||||
@@ -317,7 +316,7 @@ const finalEditorResourcesTask = task.define('final-editor-resources', () => {
|
||||
// package.json
|
||||
gulp.src('build/monaco/package.json')
|
||||
.pipe(es.through(function (data) {
|
||||
const json = JSON.parse(data.contents.toString());
|
||||
let json = JSON.parse(data.contents.toString());
|
||||
json.private = false;
|
||||
data.contents = Buffer.from(JSON.stringify(json, null, ' '));
|
||||
this.emit('data', data);
|
||||
@@ -361,10 +360,10 @@ const finalEditorResourcesTask = task.define('final-editor-resources', () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const relativePathToMap = path.relative(path.join(data.relative), path.join('min-maps', data.relative + '.map'));
|
||||
let relativePathToMap = path.relative(path.join(data.relative), path.join('min-maps', data.relative + '.map'));
|
||||
|
||||
let strContents = data.contents.toString();
|
||||
const newStr = '//# sourceMappingURL=' + relativePathToMap.replace(/\\/g, '/');
|
||||
let newStr = '//# sourceMappingURL=' + relativePathToMap.replace(/\\/g, '/');
|
||||
strContents = strContents.replace(/\/\/# sourceMappingURL=[^ ]+$/, newStr);
|
||||
|
||||
data.contents = Buffer.from(strContents);
|
||||
@@ -484,13 +483,13 @@ function createTscCompileTask(watch) {
|
||||
cwd: path.join(__dirname, '..'),
|
||||
// stdio: [null, 'pipe', 'inherit']
|
||||
});
|
||||
const errors = [];
|
||||
const reporter = createReporter('monaco');
|
||||
let errors = [];
|
||||
let reporter = createReporter('monaco');
|
||||
|
||||
/** @type {NodeJS.ReadWriteStream | undefined} */
|
||||
let report;
|
||||
// eslint-disable-next-line no-control-regex
|
||||
const magic = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g; // https://stackoverflow.com/questions/25245716/remove-all-ansi-colors-styles-from-strings
|
||||
let magic = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g; // https://stackoverflow.com/questions/25245716/remove-all-ansi-colors-styles-from-strings
|
||||
|
||||
child.stdout.on('data', data => {
|
||||
let str = String(data);
|
||||
@@ -503,12 +502,12 @@ function createTscCompileTask(watch) {
|
||||
report.end();
|
||||
|
||||
} else if (str) {
|
||||
const match = /(.*\(\d+,\d+\): )(.*: )(.*)/.exec(str);
|
||||
let match = /(.*\(\d+,\d+\): )(.*: )(.*)/.exec(str);
|
||||
if (match) {
|
||||
// trying to massage the message so that it matches the gulp-tsb error messages
|
||||
// e.g. src/vs/base/common/strings.ts(663,5): error TS2322: Type '1234' is not assignable to type 'string'.
|
||||
const fullpath = path.join(root, match[1]);
|
||||
const message = match[3];
|
||||
let fullpath = path.join(root, match[1]);
|
||||
let message = match[3];
|
||||
reporter(fullpath + message);
|
||||
} else {
|
||||
reporter(str);
|
||||
|
||||
@@ -56,7 +56,6 @@ const compilations = [
|
||||
'json-language-features/client/tsconfig.json',
|
||||
'json-language-features/server/tsconfig.json',
|
||||
'markdown-language-features/preview-src/tsconfig.json',
|
||||
'markdown-language-features/server/tsconfig.json',
|
||||
'markdown-language-features/tsconfig.json',
|
||||
'markdown-math/tsconfig.json',
|
||||
'merge-conflict/tsconfig.json',
|
||||
@@ -64,13 +63,12 @@ const compilations = [
|
||||
'npm/tsconfig.json',
|
||||
'php-language-features/tsconfig.json',
|
||||
'search-result/tsconfig.json',
|
||||
'references-view/tsconfig.json',
|
||||
'simple-browser/tsconfig.json',
|
||||
'typescript-language-features/test-workspace/tsconfig.json',
|
||||
'typescript-language-features/tsconfig.json',
|
||||
'vscode-api-tests/tsconfig.json',
|
||||
'vscode-colorize-tests/tsconfig.json',
|
||||
'vscode-notebook-tests/tsconfig.json',
|
||||
'vscode-custom-editor-tests/tsconfig.json',
|
||||
'vscode-test-resolver/tsconfig.json'
|
||||
];
|
||||
*/
|
||||
@@ -95,7 +93,7 @@ const tasks = compilations.map(function (tsconfigFile) {
|
||||
const baseUrl = getBaseUrl(out);
|
||||
|
||||
let headerId, headerOut;
|
||||
const index = relativeDirname.indexOf('/');
|
||||
let index = relativeDirname.indexOf('/');
|
||||
if (index < 0) {
|
||||
headerId = 'microsoft.' + relativeDirname; // {{SQL CARBON EDIT}}
|
||||
headerOut = 'out';
|
||||
@@ -104,9 +102,9 @@ const tasks = compilations.map(function (tsconfigFile) {
|
||||
headerOut = relativeDirname.substr(index + 1) + '/out';
|
||||
}
|
||||
|
||||
function createPipeline(build, emitError, transpileOnly) {
|
||||
function createPipeline(build, emitError) {
|
||||
const nlsDev = require('vscode-nls-dev');
|
||||
const tsb = require('./lib/tsb');
|
||||
const tsb = require('gulp-tsb');
|
||||
const sourcemaps = require('gulp-sourcemaps');
|
||||
|
||||
const reporter = createReporter('extensions');
|
||||
@@ -114,7 +112,7 @@ const tasks = compilations.map(function (tsconfigFile) {
|
||||
overrideOptions.inlineSources = Boolean(build);
|
||||
overrideOptions.base = path.dirname(absolutePath);
|
||||
|
||||
const compilation = tsb.create(absolutePath, overrideOptions, { verbose: false, transpileOnly, transpileOnlyIncludesDts: transpileOnly }, err => reporter(err.toString()));
|
||||
const compilation = tsb.create(absolutePath, overrideOptions, false, err => reporter(err.toString()));
|
||||
|
||||
const pipeline = function () {
|
||||
const input = es.through();
|
||||
@@ -156,16 +154,6 @@ const tasks = compilations.map(function (tsconfigFile) {
|
||||
|
||||
const cleanTask = task.define(`clean-extension-${name}`, util.rimraf(out));
|
||||
|
||||
const transpileTask = task.define(`transpile-extension:${name}`, task.series(cleanTask, () => {
|
||||
const pipeline = createPipeline(false, true, true);
|
||||
const nonts = gulp.src(src, srcOpts).pipe(filter(['**', '!**/*.ts']));
|
||||
const input = es.merge(nonts, pipeline.tsProjectSrc());
|
||||
|
||||
return input
|
||||
.pipe(pipeline())
|
||||
.pipe(gulp.dest(out));
|
||||
}));
|
||||
|
||||
const compileTask = task.define(`compile-extension:${name}`, task.series(cleanTask, () => {
|
||||
const pipeline = createPipeline(false, true);
|
||||
const nonts = gulp.src(src, srcOpts).pipe(filter(['**', '!**/*.ts']));
|
||||
@@ -198,16 +186,12 @@ const tasks = compilations.map(function (tsconfigFile) {
|
||||
}));
|
||||
|
||||
// Tasks
|
||||
gulp.task(transpileTask);
|
||||
gulp.task(compileTask);
|
||||
gulp.task(watchTask);
|
||||
|
||||
return { transpileTask, compileTask, watchTask, compileBuildTask };
|
||||
return { compileTask, watchTask, compileBuildTask };
|
||||
});
|
||||
|
||||
const transpileExtensionsTask = task.define('transpile-extensions', task.parallel(...tasks.map(t => t.transpileTask)));
|
||||
gulp.task(transpileExtensionsTask);
|
||||
|
||||
const compileExtensionsTask = task.define('compile-extensions', task.parallel(...tasks.map(t => t.compileTask)));
|
||||
gulp.task(compileExtensionsTask);
|
||||
exports.compileExtensionsTask = compileExtensionsTask;
|
||||
@@ -245,11 +229,7 @@ const compileExtensionsBuildTask = task.define('compile-extensions-build', task.
|
||||
));
|
||||
|
||||
gulp.task(compileExtensionsBuildTask);
|
||||
// {{SQL CARBON EDIT}} Needed to pass the "done" gulp callback function to fix "Did you roget to signal async completion" error
|
||||
gulp.task(task.define('extensions-ci', (done) => {
|
||||
task.series(compileExtensionsBuildTask, compileExtensionMediaBuildTask);
|
||||
done();
|
||||
}));
|
||||
gulp.task(task.define('extensions-ci', task.series(compileExtensionsBuildTask, compileExtensionMediaBuildTask)));
|
||||
|
||||
exports.compileExtensionsBuildTask = compileExtensionsBuildTask;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ function checkPackageJSON(actualPath) {
|
||||
const actual = require(path.join(__dirname, '..', actualPath));
|
||||
const rootPackageJSON = require('../package.json');
|
||||
const checkIncluded = (set1, set2) => {
|
||||
for (const depName in set1) {
|
||||
for (let depName in set1) {
|
||||
if (depName === 'typescript') {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ require('events').EventEmitter.defaultMaxListeners = 100;
|
||||
const gulp = require('gulp');
|
||||
const util = require('./lib/util');
|
||||
const task = require('./lib/task');
|
||||
const { transpileTask, compileTask, watchTask, compileApiProposalNamesTask, watchApiProposalNamesTask } = require('./lib/compilation');
|
||||
const { compileTask, watchTask, compileApiProposalNamesTask, watchApiProposalNamesTask } = require('./lib/compilation');
|
||||
const { monacoTypecheckTask/* , monacoTypecheckWatchTask */ } = require('./gulpfile.editor');
|
||||
const { compileExtensionsTask, watchExtensionsTask, compileExtensionMediaTask } = require('./gulpfile.extensions');
|
||||
|
||||
@@ -19,10 +19,6 @@ const { compileExtensionsTask, watchExtensionsTask, compileExtensionMediaTask }
|
||||
gulp.task(compileApiProposalNamesTask);
|
||||
gulp.task(watchApiProposalNamesTask);
|
||||
|
||||
// Transpile only
|
||||
const transpileClientTask = task.define('transpile-client', task.series(util.rimraf('out'), util.buildWebNodePaths('out'), transpileTask('src', 'out')));
|
||||
gulp.task(transpileClientTask);
|
||||
|
||||
// Fast compile for development time
|
||||
const compileClientTask = task.define('compile-client', task.series(util.rimraf('out'), util.buildWebNodePaths('out'), compileApiProposalNamesTask, compileTask('src', 'out', false)));
|
||||
gulp.task(compileClientTask);
|
||||
|
||||
@@ -116,7 +116,7 @@ const serverEntryPoints = [
|
||||
name: 'vs/workbench/api/node/extensionHostProcess',
|
||||
exclude: ['vs/css', 'vs/nls']
|
||||
},
|
||||
{
|
||||
{
|
||||
name: 'vs/platform/files/node/watcher/watcherMain',
|
||||
exclude: ['vs/css', 'vs/nls']
|
||||
},
|
||||
@@ -135,7 +135,7 @@ try {
|
||||
|
||||
// Include workbench web
|
||||
...vscodeWebEntryPoints
|
||||
];
|
||||
];
|
||||
} catch (err) {
|
||||
serverWithWebEntryPoints = [
|
||||
// Include all of server
|
||||
@@ -356,14 +356,14 @@ function copyConfigTask(folder) {
|
||||
const json = require('gulp-json-editor');
|
||||
|
||||
return gulp.src(['remote/pkg-package.json'], { base: 'remote' })
|
||||
.pipe(rename(path => path.basename += '.' + folder))
|
||||
.pipe(json(obj => {
|
||||
const pkg = obj.pkg;
|
||||
pkg.scripts = pkg.scripts && pkg.scripts.map(p => path.join(destination, p));
|
||||
pkg.assets = pkg.assets && pkg.assets.map(p => path.join(destination, p));
|
||||
return obj;
|
||||
}))
|
||||
.pipe(vfs.dest('out-vscode-reh-pkg'));
|
||||
.pipe(rename(path => path.basename += '.' + folder))
|
||||
.pipe(json(obj => {
|
||||
const pkg = obj.pkg;
|
||||
pkg.scripts = pkg.scripts && pkg.scripts.map(p => path.join(destination, p));
|
||||
pkg.assets = pkg.assets && pkg.assets.map(p => path.join(destination, p));
|
||||
return obj;
|
||||
}))
|
||||
.pipe(vfs.dest('out-vscode-reh-pkg'));
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ const vscodeResources = [
|
||||
'out-build/vs/base/browser/ui/codicons/codicon/**',
|
||||
'out-build/vs/base/parts/sandbox/electron-browser/preload.js',
|
||||
'out-build/vs/platform/environment/node/userDataPath.js',
|
||||
'out-build/vs/platform/extensions/node/extensionHostStarterWorkerMain.js',
|
||||
'out-build/vs/workbench/browser/media/*-theme.css',
|
||||
'out-build/vs/workbench/contrib/debug/**/*.json',
|
||||
'out-build/vs/workbench/contrib/externalTerminal/**/*.scpt',
|
||||
@@ -75,7 +76,7 @@ const vscodeResources = [
|
||||
'out-build/vs/workbench/contrib/tasks/**/*.json',
|
||||
'out-build/vs/platform/files/**/*.exe',
|
||||
'out-build/vs/platform/files/**/*.md',
|
||||
'out-build/vs/code/electron-sandbox/workbench/**',
|
||||
'out-build/vs/code/electron-browser/workbench/**',
|
||||
'out-build/vs/code/electron-browser/sharedProcess/sharedProcess.js',
|
||||
'out-build/vs/code/electron-sandbox/issue/issueReporter.js',
|
||||
'out-build/sql/**/*.{svg,png,cur,html}',
|
||||
@@ -186,9 +187,9 @@ gulp.task(core);
|
||||
* @return {Object} A map of paths to checksums.
|
||||
*/
|
||||
function computeChecksums(out, filenames) {
|
||||
const result = {};
|
||||
let result = {};
|
||||
filenames.forEach(function (filename) {
|
||||
const fullPath = path.join(process.cwd(), out, filename);
|
||||
let fullPath = path.join(process.cwd(), out, filename);
|
||||
result[filename] = computeChecksum(fullPath);
|
||||
});
|
||||
return result;
|
||||
@@ -201,9 +202,9 @@ function computeChecksums(out, filenames) {
|
||||
* @return {string} The checksum for `filename`.
|
||||
*/
|
||||
function computeChecksum(filename) {
|
||||
const contents = fs.readFileSync(filename);
|
||||
let contents = fs.readFileSync(filename);
|
||||
|
||||
const hash = crypto
|
||||
let hash = crypto
|
||||
.createHash('md5')
|
||||
.update(contents)
|
||||
.digest('base64')
|
||||
@@ -229,8 +230,8 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
|
||||
'vs/workbench/workbench.desktop.main.js',
|
||||
'vs/workbench/workbench.desktop.main.css',
|
||||
'vs/workbench/api/node/extensionHostProcess.js',
|
||||
'vs/code/electron-sandbox/workbench/workbench.html',
|
||||
'vs/code/electron-sandbox/workbench/workbench.js'
|
||||
'vs/code/electron-browser/workbench/workbench.html',
|
||||
'vs/code/electron-browser/workbench/workbench.js'
|
||||
]);
|
||||
|
||||
const src = gulp.src(out + '/**', { base: '.' })
|
||||
@@ -321,7 +322,6 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
|
||||
all = es.merge(all, gulp.src('resources/linux/code.png', { base: '.' }));
|
||||
} else if (platform === 'darwin') {
|
||||
const shortcut = gulp.src('resources/darwin/bin/code.sh')
|
||||
.pipe(replace('@@APPNAME@@', product.applicationName))
|
||||
.pipe(rename('bin/code'));
|
||||
|
||||
all = es.merge(all, shortcut);
|
||||
@@ -366,14 +366,10 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
|
||||
|
||||
result = es.merge(result, gulp.src('resources/win32/VisualElementsManifest.xml', { base: 'resources/win32' })
|
||||
.pipe(rename(product.nameShort + '.VisualElementsManifest.xml')));
|
||||
|
||||
result = es.merge(result, gulp.src('.build/policies/win32/**', { base: '.build/policies/win32' })
|
||||
.pipe(rename(f => f.dirname = `policies/${f.dirname}`)));
|
||||
|
||||
} else if (platform === 'linux') {
|
||||
result = es.merge(result, gulp.src('resources/linux/bin/code.sh', { base: '.' })
|
||||
.pipe(replace('@@PRODNAME@@', product.nameLong))
|
||||
.pipe(replace('@@APPNAME@@', product.applicationName))
|
||||
.pipe(replace('@@NAME@@', product.applicationName))
|
||||
.pipe(rename('bin/' + product.applicationName)));
|
||||
}
|
||||
|
||||
@@ -527,7 +523,7 @@ gulp.task(task.define(
|
||||
|
||||
gulp.task('vscode-translations-pull', function () {
|
||||
return es.merge([...i18n.defaultLanguages, ...i18n.extraLanguages].map(language => {
|
||||
const includeDefault = !!innoSetupConfig[language.id].defaultInfo;
|
||||
let includeDefault = !!innoSetupConfig[language.id].defaultInfo;
|
||||
return i18n.pullSetupXlfFiles(apiHostname, apiName, apiToken, language, includeDefault).pipe(vfs.dest(`../vscode-translations-import/${language.id}/setup`));
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -16,9 +16,6 @@ const task = require('./lib/task');
|
||||
const packageJson = require('../package.json');
|
||||
const product = require('../product.json');
|
||||
const rpmDependenciesGenerator = require('./linux/rpm/dependencies-generator');
|
||||
const debianDependenciesGenerator = require('./linux/debian/dependencies-generator');
|
||||
const sysrootInstaller = require('./linux/debian/install-sysroot');
|
||||
const debianRecommendedDependencies = require('./linux/debian/dep-lists').recommendedDeps;
|
||||
const path = require('path');
|
||||
const root = path.dirname(__dirname);
|
||||
const commit = util.getVersion(root);
|
||||
@@ -78,16 +75,12 @@ function prepareDebPackage(arch) {
|
||||
let size = 0;
|
||||
const control = code.pipe(es.through(
|
||||
function (f) { size += f.isDirectory() ? 4096 : f.contents.length; },
|
||||
async function () {
|
||||
function () {
|
||||
const that = this;
|
||||
const sysroot = await sysrootInstaller.getSysroot(debArch);
|
||||
const dependencies = debianDependenciesGenerator.getDependencies(binaryDir, product.applicationName, debArch, sysroot);
|
||||
gulp.src('resources/linux/debian/control.template', { base: '.' })
|
||||
.pipe(replace('@@NAME@@', product.applicationName))
|
||||
.pipe(replace('@@VERSION@@', packageJson.version + '-' + linuxPackageRevision))
|
||||
.pipe(replace('@@ARCHITECTURE@@', debArch))
|
||||
.pipe(replace('@@DEPENDS@@', dependencies.join(', ')))
|
||||
.pipe(replace('@@RECOMMENDS@@', debianRecommendedDependencies.join(', ')))
|
||||
.pipe(replace('@@INSTALLEDSIZE@@', Math.ceil(size / 1024)))
|
||||
.pipe(rename('DEBIAN/control'))
|
||||
.pipe(es.through(function (f) { that.emit('data', f); }, function () { that.emit('end'); }));
|
||||
@@ -219,7 +212,7 @@ function buildRpmPackage(arch) {
|
||||
|
||||
return shell.task([
|
||||
'mkdir -p ' + destination,
|
||||
'HOME="$(pwd)/' + destination + '" rpmbuild -bb ' + rpmBuildPath + '/SPECS/' + product.applicationName + '.spec --target=' + rpmArch,
|
||||
'HOME="$(pwd)/' + destination + '" fakeroot rpmbuild -bb ' + rpmBuildPath + '/SPECS/' + product.applicationName + '.spec --target=' + rpmArch,
|
||||
'cp "' + rpmOut + '/$(ls ' + rpmOut + ')" ' + destination + '/'
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ function packageTask(sourceFolderName, destinationFolderName) {
|
||||
gulp.src('resources/server/code-512.png', { base: 'resources/server' })
|
||||
);
|
||||
|
||||
const all = es.merge(
|
||||
let all = es.merge(
|
||||
packageJsonStream,
|
||||
license,
|
||||
sources,
|
||||
@@ -218,7 +218,7 @@ function packageTask(sourceFolderName, destinationFolderName) {
|
||||
pwaicons
|
||||
);
|
||||
|
||||
const result = all
|
||||
let result = all
|
||||
.pipe(util.skipDirectories())
|
||||
.pipe(util.fixWin32DirectoryPermissions());
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ function hygiene(some, linting = true) {
|
||||
const m = /([^\t\n\r\x20-\x7E⊃⊇✔︎✓🎯⚠️🛑🔴🚗🚙🚕🎉✨❗⇧⌥⌘×÷¦⋯…↑↓→→←↔⟷·•●◆▼⟪⟫┌└├⏎↩√φ]+)/g.exec(line);
|
||||
if (m) {
|
||||
console.error(
|
||||
file.relative + `(${i + 1},${m.index + 1}): Unexpected unicode character: "${m[0]}" (charCode: ${m[0].charCodeAt(0)}). To suppress, use // allow-any-unicode-next-line`
|
||||
file.relative + `(${i + 1},${m.index + 1}): Unexpected unicode character: "${m[0]}". To suppress, use // allow-any-unicode-next-line`
|
||||
);
|
||||
errorCount++;
|
||||
}
|
||||
@@ -115,8 +115,8 @@ function hygiene(some, linting = true) {
|
||||
})
|
||||
.then(
|
||||
(result) => {
|
||||
const original = result.src.replace(/\r\n/gm, '\n');
|
||||
const formatted = result.dest.replace(/\r\n/gm, '\n');
|
||||
let original = result.src.replace(/\r\n/gm, '\n');
|
||||
let formatted = result.dest.replace(/\r\n/gm, '\n');
|
||||
|
||||
if (original !== formatted) {
|
||||
console.error(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createAsar = void 0;
|
||||
const path = require("path");
|
||||
@@ -81,7 +81,7 @@ function createAsar(folderPath, unpackGlobs, destFilename) {
|
||||
out.push(file.contents);
|
||||
}
|
||||
}, function () {
|
||||
const finish = () => {
|
||||
let finish = () => {
|
||||
{
|
||||
const headerPickle = pickle.createEmpty();
|
||||
headerPickle.writeString(JSON.stringify(filesystem.header));
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as path from 'path';
|
||||
import * as es from 'event-stream';
|
||||
const pickle = require('chromium-pickle-js');
|
||||
@@ -96,7 +98,7 @@ export function createAsar(folderPath: string, unpackGlobs: string[], destFilena
|
||||
}
|
||||
}, function () {
|
||||
|
||||
const finish = () => {
|
||||
let finish = () => {
|
||||
{
|
||||
const headerPickle = pickle.createEmpty();
|
||||
headerPickle.writeString(JSON.stringify(filesystem.header));
|
||||
|
||||
@@ -98,12 +98,12 @@ function writeControlFile(control) {
|
||||
fs.writeFileSync(controlFilePath, JSON.stringify(control, null, 2));
|
||||
}
|
||||
function getBuiltInExtensions() {
|
||||
log('Synchronizing built-in extensions...');
|
||||
log('Syncronizing built-in extensions...');
|
||||
log(`You can manage built-in extensions with the ${ansiColors.cyan('--builtin')} flag`);
|
||||
const control = readControlFile();
|
||||
const streams = [];
|
||||
for (const extension of [...builtInExtensions, ...webBuiltInExtensions]) {
|
||||
const controlState = control[extension.name] || 'marketplace';
|
||||
let controlState = control[extension.name] || 'marketplace';
|
||||
control[extension.name] = controlState;
|
||||
streams.push(syncExtension(extension, controlState));
|
||||
}
|
||||
|
||||
@@ -136,14 +136,14 @@ function writeControlFile(control: IControlFile): void {
|
||||
}
|
||||
|
||||
export function getBuiltInExtensions(): Promise<void> {
|
||||
log('Synchronizing built-in extensions...');
|
||||
log('Syncronizing built-in extensions...');
|
||||
log(`You can manage built-in extensions with the ${ansiColors.cyan('--builtin')} flag`);
|
||||
|
||||
const control = readControlFile();
|
||||
const streams: Stream[] = [];
|
||||
|
||||
for (const extension of [...builtInExtensions, ...webBuiltInExtensions]) {
|
||||
const controlState = control[extension.name] || 'marketplace';
|
||||
let controlState = control[extension.name] || 'marketplace';
|
||||
control[extension.name] = controlState;
|
||||
|
||||
streams.push(syncExtension(extension, controlState));
|
||||
|
||||
@@ -43,20 +43,14 @@ function bundle(entryPoints, config, callback) {
|
||||
if (!config.paths['vs/css']) {
|
||||
config.paths['vs/css'] = 'out-build/vs/css.build';
|
||||
}
|
||||
config.buildForceInvokeFactory = config.buildForceInvokeFactory || {};
|
||||
config.buildForceInvokeFactory['vs/nls'] = true;
|
||||
config.buildForceInvokeFactory['vs/css'] = true;
|
||||
loader.config(config);
|
||||
loader(['require'], (localRequire) => {
|
||||
const resolvePath = (entry) => {
|
||||
let r = localRequire.toUrl(entry.path);
|
||||
if (!r.endsWith('.js')) {
|
||||
r += '.js';
|
||||
const resolvePath = (path) => {
|
||||
const r = localRequire.toUrl(path);
|
||||
if (!/\.js/.test(r)) {
|
||||
return r + '.js';
|
||||
}
|
||||
// avoid packaging the build version of plugins:
|
||||
r = r.replace('vs/nls.build.js', 'vs/nls.js');
|
||||
r = r.replace('vs/css.build.js', 'vs/css.js');
|
||||
return { path: r, amdModuleId: entry.amdModuleId };
|
||||
return r;
|
||||
};
|
||||
for (const moduleId in entryPointsMap) {
|
||||
const entryPoint = entryPointsMap[moduleId];
|
||||
@@ -305,17 +299,8 @@ function emitEntryPoint(modulesMap, deps, entryPoint, includedModules, prepend,
|
||||
if (module.shim) {
|
||||
mainResult.sources.push(emitShimmedModule(c, deps[c], module.shim, module.path, contents));
|
||||
}
|
||||
else if (module.defineLocation) {
|
||||
mainResult.sources.push(emitNamedModule(c, module.defineLocation, module.path, contents));
|
||||
}
|
||||
else {
|
||||
const moduleCopy = {
|
||||
id: module.id,
|
||||
path: module.path,
|
||||
defineLocation: module.defineLocation,
|
||||
dependencies: module.dependencies
|
||||
};
|
||||
throw new Error(`Cannot bundle module '${module.id}' for entry point '${entryPoint}' because it has no shim and it lacks a defineLocation: ${JSON.stringify(moduleCopy)}`);
|
||||
mainResult.sources.push(emitNamedModule(c, module.defineLocation, module.path, contents));
|
||||
}
|
||||
});
|
||||
Object.keys(usedPlugins).forEach((pluginName) => {
|
||||
@@ -337,13 +322,10 @@ function emitEntryPoint(modulesMap, deps, entryPoint, includedModules, prepend,
|
||||
plugin.writeFile(pluginName, entryPoint, req, write, {});
|
||||
}
|
||||
});
|
||||
const toIFile = (entry) => {
|
||||
let contents = readFileAndRemoveBOM(entry.path);
|
||||
if (entry.amdModuleId) {
|
||||
contents = contents.replace(/^define\(/m, `define("${entry.amdModuleId}",`);
|
||||
}
|
||||
const toIFile = (path) => {
|
||||
const contents = readFileAndRemoveBOM(path);
|
||||
return {
|
||||
path: entry.path,
|
||||
path: path,
|
||||
contents: contents
|
||||
};
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ interface IPosition {
|
||||
interface IBuildModuleInfo {
|
||||
id: string;
|
||||
path: string;
|
||||
defineLocation: IPosition | null;
|
||||
defineLocation: IPosition;
|
||||
dependencies: string[];
|
||||
shim: string;
|
||||
exports: any;
|
||||
@@ -42,17 +42,12 @@ interface ILoaderPluginReqFunc {
|
||||
toUrl(something: string): string;
|
||||
}
|
||||
|
||||
export interface IExtraFile {
|
||||
path: string;
|
||||
amdModuleId?: string;
|
||||
}
|
||||
|
||||
export interface IEntryPoint {
|
||||
name: string;
|
||||
include?: string[];
|
||||
exclude?: string[];
|
||||
prepend?: IExtraFile[];
|
||||
append?: IExtraFile[];
|
||||
prepend?: string[];
|
||||
append?: string[];
|
||||
dest?: string;
|
||||
}
|
||||
|
||||
@@ -97,13 +92,6 @@ interface IPartialBundleResult {
|
||||
export interface ILoaderConfig {
|
||||
isBuild?: boolean;
|
||||
paths?: { [path: string]: any };
|
||||
/*
|
||||
* Normally, during a build, no module factories are invoked. This can be used
|
||||
* to forcefully execute a module's factory.
|
||||
*/
|
||||
buildForceInvokeFactory: {
|
||||
[moduleId: string]: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,21 +132,15 @@ export function bundle(entryPoints: IEntryPoint[], config: ILoaderConfig, callba
|
||||
if (!config.paths['vs/css']) {
|
||||
config.paths['vs/css'] = 'out-build/vs/css.build';
|
||||
}
|
||||
config.buildForceInvokeFactory = config.buildForceInvokeFactory || {};
|
||||
config.buildForceInvokeFactory['vs/nls'] = true;
|
||||
config.buildForceInvokeFactory['vs/css'] = true;
|
||||
loader.config(config);
|
||||
|
||||
loader(['require'], (localRequire: any) => {
|
||||
const resolvePath = (entry: IExtraFile) => {
|
||||
let r = localRequire.toUrl(entry.path);
|
||||
if (!r.endsWith('.js')) {
|
||||
r += '.js';
|
||||
const resolvePath = (path: string) => {
|
||||
const r = localRequire.toUrl(path);
|
||||
if (!/\.js/.test(r)) {
|
||||
return r + '.js';
|
||||
}
|
||||
// avoid packaging the build version of plugins:
|
||||
r = r.replace('vs/nls.build.js', 'vs/nls.js');
|
||||
r = r.replace('vs/css.build.js', 'vs/css.js');
|
||||
return { path: r, amdModuleId: entry.amdModuleId };
|
||||
return r;
|
||||
};
|
||||
for (const moduleId in entryPointsMap) {
|
||||
const entryPoint = entryPointsMap[moduleId];
|
||||
@@ -421,8 +403,8 @@ function emitEntryPoint(
|
||||
deps: IGraph,
|
||||
entryPoint: string,
|
||||
includedModules: string[],
|
||||
prepend: IExtraFile[],
|
||||
append: IExtraFile[],
|
||||
prepend: string[],
|
||||
append: string[],
|
||||
dest: string | undefined
|
||||
): IEmitEntryPointResult {
|
||||
if (!dest) {
|
||||
@@ -462,16 +444,8 @@ function emitEntryPoint(
|
||||
|
||||
if (module.shim) {
|
||||
mainResult.sources.push(emitShimmedModule(c, deps[c], module.shim, module.path, contents));
|
||||
} else if (module.defineLocation) {
|
||||
mainResult.sources.push(emitNamedModule(c, module.defineLocation, module.path, contents));
|
||||
} else {
|
||||
const moduleCopy = {
|
||||
id: module.id,
|
||||
path: module.path,
|
||||
defineLocation: module.defineLocation,
|
||||
dependencies: module.dependencies
|
||||
};
|
||||
throw new Error(`Cannot bundle module '${module.id}' for entry point '${entryPoint}' because it has no shim and it lacks a defineLocation: ${JSON.stringify(moduleCopy)}`);
|
||||
mainResult.sources.push(emitNamedModule(c, module.defineLocation, module.path, contents));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -496,13 +470,10 @@ function emitEntryPoint(
|
||||
}
|
||||
});
|
||||
|
||||
const toIFile = (entry: IExtraFile): IFile => {
|
||||
let contents = readFileAndRemoveBOM(entry.path);
|
||||
if (entry.amdModuleId) {
|
||||
contents = contents.replace(/^define\(/m, `define("${entry.amdModuleId}",`);
|
||||
}
|
||||
const toIFile = (path: string): IFile => {
|
||||
const contents = readFileAndRemoveBOM(path);
|
||||
return {
|
||||
path: entry.path,
|
||||
path: path,
|
||||
contents: contents
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.watchApiProposalNamesTask = exports.compileApiProposalNamesTask = exports.watchTask = exports.compileTask = exports.transpileTask = void 0;
|
||||
exports.watchApiProposalNamesTask = exports.compileApiProposalNamesTask = exports.watchTask = exports.compileTask = void 0;
|
||||
const es = require("event-stream");
|
||||
const fs = require("fs");
|
||||
const gulp = require("gulp");
|
||||
@@ -22,7 +22,7 @@ const watch = require('./watch');
|
||||
const reporter = (0, reporter_1.createReporter)();
|
||||
function getTypeScriptCompilerOptions(src) {
|
||||
const rootDir = path.join(__dirname, `../../${src}`);
|
||||
const options = {};
|
||||
let options = {};
|
||||
options.verbose = false;
|
||||
options.sourceMap = true;
|
||||
if (process.env['VSCODE_NO_SOURCEMAP']) { // To be used by developers in a hurry
|
||||
@@ -34,8 +34,8 @@ function getTypeScriptCompilerOptions(src) {
|
||||
options.newLine = /\r\n/.test(fs.readFileSync(__filename, 'utf8')) ? 0 : 1;
|
||||
return options;
|
||||
}
|
||||
function createCompile(src, build, emitError, transpileOnly) {
|
||||
const tsb = require('./tsb');
|
||||
function createCompile(src, build, emitError) {
|
||||
const tsb = require('gulp-tsb');
|
||||
const sourcemaps = require('gulp-sourcemaps');
|
||||
const projectPath = path.join(__dirname, '../../', src, 'tsconfig.json');
|
||||
const overrideOptions = Object.assign(Object.assign({}, getTypeScriptCompilerOptions(src)), { inlineSources: Boolean(build) });
|
||||
@@ -69,7 +69,7 @@ function createCompile(src, build, emitError, transpileOnly) {
|
||||
.pipe(noDeclarationsFilter)
|
||||
.pipe(build ? nls.nls() : es.through())
|
||||
.pipe(noDeclarationsFilter.restore)
|
||||
.pipe(transpileOnly ? es.through() : sourcemaps.write('.', {
|
||||
.pipe(sourcemaps.write('.', {
|
||||
addComment: false,
|
||||
includeContent: !!build,
|
||||
sourceRoot: overrideOptions.sourceRoot
|
||||
@@ -83,24 +83,14 @@ function createCompile(src, build, emitError, transpileOnly) {
|
||||
};
|
||||
return pipeline;
|
||||
}
|
||||
function transpileTask(src, out) {
|
||||
return function () {
|
||||
const transpile = createCompile(src, false, true, true);
|
||||
const srcPipe = gulp.src(`${src}/**`, { base: `${src}` });
|
||||
return srcPipe
|
||||
.pipe(transpile())
|
||||
.pipe(gulp.dest(out));
|
||||
};
|
||||
}
|
||||
exports.transpileTask = transpileTask;
|
||||
function compileTask(src, out, build) {
|
||||
return function () {
|
||||
if (os.totalmem() < 4000000000) {
|
||||
throw new Error('compilation requires 4GB of RAM');
|
||||
}
|
||||
const compile = createCompile(src, build, true, false);
|
||||
const compile = createCompile(src, build, true);
|
||||
const srcPipe = gulp.src(`${src}/**`, { base: `${src}` });
|
||||
const generator = new MonacoGenerator(false);
|
||||
let generator = new MonacoGenerator(false);
|
||||
if (src === 'src') {
|
||||
generator.execute();
|
||||
}
|
||||
@@ -113,10 +103,10 @@ function compileTask(src, out, build) {
|
||||
exports.compileTask = compileTask;
|
||||
function watchTask(out, build) {
|
||||
return function () {
|
||||
const compile = createCompile('src', build, false, false);
|
||||
const compile = createCompile('src', build);
|
||||
const src = gulp.src('src/**', { base: 'src' });
|
||||
const watchSrc = watch('src/**', { base: 'src', readDelay: 200 });
|
||||
const generator = new MonacoGenerator(true);
|
||||
let generator = new MonacoGenerator(true);
|
||||
generator.execute();
|
||||
return watchSrc
|
||||
.pipe(generator.stream)
|
||||
@@ -132,7 +122,7 @@ class MonacoGenerator {
|
||||
this._isWatch = isWatch;
|
||||
this.stream = es.through();
|
||||
this._watchedFiles = {};
|
||||
const onWillReadFile = (moduleId, filePath) => {
|
||||
let onWillReadFile = (moduleId, filePath) => {
|
||||
if (!this._isWatch) {
|
||||
return;
|
||||
}
|
||||
@@ -169,7 +159,7 @@ class MonacoGenerator {
|
||||
}, 20);
|
||||
}
|
||||
_run() {
|
||||
const r = monacodts.run3(this._declarationResolver);
|
||||
let r = monacodts.run3(this._declarationResolver);
|
||||
if (!r && !this._isWatch) {
|
||||
// The build must always be able to generate the monaco.d.ts
|
||||
throw new Error(`monaco.d.ts generation error - Cannot continue`);
|
||||
@@ -198,15 +188,6 @@ class MonacoGenerator {
|
||||
}
|
||||
}
|
||||
function generateApiProposalNames() {
|
||||
let eol;
|
||||
try {
|
||||
const src = fs.readFileSync('src/vs/workbench/services/extensions/common/extensionsApiProposals.ts', 'utf-8');
|
||||
const match = /\r?\n/m.exec(src);
|
||||
eol = match ? match[0] : os.EOL;
|
||||
}
|
||||
catch {
|
||||
eol = os.EOL;
|
||||
}
|
||||
const pattern = /vscode\.proposed\.([a-zA-Z]+)\.d\.ts$/;
|
||||
const proposalNames = new Set();
|
||||
const input = es.through();
|
||||
@@ -233,7 +214,7 @@ function generateApiProposalNames() {
|
||||
'});',
|
||||
'export type ApiProposalName = keyof typeof allApiProposals;',
|
||||
'',
|
||||
].join(eol);
|
||||
].join(os.EOL);
|
||||
this.emit('data', new File({
|
||||
path: 'vs/workbench/services/extensions/common/extensionsApiProposals.ts',
|
||||
contents: Buffer.from(contents)
|
||||
|
||||
@@ -26,7 +26,7 @@ const reporter = createReporter();
|
||||
|
||||
function getTypeScriptCompilerOptions(src: string): ts.CompilerOptions {
|
||||
const rootDir = path.join(__dirname, `../../${src}`);
|
||||
const options: ts.CompilerOptions = {};
|
||||
let options: ts.CompilerOptions = {};
|
||||
options.verbose = false;
|
||||
options.sourceMap = true;
|
||||
if (process.env['VSCODE_NO_SOURCEMAP']) { // To be used by developers in a hurry
|
||||
@@ -39,8 +39,8 @@ function getTypeScriptCompilerOptions(src: string): ts.CompilerOptions {
|
||||
return options;
|
||||
}
|
||||
|
||||
function createCompile(src: string, build: boolean, emitError: boolean, transpileOnly: boolean) {
|
||||
const tsb = require('./tsb') as typeof import('./tsb');
|
||||
function createCompile(src: string, build: boolean, emitError?: boolean) {
|
||||
const tsb = require('gulp-tsb') as typeof import('gulp-tsb');
|
||||
const sourcemaps = require('gulp-sourcemaps') as typeof import('gulp-sourcemaps');
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ function createCompile(src: string, build: boolean, emitError: boolean, transpil
|
||||
.pipe(noDeclarationsFilter)
|
||||
.pipe(build ? nls.nls() : es.through())
|
||||
.pipe(noDeclarationsFilter.restore)
|
||||
.pipe(transpileOnly ? es.through() : sourcemaps.write('.', {
|
||||
.pipe(sourcemaps.write('.', {
|
||||
addComment: false,
|
||||
includeContent: !!build,
|
||||
sourceRoot: overrideOptions.sourceRoot
|
||||
@@ -96,19 +96,6 @@ function createCompile(src: string, build: boolean, emitError: boolean, transpil
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
export function transpileTask(src: string, out: string): () => NodeJS.ReadWriteStream {
|
||||
|
||||
return function () {
|
||||
|
||||
const transpile = createCompile(src, false, true, true);
|
||||
const srcPipe = gulp.src(`${src}/**`, { base: `${src}` });
|
||||
|
||||
return srcPipe
|
||||
.pipe(transpile())
|
||||
.pipe(gulp.dest(out));
|
||||
};
|
||||
}
|
||||
|
||||
export function compileTask(src: string, out: string, build: boolean): () => NodeJS.ReadWriteStream {
|
||||
|
||||
return function () {
|
||||
@@ -117,9 +104,9 @@ export function compileTask(src: string, out: string, build: boolean): () => Nod
|
||||
throw new Error('compilation requires 4GB of RAM');
|
||||
}
|
||||
|
||||
const compile = createCompile(src, build, true, false);
|
||||
const compile = createCompile(src, build, true);
|
||||
const srcPipe = gulp.src(`${src}/**`, { base: `${src}` });
|
||||
const generator = new MonacoGenerator(false);
|
||||
let generator = new MonacoGenerator(false);
|
||||
if (src === 'src') {
|
||||
generator.execute();
|
||||
}
|
||||
@@ -134,12 +121,12 @@ export function compileTask(src: string, out: string, build: boolean): () => Nod
|
||||
export function watchTask(out: string, build: boolean): () => NodeJS.ReadWriteStream {
|
||||
|
||||
return function () {
|
||||
const compile = createCompile('src', build, false, false);
|
||||
const compile = createCompile('src', build);
|
||||
|
||||
const src = gulp.src('src/**', { base: 'src' });
|
||||
const watchSrc = watch('src/**', { base: 'src', readDelay: 200 });
|
||||
|
||||
const generator = new MonacoGenerator(true);
|
||||
let generator = new MonacoGenerator(true);
|
||||
generator.execute();
|
||||
|
||||
return watchSrc
|
||||
@@ -163,7 +150,7 @@ class MonacoGenerator {
|
||||
this._isWatch = isWatch;
|
||||
this.stream = es.through();
|
||||
this._watchedFiles = {};
|
||||
const onWillReadFile = (moduleId: string, filePath: string) => {
|
||||
let onWillReadFile = (moduleId: string, filePath: string) => {
|
||||
if (!this._isWatch) {
|
||||
return;
|
||||
}
|
||||
@@ -205,7 +192,7 @@ class MonacoGenerator {
|
||||
}
|
||||
|
||||
private _run(): monacodts.IMonacoDeclarationResult | null {
|
||||
const r = monacodts.run3(this._declarationResolver);
|
||||
let r = monacodts.run3(this._declarationResolver);
|
||||
if (!r && !this._isWatch) {
|
||||
// The build must always be able to generate the monaco.d.ts
|
||||
throw new Error(`monaco.d.ts generation error - Cannot continue`);
|
||||
@@ -238,16 +225,6 @@ class MonacoGenerator {
|
||||
}
|
||||
|
||||
function generateApiProposalNames() {
|
||||
let eol: string;
|
||||
|
||||
try {
|
||||
const src = fs.readFileSync('src/vs/workbench/services/extensions/common/extensionsApiProposals.ts', 'utf-8');
|
||||
const match = /\r?\n/m.exec(src);
|
||||
eol = match ? match[0] : os.EOL;
|
||||
} catch {
|
||||
eol = os.EOL;
|
||||
}
|
||||
|
||||
const pattern = /vscode\.proposed\.([a-zA-Z]+)\.d\.ts$/;
|
||||
const proposalNames = new Set<string>();
|
||||
|
||||
@@ -276,7 +253,7 @@ function generateApiProposalNames() {
|
||||
'});',
|
||||
'export type ApiProposalName = keyof typeof allApiProposals;',
|
||||
'',
|
||||
].join(eol);
|
||||
].join(os.EOL);
|
||||
|
||||
this.emit('data', new File({
|
||||
path: 'vs/workbench/services/extensions/common/extensionsApiProposals.ts',
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getProductionDependencies = void 0;
|
||||
const path = require("path");
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as path from 'path';
|
||||
import * as cp from 'child_process';
|
||||
import * as _ from 'underscore';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.config = void 0;
|
||||
const fs = require("fs");
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as vfs from 'vinyl-fs';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as eslint from 'eslint';
|
||||
import { TSESTree } from '@typescript-eslint/experimental-utils';
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
@@ -41,7 +41,7 @@ module.exports = new (_a = class NoUnexternalizedStrings {
|
||||
key = keyNode.value;
|
||||
}
|
||||
else if (keyNode.type === experimental_utils_1.AST_NODE_TYPES.ObjectExpression) {
|
||||
for (const property of keyNode.properties) {
|
||||
for (let property of keyNode.properties) {
|
||||
if (property.type === experimental_utils_1.AST_NODE_TYPES.Property && !property.computed) {
|
||||
if (property.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier && property.key.name === 'key') {
|
||||
if (isStringLiteral(property.value)) {
|
||||
@@ -83,7 +83,7 @@ module.exports = new (_a = class NoUnexternalizedStrings {
|
||||
// (2)
|
||||
// report all invalid NLS keys
|
||||
if (!key.match(NoUnexternalizedStrings._rNlsKeys)) {
|
||||
for (const value of values) {
|
||||
for (let value of values) {
|
||||
context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule {
|
||||
key = keyNode.value;
|
||||
|
||||
} else if (keyNode.type === AST_NODE_TYPES.ObjectExpression) {
|
||||
for (const property of keyNode.properties) {
|
||||
for (let property of keyNode.properties) {
|
||||
if (property.type === AST_NODE_TYPES.Property && !property.computed) {
|
||||
if (property.key.type === AST_NODE_TYPES.Identifier && property.key.name === 'key') {
|
||||
if (isStringLiteral(property.value)) {
|
||||
@@ -97,7 +97,7 @@ export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule {
|
||||
// (2)
|
||||
// report all invalid NLS keys
|
||||
if (!key.match(NoUnexternalizedStrings._rNlsKeys)) {
|
||||
for (const value of values) {
|
||||
for (let value of values) {
|
||||
context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
// FORKED FROM https://github.com/eslint/eslint/blob/b23ad0d789a909baf8d7c41a35bc53df932eaf30/lib/rules/no-unused-expressions.js
|
||||
// and added support for `OptionalCallExpression`, see https://github.com/facebook/create-react-app/issues/8107 and https://github.com/eslint/eslint/issues/12642
|
||||
/**
|
||||
* @fileoverview Flag expressions in statement position that do not side effect
|
||||
* @author Michael Ficarra
|
||||
*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
* @author Michael Ficarra
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as eslint from 'eslint';
|
||||
import { TSESTree } from '@typescript-eslint/experimental-utils';
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = new class ApiProviderNaming {
|
||||
return {
|
||||
['TSInterfaceDeclaration[id.name=/.+Provider/] TSMethodSignature[key.name=/^(provide|resolve).+/]']: (node) => {
|
||||
let found = false;
|
||||
for (const param of node.params) {
|
||||
for (let param of node.params) {
|
||||
if (param.type === experimental_utils_1.AST_NODE_TYPES.Identifier) {
|
||||
found = found || param.name === 'token';
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export = new class ApiProviderNaming implements eslint.Rule.RuleModule {
|
||||
['TSInterfaceDeclaration[id.name=/.+Provider/] TSMethodSignature[key.name=/^(provide|resolve).+/]']: (node: any) => {
|
||||
|
||||
let found = false;
|
||||
for (const param of (<TSESTree.TSMethodSignature>node).params) {
|
||||
for (let param of (<TSESTree.TSMethodSignature>node).params) {
|
||||
if (param.type === AST_NODE_TYPES.Identifier) {
|
||||
found = found || param.name === 'token';
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ module.exports = new (_a = class ApiEventNaming {
|
||||
if (def.type === experimental_utils_1.AST_NODE_TYPES.Identifier) {
|
||||
return def;
|
||||
}
|
||||
else if ((def.type === experimental_utils_1.AST_NODE_TYPES.TSPropertySignature || def.type === experimental_utils_1.AST_NODE_TYPES.PropertyDefinition) && def.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier) {
|
||||
else if ((def.type === experimental_utils_1.AST_NODE_TYPES.TSPropertySignature || def.type === experimental_utils_1.AST_NODE_TYPES.Property) && def.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier) {
|
||||
return def.key;
|
||||
}
|
||||
return this.getIdent(def.parent);
|
||||
|
||||
@@ -88,10 +88,11 @@ export = new class ApiEventNaming implements eslint.Rule.RuleModule {
|
||||
|
||||
if (def.type === AST_NODE_TYPES.Identifier) {
|
||||
return def;
|
||||
} else if ((def.type === AST_NODE_TYPES.TSPropertySignature || def.type === AST_NODE_TYPES.PropertyDefinition) && def.key.type === AST_NODE_TYPES.Identifier) {
|
||||
} else if ((def.type === AST_NODE_TYPES.TSPropertySignature || def.type === AST_NODE_TYPES.Property) && def.key.type === AST_NODE_TYPES.Identifier) {
|
||||
return def.key;
|
||||
}
|
||||
|
||||
return this.getIdent(def.parent);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -34,14 +34,14 @@ function minifyExtensionResources(input) {
|
||||
.pipe(jsonFilter)
|
||||
.pipe(buffer())
|
||||
.pipe(es.mapSync((f) => {
|
||||
const errors = [];
|
||||
const value = jsoncParser.parse(f.contents.toString('utf8'), errors);
|
||||
if (errors.length === 0) {
|
||||
// file parsed OK => just stringify to drop whitespace and comments
|
||||
f.contents = Buffer.from(JSON.stringify(value));
|
||||
}
|
||||
return f;
|
||||
}))
|
||||
const errors = [];
|
||||
const value = jsoncParser.parse(f.contents.toString('utf8'), errors);
|
||||
if (errors.length === 0) {
|
||||
// file parsed OK => just stringify to drop whitespace and comments
|
||||
f.contents = Buffer.from(JSON.stringify(value));
|
||||
}
|
||||
return f;
|
||||
}))
|
||||
.pipe(jsonFilter.restore);
|
||||
}
|
||||
function updateExtensionPackageJSON(input, update) {
|
||||
@@ -50,10 +50,10 @@ function updateExtensionPackageJSON(input, update) {
|
||||
.pipe(packageJsonFilter)
|
||||
.pipe(buffer())
|
||||
.pipe(es.mapSync((f) => {
|
||||
const data = JSON.parse(f.contents.toString('utf8'));
|
||||
f.contents = Buffer.from(JSON.stringify(update(data)));
|
||||
return f;
|
||||
}))
|
||||
const data = JSON.parse(f.contents.toString('utf8'));
|
||||
f.contents = Buffer.from(JSON.stringify(update(data)));
|
||||
return f;
|
||||
}))
|
||||
.pipe(packageJsonFilter.restore);
|
||||
}
|
||||
function fromLocal(extensionPath, forWeb) {
|
||||
@@ -95,11 +95,11 @@ function fromLocalWebpack(extensionPath, webpackConfigFileName) {
|
||||
const files = fileNames
|
||||
.map(fileName => path.join(extensionPath, fileName))
|
||||
.map(filePath => new File({
|
||||
path: filePath,
|
||||
stat: fs.statSync(filePath),
|
||||
base: extensionPath,
|
||||
contents: fs.createReadStream(filePath)
|
||||
}));
|
||||
path: filePath,
|
||||
stat: fs.statSync(filePath),
|
||||
base: extensionPath,
|
||||
contents: fs.createReadStream(filePath)
|
||||
}));
|
||||
// check for a webpack configuration files, then invoke webpack
|
||||
// and merge its output with the files stream.
|
||||
const webpackConfigLocations = glob.sync(path.join(extensionPath, '**', webpackConfigFileName), { ignore: ['**/node_modules'] });
|
||||
@@ -123,20 +123,20 @@ function fromLocalWebpack(extensionPath, webpackConfigFileName) {
|
||||
const relativeOutputPath = path.relative(extensionPath, webpackConfig.output.path);
|
||||
return webpackGulp(webpackConfig, webpack, webpackDone)
|
||||
.pipe(es.through(function (data) {
|
||||
data.stat = data.stat || {};
|
||||
data.base = extensionPath;
|
||||
this.emit('data', data);
|
||||
}))
|
||||
data.stat = data.stat || {};
|
||||
data.base = extensionPath;
|
||||
this.emit('data', data);
|
||||
}))
|
||||
.pipe(es.through(function (data) {
|
||||
// source map handling:
|
||||
// * rewrite sourceMappingURL
|
||||
// * save to disk so that upload-task picks this up
|
||||
const contents = data.contents.toString('utf8');
|
||||
data.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, function (_m, g1) {
|
||||
return `\n//# sourceMappingURL=${sourceMappingURLBase}/extensions/${path.basename(extensionPath)}/${relativeOutputPath}/${g1}`;
|
||||
}), 'utf8');
|
||||
this.emit('data', data);
|
||||
}));
|
||||
// source map handling:
|
||||
// * rewrite sourceMappingURL
|
||||
// * save to disk so that upload-task picks this up
|
||||
const contents = data.contents.toString('utf8');
|
||||
data.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, function (_m, g1) {
|
||||
return `\n//# sourceMappingURL=${sourceMappingURLBase}/extensions/${path.basename(extensionPath)}/${relativeOutputPath}/${g1}`;
|
||||
}), 'utf8');
|
||||
this.emit('data', data);
|
||||
}));
|
||||
});
|
||||
});
|
||||
es.merge(...webpackStreams, es.readArray(files))
|
||||
@@ -158,16 +158,16 @@ function fromLocalNormal(extensionPath) {
|
||||
const result = es.through();
|
||||
vsce.listFiles({ cwd: extensionPath, packageManager: vsce.PackageManager.Yarn })
|
||||
.then(fileNames => {
|
||||
const files = fileNames
|
||||
.map(fileName => path.join(extensionPath, fileName))
|
||||
.map(filePath => new File({
|
||||
path: filePath,
|
||||
stat: fs.statSync(filePath),
|
||||
base: extensionPath,
|
||||
contents: fs.createReadStream(filePath)
|
||||
}));
|
||||
es.readArray(files).pipe(result);
|
||||
})
|
||||
const files = fileNames
|
||||
.map(fileName => path.join(extensionPath, fileName))
|
||||
.map(filePath => new File({
|
||||
path: filePath,
|
||||
stat: fs.statSync(filePath),
|
||||
base: extensionPath,
|
||||
contents: fs.createReadStream(filePath)
|
||||
}));
|
||||
es.readArray(files).pipe(result);
|
||||
})
|
||||
.catch(err => result.emit('error', err));
|
||||
return result.pipe((0, stats_1.createStatsStream)(path.basename(extensionPath)));
|
||||
}
|
||||
@@ -324,11 +324,11 @@ function isWebExtension(manifest) {
|
||||
function packageLocalExtensionsStream(forWeb) {
|
||||
const localExtensionsDescriptions = (glob.sync('extensions/*/package.json')
|
||||
.map(manifestPath => {
|
||||
const absoluteManifestPath = path.join(root, manifestPath);
|
||||
const extensionPath = path.dirname(path.join(root, manifestPath));
|
||||
const extensionName = path.basename(extensionPath);
|
||||
return { name: extensionName, path: extensionPath, manifestPath: absoluteManifestPath };
|
||||
})
|
||||
const absoluteManifestPath = path.join(root, manifestPath);
|
||||
const extensionPath = path.dirname(path.join(root, manifestPath));
|
||||
const extensionName = path.basename(extensionPath);
|
||||
return { name: extensionName, path: extensionPath, manifestPath: absoluteManifestPath };
|
||||
})
|
||||
.filter(({ name }) => excludedExtensions.indexOf(name) === -1)
|
||||
.filter(({ name }) => builtInExtensions.every(b => b.name !== name))
|
||||
.filter(({ name }) => externalExtensions.indexOf(name) === -1) // {{SQL CARBON EDIT}} Remove external Extensions with separate package
|
||||
@@ -359,15 +359,15 @@ function packageMarketplaceExtensionsStream(forWeb, galleryServiceUrl) {
|
||||
];
|
||||
const marketplaceExtensionsStream = minifyExtensionResources(es.merge(...marketplaceExtensionsDescriptions
|
||||
.map(extension => {
|
||||
const input = (galleryServiceUrl ? fromMarketplace(galleryServiceUrl, extension) : fromGithub(extension))
|
||||
.pipe(rename(p => p.dirname = `extensions/${extension.name}/${p.dirname}`));
|
||||
return updateExtensionPackageJSON(input, (data) => {
|
||||
delete data.scripts;
|
||||
delete data.dependencies;
|
||||
delete data.devDependencies;
|
||||
return data;
|
||||
});
|
||||
})));
|
||||
const input = (galleryServiceUrl ? fromMarketplace(galleryServiceUrl, extension) : fromGithub(extension))
|
||||
.pipe(rename(p => p.dirname = `extensions/${extension.name}/${p.dirname}`));
|
||||
return updateExtensionPackageJSON(input, (data) => {
|
||||
delete data.scripts;
|
||||
delete data.dependencies;
|
||||
delete data.devDependencies;
|
||||
return data;
|
||||
});
|
||||
})));
|
||||
return (marketplaceExtensionsStream
|
||||
.pipe(util2.setExecutableBit(['**/*.sh'])));
|
||||
}
|
||||
@@ -384,7 +384,7 @@ function scanBuiltinExtensions(extensionsRoot, exclude = []) {
|
||||
if (!fs.existsSync(packageJSONPath)) {
|
||||
continue;
|
||||
}
|
||||
const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath).toString('utf8'));
|
||||
let packageJSON = JSON.parse(fs.readFileSync(packageJSONPath).toString('utf8'));
|
||||
if (!isWebExtension(packageJSON)) {
|
||||
continue;
|
||||
}
|
||||
@@ -412,10 +412,10 @@ exports.scanBuiltinExtensions = scanBuiltinExtensions;
|
||||
function packageExternalExtensionsStream() {
|
||||
const extenalExtensionDescriptions = glob.sync('extensions/*/package.json')
|
||||
.map(manifestPath => {
|
||||
const extensionPath = path.dirname(path.join(root, manifestPath));
|
||||
const extensionName = path.basename(extensionPath);
|
||||
return { name: extensionName, path: extensionPath };
|
||||
})
|
||||
const extensionPath = path.dirname(path.join(root, manifestPath));
|
||||
const extensionName = path.basename(extensionPath);
|
||||
return { name: extensionName, path: extensionPath };
|
||||
})
|
||||
.filter(({ name }) => externalExtensions.indexOf(name) >= 0 || exports.vscodeExternalExtensions.indexOf(name) >= 0);
|
||||
const builtExtensions = extenalExtensionDescriptions.map(extension => {
|
||||
return fromLocal(extension.path, false)
|
||||
@@ -433,10 +433,10 @@ exports.cleanRebuildExtensions = cleanRebuildExtensions;
|
||||
function packageRebuildExtensionsStream() {
|
||||
const extenalExtensionDescriptions = glob.sync('extensions/*/package.json')
|
||||
.map(manifestPath => {
|
||||
const extensionPath = path.dirname(path.join(root, manifestPath));
|
||||
const extensionName = path.basename(extensionPath);
|
||||
return { name: extensionName, path: extensionPath };
|
||||
})
|
||||
const extensionPath = path.dirname(path.join(root, manifestPath));
|
||||
const extensionName = path.basename(extensionPath);
|
||||
return { name: extensionName, path: extensionPath };
|
||||
})
|
||||
.filter(({ name }) => rebuildExtensions.indexOf(name) >= 0);
|
||||
const builtExtensions = extenalExtensionDescriptions.map(extension => {
|
||||
return fromLocal(extension.path, false)
|
||||
@@ -450,7 +450,7 @@ function translatePackageJSON(packageJSON, packageNLSPath) {
|
||||
const CharCode_PC = '%'.charCodeAt(0);
|
||||
const packageNls = JSON.parse(fs.readFileSync(packageNLSPath).toString());
|
||||
const translate = (obj) => {
|
||||
for (const key in obj) {
|
||||
for (let key in obj) {
|
||||
const val = obj[key];
|
||||
if (Array.isArray(val)) {
|
||||
val.forEach(translate);
|
||||
@@ -477,7 +477,6 @@ const esbuildMediaScripts = [
|
||||
'markdown-language-features/esbuild-preview.js',
|
||||
'markdown-math/esbuild.js',
|
||||
'notebook-renderers/esbuild.js',
|
||||
'ipynb/esbuild.js',
|
||||
'simple-browser/esbuild-preview.js',
|
||||
];
|
||||
async function webpackExtensions(taskName, isWatch, webpackConfigLocations) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import * as cp from 'child_process';
|
||||
import * as glob from 'glob';
|
||||
import * as gulp from 'gulp';
|
||||
import * as path from 'path';
|
||||
import * as through2 from 'through2'
|
||||
import * as through2 from 'through2';
|
||||
import got from 'got';
|
||||
import { Stream } from 'stream';
|
||||
import * as File from 'vinyl';
|
||||
@@ -285,7 +285,6 @@ const excludedExtensions = [
|
||||
'ms-vscode.node-debug',
|
||||
'ms-vscode.node-debug2',
|
||||
'vscode-custom-editor-tests',
|
||||
'vscode-notebook-tests',
|
||||
'integration-tests', // {{SQL CARBON EDIT}}
|
||||
];
|
||||
|
||||
@@ -477,7 +476,7 @@ export function scanBuiltinExtensions(extensionsRoot: string, exclude: string[]
|
||||
if (!fs.existsSync(packageJSONPath)) {
|
||||
continue;
|
||||
}
|
||||
const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath).toString('utf8'));
|
||||
let packageJSON = JSON.parse(fs.readFileSync(packageJSONPath).toString('utf8'));
|
||||
if (!isWebExtension(packageJSON)) {
|
||||
continue;
|
||||
}
|
||||
@@ -550,7 +549,7 @@ export function translatePackageJSON(packageJSON: string, packageNLSPath: string
|
||||
const CharCode_PC = '%'.charCodeAt(0);
|
||||
const packageNls: NLSFormat = JSON.parse(fs.readFileSync(packageNLSPath).toString());
|
||||
const translate = (obj: any) => {
|
||||
for (const key in obj) {
|
||||
for (let key in obj) {
|
||||
const val = obj[key];
|
||||
if (Array.isArray(val)) {
|
||||
val.forEach(translate);
|
||||
@@ -576,7 +575,6 @@ const esbuildMediaScripts = [
|
||||
'markdown-language-features/esbuild-preview.js',
|
||||
'markdown-math/esbuild.js',
|
||||
'notebook-renderers/esbuild.js',
|
||||
'ipynb/esbuild.js',
|
||||
'simple-browser/esbuild-preview.js',
|
||||
];
|
||||
|
||||
@@ -590,7 +588,7 @@ export async function webpackExtensions(taskName: string, isWatch: boolean, webp
|
||||
function addConfig(configOrFn: webpack.Configuration | Function) {
|
||||
let config;
|
||||
if (typeof configOrFn === 'function') {
|
||||
config = (configOrFn as Function)({}, {});
|
||||
config = configOrFn({}, {});
|
||||
webpackConfigs.push(config);
|
||||
} else {
|
||||
config = configOrFn;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getVersion = void 0;
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getVersion = void 0;
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
/**
|
||||
@@ -45,7 +45,7 @@ function getVersion(repo) {
|
||||
}
|
||||
const refsRegex = /^([0-9a-f]{40})\s+(.+)$/gm;
|
||||
let refsMatch;
|
||||
const refs = {};
|
||||
let refs = {};
|
||||
while (refsMatch = refsRegex.exec(refsRaw)) {
|
||||
refs[refsMatch[2]] = refsMatch[1];
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
|
||||
@@ -49,7 +51,7 @@ export function getVersion(repo: string): string | undefined {
|
||||
|
||||
const refsRegex = /^([0-9a-f]{40})\s+(.+)$/gm;
|
||||
let refsMatch: RegExpExecArray | null;
|
||||
const refs: { [ref: string]: string } = {};
|
||||
let refs: { [ref: string]: string } = {};
|
||||
|
||||
while (refsMatch = refsRegex.exec(refsRaw)) {
|
||||
refs[refsMatch[2]] = refsMatch[1];
|
||||
|
||||
@@ -46,7 +46,7 @@ exports.externalExtensionsWithTranslations = {
|
||||
var LocalizeInfo;
|
||||
(function (LocalizeInfo) {
|
||||
function is(value) {
|
||||
const candidate = value;
|
||||
let candidate = value;
|
||||
return Is.defined(candidate) && Is.string(candidate.key) && (Is.undef(candidate.comment) || (Is.array(candidate.comment) && candidate.comment.every(element => Is.string(element))));
|
||||
}
|
||||
LocalizeInfo.is = is;
|
||||
@@ -57,8 +57,8 @@ var BundledFormat;
|
||||
if (Is.undef(value)) {
|
||||
return false;
|
||||
}
|
||||
const candidate = value;
|
||||
const length = Object.keys(value).length;
|
||||
let candidate = value;
|
||||
let length = Object.keys(value).length;
|
||||
return length === 3 && Is.defined(candidate.keys) && Is.defined(candidate.messages) && Is.defined(candidate.bundles);
|
||||
}
|
||||
BundledFormat.is = is;
|
||||
@@ -70,7 +70,7 @@ var PackageJsonFormat;
|
||||
return false;
|
||||
}
|
||||
return Object.keys(value).every(key => {
|
||||
const element = value[key];
|
||||
let element = value[key];
|
||||
return Is.string(element) || (Is.object(element) && Is.defined(element.message) && Is.defined(element.comment));
|
||||
});
|
||||
}
|
||||
@@ -133,9 +133,9 @@ class XLF {
|
||||
}
|
||||
this.numberOfMessages += keys.length;
|
||||
this.files[original] = [];
|
||||
const existingKeys = new Set();
|
||||
let existingKeys = new Set();
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
let key = keys[i];
|
||||
let realKey;
|
||||
let comment;
|
||||
if (Is.string(key)) {
|
||||
@@ -152,7 +152,7 @@ class XLF {
|
||||
continue;
|
||||
}
|
||||
existingKeys.add(realKey);
|
||||
const message = encodeEntities(messages[i]);
|
||||
let message = encodeEntities(messages[i]);
|
||||
this.files[original].push({ id: realKey, message: message, comment: comment });
|
||||
}
|
||||
}
|
||||
@@ -178,7 +178,7 @@ class XLF {
|
||||
this.appendNewLine('</xliff>', 0);
|
||||
}
|
||||
appendNewLine(content, indent) {
|
||||
const line = new Line(indent);
|
||||
let line = new Line(indent);
|
||||
line.append(content);
|
||||
this.buffer.push(line.toString());
|
||||
}
|
||||
@@ -186,8 +186,8 @@ class XLF {
|
||||
exports.XLF = XLF;
|
||||
XLF.parsePseudo = function (xlfString) {
|
||||
return new Promise((resolve) => {
|
||||
const parser = new xml2js.Parser();
|
||||
const files = [];
|
||||
let parser = new xml2js.Parser();
|
||||
let files = [];
|
||||
parser.parseString(xlfString, function (_err, result) {
|
||||
const fileNodes = result['xliff']['file'];
|
||||
fileNodes.forEach(file => {
|
||||
@@ -211,8 +211,8 @@ XLF.parsePseudo = function (xlfString) {
|
||||
};
|
||||
XLF.parse = function (xlfString) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const parser = new xml2js.Parser();
|
||||
const files = [];
|
||||
let parser = new xml2js.Parser();
|
||||
let files = [];
|
||||
parser.parseString(xlfString, function (err, result) {
|
||||
if (err) {
|
||||
reject(new Error(`XLF parsing error: Failed to parse XLIFF string. ${err}`));
|
||||
@@ -226,7 +226,7 @@ XLF.parse = function (xlfString) {
|
||||
if (!originalFilePath) {
|
||||
reject(new Error(`XLF parsing error: XLIFF file node does not contain original attribute to determine the original location of the resource file.`));
|
||||
}
|
||||
const language = file.$['target-language'];
|
||||
let language = file.$['target-language'];
|
||||
if (!language) {
|
||||
reject(new Error(`XLF parsing error: XLIFF file node does not contain target-language attribute to determine translated language.`));
|
||||
}
|
||||
@@ -295,10 +295,9 @@ function stripComments(content) {
|
||||
// Second group matches a single quoted string
|
||||
// Third group matches a multi line comment
|
||||
// Forth group matches a single line comment
|
||||
// Fifth group matches a trailing comma
|
||||
const regexp = /("[^"\\]*(?:\\.[^"\\]*)*")|('[^'\\]*(?:\\.[^'\\]*)*')|(\/\*[^\/\*]*(?:(?:\*|\/)[^\/\*]*)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))|(,\s*[}\]])/g;
|
||||
const result = content.replace(regexp, (match, _m1, _m2, m3, m4, m5) => {
|
||||
// Only one of m1, m2, m3, m4, m5 matches
|
||||
const regexp = /("[^"\\]*(?:\\.[^"\\]*)*")|('[^'\\]*(?:\\.[^'\\]*)*')|(\/\*[^\/\*]*(?:(?:\*|\/)[^\/\*]*)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g;
|
||||
let result = content.replace(regexp, (match, _m1, _m2, m3, m4) => {
|
||||
// Only one of m1, m2, m3, m4 matches
|
||||
if (m3) {
|
||||
// A block comment. Replace with nothing
|
||||
return '';
|
||||
@@ -314,10 +313,6 @@ function stripComments(content) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
else if (m5) {
|
||||
// Remove the trailing comma
|
||||
return match.substring(1);
|
||||
}
|
||||
else {
|
||||
// We match a string
|
||||
return match;
|
||||
@@ -361,20 +356,20 @@ function escapeCharacters(value) {
|
||||
return result.join('');
|
||||
}
|
||||
function processCoreBundleFormat(fileHeader, languages, json, emitter) {
|
||||
const keysSection = json.keys;
|
||||
const messageSection = json.messages;
|
||||
const bundleSection = json.bundles;
|
||||
const statistics = Object.create(null);
|
||||
const defaultMessages = Object.create(null);
|
||||
const modules = Object.keys(keysSection);
|
||||
let keysSection = json.keys;
|
||||
let messageSection = json.messages;
|
||||
let bundleSection = json.bundles;
|
||||
let statistics = Object.create(null);
|
||||
let defaultMessages = Object.create(null);
|
||||
let modules = Object.keys(keysSection);
|
||||
modules.forEach((module) => {
|
||||
const keys = keysSection[module];
|
||||
const messages = messageSection[module];
|
||||
let keys = keysSection[module];
|
||||
let messages = messageSection[module];
|
||||
if (!messages || keys.length !== messages.length) {
|
||||
emitter.emit('error', `Message for module ${module} corrupted. Mismatch in number of keys and messages.`);
|
||||
return;
|
||||
}
|
||||
const messageMap = Object.create(null);
|
||||
let messageMap = Object.create(null);
|
||||
defaultMessages[module] = messageMap;
|
||||
keys.map((key, i) => {
|
||||
if (typeof key === 'string') {
|
||||
@@ -385,27 +380,27 @@ function processCoreBundleFormat(fileHeader, languages, json, emitter) {
|
||||
}
|
||||
});
|
||||
});
|
||||
const languageDirectory = path.join(__dirname, '..', '..', '..', 'vscode-loc', 'i18n');
|
||||
let languageDirectory = path.join(__dirname, '..', '..', '..', 'vscode-loc', 'i18n');
|
||||
if (!fs.existsSync(languageDirectory)) {
|
||||
log(`No VS Code localization repository found. Looking at ${languageDirectory}`);
|
||||
log(`To bundle translations please check out the vscode-loc repository as a sibling of the vscode repository.`);
|
||||
}
|
||||
const sortedLanguages = sortLanguages(languages);
|
||||
let sortedLanguages = sortLanguages(languages);
|
||||
sortedLanguages.forEach((language) => {
|
||||
if (process.env['VSCODE_BUILD_VERBOSE']) {
|
||||
log(`Generating nls bundles for: ${language.id}`);
|
||||
}
|
||||
statistics[language.id] = 0;
|
||||
const localizedModules = Object.create(null);
|
||||
const languageFolderName = language.translationId || language.id;
|
||||
const i18nFile = path.join(languageDirectory, `vscode-language-pack-${languageFolderName}`, 'translations', 'main.i18n.json');
|
||||
let localizedModules = Object.create(null);
|
||||
let languageFolderName = language.translationId || language.id;
|
||||
let i18nFile = path.join(languageDirectory, `vscode-language-pack-${languageFolderName}`, 'translations', 'main.i18n.json');
|
||||
let allMessages;
|
||||
if (fs.existsSync(i18nFile)) {
|
||||
const content = stripComments(fs.readFileSync(i18nFile, 'utf8'));
|
||||
let content = stripComments(fs.readFileSync(i18nFile, 'utf8'));
|
||||
allMessages = JSON.parse(content);
|
||||
}
|
||||
modules.forEach((module) => {
|
||||
const order = keysSection[module];
|
||||
let order = keysSection[module];
|
||||
let moduleMessage;
|
||||
if (allMessages) {
|
||||
moduleMessage = allMessages.contents[module];
|
||||
@@ -417,7 +412,7 @@ function processCoreBundleFormat(fileHeader, languages, json, emitter) {
|
||||
moduleMessage = defaultMessages[module];
|
||||
statistics[language.id] = statistics[language.id] + Object.keys(moduleMessage).length;
|
||||
}
|
||||
const localizedMessages = [];
|
||||
let localizedMessages = [];
|
||||
order.forEach((keyInfo) => {
|
||||
let key = null;
|
||||
if (typeof keyInfo === 'string') {
|
||||
@@ -439,14 +434,14 @@ function processCoreBundleFormat(fileHeader, languages, json, emitter) {
|
||||
localizedModules[module] = localizedMessages;
|
||||
});
|
||||
Object.keys(bundleSection).forEach((bundle) => {
|
||||
const modules = bundleSection[bundle];
|
||||
const contents = [
|
||||
let modules = bundleSection[bundle];
|
||||
let contents = [
|
||||
fileHeader,
|
||||
`define("${bundle}.nls.${language.id}", {`
|
||||
];
|
||||
modules.forEach((module, index) => {
|
||||
contents.push(`\t"${module}": [`);
|
||||
const messages = localizedModules[module];
|
||||
let messages = localizedModules[module];
|
||||
if (!messages) {
|
||||
emitter.emit('error', `Didn't find messages for module ${module}.`);
|
||||
return;
|
||||
@@ -461,11 +456,11 @@ function processCoreBundleFormat(fileHeader, languages, json, emitter) {
|
||||
});
|
||||
});
|
||||
Object.keys(statistics).forEach(key => {
|
||||
const value = statistics[key];
|
||||
let value = statistics[key];
|
||||
log(`${key} has ${value} untranslated strings.`);
|
||||
});
|
||||
sortedLanguages.forEach(language => {
|
||||
const stats = statistics[language.id];
|
||||
let stats = statistics[language.id];
|
||||
if (Is.undef(stats)) {
|
||||
log(`\tNo translations found for language ${language.id}. Using default language instead.`);
|
||||
}
|
||||
@@ -473,7 +468,7 @@ function processCoreBundleFormat(fileHeader, languages, json, emitter) {
|
||||
}
|
||||
function processNlsFiles(opts) {
|
||||
return (0, event_stream_1.through)(function (file) {
|
||||
const fileName = path.basename(file.path);
|
||||
let fileName = path.basename(file.path);
|
||||
if (fileName === 'nls.metadata.json') {
|
||||
let json = null;
|
||||
if (file.isBuffer()) {
|
||||
@@ -559,7 +554,7 @@ function createXlfFilesForCoreBundle() {
|
||||
xlf.addFile(`src/${coreModule}`, keys, messages);
|
||||
}
|
||||
}
|
||||
for (const resource in xlfs) {
|
||||
for (let resource in xlfs) {
|
||||
const xlf = xlfs[resource];
|
||||
const filePath = `${xlf.project}/${resource.replace(/\//g, '_')}.xlf`;
|
||||
const xlfFile = new File({
|
||||
@@ -591,7 +586,7 @@ function createXlfFilesForExtensions() {
|
||||
if (!stat.isDirectory()) {
|
||||
return;
|
||||
}
|
||||
const extensionName = path.basename(extensionFolder.path);
|
||||
let extensionName = path.basename(extensionFolder.path);
|
||||
if (extensionName === 'node_modules') {
|
||||
return;
|
||||
}
|
||||
@@ -609,24 +604,17 @@ function createXlfFilesForExtensions() {
|
||||
const basename = path.basename(file.path);
|
||||
if (basename === 'package.nls.json') {
|
||||
const json = JSON.parse(buffer.toString('utf8'));
|
||||
const keys = [];
|
||||
const messages = [];
|
||||
Object.keys(json).forEach((key) => {
|
||||
const keys = Object.keys(json);
|
||||
const messages = keys.map((key) => {
|
||||
const value = json[key];
|
||||
if (Is.string(value)) {
|
||||
keys.push(key);
|
||||
messages.push(value);
|
||||
return value;
|
||||
}
|
||||
else if (value) {
|
||||
keys.push({
|
||||
key,
|
||||
comment: value.comment
|
||||
});
|
||||
messages.push(value.message);
|
||||
return value.message;
|
||||
}
|
||||
else {
|
||||
keys.push(key);
|
||||
messages.push(`Unknown message for key: ${key}`);
|
||||
return `Unknown message for key: ${key}`;
|
||||
}
|
||||
});
|
||||
getXlf().addFile(`extensions/${extensionName}/package`, keys, messages);
|
||||
@@ -634,7 +622,7 @@ function createXlfFilesForExtensions() {
|
||||
else if (basename === 'nls.metadata.json') {
|
||||
const json = JSON.parse(buffer.toString('utf8'));
|
||||
const relPath = path.relative(`.build/extensions/${extensionName}`, path.dirname(file.path));
|
||||
for (const file in json) {
|
||||
for (let file in json) {
|
||||
const fileContent = json[file];
|
||||
getXlf().addFile(`extensions/${extensionName}/${relPath}/${file}`, fileContent.keys, fileContent.messages);
|
||||
}
|
||||
@@ -646,7 +634,7 @@ function createXlfFilesForExtensions() {
|
||||
}
|
||||
}, function () {
|
||||
if (_xlf) {
|
||||
const xlfFile = new File({
|
||||
let xlfFile = new File({
|
||||
path: path.join(extensionsProject, extensionName + '.xlf'),
|
||||
contents: Buffer.from(_xlf.toString(), 'utf8')
|
||||
});
|
||||
@@ -678,14 +666,14 @@ function createXlfFilesForIsl() {
|
||||
else {
|
||||
throw new Error(`Unknown input file ${file.path}`);
|
||||
}
|
||||
const xlf = new XLF(projectName), keys = [], messages = [];
|
||||
const model = new TextModel(file.contents.toString());
|
||||
let xlf = new XLF(projectName), keys = [], messages = [];
|
||||
let model = new TextModel(file.contents.toString());
|
||||
let inMessageSection = false;
|
||||
model.lines.forEach(line => {
|
||||
if (line.length === 0) {
|
||||
return;
|
||||
}
|
||||
const firstChar = line.charAt(0);
|
||||
let firstChar = line.charAt(0);
|
||||
switch (firstChar) {
|
||||
case ';':
|
||||
// Comment line;
|
||||
@@ -697,13 +685,13 @@ function createXlfFilesForIsl() {
|
||||
if (!inMessageSection) {
|
||||
return;
|
||||
}
|
||||
const sections = line.split('=');
|
||||
let sections = line.split('=');
|
||||
if (sections.length !== 2) {
|
||||
throw new Error(`Badly formatted message found: ${line}`);
|
||||
}
|
||||
else {
|
||||
const key = sections[0];
|
||||
const value = sections[1];
|
||||
let key = sections[0];
|
||||
let value = sections[1];
|
||||
if (key.length > 0 && value.length > 0) {
|
||||
keys.push(key);
|
||||
messages.push(value);
|
||||
@@ -720,8 +708,8 @@ function createXlfFilesForIsl() {
|
||||
}
|
||||
exports.createXlfFilesForIsl = createXlfFilesForIsl;
|
||||
function pushXlfFiles(apiHostname, username, password) {
|
||||
const tryGetPromises = [];
|
||||
const updateCreatePromises = [];
|
||||
let tryGetPromises = [];
|
||||
let updateCreatePromises = [];
|
||||
return (0, event_stream_1.through)(function (file) {
|
||||
const project = path.dirname(file.relative);
|
||||
const fileName = path.basename(file.path);
|
||||
@@ -759,11 +747,11 @@ function getAllResources(project, apiHostname, username, password) {
|
||||
method: 'GET'
|
||||
};
|
||||
const request = https.request(options, (res) => {
|
||||
const buffer = [];
|
||||
let buffer = [];
|
||||
res.on('data', (chunk) => buffer.push(chunk));
|
||||
res.on('end', () => {
|
||||
if (res.statusCode === 200) {
|
||||
const json = JSON.parse(Buffer.concat(buffer).toString());
|
||||
let json = JSON.parse(Buffer.concat(buffer).toString());
|
||||
if (Array.isArray(json)) {
|
||||
resolve(json.map(o => o.slug));
|
||||
return;
|
||||
@@ -782,7 +770,7 @@ function getAllResources(project, apiHostname, username, password) {
|
||||
});
|
||||
}
|
||||
function findObsoleteResources(apiHostname, username, password) {
|
||||
const resourcesByProject = Object.create(null);
|
||||
let resourcesByProject = Object.create(null);
|
||||
resourcesByProject[extensionsProject] = [].concat(exports.externalExtensionsWithTranslations); // clone
|
||||
return (0, event_stream_1.through)(function (file) {
|
||||
const project = path.dirname(file.relative);
|
||||
@@ -796,10 +784,10 @@ function findObsoleteResources(apiHostname, username, password) {
|
||||
this.push(file);
|
||||
}, function () {
|
||||
const json = JSON.parse(fs.readFileSync('./build/lib/i18n.resources.json', 'utf8'));
|
||||
const i18Resources = [...json.editor, ...json.workbench].map((r) => r.project + '/' + r.name.replace(/\//g, '_'));
|
||||
const extractedResources = [];
|
||||
for (const project of [workbenchProject, editorProject]) {
|
||||
for (const resource of resourcesByProject[project]) {
|
||||
let i18Resources = [...json.editor, ...json.workbench].map((r) => r.project + '/' + r.name.replace(/\//g, '_'));
|
||||
let extractedResources = [];
|
||||
for (let project of [workbenchProject, editorProject]) {
|
||||
for (let resource of resourcesByProject[project]) {
|
||||
if (resource !== 'setup_messages') {
|
||||
extractedResources.push(project + '/' + resource);
|
||||
}
|
||||
@@ -809,11 +797,11 @@ function findObsoleteResources(apiHostname, username, password) {
|
||||
console.log(`[i18n] Obsolete resources in file 'build/lib/i18n.resources.json': JSON.stringify(${i18Resources.filter(p => extractedResources.indexOf(p) === -1)})`);
|
||||
console.log(`[i18n] Missing resources in file 'build/lib/i18n.resources.json': JSON.stringify(${extractedResources.filter(p => i18Resources.indexOf(p) === -1)})`);
|
||||
}
|
||||
const promises = [];
|
||||
for (const project in resourcesByProject) {
|
||||
let promises = [];
|
||||
for (let project in resourcesByProject) {
|
||||
promises.push(getAllResources(project, apiHostname, username, password).then(resources => {
|
||||
const expectedResources = resourcesByProject[project];
|
||||
const unusedResources = resources.filter(resource => resource && expectedResources.indexOf(resource) === -1);
|
||||
let expectedResources = resourcesByProject[project];
|
||||
let unusedResources = resources.filter(resource => resource && expectedResources.indexOf(resource) === -1);
|
||||
if (unusedResources.length) {
|
||||
console.log(`[transifex] Obsolete resources in project '${project}': ${unusedResources.join(', ')}`);
|
||||
}
|
||||
@@ -868,7 +856,7 @@ function createResource(project, slug, xlfFile, apiHostname, credentials) {
|
||||
auth: credentials,
|
||||
method: 'POST'
|
||||
};
|
||||
const request = https.request(options, (res) => {
|
||||
let request = https.request(options, (res) => {
|
||||
if (res.statusCode === 201) {
|
||||
log(`Resource ${project}/${slug} successfully created on Transifex.`);
|
||||
}
|
||||
@@ -900,7 +888,7 @@ function updateResource(project, slug, xlfFile, apiHostname, credentials) {
|
||||
auth: credentials,
|
||||
method: 'PUT'
|
||||
};
|
||||
const request = https.request(options, (res) => {
|
||||
let request = https.request(options, (res) => {
|
||||
if (res.statusCode === 200) {
|
||||
res.setEncoding('utf8');
|
||||
let responseBuffer = '';
|
||||
@@ -925,7 +913,7 @@ function updateResource(project, slug, xlfFile, apiHostname, credentials) {
|
||||
});
|
||||
}
|
||||
function pullSetupXlfFiles(apiHostname, username, password, language, includeDefault) {
|
||||
const setupResources = [{ name: 'setup_messages', project: workbenchProject }];
|
||||
let setupResources = [{ name: 'setup_messages', project: workbenchProject }];
|
||||
if (includeDefault) {
|
||||
setupResources.push({ name: 'setup_default', project: setupProject });
|
||||
}
|
||||
@@ -934,7 +922,7 @@ function pullSetupXlfFiles(apiHostname, username, password, language, includeDef
|
||||
exports.pullSetupXlfFiles = pullSetupXlfFiles;
|
||||
function pullXlfFiles(apiHostname, username, password, language, resources) {
|
||||
const credentials = `${username}:${password}`;
|
||||
const expectedTranslationsCount = resources.length;
|
||||
let expectedTranslationsCount = resources.length;
|
||||
let translationsRetrieved = 0, called = false;
|
||||
return (0, event_stream_1.readable)(function (_count, callback) {
|
||||
// Mark end of stream when all resources were retrieved
|
||||
@@ -961,7 +949,7 @@ function retrieveResource(language, resource, apiHostname, credentials) {
|
||||
return limiter.queue(() => new Promise((resolve, reject) => {
|
||||
const slug = resource.name.replace(/\//g, '_');
|
||||
const project = resource.project;
|
||||
const transifexLanguageId = language.id === 'ps' ? 'en' : language.translationId || language.id;
|
||||
let transifexLanguageId = language.id === 'ps' ? 'en' : language.translationId || language.id;
|
||||
const options = {
|
||||
hostname: apiHostname,
|
||||
path: `/api/2/project/${project}/resource/${slug}/translation/${transifexLanguageId}?file&mode=onlyreviewed`,
|
||||
@@ -970,8 +958,8 @@ function retrieveResource(language, resource, apiHostname, credentials) {
|
||||
method: 'GET'
|
||||
};
|
||||
console.log('[transifex] Fetching ' + options.path);
|
||||
const request = https.request(options, (res) => {
|
||||
const xlfBuffer = [];
|
||||
let request = https.request(options, (res) => {
|
||||
let xlfBuffer = [];
|
||||
res.on('data', (chunk) => xlfBuffer.push(chunk));
|
||||
res.on('end', () => {
|
||||
if (res.statusCode === 200) {
|
||||
@@ -993,14 +981,14 @@ function retrieveResource(language, resource, apiHostname, credentials) {
|
||||
}));
|
||||
}
|
||||
function prepareI18nFiles() {
|
||||
const parsePromises = [];
|
||||
let parsePromises = [];
|
||||
return (0, event_stream_1.through)(function (xlf) {
|
||||
const stream = this;
|
||||
const parsePromise = XLF.parse(xlf.contents.toString());
|
||||
let stream = this;
|
||||
let parsePromise = XLF.parse(xlf.contents.toString());
|
||||
parsePromises.push(parsePromise);
|
||||
parsePromise.then(resolvedFiles => {
|
||||
resolvedFiles.forEach(file => {
|
||||
const translatedFile = createI18nFile(file.originalFilePath, file.messages);
|
||||
let translatedFile = createI18nFile(file.originalFilePath, file.messages);
|
||||
stream.queue(translatedFile);
|
||||
});
|
||||
});
|
||||
@@ -1012,7 +1000,7 @@ function prepareI18nFiles() {
|
||||
}
|
||||
exports.prepareI18nFiles = prepareI18nFiles;
|
||||
function createI18nFile(originalFilePath, messages) {
|
||||
const result = Object.create(null);
|
||||
let result = Object.create(null);
|
||||
result[''] = [
|
||||
'--------------------------------------------------------------------------------------------',
|
||||
'Copyright (c) Microsoft Corporation. All rights reserved.',
|
||||
@@ -1020,7 +1008,7 @@ function createI18nFile(originalFilePath, messages) {
|
||||
'--------------------------------------------------------------------------------------------',
|
||||
'Do not edit this file. It is machine generated.'
|
||||
];
|
||||
for (const key of Object.keys(messages)) {
|
||||
for (let key of Object.keys(messages)) {
|
||||
result[key] = messages[key];
|
||||
}
|
||||
let content = JSON.stringify(result, null, '\t');
|
||||
@@ -1080,7 +1068,7 @@ function prepareI18nPackFiles(externalExtensions, resultingTranslationPaths, pse
|
||||
const translatedMainFile = createI18nFile('./main', mainPack);
|
||||
resultingTranslationPaths.push({ id: 'vscode', resourceName: 'main.i18n.json' });
|
||||
this.queue(translatedMainFile);
|
||||
for (const extension in extensionsPacks) {
|
||||
for (let extension in extensionsPacks) {
|
||||
const translatedExtFile = createI18nFile(`extensions/${extension}`, extensionsPacks[extension]);
|
||||
this.queue(translatedExtFile);
|
||||
const externalExtensionId = externalExtensions[extension];
|
||||
@@ -1100,14 +1088,14 @@ function prepareI18nPackFiles(externalExtensions, resultingTranslationPaths, pse
|
||||
}
|
||||
exports.prepareI18nPackFiles = prepareI18nPackFiles;
|
||||
function prepareIslFiles(language, innoSetupConfig) {
|
||||
const parsePromises = [];
|
||||
let parsePromises = [];
|
||||
return (0, event_stream_1.through)(function (xlf) {
|
||||
const stream = this;
|
||||
const parsePromise = XLF.parse(xlf.contents.toString());
|
||||
let stream = this;
|
||||
let parsePromise = XLF.parse(xlf.contents.toString());
|
||||
parsePromises.push(parsePromise);
|
||||
parsePromise.then(resolvedFiles => {
|
||||
resolvedFiles.forEach(file => {
|
||||
const translatedFile = createIslFile(file.originalFilePath, file.messages, language, innoSetupConfig);
|
||||
let translatedFile = createIslFile(file.originalFilePath, file.messages, language, innoSetupConfig);
|
||||
stream.queue(translatedFile);
|
||||
});
|
||||
}).catch(reason => {
|
||||
@@ -1123,7 +1111,7 @@ function prepareIslFiles(language, innoSetupConfig) {
|
||||
}
|
||||
exports.prepareIslFiles = prepareIslFiles;
|
||||
function createIslFile(originalFilePath, messages, language, innoSetup) {
|
||||
const content = [];
|
||||
let content = [];
|
||||
let originalContent;
|
||||
if (path.basename(originalFilePath) === 'Default') {
|
||||
originalContent = new TextModel(fs.readFileSync(originalFilePath + '.isl', 'utf8'));
|
||||
@@ -1133,16 +1121,16 @@ function createIslFile(originalFilePath, messages, language, innoSetup) {
|
||||
}
|
||||
originalContent.lines.forEach(line => {
|
||||
if (line.length > 0) {
|
||||
const firstChar = line.charAt(0);
|
||||
let firstChar = line.charAt(0);
|
||||
if (firstChar === '[' || firstChar === ';') {
|
||||
content.push(line);
|
||||
}
|
||||
else {
|
||||
const sections = line.split('=');
|
||||
const key = sections[0];
|
||||
let sections = line.split('=');
|
||||
let key = sections[0];
|
||||
let translated = line;
|
||||
if (key) {
|
||||
const translatedMessage = messages[key];
|
||||
let translatedMessage = messages[key];
|
||||
if (translatedMessage) {
|
||||
translated = `${key}=${translatedMessage}`;
|
||||
}
|
||||
@@ -1160,9 +1148,9 @@ function createIslFile(originalFilePath, messages, language, innoSetup) {
|
||||
});
|
||||
}
|
||||
function encodeEntities(value) {
|
||||
const result = [];
|
||||
let result = [];
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const ch = value[i];
|
||||
let ch = value[i];
|
||||
switch (ch) {
|
||||
case '<':
|
||||
result.push('<');
|
||||
|
||||
@@ -119,11 +119,7 @@
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/contrib/mergeEditor",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/contrib/localization",
|
||||
"name": "vs/workbench/contrib/localizations",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
@@ -278,10 +274,6 @@
|
||||
"name": "vs/workbench/contrib/userDataSync",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/contrib/editSessions",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/contrib/views",
|
||||
"project": "vscode-workbench"
|
||||
@@ -294,14 +286,6 @@
|
||||
"name": "vs/workbench/contrib/audioCues",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/contrib/deprecatedExtensionMigrator",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/contrib/bracketPairColorizer2Telemetry",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/contrib/offline",
|
||||
"project": "vscode-workbench"
|
||||
@@ -438,10 +422,6 @@
|
||||
"name": "vs/workbench/services/userDataSync",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/editSessions",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/views",
|
||||
"project": "vscode-workbench"
|
||||
@@ -471,11 +451,11 @@
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/contrib/userDataProfile",
|
||||
"name": "vs/workbench/contrib/profiles",
|
||||
"project": "vscode-profiles"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/userDataProfile",
|
||||
"name": "vs/workbench/services/profiles",
|
||||
"project": "vscode-profiles"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -87,7 +87,7 @@ interface LocalizeInfo {
|
||||
|
||||
module LocalizeInfo {
|
||||
export function is(value: any): value is LocalizeInfo {
|
||||
const candidate = value as LocalizeInfo;
|
||||
let candidate = value as LocalizeInfo;
|
||||
return Is.defined(candidate) && Is.string(candidate.key) && (Is.undef(candidate.comment) || (Is.array(candidate.comment) && candidate.comment.every(element => Is.string(element))));
|
||||
}
|
||||
}
|
||||
@@ -104,8 +104,8 @@ module BundledFormat {
|
||||
return false;
|
||||
}
|
||||
|
||||
const candidate = value as BundledFormat;
|
||||
const length = Object.keys(value).length;
|
||||
let candidate = value as BundledFormat;
|
||||
let length = Object.keys(value).length;
|
||||
|
||||
return length === 3 && Is.defined(candidate.keys) && Is.defined(candidate.messages) && Is.defined(candidate.bundles);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ module PackageJsonFormat {
|
||||
return false;
|
||||
}
|
||||
return Object.keys(value).every(key => {
|
||||
const element = value[key];
|
||||
let element = value[key];
|
||||
return Is.string(element) || (Is.object(element) && Is.defined(element.message) && Is.defined(element.comment));
|
||||
});
|
||||
}
|
||||
@@ -218,9 +218,9 @@ export class XLF {
|
||||
}
|
||||
this.numberOfMessages += keys.length;
|
||||
this.files[original] = [];
|
||||
const existingKeys = new Set<string>();
|
||||
let existingKeys = new Set<string>();
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
let key = keys[i];
|
||||
let realKey: string | undefined;
|
||||
let comment: string | undefined;
|
||||
if (Is.string(key)) {
|
||||
@@ -236,7 +236,7 @@ export class XLF {
|
||||
continue;
|
||||
}
|
||||
existingKeys.add(realKey);
|
||||
const message: string = encodeEntities(messages[i]);
|
||||
let message: string = encodeEntities(messages[i]);
|
||||
this.files[original].push({ id: realKey, message: message, comment: comment });
|
||||
}
|
||||
}
|
||||
@@ -269,15 +269,15 @@ export class XLF {
|
||||
}
|
||||
|
||||
private appendNewLine(content: string, indent?: number): void {
|
||||
const line = new Line(indent);
|
||||
let line = new Line(indent);
|
||||
line.append(content);
|
||||
this.buffer.push(line.toString());
|
||||
}
|
||||
|
||||
static parsePseudo = function (xlfString: string): Promise<ParsedXLF[]> {
|
||||
return new Promise((resolve) => {
|
||||
const parser = new xml2js.Parser();
|
||||
const files: { messages: Map<string>; originalFilePath: string; language: string }[] = [];
|
||||
let parser = new xml2js.Parser();
|
||||
let files: { messages: Map<string>; originalFilePath: string; language: string }[] = [];
|
||||
parser.parseString(xlfString, function (_err: any, result: any) {
|
||||
const fileNodes: any[] = result['xliff']['file'];
|
||||
fileNodes.forEach(file => {
|
||||
@@ -302,9 +302,9 @@ export class XLF {
|
||||
|
||||
static parse = function (xlfString: string): Promise<ParsedXLF[]> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const parser = new xml2js.Parser();
|
||||
let parser = new xml2js.Parser();
|
||||
|
||||
const files: { messages: Map<string>; originalFilePath: string; language: string }[] = [];
|
||||
let files: { messages: Map<string>; originalFilePath: string; language: string }[] = [];
|
||||
|
||||
parser.parseString(xlfString, function (err: any, result: any) {
|
||||
if (err) {
|
||||
@@ -321,7 +321,7 @@ export class XLF {
|
||||
if (!originalFilePath) {
|
||||
reject(new Error(`XLF parsing error: XLIFF file node does not contain original attribute to determine the original location of the resource file.`));
|
||||
}
|
||||
const language = file.$['target-language'];
|
||||
let language = file.$['target-language'];
|
||||
if (!language) {
|
||||
reject(new Error(`XLF parsing error: XLIFF file node does not contain target-language attribute to determine translated language.`));
|
||||
}
|
||||
@@ -412,10 +412,9 @@ function stripComments(content: string): string {
|
||||
// Second group matches a single quoted string
|
||||
// Third group matches a multi line comment
|
||||
// Forth group matches a single line comment
|
||||
// Fifth group matches a trailing comma
|
||||
const regexp = /("[^"\\]*(?:\\.[^"\\]*)*")|('[^'\\]*(?:\\.[^'\\]*)*')|(\/\*[^\/\*]*(?:(?:\*|\/)[^\/\*]*)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))|(,\s*[}\]])/g;
|
||||
const result = content.replace(regexp, (match, _m1: string, _m2: string, m3: string, m4: string, m5: string) => {
|
||||
// Only one of m1, m2, m3, m4, m5 matches
|
||||
const regexp = /("[^"\\]*(?:\\.[^"\\]*)*")|('[^'\\]*(?:\\.[^'\\]*)*')|(\/\*[^\/\*]*(?:(?:\*|\/)[^\/\*]*)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g;
|
||||
let result = content.replace(regexp, (match, _m1: string, _m2: string, m3: string, m4: string) => {
|
||||
// Only one of m1, m2, m3, m4 matches
|
||||
if (m3) {
|
||||
// A block comment. Replace with nothing
|
||||
return '';
|
||||
@@ -428,9 +427,6 @@ function stripComments(content: string): string {
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else if (m5) {
|
||||
// Remove the trailing comma
|
||||
return match.substring(1);
|
||||
} else {
|
||||
// We match a string
|
||||
return match;
|
||||
@@ -476,22 +472,22 @@ function escapeCharacters(value: string): string {
|
||||
}
|
||||
|
||||
function processCoreBundleFormat(fileHeader: string, languages: Language[], json: BundledFormat, emitter: ThroughStream) {
|
||||
const keysSection = json.keys;
|
||||
const messageSection = json.messages;
|
||||
const bundleSection = json.bundles;
|
||||
let keysSection = json.keys;
|
||||
let messageSection = json.messages;
|
||||
let bundleSection = json.bundles;
|
||||
|
||||
const statistics: Map<number> = Object.create(null);
|
||||
let statistics: Map<number> = Object.create(null);
|
||||
|
||||
const defaultMessages: Map<Map<string>> = Object.create(null);
|
||||
const modules = Object.keys(keysSection);
|
||||
let defaultMessages: Map<Map<string>> = Object.create(null);
|
||||
let modules = Object.keys(keysSection);
|
||||
modules.forEach((module) => {
|
||||
const keys = keysSection[module];
|
||||
const messages = messageSection[module];
|
||||
let keys = keysSection[module];
|
||||
let messages = messageSection[module];
|
||||
if (!messages || keys.length !== messages.length) {
|
||||
emitter.emit('error', `Message for module ${module} corrupted. Mismatch in number of keys and messages.`);
|
||||
return;
|
||||
}
|
||||
const messageMap: Map<string> = Object.create(null);
|
||||
let messageMap: Map<string> = Object.create(null);
|
||||
defaultMessages[module] = messageMap;
|
||||
keys.map((key, i) => {
|
||||
if (typeof key === 'string') {
|
||||
@@ -502,28 +498,28 @@ function processCoreBundleFormat(fileHeader: string, languages: Language[], json
|
||||
});
|
||||
});
|
||||
|
||||
const languageDirectory = path.join(__dirname, '..', '..', '..', 'vscode-loc', 'i18n');
|
||||
let languageDirectory = path.join(__dirname, '..', '..', '..', 'vscode-loc', 'i18n');
|
||||
if (!fs.existsSync(languageDirectory)) {
|
||||
log(`No VS Code localization repository found. Looking at ${languageDirectory}`);
|
||||
log(`To bundle translations please check out the vscode-loc repository as a sibling of the vscode repository.`);
|
||||
}
|
||||
const sortedLanguages = sortLanguages(languages);
|
||||
let sortedLanguages = sortLanguages(languages);
|
||||
sortedLanguages.forEach((language) => {
|
||||
if (process.env['VSCODE_BUILD_VERBOSE']) {
|
||||
log(`Generating nls bundles for: ${language.id}`);
|
||||
}
|
||||
|
||||
statistics[language.id] = 0;
|
||||
const localizedModules: Map<string[]> = Object.create(null);
|
||||
const languageFolderName = language.translationId || language.id;
|
||||
const i18nFile = path.join(languageDirectory, `vscode-language-pack-${languageFolderName}`, 'translations', 'main.i18n.json');
|
||||
let localizedModules: Map<string[]> = Object.create(null);
|
||||
let languageFolderName = language.translationId || language.id;
|
||||
let i18nFile = path.join(languageDirectory, `vscode-language-pack-${languageFolderName}`, 'translations', 'main.i18n.json');
|
||||
let allMessages: I18nFormat | undefined;
|
||||
if (fs.existsSync(i18nFile)) {
|
||||
const content = stripComments(fs.readFileSync(i18nFile, 'utf8'));
|
||||
let content = stripComments(fs.readFileSync(i18nFile, 'utf8'));
|
||||
allMessages = JSON.parse(content);
|
||||
}
|
||||
modules.forEach((module) => {
|
||||
const order = keysSection[module];
|
||||
let order = keysSection[module];
|
||||
let moduleMessage: { [messageKey: string]: string } | undefined;
|
||||
if (allMessages) {
|
||||
moduleMessage = allMessages.contents[module];
|
||||
@@ -535,7 +531,7 @@ function processCoreBundleFormat(fileHeader: string, languages: Language[], json
|
||||
moduleMessage = defaultMessages[module];
|
||||
statistics[language.id] = statistics[language.id] + Object.keys(moduleMessage).length;
|
||||
}
|
||||
const localizedMessages: string[] = [];
|
||||
let localizedMessages: string[] = [];
|
||||
order.forEach((keyInfo) => {
|
||||
let key: string | null = null;
|
||||
if (typeof keyInfo === 'string') {
|
||||
@@ -556,14 +552,14 @@ function processCoreBundleFormat(fileHeader: string, languages: Language[], json
|
||||
localizedModules[module] = localizedMessages;
|
||||
});
|
||||
Object.keys(bundleSection).forEach((bundle) => {
|
||||
const modules = bundleSection[bundle];
|
||||
const contents: string[] = [
|
||||
let modules = bundleSection[bundle];
|
||||
let contents: string[] = [
|
||||
fileHeader,
|
||||
`define("${bundle}.nls.${language.id}", {`
|
||||
];
|
||||
modules.forEach((module, index) => {
|
||||
contents.push(`\t"${module}": [`);
|
||||
const messages = localizedModules[module];
|
||||
let messages = localizedModules[module];
|
||||
if (!messages) {
|
||||
emitter.emit('error', `Didn't find messages for module ${module}.`);
|
||||
return;
|
||||
@@ -578,11 +574,11 @@ function processCoreBundleFormat(fileHeader: string, languages: Language[], json
|
||||
});
|
||||
});
|
||||
Object.keys(statistics).forEach(key => {
|
||||
const value = statistics[key];
|
||||
let value = statistics[key];
|
||||
log(`${key} has ${value} untranslated strings.`);
|
||||
});
|
||||
sortedLanguages.forEach(language => {
|
||||
const stats = statistics[language.id];
|
||||
let stats = statistics[language.id];
|
||||
if (Is.undef(stats)) {
|
||||
log(`\tNo translations found for language ${language.id}. Using default language instead.`);
|
||||
}
|
||||
@@ -591,7 +587,7 @@ function processCoreBundleFormat(fileHeader: string, languages: Language[], json
|
||||
|
||||
export function processNlsFiles(opts: { fileHeader: string; languages: Language[] }): ThroughStream {
|
||||
return through(function (this: ThroughStream, file: File) {
|
||||
const fileName = path.basename(file.path);
|
||||
let fileName = path.basename(file.path);
|
||||
if (fileName === 'nls.metadata.json') {
|
||||
let json = null;
|
||||
if (file.isBuffer()) {
|
||||
@@ -678,7 +674,7 @@ export function createXlfFilesForCoreBundle(): ThroughStream {
|
||||
xlf.addFile(`src/${coreModule}`, keys, messages);
|
||||
}
|
||||
}
|
||||
for (const resource in xlfs) {
|
||||
for (let resource in xlfs) {
|
||||
const xlf = xlfs[resource];
|
||||
const filePath = `${xlf.project}/${resource.replace(/\//g, '_')}.xlf`;
|
||||
const xlfFile = new File({
|
||||
@@ -708,7 +704,7 @@ export function createXlfFilesForExtensions(): ThroughStream {
|
||||
if (!stat.isDirectory()) {
|
||||
return;
|
||||
}
|
||||
const extensionName = path.basename(extensionFolder.path);
|
||||
let extensionName = path.basename(extensionFolder.path);
|
||||
if (extensionName === 'node_modules') {
|
||||
return;
|
||||
}
|
||||
@@ -726,29 +722,22 @@ export function createXlfFilesForExtensions(): ThroughStream {
|
||||
const basename = path.basename(file.path);
|
||||
if (basename === 'package.nls.json') {
|
||||
const json: PackageJsonFormat = JSON.parse(buffer.toString('utf8'));
|
||||
const keys: Array<string | LocalizeInfo> = [];
|
||||
const messages: string[] = [];
|
||||
Object.keys(json).forEach((key) => {
|
||||
const keys = Object.keys(json);
|
||||
const messages = keys.map((key) => {
|
||||
const value = json[key];
|
||||
if (Is.string(value)) {
|
||||
keys.push(key);
|
||||
messages.push(value);
|
||||
return value;
|
||||
} else if (value) {
|
||||
keys.push({
|
||||
key,
|
||||
comment: value.comment
|
||||
});
|
||||
messages.push(value.message);
|
||||
return value.message;
|
||||
} else {
|
||||
keys.push(key);
|
||||
messages.push(`Unknown message for key: ${key}`);
|
||||
return `Unknown message for key: ${key}`;
|
||||
}
|
||||
});
|
||||
getXlf().addFile(`extensions/${extensionName}/package`, keys, messages);
|
||||
} else if (basename === 'nls.metadata.json') {
|
||||
const json: BundledExtensionFormat = JSON.parse(buffer.toString('utf8'));
|
||||
const relPath = path.relative(`.build/extensions/${extensionName}`, path.dirname(file.path));
|
||||
for (const file in json) {
|
||||
for (let file in json) {
|
||||
const fileContent = json[file];
|
||||
getXlf().addFile(`extensions/${extensionName}/${relPath}/${file}`, fileContent.keys, fileContent.messages);
|
||||
}
|
||||
@@ -759,7 +748,7 @@ export function createXlfFilesForExtensions(): ThroughStream {
|
||||
}
|
||||
}, function () {
|
||||
if (_xlf) {
|
||||
const xlfFile = new File({
|
||||
let xlfFile = new File({
|
||||
path: path.join(extensionsProject, extensionName + '.xlf'),
|
||||
contents: Buffer.from(_xlf.toString(), 'utf8')
|
||||
});
|
||||
@@ -792,17 +781,17 @@ export function createXlfFilesForIsl(): ThroughStream {
|
||||
throw new Error(`Unknown input file ${file.path}`);
|
||||
}
|
||||
|
||||
const xlf = new XLF(projectName),
|
||||
let xlf = new XLF(projectName),
|
||||
keys: string[] = [],
|
||||
messages: string[] = [];
|
||||
|
||||
const model = new TextModel(file.contents.toString());
|
||||
let model = new TextModel(file.contents.toString());
|
||||
let inMessageSection = false;
|
||||
model.lines.forEach(line => {
|
||||
if (line.length === 0) {
|
||||
return;
|
||||
}
|
||||
const firstChar = line.charAt(0);
|
||||
let firstChar = line.charAt(0);
|
||||
switch (firstChar) {
|
||||
case ';':
|
||||
// Comment line;
|
||||
@@ -814,12 +803,12 @@ export function createXlfFilesForIsl(): ThroughStream {
|
||||
if (!inMessageSection) {
|
||||
return;
|
||||
}
|
||||
const sections: string[] = line.split('=');
|
||||
let sections: string[] = line.split('=');
|
||||
if (sections.length !== 2) {
|
||||
throw new Error(`Badly formatted message found: ${line}`);
|
||||
} else {
|
||||
const key = sections[0];
|
||||
const value = sections[1];
|
||||
let key = sections[0];
|
||||
let value = sections[1];
|
||||
if (key.length > 0 && value.length > 0) {
|
||||
keys.push(key);
|
||||
messages.push(value);
|
||||
@@ -838,8 +827,8 @@ export function createXlfFilesForIsl(): ThroughStream {
|
||||
}
|
||||
|
||||
export function pushXlfFiles(apiHostname: string, username: string, password: string): ThroughStream {
|
||||
const tryGetPromises: Array<Promise<boolean>> = [];
|
||||
const updateCreatePromises: Array<Promise<boolean>> = [];
|
||||
let tryGetPromises: Array<Promise<boolean>> = [];
|
||||
let updateCreatePromises: Array<Promise<boolean>> = [];
|
||||
|
||||
return through(function (this: ThroughStream, file: File) {
|
||||
const project = path.dirname(file.relative);
|
||||
@@ -880,11 +869,11 @@ function getAllResources(project: string, apiHostname: string, username: string,
|
||||
};
|
||||
|
||||
const request = https.request(options, (res) => {
|
||||
const buffer: Buffer[] = [];
|
||||
let buffer: Buffer[] = [];
|
||||
res.on('data', (chunk: Buffer) => buffer.push(chunk));
|
||||
res.on('end', () => {
|
||||
if (res.statusCode === 200) {
|
||||
const json = JSON.parse(Buffer.concat(buffer).toString());
|
||||
let json = JSON.parse(Buffer.concat(buffer).toString());
|
||||
if (Array.isArray(json)) {
|
||||
resolve(json.map(o => o.slug));
|
||||
return;
|
||||
@@ -903,7 +892,7 @@ function getAllResources(project: string, apiHostname: string, username: string,
|
||||
}
|
||||
|
||||
export function findObsoleteResources(apiHostname: string, username: string, password: string): ThroughStream {
|
||||
const resourcesByProject: Map<string[]> = Object.create(null);
|
||||
let resourcesByProject: Map<string[]> = Object.create(null);
|
||||
resourcesByProject[extensionsProject] = ([] as any[]).concat(externalExtensionsWithTranslations); // clone
|
||||
|
||||
return through(function (this: ThroughStream, file: File) {
|
||||
@@ -920,10 +909,10 @@ export function findObsoleteResources(apiHostname: string, username: string, pas
|
||||
}, function () {
|
||||
|
||||
const json = JSON.parse(fs.readFileSync('./build/lib/i18n.resources.json', 'utf8'));
|
||||
const i18Resources = [...json.editor, ...json.workbench].map((r: Resource) => r.project + '/' + r.name.replace(/\//g, '_'));
|
||||
const extractedResources: string[] = [];
|
||||
for (const project of [workbenchProject, editorProject]) {
|
||||
for (const resource of resourcesByProject[project]) {
|
||||
let i18Resources = [...json.editor, ...json.workbench].map((r: Resource) => r.project + '/' + r.name.replace(/\//g, '_'));
|
||||
let extractedResources: string[] = [];
|
||||
for (let project of [workbenchProject, editorProject]) {
|
||||
for (let resource of resourcesByProject[project]) {
|
||||
if (resource !== 'setup_messages') {
|
||||
extractedResources.push(project + '/' + resource);
|
||||
}
|
||||
@@ -934,12 +923,12 @@ export function findObsoleteResources(apiHostname: string, username: string, pas
|
||||
console.log(`[i18n] Missing resources in file 'build/lib/i18n.resources.json': JSON.stringify(${extractedResources.filter(p => i18Resources.indexOf(p) === -1)})`);
|
||||
}
|
||||
|
||||
const promises: Array<Promise<void>> = [];
|
||||
for (const project in resourcesByProject) {
|
||||
let promises: Array<Promise<void>> = [];
|
||||
for (let project in resourcesByProject) {
|
||||
promises.push(
|
||||
getAllResources(project, apiHostname, username, password).then(resources => {
|
||||
const expectedResources = resourcesByProject[project];
|
||||
const unusedResources = resources.filter(resource => resource && expectedResources.indexOf(resource) === -1);
|
||||
let expectedResources = resourcesByProject[project];
|
||||
let unusedResources = resources.filter(resource => resource && expectedResources.indexOf(resource) === -1);
|
||||
if (unusedResources.length) {
|
||||
console.log(`[transifex] Obsolete resources in project '${project}': ${unusedResources.join(', ')}`);
|
||||
}
|
||||
@@ -997,7 +986,7 @@ function createResource(project: string, slug: string, xlfFile: File, apiHostnam
|
||||
method: 'POST'
|
||||
};
|
||||
|
||||
const request = https.request(options, (res) => {
|
||||
let request = https.request(options, (res) => {
|
||||
if (res.statusCode === 201) {
|
||||
log(`Resource ${project}/${slug} successfully created on Transifex.`);
|
||||
} else {
|
||||
@@ -1031,7 +1020,7 @@ function updateResource(project: string, slug: string, xlfFile: File, apiHostnam
|
||||
method: 'PUT'
|
||||
};
|
||||
|
||||
const request = https.request(options, (res) => {
|
||||
let request = https.request(options, (res) => {
|
||||
if (res.statusCode === 200) {
|
||||
res.setEncoding('utf8');
|
||||
|
||||
@@ -1058,7 +1047,7 @@ function updateResource(project: string, slug: string, xlfFile: File, apiHostnam
|
||||
}
|
||||
|
||||
export function pullSetupXlfFiles(apiHostname: string, username: string, password: string, language: Language, includeDefault: boolean): NodeJS.ReadableStream {
|
||||
const setupResources = [{ name: 'setup_messages', project: workbenchProject }];
|
||||
let setupResources = [{ name: 'setup_messages', project: workbenchProject }];
|
||||
if (includeDefault) {
|
||||
setupResources.push({ name: 'setup_default', project: setupProject });
|
||||
}
|
||||
@@ -1067,7 +1056,7 @@ export function pullSetupXlfFiles(apiHostname: string, username: string, passwor
|
||||
|
||||
function pullXlfFiles(apiHostname: string, username: string, password: string, language: Language, resources: Resource[]): NodeJS.ReadableStream {
|
||||
const credentials = `${username}:${password}`;
|
||||
const expectedTranslationsCount = resources.length;
|
||||
let expectedTranslationsCount = resources.length;
|
||||
let translationsRetrieved = 0, called = false;
|
||||
|
||||
return readable(function (_count: any, callback: any) {
|
||||
@@ -1098,7 +1087,7 @@ function retrieveResource(language: Language, resource: Resource, apiHostname: s
|
||||
return limiter.queue(() => new Promise<File | null>((resolve, reject) => {
|
||||
const slug = resource.name.replace(/\//g, '_');
|
||||
const project = resource.project;
|
||||
const transifexLanguageId = language.id === 'ps' ? 'en' : language.translationId || language.id;
|
||||
let transifexLanguageId = language.id === 'ps' ? 'en' : language.translationId || language.id;
|
||||
const options = {
|
||||
hostname: apiHostname,
|
||||
path: `/api/2/project/${project}/resource/${slug}/translation/${transifexLanguageId}?file&mode=onlyreviewed`,
|
||||
@@ -1108,8 +1097,8 @@ function retrieveResource(language: Language, resource: Resource, apiHostname: s
|
||||
};
|
||||
console.log('[transifex] Fetching ' + options.path);
|
||||
|
||||
const request = https.request(options, (res) => {
|
||||
const xlfBuffer: Buffer[] = [];
|
||||
let request = https.request(options, (res) => {
|
||||
let xlfBuffer: Buffer[] = [];
|
||||
res.on('data', (chunk: Buffer) => xlfBuffer.push(chunk));
|
||||
res.on('end', () => {
|
||||
if (res.statusCode === 200) {
|
||||
@@ -1130,16 +1119,16 @@ function retrieveResource(language: Language, resource: Resource, apiHostname: s
|
||||
}
|
||||
|
||||
export function prepareI18nFiles(): ThroughStream {
|
||||
const parsePromises: Promise<ParsedXLF[]>[] = [];
|
||||
let parsePromises: Promise<ParsedXLF[]>[] = [];
|
||||
|
||||
return through(function (this: ThroughStream, xlf: File) {
|
||||
const stream = this;
|
||||
const parsePromise = XLF.parse(xlf.contents.toString());
|
||||
let stream = this;
|
||||
let parsePromise = XLF.parse(xlf.contents.toString());
|
||||
parsePromises.push(parsePromise);
|
||||
parsePromise.then(
|
||||
resolvedFiles => {
|
||||
resolvedFiles.forEach(file => {
|
||||
const translatedFile = createI18nFile(file.originalFilePath, file.messages);
|
||||
let translatedFile = createI18nFile(file.originalFilePath, file.messages);
|
||||
stream.queue(translatedFile);
|
||||
});
|
||||
}
|
||||
@@ -1160,7 +1149,7 @@ export function createI18nFile(originalFilePath: string, messages: any): File {
|
||||
'--------------------------------------------------------------------------------------------',
|
||||
'Do not edit this file. It is machine generated.'
|
||||
];
|
||||
for (const key of Object.keys(messages)) {
|
||||
for (let key of Object.keys(messages)) {
|
||||
result[key] = messages[key];
|
||||
}
|
||||
|
||||
@@ -1189,16 +1178,16 @@ export interface TranslationPath {
|
||||
}
|
||||
|
||||
export function prepareI18nPackFiles(externalExtensions: Map<string>, resultingTranslationPaths: TranslationPath[], pseudo = false): NodeJS.ReadWriteStream {
|
||||
const parsePromises: Promise<ParsedXLF[]>[] = [];
|
||||
const mainPack: I18nPack = { version: i18nPackVersion, contents: {} };
|
||||
const extensionsPacks: Map<I18nPack> = {};
|
||||
const errors: any[] = [];
|
||||
let parsePromises: Promise<ParsedXLF[]>[] = [];
|
||||
let mainPack: I18nPack = { version: i18nPackVersion, contents: {} };
|
||||
let extensionsPacks: Map<I18nPack> = {};
|
||||
let errors: any[] = [];
|
||||
return through(function (this: ThroughStream, xlf: File) {
|
||||
const project = path.basename(path.dirname(path.dirname(xlf.relative)));
|
||||
const resource = path.basename(xlf.relative, '.xlf');
|
||||
const contents = xlf.contents.toString();
|
||||
let project = path.basename(path.dirname(path.dirname(xlf.relative)));
|
||||
let resource = path.basename(xlf.relative, '.xlf');
|
||||
let contents = xlf.contents.toString();
|
||||
log(`Found ${project}: ${resource}`);
|
||||
const parsePromise = pseudo ? XLF.parsePseudo(contents) : XLF.parse(contents);
|
||||
let parsePromise = pseudo ? XLF.parsePseudo(contents) : XLF.parse(contents);
|
||||
parsePromises.push(parsePromise);
|
||||
parsePromise.then(
|
||||
resolvedFiles => {
|
||||
@@ -1236,7 +1225,7 @@ export function prepareI18nPackFiles(externalExtensions: Map<string>, resultingT
|
||||
resultingTranslationPaths.push({ id: 'vscode', resourceName: 'main.i18n.json' });
|
||||
|
||||
this.queue(translatedMainFile);
|
||||
for (const extension in extensionsPacks) {
|
||||
for (let extension in extensionsPacks) {
|
||||
const translatedExtFile = createI18nFile(`extensions/${extension}`, extensionsPacks[extension]);
|
||||
this.queue(translatedExtFile);
|
||||
|
||||
@@ -1257,16 +1246,16 @@ export function prepareI18nPackFiles(externalExtensions: Map<string>, resultingT
|
||||
}
|
||||
|
||||
export function prepareIslFiles(language: Language, innoSetupConfig: InnoSetup): ThroughStream {
|
||||
const parsePromises: Promise<ParsedXLF[]>[] = [];
|
||||
let parsePromises: Promise<ParsedXLF[]>[] = [];
|
||||
|
||||
return through(function (this: ThroughStream, xlf: File) {
|
||||
const stream = this;
|
||||
const parsePromise = XLF.parse(xlf.contents.toString());
|
||||
let stream = this;
|
||||
let parsePromise = XLF.parse(xlf.contents.toString());
|
||||
parsePromises.push(parsePromise);
|
||||
parsePromise.then(
|
||||
resolvedFiles => {
|
||||
resolvedFiles.forEach(file => {
|
||||
const translatedFile = createIslFile(file.originalFilePath, file.messages, language, innoSetupConfig);
|
||||
let translatedFile = createIslFile(file.originalFilePath, file.messages, language, innoSetupConfig);
|
||||
stream.queue(translatedFile);
|
||||
});
|
||||
}
|
||||
@@ -1283,7 +1272,7 @@ export function prepareIslFiles(language: Language, innoSetupConfig: InnoSetup):
|
||||
}
|
||||
|
||||
function createIslFile(originalFilePath: string, messages: Map<string>, language: Language, innoSetup: InnoSetup): File {
|
||||
const content: string[] = [];
|
||||
let content: string[] = [];
|
||||
let originalContent: TextModel;
|
||||
if (path.basename(originalFilePath) === 'Default') {
|
||||
originalContent = new TextModel(fs.readFileSync(originalFilePath + '.isl', 'utf8'));
|
||||
@@ -1292,15 +1281,15 @@ function createIslFile(originalFilePath: string, messages: Map<string>, language
|
||||
}
|
||||
originalContent.lines.forEach(line => {
|
||||
if (line.length > 0) {
|
||||
const firstChar = line.charAt(0);
|
||||
let firstChar = line.charAt(0);
|
||||
if (firstChar === '[' || firstChar === ';') {
|
||||
content.push(line);
|
||||
} else {
|
||||
const sections: string[] = line.split('=');
|
||||
const key = sections[0];
|
||||
let sections: string[] = line.split('=');
|
||||
let key = sections[0];
|
||||
let translated = line;
|
||||
if (key) {
|
||||
const translatedMessage = messages[key];
|
||||
let translatedMessage = messages[key];
|
||||
if (translatedMessage) {
|
||||
translated = `${key}=${translatedMessage}`;
|
||||
}
|
||||
@@ -1322,9 +1311,9 @@ function createIslFile(originalFilePath: string, messages: Map<string>, language
|
||||
}
|
||||
|
||||
function encodeEntities(value: string): string {
|
||||
const result: string[] = [];
|
||||
let result: string[] = [];
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const ch = value[i];
|
||||
let ch = value[i];
|
||||
switch (ch) {
|
||||
case '<':
|
||||
result.push('<');
|
||||
|
||||
@@ -72,11 +72,6 @@ const RULES = [
|
||||
target: '**/{vs,sql}/**/test/**',
|
||||
skip: true // -> skip all test files
|
||||
},
|
||||
// TODO@bpasero remove me once electron utility process has landed
|
||||
{
|
||||
target: '**/vs/workbench/services/extensions/electron-sandbox/nativeLocalProcessExtensionHost.ts',
|
||||
skip: true
|
||||
},
|
||||
// Common: vs/base/common/platform.ts
|
||||
{
|
||||
target: '**/{vs,sql}/base/common/platform.ts',
|
||||
|
||||
@@ -27,7 +27,7 @@ function isDeclaration(ts, a) {
|
||||
}
|
||||
function visitTopLevelDeclarations(ts, sourceFile, visitor) {
|
||||
let stop = false;
|
||||
const visit = (node) => {
|
||||
let visit = (node) => {
|
||||
if (stop) {
|
||||
return;
|
||||
}
|
||||
@@ -49,19 +49,19 @@ function visitTopLevelDeclarations(ts, sourceFile, visitor) {
|
||||
visit(sourceFile);
|
||||
}
|
||||
function getAllTopLevelDeclarations(ts, sourceFile) {
|
||||
const all = [];
|
||||
let all = [];
|
||||
visitTopLevelDeclarations(ts, sourceFile, (node) => {
|
||||
if (node.kind === ts.SyntaxKind.InterfaceDeclaration || node.kind === ts.SyntaxKind.ClassDeclaration || node.kind === ts.SyntaxKind.ModuleDeclaration) {
|
||||
const interfaceDeclaration = node;
|
||||
const triviaStart = interfaceDeclaration.pos;
|
||||
const triviaEnd = interfaceDeclaration.name.pos;
|
||||
const triviaText = getNodeText(sourceFile, { pos: triviaStart, end: triviaEnd });
|
||||
let interfaceDeclaration = node;
|
||||
let triviaStart = interfaceDeclaration.pos;
|
||||
let triviaEnd = interfaceDeclaration.name.pos;
|
||||
let triviaText = getNodeText(sourceFile, { pos: triviaStart, end: triviaEnd });
|
||||
if (triviaText.indexOf('@internal') === -1) {
|
||||
all.push(node);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const nodeText = getNodeText(sourceFile, node);
|
||||
let nodeText = getNodeText(sourceFile, node);
|
||||
if (nodeText.indexOf('@internal') === -1) {
|
||||
all.push(node);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ function getNodeText(sourceFile, node) {
|
||||
function hasModifier(modifiers, kind) {
|
||||
if (modifiers) {
|
||||
for (let i = 0; i < modifiers.length; i++) {
|
||||
const mod = modifiers[i];
|
||||
let mod = modifiers[i];
|
||||
if (mod.kind === kind) {
|
||||
return true;
|
||||
}
|
||||
@@ -113,14 +113,14 @@ function isDefaultExport(ts, declaration) {
|
||||
function getMassagedTopLevelDeclarationText(ts, sourceFile, declaration, importName, usage, enums) {
|
||||
let result = getNodeText(sourceFile, declaration);
|
||||
if (declaration.kind === ts.SyntaxKind.InterfaceDeclaration || declaration.kind === ts.SyntaxKind.ClassDeclaration) {
|
||||
const interfaceDeclaration = declaration;
|
||||
let interfaceDeclaration = declaration;
|
||||
const staticTypeName = (isDefaultExport(ts, interfaceDeclaration)
|
||||
? `${importName}.default`
|
||||
: `${importName}.${declaration.name.text}`);
|
||||
let instanceTypeName = staticTypeName;
|
||||
const typeParametersCnt = (interfaceDeclaration.typeParameters ? interfaceDeclaration.typeParameters.length : 0);
|
||||
if (typeParametersCnt > 0) {
|
||||
const arr = [];
|
||||
let arr = [];
|
||||
for (let i = 0; i < typeParametersCnt; i++) {
|
||||
arr.push('any');
|
||||
}
|
||||
@@ -129,7 +129,7 @@ function getMassagedTopLevelDeclarationText(ts, sourceFile, declaration, importN
|
||||
const members = interfaceDeclaration.members;
|
||||
members.forEach((member) => {
|
||||
try {
|
||||
const memberText = getNodeText(sourceFile, member);
|
||||
let memberText = getNodeText(sourceFile, member);
|
||||
if (memberText.indexOf('@internal') >= 0 || memberText.indexOf('private') >= 0) {
|
||||
result = result.replace(memberText, '');
|
||||
}
|
||||
@@ -152,7 +152,7 @@ function getMassagedTopLevelDeclarationText(ts, sourceFile, declaration, importN
|
||||
result = result.replace(/export default /g, 'export ');
|
||||
result = result.replace(/export declare /g, 'export ');
|
||||
result = result.replace(/declare /g, '');
|
||||
const lines = result.split(/\r\n|\r|\n/);
|
||||
let lines = result.split(/\r\n|\r|\n/);
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
if (/\s*\*/.test(lines[i])) {
|
||||
// very likely a comment
|
||||
@@ -177,9 +177,9 @@ function format(ts, text, endl) {
|
||||
return text;
|
||||
}
|
||||
// Parse the source text
|
||||
const sourceFile = ts.createSourceFile('file.ts', text, ts.ScriptTarget.Latest, /*setParentPointers*/ true);
|
||||
let sourceFile = ts.createSourceFile('file.ts', text, ts.ScriptTarget.Latest, /*setParentPointers*/ true);
|
||||
// Get the formatting edits on the input sources
|
||||
const edits = ts.formatting.formatDocument(sourceFile, getRuleProvider(tsfmt), tsfmt);
|
||||
let edits = ts.formatting.formatDocument(sourceFile, getRuleProvider(tsfmt), tsfmt);
|
||||
// Apply the edits on the input code
|
||||
return applyEdits(text, edits);
|
||||
function countParensCurly(text) {
|
||||
@@ -202,7 +202,7 @@ function format(ts, text, endl) {
|
||||
return r;
|
||||
}
|
||||
function preformat(text, endl) {
|
||||
const lines = text.split(endl);
|
||||
let lines = text.split(endl);
|
||||
let inComment = false;
|
||||
let inCommentDeltaIndent = 0;
|
||||
let indent = 0;
|
||||
@@ -282,9 +282,9 @@ function format(ts, text, endl) {
|
||||
// Apply edits in reverse on the existing text
|
||||
let result = text;
|
||||
for (let i = edits.length - 1; i >= 0; i--) {
|
||||
const change = edits[i];
|
||||
const head = result.slice(0, change.span.start);
|
||||
const tail = result.slice(change.span.start + change.span.length);
|
||||
let change = edits[i];
|
||||
let head = result.slice(0, change.span.start);
|
||||
let tail = result.slice(change.span.start + change.span.length);
|
||||
result = head + change.newText + tail;
|
||||
}
|
||||
return result;
|
||||
@@ -300,15 +300,15 @@ function createReplacerFromDirectives(directives) {
|
||||
}
|
||||
function createReplacer(data) {
|
||||
data = data || '';
|
||||
const rawDirectives = data.split(';');
|
||||
const directives = [];
|
||||
let rawDirectives = data.split(';');
|
||||
let directives = [];
|
||||
rawDirectives.forEach((rawDirective) => {
|
||||
if (rawDirective.length === 0) {
|
||||
return;
|
||||
}
|
||||
const pieces = rawDirective.split('=>');
|
||||
let pieces = rawDirective.split('=>');
|
||||
let findStr = pieces[0];
|
||||
const replaceStr = pieces[1];
|
||||
let replaceStr = pieces[1];
|
||||
findStr = findStr.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, '\\$&');
|
||||
findStr = '\\b' + findStr + '\\b';
|
||||
directives.push([new RegExp(findStr, 'g'), replaceStr]);
|
||||
@@ -317,32 +317,32 @@ function createReplacer(data) {
|
||||
}
|
||||
function generateDeclarationFile(ts, recipe, sourceFileGetter) {
|
||||
const endl = /\r\n/.test(recipe) ? '\r\n' : '\n';
|
||||
const lines = recipe.split(endl);
|
||||
const result = [];
|
||||
let lines = recipe.split(endl);
|
||||
let result = [];
|
||||
let usageCounter = 0;
|
||||
const usageImports = [];
|
||||
const usage = [];
|
||||
let usageImports = [];
|
||||
let usage = [];
|
||||
let failed = false;
|
||||
usage.push(`var a: any;`);
|
||||
usage.push(`var b: any;`);
|
||||
const generateUsageImport = (moduleId) => {
|
||||
const importName = 'm' + (++usageCounter);
|
||||
let importName = 'm' + (++usageCounter);
|
||||
usageImports.push(`import * as ${importName} from './${moduleId.replace(/\.d\.ts$/, '')}';`);
|
||||
return importName;
|
||||
};
|
||||
const enums = [];
|
||||
let enums = [];
|
||||
let version = null;
|
||||
lines.forEach(line => {
|
||||
if (failed) {
|
||||
return;
|
||||
}
|
||||
const m0 = line.match(/^\/\/dtsv=(\d+)$/);
|
||||
let m0 = line.match(/^\/\/dtsv=(\d+)$/);
|
||||
if (m0) {
|
||||
version = m0[1];
|
||||
}
|
||||
const m1 = line.match(/^\s*#include\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
||||
let m1 = line.match(/^\s*#include\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
||||
if (m1) {
|
||||
const moduleId = m1[1];
|
||||
let moduleId = m1[1];
|
||||
const sourceFile = sourceFileGetter(moduleId);
|
||||
if (!sourceFile) {
|
||||
logErr(`While handling ${line}`);
|
||||
@@ -351,14 +351,14 @@ function generateDeclarationFile(ts, recipe, sourceFileGetter) {
|
||||
return;
|
||||
}
|
||||
const importName = generateUsageImport(moduleId);
|
||||
const replacer = createReplacer(m1[2]);
|
||||
const typeNames = m1[3].split(/,/);
|
||||
let replacer = createReplacer(m1[2]);
|
||||
let typeNames = m1[3].split(/,/);
|
||||
typeNames.forEach((typeName) => {
|
||||
typeName = typeName.trim();
|
||||
if (typeName.length === 0) {
|
||||
return;
|
||||
}
|
||||
const declaration = getTopLevelDeclaration(ts, sourceFile, typeName);
|
||||
let declaration = getTopLevelDeclaration(ts, sourceFile, typeName);
|
||||
if (!declaration) {
|
||||
logErr(`While handling ${line}`);
|
||||
logErr(`Cannot find ${typeName}`);
|
||||
@@ -369,9 +369,9 @@ function generateDeclarationFile(ts, recipe, sourceFileGetter) {
|
||||
});
|
||||
return;
|
||||
}
|
||||
const m2 = line.match(/^\s*#includeAll\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
||||
let m2 = line.match(/^\s*#includeAll\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
||||
if (m2) {
|
||||
const moduleId = m2[1];
|
||||
let moduleId = m2[1];
|
||||
const sourceFile = sourceFileGetter(moduleId);
|
||||
if (!sourceFile) {
|
||||
logErr(`While handling ${line}`);
|
||||
@@ -380,10 +380,10 @@ function generateDeclarationFile(ts, recipe, sourceFileGetter) {
|
||||
return;
|
||||
}
|
||||
const importName = generateUsageImport(moduleId);
|
||||
const replacer = createReplacer(m2[2]);
|
||||
const typeNames = m2[3].split(/,/);
|
||||
const typesToExcludeMap = {};
|
||||
const typesToExcludeArr = [];
|
||||
let replacer = createReplacer(m2[2]);
|
||||
let typeNames = m2[3].split(/,/);
|
||||
let typesToExcludeMap = {};
|
||||
let typesToExcludeArr = [];
|
||||
typeNames.forEach((typeName) => {
|
||||
typeName = typeName.trim();
|
||||
if (typeName.length === 0) {
|
||||
@@ -400,7 +400,7 @@ function generateDeclarationFile(ts, recipe, sourceFileGetter) {
|
||||
}
|
||||
else {
|
||||
// node is ts.VariableStatement
|
||||
const nodeText = getNodeText(sourceFile, declaration);
|
||||
let nodeText = getNodeText(sourceFile, declaration);
|
||||
for (let i = 0; i < typesToExcludeArr.length; i++) {
|
||||
if (nodeText.indexOf(typesToExcludeArr[i]) >= 0) {
|
||||
return;
|
||||
@@ -605,7 +605,7 @@ class TypeScriptLanguageServiceHost {
|
||||
}
|
||||
}
|
||||
function execute() {
|
||||
const r = run3(new DeclarationResolver(new FSProvider()));
|
||||
let r = run3(new DeclarationResolver(new FSProvider()));
|
||||
if (!r) {
|
||||
throw new Error(`monaco.d.ts generation error - Cannot continue`);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ function isDeclaration(ts: typeof import('typescript'), a: TSTopLevelDeclare): a
|
||||
function visitTopLevelDeclarations(ts: typeof import('typescript'), sourceFile: ts.SourceFile, visitor: (node: TSTopLevelDeclare) => boolean): void {
|
||||
let stop = false;
|
||||
|
||||
const visit = (node: ts.Node): void => {
|
||||
let visit = (node: ts.Node): void => {
|
||||
if (stop) {
|
||||
return;
|
||||
}
|
||||
@@ -67,19 +67,19 @@ function visitTopLevelDeclarations(ts: typeof import('typescript'), sourceFile:
|
||||
|
||||
|
||||
function getAllTopLevelDeclarations(ts: typeof import('typescript'), sourceFile: ts.SourceFile): TSTopLevelDeclare[] {
|
||||
const all: TSTopLevelDeclare[] = [];
|
||||
let all: TSTopLevelDeclare[] = [];
|
||||
visitTopLevelDeclarations(ts, sourceFile, (node) => {
|
||||
if (node.kind === ts.SyntaxKind.InterfaceDeclaration || node.kind === ts.SyntaxKind.ClassDeclaration || node.kind === ts.SyntaxKind.ModuleDeclaration) {
|
||||
const interfaceDeclaration = <ts.InterfaceDeclaration>node;
|
||||
const triviaStart = interfaceDeclaration.pos;
|
||||
const triviaEnd = interfaceDeclaration.name.pos;
|
||||
const triviaText = getNodeText(sourceFile, { pos: triviaStart, end: triviaEnd });
|
||||
let interfaceDeclaration = <ts.InterfaceDeclaration>node;
|
||||
let triviaStart = interfaceDeclaration.pos;
|
||||
let triviaEnd = interfaceDeclaration.name.pos;
|
||||
let triviaText = getNodeText(sourceFile, { pos: triviaStart, end: triviaEnd });
|
||||
|
||||
if (triviaText.indexOf('@internal') === -1) {
|
||||
all.push(node);
|
||||
}
|
||||
} else {
|
||||
const nodeText = getNodeText(sourceFile, node);
|
||||
let nodeText = getNodeText(sourceFile, node);
|
||||
if (nodeText.indexOf('@internal') === -1) {
|
||||
all.push(node);
|
||||
}
|
||||
@@ -115,10 +115,10 @@ function getNodeText(sourceFile: ts.SourceFile, node: { pos: number; end: number
|
||||
return sourceFile.getFullText().substring(node.pos, node.end);
|
||||
}
|
||||
|
||||
function hasModifier(modifiers: ts.NodeArray<ts.ModifierLike> | undefined, kind: ts.SyntaxKind): boolean {
|
||||
function hasModifier(modifiers: ts.NodeArray<ts.Modifier> | undefined, kind: ts.SyntaxKind): boolean {
|
||||
if (modifiers) {
|
||||
for (let i = 0; i < modifiers.length; i++) {
|
||||
const mod = modifiers[i];
|
||||
let mod = modifiers[i];
|
||||
if (mod.kind === kind) {
|
||||
return true;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ function isDefaultExport(ts: typeof import('typescript'), declaration: ts.Interf
|
||||
function getMassagedTopLevelDeclarationText(ts: typeof import('typescript'), sourceFile: ts.SourceFile, declaration: TSTopLevelDeclare, importName: string, usage: string[], enums: IEnumEntry[]): string {
|
||||
let result = getNodeText(sourceFile, declaration);
|
||||
if (declaration.kind === ts.SyntaxKind.InterfaceDeclaration || declaration.kind === ts.SyntaxKind.ClassDeclaration) {
|
||||
const interfaceDeclaration = <ts.InterfaceDeclaration | ts.ClassDeclaration>declaration;
|
||||
let interfaceDeclaration = <ts.InterfaceDeclaration | ts.ClassDeclaration>declaration;
|
||||
|
||||
const staticTypeName = (
|
||||
isDefaultExport(ts, interfaceDeclaration)
|
||||
@@ -152,7 +152,7 @@ function getMassagedTopLevelDeclarationText(ts: typeof import('typescript'), sou
|
||||
let instanceTypeName = staticTypeName;
|
||||
const typeParametersCnt = (interfaceDeclaration.typeParameters ? interfaceDeclaration.typeParameters.length : 0);
|
||||
if (typeParametersCnt > 0) {
|
||||
const arr: string[] = [];
|
||||
let arr: string[] = [];
|
||||
for (let i = 0; i < typeParametersCnt; i++) {
|
||||
arr.push('any');
|
||||
}
|
||||
@@ -162,7 +162,7 @@ function getMassagedTopLevelDeclarationText(ts: typeof import('typescript'), sou
|
||||
const members: ts.NodeArray<ts.ClassElement | ts.TypeElement> = interfaceDeclaration.members;
|
||||
members.forEach((member) => {
|
||||
try {
|
||||
const memberText = getNodeText(sourceFile, member);
|
||||
let memberText = getNodeText(sourceFile, member);
|
||||
if (memberText.indexOf('@internal') >= 0 || memberText.indexOf('private') >= 0) {
|
||||
result = result.replace(memberText, '');
|
||||
} else {
|
||||
@@ -182,7 +182,7 @@ function getMassagedTopLevelDeclarationText(ts: typeof import('typescript'), sou
|
||||
result = result.replace(/export default /g, 'export ');
|
||||
result = result.replace(/export declare /g, 'export ');
|
||||
result = result.replace(/declare /g, '');
|
||||
const lines = result.split(/\r\n|\r|\n/);
|
||||
let lines = result.split(/\r\n|\r|\n/);
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
if (/\s*\*/.test(lines[i])) {
|
||||
// very likely a comment
|
||||
@@ -212,10 +212,10 @@ function format(ts: typeof import('typescript'), text: string, endl: string): st
|
||||
}
|
||||
|
||||
// Parse the source text
|
||||
const sourceFile = ts.createSourceFile('file.ts', text, ts.ScriptTarget.Latest, /*setParentPointers*/ true);
|
||||
let sourceFile = ts.createSourceFile('file.ts', text, ts.ScriptTarget.Latest, /*setParentPointers*/ true);
|
||||
|
||||
// Get the formatting edits on the input sources
|
||||
const edits = (<any>ts).formatting.formatDocument(sourceFile, getRuleProvider(tsfmt), tsfmt);
|
||||
let edits = (<any>ts).formatting.formatDocument(sourceFile, getRuleProvider(tsfmt), tsfmt);
|
||||
|
||||
// Apply the edits on the input code
|
||||
return applyEdits(text, edits);
|
||||
@@ -242,7 +242,7 @@ function format(ts: typeof import('typescript'), text: string, endl: string): st
|
||||
}
|
||||
|
||||
function preformat(text: string, endl: string): string {
|
||||
const lines = text.split(endl);
|
||||
let lines = text.split(endl);
|
||||
let inComment = false;
|
||||
let inCommentDeltaIndent = 0;
|
||||
let indent = 0;
|
||||
@@ -328,9 +328,9 @@ function format(ts: typeof import('typescript'), text: string, endl: string): st
|
||||
// Apply edits in reverse on the existing text
|
||||
let result = text;
|
||||
for (let i = edits.length - 1; i >= 0; i--) {
|
||||
const change = edits[i];
|
||||
const head = result.slice(0, change.span.start);
|
||||
const tail = result.slice(change.span.start + change.span.length);
|
||||
let change = edits[i];
|
||||
let head = result.slice(0, change.span.start);
|
||||
let tail = result.slice(change.span.start + change.span.length);
|
||||
result = head + change.newText + tail;
|
||||
}
|
||||
return result;
|
||||
@@ -348,15 +348,15 @@ function createReplacerFromDirectives(directives: [RegExp, string][]): (str: str
|
||||
|
||||
function createReplacer(data: string): (str: string) => string {
|
||||
data = data || '';
|
||||
const rawDirectives = data.split(';');
|
||||
const directives: [RegExp, string][] = [];
|
||||
let rawDirectives = data.split(';');
|
||||
let directives: [RegExp, string][] = [];
|
||||
rawDirectives.forEach((rawDirective) => {
|
||||
if (rawDirective.length === 0) {
|
||||
return;
|
||||
}
|
||||
const pieces = rawDirective.split('=>');
|
||||
let pieces = rawDirective.split('=>');
|
||||
let findStr = pieces[0];
|
||||
const replaceStr = pieces[1];
|
||||
let replaceStr = pieces[1];
|
||||
|
||||
findStr = findStr.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, '\\$&');
|
||||
findStr = '\\b' + findStr + '\\b';
|
||||
@@ -380,12 +380,12 @@ interface IEnumEntry {
|
||||
function generateDeclarationFile(ts: typeof import('typescript'), recipe: string, sourceFileGetter: SourceFileGetter): ITempResult | null {
|
||||
const endl = /\r\n/.test(recipe) ? '\r\n' : '\n';
|
||||
|
||||
const lines = recipe.split(endl);
|
||||
const result: string[] = [];
|
||||
let lines = recipe.split(endl);
|
||||
let result: string[] = [];
|
||||
|
||||
let usageCounter = 0;
|
||||
const usageImports: string[] = [];
|
||||
const usage: string[] = [];
|
||||
let usageImports: string[] = [];
|
||||
let usage: string[] = [];
|
||||
|
||||
let failed = false;
|
||||
|
||||
@@ -393,12 +393,12 @@ function generateDeclarationFile(ts: typeof import('typescript'), recipe: string
|
||||
usage.push(`var b: any;`);
|
||||
|
||||
const generateUsageImport = (moduleId: string) => {
|
||||
const importName = 'm' + (++usageCounter);
|
||||
let importName = 'm' + (++usageCounter);
|
||||
usageImports.push(`import * as ${importName} from './${moduleId.replace(/\.d\.ts$/, '')}';`);
|
||||
return importName;
|
||||
};
|
||||
|
||||
const enums: IEnumEntry[] = [];
|
||||
let enums: IEnumEntry[] = [];
|
||||
let version: string | null = null;
|
||||
|
||||
lines.forEach(line => {
|
||||
@@ -407,14 +407,14 @@ function generateDeclarationFile(ts: typeof import('typescript'), recipe: string
|
||||
return;
|
||||
}
|
||||
|
||||
const m0 = line.match(/^\/\/dtsv=(\d+)$/);
|
||||
let m0 = line.match(/^\/\/dtsv=(\d+)$/);
|
||||
if (m0) {
|
||||
version = m0[1];
|
||||
}
|
||||
|
||||
const m1 = line.match(/^\s*#include\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
||||
let m1 = line.match(/^\s*#include\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
||||
if (m1) {
|
||||
const moduleId = m1[1];
|
||||
let moduleId = m1[1];
|
||||
const sourceFile = sourceFileGetter(moduleId);
|
||||
if (!sourceFile) {
|
||||
logErr(`While handling ${line}`);
|
||||
@@ -425,15 +425,15 @@ function generateDeclarationFile(ts: typeof import('typescript'), recipe: string
|
||||
|
||||
const importName = generateUsageImport(moduleId);
|
||||
|
||||
const replacer = createReplacer(m1[2]);
|
||||
let replacer = createReplacer(m1[2]);
|
||||
|
||||
const typeNames = m1[3].split(/,/);
|
||||
let typeNames = m1[3].split(/,/);
|
||||
typeNames.forEach((typeName) => {
|
||||
typeName = typeName.trim();
|
||||
if (typeName.length === 0) {
|
||||
return;
|
||||
}
|
||||
const declaration = getTopLevelDeclaration(ts, sourceFile, typeName);
|
||||
let declaration = getTopLevelDeclaration(ts, sourceFile, typeName);
|
||||
if (!declaration) {
|
||||
logErr(`While handling ${line}`);
|
||||
logErr(`Cannot find ${typeName}`);
|
||||
@@ -445,9 +445,9 @@ function generateDeclarationFile(ts: typeof import('typescript'), recipe: string
|
||||
return;
|
||||
}
|
||||
|
||||
const m2 = line.match(/^\s*#includeAll\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
||||
let m2 = line.match(/^\s*#includeAll\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
||||
if (m2) {
|
||||
const moduleId = m2[1];
|
||||
let moduleId = m2[1];
|
||||
const sourceFile = sourceFileGetter(moduleId);
|
||||
if (!sourceFile) {
|
||||
logErr(`While handling ${line}`);
|
||||
@@ -458,11 +458,11 @@ function generateDeclarationFile(ts: typeof import('typescript'), recipe: string
|
||||
|
||||
const importName = generateUsageImport(moduleId);
|
||||
|
||||
const replacer = createReplacer(m2[2]);
|
||||
let replacer = createReplacer(m2[2]);
|
||||
|
||||
const typeNames = m2[3].split(/,/);
|
||||
const typesToExcludeMap: { [typeName: string]: boolean } = {};
|
||||
const typesToExcludeArr: string[] = [];
|
||||
let typeNames = m2[3].split(/,/);
|
||||
let typesToExcludeMap: { [typeName: string]: boolean } = {};
|
||||
let typesToExcludeArr: string[] = [];
|
||||
typeNames.forEach((typeName) => {
|
||||
typeName = typeName.trim();
|
||||
if (typeName.length === 0) {
|
||||
@@ -479,7 +479,7 @@ function generateDeclarationFile(ts: typeof import('typescript'), recipe: string
|
||||
}
|
||||
} else {
|
||||
// node is ts.VariableStatement
|
||||
const nodeText = getNodeText(sourceFile, declaration);
|
||||
let nodeText = getNodeText(sourceFile, declaration);
|
||||
for (let i = 0; i < typesToExcludeArr.length; i++) {
|
||||
if (nodeText.indexOf(typesToExcludeArr[i]) >= 0) {
|
||||
return;
|
||||
@@ -732,7 +732,7 @@ class TypeScriptLanguageServiceHost implements ts.LanguageServiceHost {
|
||||
}
|
||||
|
||||
export function execute(): IMonacoDeclarationResult {
|
||||
const r = run3(new DeclarationResolver(new FSProvider()));
|
||||
let r = run3(new DeclarationResolver(new FSProvider()));
|
||||
if (!r) {
|
||||
throw new Error(`monaco.d.ts generation error - Cannot continue`);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.minifyTask = exports.optimizeTask = exports.loaderConfig = void 0;
|
||||
const es = require("event-stream");
|
||||
@@ -37,58 +37,40 @@ function loaderConfig() {
|
||||
}
|
||||
exports.loaderConfig = loaderConfig;
|
||||
const IS_OUR_COPYRIGHT_REGEXP = /Copyright \(C\) Microsoft Corporation/i;
|
||||
function loaderPlugin(src, base, amdModuleId) {
|
||||
return (gulp
|
||||
.src(src, { base })
|
||||
.pipe(es.through(function (data) {
|
||||
if (amdModuleId) {
|
||||
let contents = data.contents.toString('utf8');
|
||||
contents = contents.replace(/^define\(/m, `define("${amdModuleId}",`);
|
||||
data.contents = Buffer.from(contents);
|
||||
}
|
||||
this.emit('data', data);
|
||||
})));
|
||||
}
|
||||
function loader(src, bundledFileHeader, bundleLoader, externalLoaderInfo) {
|
||||
let loaderStream = gulp.src(`${src}/vs/loader.js`, { base: `${src}` });
|
||||
let sources = [
|
||||
`${src}/vs/loader.js`
|
||||
];
|
||||
if (bundleLoader) {
|
||||
loaderStream = es.merge(loaderStream, loaderPlugin(`${src}/vs/css.js`, `${src}`, 'vs/css'), loaderPlugin(`${src}/vs/nls.js`, `${src}`, 'vs/nls'));
|
||||
sources = sources.concat([
|
||||
`${src}/vs/css.js`,
|
||||
`${src}/vs/nls.js`
|
||||
]);
|
||||
}
|
||||
const files = [];
|
||||
const order = (f) => {
|
||||
if (f.path.endsWith('loader.js')) {
|
||||
return 0;
|
||||
}
|
||||
if (f.path.endsWith('css.js')) {
|
||||
return 1;
|
||||
}
|
||||
if (f.path.endsWith('nls.js')) {
|
||||
return 2;
|
||||
}
|
||||
return 3;
|
||||
};
|
||||
return (loaderStream
|
||||
let isFirst = true;
|
||||
return (gulp
|
||||
.src(sources, { base: `${src}` })
|
||||
.pipe(es.through(function (data) {
|
||||
files.push(data);
|
||||
if (isFirst) {
|
||||
isFirst = false;
|
||||
this.emit('data', new VinylFile({
|
||||
path: 'fake',
|
||||
base: '.',
|
||||
contents: Buffer.from(bundledFileHeader)
|
||||
}));
|
||||
this.emit('data', data);
|
||||
}
|
||||
else {
|
||||
this.emit('data', data);
|
||||
}
|
||||
}, function () {
|
||||
files.sort((a, b) => {
|
||||
return order(a) - order(b);
|
||||
});
|
||||
files.unshift(new VinylFile({
|
||||
path: 'fake',
|
||||
base: '.',
|
||||
contents: Buffer.from(bundledFileHeader)
|
||||
}));
|
||||
if (externalLoaderInfo !== undefined) {
|
||||
files.push(new VinylFile({
|
||||
this.emit('data', new VinylFile({
|
||||
path: 'fake2',
|
||||
base: '.',
|
||||
contents: Buffer.from(`require.config(${JSON.stringify(externalLoaderInfo, undefined, 2)});`)
|
||||
}));
|
||||
}
|
||||
for (const file of files) {
|
||||
this.emit('data', file);
|
||||
}
|
||||
this.emit('end');
|
||||
}))
|
||||
.pipe(concat('vs/loader.js')));
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as es from 'event-stream';
|
||||
import * as gulp from 'gulp';
|
||||
import * as concat from 'gulp-concat';
|
||||
@@ -41,68 +43,41 @@ export function loaderConfig() {
|
||||
|
||||
const IS_OUR_COPYRIGHT_REGEXP = /Copyright \(C\) Microsoft Corporation/i;
|
||||
|
||||
function loaderPlugin(src: string, base: string, amdModuleId: string | undefined): NodeJS.ReadWriteStream {
|
||||
return (
|
||||
gulp
|
||||
.src(src, { base })
|
||||
.pipe(es.through(function (data: VinylFile) {
|
||||
if (amdModuleId) {
|
||||
let contents = data.contents.toString('utf8');
|
||||
contents = contents.replace(/^define\(/m, `define("${amdModuleId}",`);
|
||||
data.contents = Buffer.from(contents);
|
||||
}
|
||||
this.emit('data', data);
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
function loader(src: string, bundledFileHeader: string, bundleLoader: boolean, externalLoaderInfo?: any): NodeJS.ReadWriteStream {
|
||||
let loaderStream = gulp.src(`${src}/vs/loader.js`, { base: `${src}` });
|
||||
let sources = [
|
||||
`${src}/vs/loader.js`
|
||||
];
|
||||
if (bundleLoader) {
|
||||
loaderStream = es.merge(
|
||||
loaderStream,
|
||||
loaderPlugin(`${src}/vs/css.js`, `${src}`, 'vs/css'),
|
||||
loaderPlugin(`${src}/vs/nls.js`, `${src}`, 'vs/nls'),
|
||||
);
|
||||
sources = sources.concat([
|
||||
`${src}/vs/css.js`,
|
||||
`${src}/vs/nls.js`
|
||||
]);
|
||||
}
|
||||
|
||||
const files: VinylFile[] = [];
|
||||
const order = (f: VinylFile) => {
|
||||
if (f.path.endsWith('loader.js')) {
|
||||
return 0;
|
||||
}
|
||||
if (f.path.endsWith('css.js')) {
|
||||
return 1;
|
||||
}
|
||||
if (f.path.endsWith('nls.js')) {
|
||||
return 2;
|
||||
}
|
||||
return 3;
|
||||
};
|
||||
|
||||
let isFirst = true;
|
||||
return (
|
||||
loaderStream
|
||||
gulp
|
||||
.src(sources, { base: `${src}` })
|
||||
.pipe(es.through(function (data) {
|
||||
files.push(data);
|
||||
if (isFirst) {
|
||||
isFirst = false;
|
||||
this.emit('data', new VinylFile({
|
||||
path: 'fake',
|
||||
base: '.',
|
||||
contents: Buffer.from(bundledFileHeader)
|
||||
}));
|
||||
this.emit('data', data);
|
||||
} else {
|
||||
this.emit('data', data);
|
||||
}
|
||||
}, function () {
|
||||
files.sort((a, b) => {
|
||||
return order(a) - order(b);
|
||||
});
|
||||
files.unshift(new VinylFile({
|
||||
path: 'fake',
|
||||
base: '.',
|
||||
contents: Buffer.from(bundledFileHeader)
|
||||
}));
|
||||
if (externalLoaderInfo !== undefined) {
|
||||
files.push(new VinylFile({
|
||||
this.emit('data', new VinylFile({
|
||||
path: 'fake2',
|
||||
base: '.',
|
||||
contents: Buffer.from(`require.config(${JSON.stringify(externalLoaderInfo, undefined, 2)});`)
|
||||
}));
|
||||
}
|
||||
for (const file of files) {
|
||||
this.emit('data', file);
|
||||
}
|
||||
this.emit('end');
|
||||
}))
|
||||
.pipe(concat('vs/loader.js'))
|
||||
|
||||
@@ -1,497 +0,0 @@
|
||||
"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 child_process_1 = require("child_process");
|
||||
const fs_1 = require("fs");
|
||||
const path = require("path");
|
||||
const byline = require("byline");
|
||||
const ripgrep_1 = require("@vscode/ripgrep");
|
||||
const Parser = require("tree-sitter");
|
||||
const node_fetch_1 = require("node-fetch");
|
||||
const { typescript } = require('tree-sitter-typescript');
|
||||
const product = require('../../product.json');
|
||||
function isNlsString(value) {
|
||||
return value ? typeof value !== 'string' : false;
|
||||
}
|
||||
function isStringArray(value) {
|
||||
return !value.some(s => isNlsString(s));
|
||||
}
|
||||
function isNlsStringArray(value) {
|
||||
return value.every(s => isNlsString(s));
|
||||
}
|
||||
var PolicyType;
|
||||
(function (PolicyType) {
|
||||
PolicyType[PolicyType["StringEnum"] = 0] = "StringEnum";
|
||||
})(PolicyType || (PolicyType = {}));
|
||||
function renderADMLString(prefix, moduleName, nlsString, translations) {
|
||||
let value;
|
||||
if (translations) {
|
||||
const moduleTranslations = translations[moduleName];
|
||||
if (moduleTranslations) {
|
||||
value = moduleTranslations[nlsString.nlsKey];
|
||||
}
|
||||
}
|
||||
if (!value) {
|
||||
value = nlsString.value;
|
||||
}
|
||||
return `<string id="${prefix}_${nlsString.nlsKey}">${value}</string>`;
|
||||
}
|
||||
class BasePolicy {
|
||||
constructor(policyType, name, category, minimumVersion, description, moduleName) {
|
||||
this.policyType = policyType;
|
||||
this.name = name;
|
||||
this.category = category;
|
||||
this.minimumVersion = minimumVersion;
|
||||
this.description = description;
|
||||
this.moduleName = moduleName;
|
||||
}
|
||||
renderADMLString(nlsString, translations) {
|
||||
return renderADMLString(this.name, this.moduleName, nlsString, translations);
|
||||
}
|
||||
renderADMX(regKey) {
|
||||
return [
|
||||
`<policy name="${this.name}" class="Both" displayName="$(string.${this.name})" explainText="$(string.${this.name}_${this.description.nlsKey})" key="Software\\Policies\\Microsoft\\${regKey}" presentation="$(presentation.${this.name})">`,
|
||||
` <parentCategory ref="${this.category.name.nlsKey}" />`,
|
||||
` <supportedOn ref="Supported_${this.minimumVersion.replace(/\./g, '_')}" />`,
|
||||
` <elements>`,
|
||||
...this.renderADMXElements(),
|
||||
` </elements>`,
|
||||
`</policy>`
|
||||
];
|
||||
}
|
||||
renderADMLStrings(translations) {
|
||||
return [
|
||||
`<string id="${this.name}">${this.name}</string>`,
|
||||
this.renderADMLString(this.description, translations)
|
||||
];
|
||||
}
|
||||
renderADMLPresentation() {
|
||||
return `<presentation id="${this.name}">${this.renderADMLPresentationContents()}</presentation>`;
|
||||
}
|
||||
}
|
||||
class BooleanPolicy extends BasePolicy {
|
||||
static from(name, category, minimumVersion, description, moduleName, settingNode) {
|
||||
const type = getStringProperty(settingNode, 'type');
|
||||
if (type !== 'boolean') {
|
||||
return undefined;
|
||||
}
|
||||
return new BooleanPolicy(name, category, minimumVersion, description, moduleName);
|
||||
}
|
||||
constructor(name, category, minimumVersion, description, moduleName) {
|
||||
super(PolicyType.StringEnum, name, category, minimumVersion, description, moduleName);
|
||||
}
|
||||
renderADMXElements() {
|
||||
return [
|
||||
`<boolean id="${this.name}" valueName="${this.name}">`,
|
||||
` <trueValue><decimal value="1" /></trueValue><falseValue><decimal value="0" /></falseValue>`,
|
||||
`</boolean>`
|
||||
];
|
||||
}
|
||||
renderADMLPresentationContents() {
|
||||
return `<checkBox refId="${this.name}">${this.name}</checkBox>`;
|
||||
}
|
||||
}
|
||||
class IntPolicy extends BasePolicy {
|
||||
constructor(name, category, minimumVersion, description, moduleName, defaultValue) {
|
||||
super(PolicyType.StringEnum, name, category, minimumVersion, description, moduleName);
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
static from(name, category, minimumVersion, description, moduleName, settingNode) {
|
||||
const type = getStringProperty(settingNode, 'type');
|
||||
if (type !== 'number') {
|
||||
return undefined;
|
||||
}
|
||||
const defaultValue = getIntProperty(settingNode, 'default');
|
||||
if (typeof defaultValue === 'undefined') {
|
||||
throw new Error(`Missing required 'default' property.`);
|
||||
}
|
||||
return new IntPolicy(name, category, minimumVersion, description, moduleName, defaultValue);
|
||||
}
|
||||
renderADMXElements() {
|
||||
return [
|
||||
`<decimal id="${this.name}" valueName="${this.name}" />`
|
||||
// `<decimal id="Quarantine_PurgeItemsAfterDelay" valueName="PurgeItemsAfterDelay" minValue="0" maxValue="10000000" />`
|
||||
];
|
||||
}
|
||||
renderADMLPresentationContents() {
|
||||
return `<decimalTextBox refId="${this.name}" defaultValue="${this.defaultValue}">${this.name}</decimalTextBox>`;
|
||||
}
|
||||
}
|
||||
class StringPolicy extends BasePolicy {
|
||||
static from(name, category, minimumVersion, description, moduleName, settingNode) {
|
||||
const type = getStringProperty(settingNode, 'type');
|
||||
if (type !== 'string') {
|
||||
return undefined;
|
||||
}
|
||||
return new StringPolicy(name, category, minimumVersion, description, moduleName);
|
||||
}
|
||||
constructor(name, category, minimumVersion, description, moduleName) {
|
||||
super(PolicyType.StringEnum, name, category, minimumVersion, description, moduleName);
|
||||
}
|
||||
renderADMXElements() {
|
||||
return [`<text id="${this.name}" valueName="${this.name}" required="true" />`];
|
||||
}
|
||||
renderADMLPresentationContents() {
|
||||
return `<textBox refId="${this.name}"><label>${this.name}:</label></textBox>`;
|
||||
}
|
||||
}
|
||||
class StringEnumPolicy extends BasePolicy {
|
||||
constructor(name, category, minimumVersion, description, moduleName, enum_, enumDescriptions) {
|
||||
super(PolicyType.StringEnum, name, category, minimumVersion, description, moduleName);
|
||||
this.enum_ = enum_;
|
||||
this.enumDescriptions = enumDescriptions;
|
||||
}
|
||||
static from(name, category, minimumVersion, description, moduleName, settingNode) {
|
||||
const type = getStringProperty(settingNode, 'type');
|
||||
if (type !== 'string') {
|
||||
return undefined;
|
||||
}
|
||||
const enum_ = getStringArrayProperty(settingNode, 'enum');
|
||||
if (!enum_) {
|
||||
return undefined;
|
||||
}
|
||||
if (!isStringArray(enum_)) {
|
||||
throw new Error(`Property 'enum' should not be localized.`);
|
||||
}
|
||||
const enumDescriptions = getStringArrayProperty(settingNode, 'enumDescriptions');
|
||||
if (!enumDescriptions) {
|
||||
throw new Error(`Missing required 'enumDescriptions' property.`);
|
||||
}
|
||||
else if (!isNlsStringArray(enumDescriptions)) {
|
||||
throw new Error(`Property 'enumDescriptions' should be localized.`);
|
||||
}
|
||||
return new StringEnumPolicy(name, category, minimumVersion, description, moduleName, enum_, enumDescriptions);
|
||||
}
|
||||
renderADMXElements() {
|
||||
return [
|
||||
`<enum id="${this.name}" valueName="${this.name}">`,
|
||||
...this.enum_.map((value, index) => ` <item displayName="$(string.${this.name}_${this.enumDescriptions[index].nlsKey})"><value><string>${value}</string></value></item>`),
|
||||
`</enum>`
|
||||
];
|
||||
}
|
||||
renderADMLStrings(translations) {
|
||||
return [
|
||||
...super.renderADMLStrings(translations),
|
||||
...this.enumDescriptions.map(e => this.renderADMLString(e, translations))
|
||||
];
|
||||
}
|
||||
renderADMLPresentationContents() {
|
||||
return `<dropdownList refId="${this.name}" />`;
|
||||
}
|
||||
}
|
||||
const IntQ = {
|
||||
Q: `(number) @value`,
|
||||
value(matches) {
|
||||
const match = matches[0];
|
||||
if (!match) {
|
||||
return undefined;
|
||||
}
|
||||
const value = match.captures.filter(c => c.name === 'value')[0]?.node.text;
|
||||
if (!value) {
|
||||
throw new Error(`Missing required 'value' property.`);
|
||||
}
|
||||
return parseInt(value);
|
||||
}
|
||||
};
|
||||
const StringQ = {
|
||||
Q: `[
|
||||
(string (string_fragment) @value)
|
||||
(call_expression function: (identifier) @localizeFn arguments: (arguments (string (string_fragment) @nlsKey) (string (string_fragment) @value)) (#eq? @localizeFn localize))
|
||||
]`,
|
||||
value(matches) {
|
||||
const match = matches[0];
|
||||
if (!match) {
|
||||
return undefined;
|
||||
}
|
||||
const value = match.captures.filter(c => c.name === 'value')[0]?.node.text;
|
||||
if (!value) {
|
||||
throw new Error(`Missing required 'value' property.`);
|
||||
}
|
||||
const nlsKey = match.captures.filter(c => c.name === 'nlsKey')[0]?.node.text;
|
||||
if (nlsKey) {
|
||||
return { value, nlsKey };
|
||||
}
|
||||
else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
};
|
||||
const StringArrayQ = {
|
||||
Q: `(array ${StringQ.Q})`,
|
||||
value(matches) {
|
||||
if (matches.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
return matches.map(match => {
|
||||
return StringQ.value([match]);
|
||||
});
|
||||
}
|
||||
};
|
||||
function getProperty(qtype, node, key) {
|
||||
const query = new Parser.Query(typescript, `(
|
||||
(pair
|
||||
key: [(property_identifier)(string)] @key
|
||||
value: ${qtype.Q}
|
||||
)
|
||||
(#eq? @key ${key})
|
||||
)`);
|
||||
return qtype.value(query.matches(node));
|
||||
}
|
||||
function getIntProperty(node, key) {
|
||||
return getProperty(IntQ, node, key);
|
||||
}
|
||||
function getStringProperty(node, key) {
|
||||
return getProperty(StringQ, node, key);
|
||||
}
|
||||
function getStringArrayProperty(node, key) {
|
||||
return getProperty(StringArrayQ, node, key);
|
||||
}
|
||||
// TODO: add more policy types
|
||||
const PolicyTypes = [
|
||||
BooleanPolicy,
|
||||
IntPolicy,
|
||||
StringEnumPolicy,
|
||||
StringPolicy,
|
||||
];
|
||||
function getPolicy(moduleName, configurationNode, settingNode, policyNode, categories) {
|
||||
const name = getStringProperty(policyNode, 'name');
|
||||
if (!name) {
|
||||
throw new Error(`Missing required 'name' property.`);
|
||||
}
|
||||
else if (isNlsString(name)) {
|
||||
throw new Error(`Property 'name' should be a literal string.`);
|
||||
}
|
||||
const categoryName = getStringProperty(configurationNode, 'title');
|
||||
if (!categoryName) {
|
||||
throw new Error(`Missing required 'title' property.`);
|
||||
}
|
||||
else if (!isNlsString(categoryName)) {
|
||||
throw new Error(`Property 'title' should be localized.`);
|
||||
}
|
||||
const categoryKey = `${categoryName.nlsKey}:${categoryName.value}`;
|
||||
let category = categories.get(categoryKey);
|
||||
if (!category) {
|
||||
category = { moduleName, name: categoryName };
|
||||
categories.set(categoryKey, category);
|
||||
}
|
||||
const minimumVersion = getStringProperty(policyNode, 'minimumVersion');
|
||||
if (!minimumVersion) {
|
||||
throw new Error(`Missing required 'minimumVersion' property.`);
|
||||
}
|
||||
else if (isNlsString(minimumVersion)) {
|
||||
throw new Error(`Property 'minimumVersion' should be a literal string.`);
|
||||
}
|
||||
const description = getStringProperty(settingNode, 'description');
|
||||
if (!description) {
|
||||
throw new Error(`Missing required 'description' property.`);
|
||||
}
|
||||
if (!isNlsString(description)) {
|
||||
throw new Error(`Property 'description' should be localized.`);
|
||||
}
|
||||
let result;
|
||||
for (const policyType of PolicyTypes) {
|
||||
if (result = policyType.from(name, category, minimumVersion, description, moduleName, settingNode)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!result) {
|
||||
throw new Error(`Failed to parse policy '${name}'.`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function getPolicies(moduleName, node) {
|
||||
const query = new Parser.Query(typescript, `
|
||||
(
|
||||
(call_expression
|
||||
function: (member_expression property: (property_identifier) @registerConfigurationFn) (#eq? @registerConfigurationFn registerConfiguration)
|
||||
arguments: (arguments (object (pair
|
||||
key: [(property_identifier)(string)] @propertiesKey (#eq? @propertiesKey properties)
|
||||
value: (object (pair
|
||||
key: [(property_identifier)(string)]
|
||||
value: (object (pair
|
||||
key: [(property_identifier)(string)] @policyKey (#eq? @policyKey policy)
|
||||
value: (object) @policy
|
||||
)) @setting
|
||||
))
|
||||
)) @configuration)
|
||||
)
|
||||
)
|
||||
`);
|
||||
const categories = new Map();
|
||||
return query.matches(node).map(m => {
|
||||
const configurationNode = m.captures.filter(c => c.name === 'configuration')[0].node;
|
||||
const settingNode = m.captures.filter(c => c.name === 'setting')[0].node;
|
||||
const policyNode = m.captures.filter(c => c.name === 'policy')[0].node;
|
||||
return getPolicy(moduleName, configurationNode, settingNode, policyNode, categories);
|
||||
});
|
||||
}
|
||||
async function getFiles(root) {
|
||||
return new Promise((c, e) => {
|
||||
const result = [];
|
||||
const rg = (0, child_process_1.spawn)(ripgrep_1.rgPath, ['-l', 'registerConfiguration\\(', '-g', 'src/**/*.ts', '-g', '!src/**/test/**', root]);
|
||||
const stream = byline(rg.stdout.setEncoding('utf8'));
|
||||
stream.on('data', path => result.push(path));
|
||||
stream.on('error', err => e(err));
|
||||
stream.on('end', () => c(result));
|
||||
});
|
||||
}
|
||||
function renderADMX(regKey, versions, categories, policies) {
|
||||
versions = versions.map(v => v.replace(/\./g, '_'));
|
||||
return `<?xml version="1.0" encoding="utf-8"?>
|
||||
<policyDefinitions revision="1.1" schemaVersion="1.0">
|
||||
<policyNamespaces>
|
||||
<target prefix="${regKey}" namespace="Microsoft.Policies.${regKey}" />
|
||||
</policyNamespaces>
|
||||
<resources minRequiredRevision="1.0" />
|
||||
<supportedOn>
|
||||
<definitions>
|
||||
${versions.map(v => `<definition name="Supported_${v}" displayName="$(string.Supported_${v})" />`).join(`\n `)}
|
||||
</definitions>
|
||||
</supportedOn>
|
||||
<categories>
|
||||
<category displayName="$(string.Application)" name="Application" />
|
||||
${categories.map(c => `<category displayName="$(string.Category_${c.name.nlsKey})" name="${c.name.nlsKey}"><parentCategory ref="Application" /></category>`).join(`\n `)}
|
||||
</categories>
|
||||
<policies>
|
||||
${policies.map(p => p.renderADMX(regKey)).flat().join(`\n `)}
|
||||
</policies>
|
||||
</policyDefinitions>
|
||||
`;
|
||||
}
|
||||
function renderADML(appName, versions, categories, policies, translations) {
|
||||
return `<?xml version="1.0" encoding="utf-8"?>
|
||||
<policyDefinitionResources revision="1.0" schemaVersion="1.0">
|
||||
<displayName />
|
||||
<description />
|
||||
<resources>
|
||||
<stringTable>
|
||||
<string id="Application">${appName}</string>
|
||||
${versions.map(v => `<string id="Supported_${v.replace(/\./g, '_')}">${appName} >= ${v}</string>`)}
|
||||
${categories.map(c => renderADMLString('Category', c.moduleName, c.name, translations))}
|
||||
${policies.map(p => p.renderADMLStrings(translations)).flat().join(`\n `)}
|
||||
</stringTable>
|
||||
<presentationTable>
|
||||
${policies.map(p => p.renderADMLPresentation()).join(`\n `)}
|
||||
</presentationTable>
|
||||
</resources>
|
||||
</policyDefinitionResources>
|
||||
`;
|
||||
}
|
||||
function renderGP(policies, translations) {
|
||||
const appName = product.nameLong;
|
||||
const regKey = product.win32RegValueName;
|
||||
const versions = [...new Set(policies.map(p => p.minimumVersion)).values()].sort();
|
||||
const categories = [...new Set(policies.map(p => p.category))];
|
||||
return {
|
||||
admx: renderADMX(regKey, versions, categories, policies),
|
||||
adml: [
|
||||
{ languageId: 'en-us', contents: renderADML(appName, versions, categories, policies) },
|
||||
...translations.map(({ languageId, languageTranslations }) => ({ languageId, contents: renderADML(appName, versions, categories, policies, languageTranslations) }))
|
||||
]
|
||||
};
|
||||
}
|
||||
const Languages = {
|
||||
'fr': 'fr-fr',
|
||||
'it': 'it-it',
|
||||
'de': 'de-de',
|
||||
'es': 'es-es',
|
||||
'ru': 'ru-ru',
|
||||
'zh-hans': 'zh-cn',
|
||||
'zh-hant': 'zh-tw',
|
||||
'ja': 'ja-jp',
|
||||
'ko': 'ko-kr',
|
||||
'cs': 'cs-cz',
|
||||
'pt-br': 'pt-br',
|
||||
'tr': 'tr-tr',
|
||||
'pl': 'pl-pl',
|
||||
};
|
||||
async function getLatestStableVersion(updateUrl) {
|
||||
const res = await (0, node_fetch_1.default)(`${updateUrl}/api/update/darwin/stable/latest`);
|
||||
const { name: version } = await res.json();
|
||||
return version;
|
||||
}
|
||||
async function getSpecificNLS(resourceUrlTemplate, languageId, version) {
|
||||
const resource = {
|
||||
publisher: 'ms-ceintl',
|
||||
name: `vscode-language-pack-${languageId}`,
|
||||
version,
|
||||
path: 'extension/translations/main.i18n.json'
|
||||
};
|
||||
const url = resourceUrlTemplate.replace(/\{([^}]+)\}/g, (_, key) => resource[key]);
|
||||
const res = await (0, node_fetch_1.default)(url);
|
||||
if (res.status !== 200) {
|
||||
throw new Error(`[${res.status}] Error downloading language pack ${languageId}@${version}`);
|
||||
}
|
||||
const { contents: result } = await res.json();
|
||||
return result;
|
||||
}
|
||||
function previousVersion(version) {
|
||||
const [, major, minor, patch] = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
|
||||
return `${major}.${parseInt(minor) - 1}.${patch}`;
|
||||
}
|
||||
async function getNLS(resourceUrlTemplate, languageId, version) {
|
||||
try {
|
||||
return await getSpecificNLS(resourceUrlTemplate, languageId, version);
|
||||
}
|
||||
catch (err) {
|
||||
if (/\[404\]/.test(err.message)) {
|
||||
console.warn(`Language pack ${languageId}@${version} is missing. Downloading previous version...`);
|
||||
return await getSpecificNLS(resourceUrlTemplate, languageId, previousVersion(version));
|
||||
}
|
||||
else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
async function parsePolicies() {
|
||||
const parser = new Parser();
|
||||
parser.setLanguage(typescript);
|
||||
const files = await getFiles(process.cwd());
|
||||
const base = path.join(process.cwd(), 'src');
|
||||
const policies = [];
|
||||
for (const file of files) {
|
||||
const moduleName = path.relative(base, file).replace(/\.ts$/i, '').replace(/\\/g, '/');
|
||||
const contents = await fs_1.promises.readFile(file, { encoding: 'utf8' });
|
||||
const tree = parser.parse(contents);
|
||||
policies.push(...getPolicies(moduleName, tree.rootNode));
|
||||
}
|
||||
return policies;
|
||||
}
|
||||
async function getTranslations() {
|
||||
const updateUrl = product.updateUrl;
|
||||
if (!updateUrl) {
|
||||
console.warn(`Skipping policy localization: No 'updateUrl' found in 'product.json'.`);
|
||||
return [];
|
||||
}
|
||||
const resourceUrlTemplate = product.extensionsGallery?.resourceUrlTemplate;
|
||||
if (!resourceUrlTemplate) {
|
||||
console.warn(`Skipping policy localization: No 'resourceUrlTemplate' found in 'product.json'.`);
|
||||
return [];
|
||||
}
|
||||
const version = await getLatestStableVersion(updateUrl);
|
||||
const languageIds = Object.keys(Languages);
|
||||
return await Promise.all(languageIds.map(languageId => getNLS(resourceUrlTemplate, languageId, version)
|
||||
.then(languageTranslations => ({ languageId, languageTranslations }))));
|
||||
}
|
||||
async function main() {
|
||||
const [policies, translations] = await Promise.all([parsePolicies(), getTranslations()]);
|
||||
const { admx, adml } = await renderGP(policies, translations);
|
||||
const root = '.build/policies/win32';
|
||||
await fs_1.promises.rm(root, { recursive: true, force: true });
|
||||
await fs_1.promises.mkdir(root, { recursive: true });
|
||||
await fs_1.promises.writeFile(path.join(root, `${product.win32RegValueName}.admx`), admx.replace(/\r?\n/g, '\n'));
|
||||
for (const { languageId, contents } of adml) {
|
||||
const languagePath = path.join(root, languageId === 'en-us' ? 'en-us' : Languages[languageId]);
|
||||
await fs_1.promises.mkdir(languagePath, { recursive: true });
|
||||
await fs_1.promises.writeFile(path.join(languagePath, `${product.win32RegValueName}.adml`), contents.replace(/\r?\n/g, '\n'));
|
||||
}
|
||||
}
|
||||
if (require.main === module) {
|
||||
main().catch(err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
@@ -1,697 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { spawn } from 'child_process';
|
||||
import { promises as fs } from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as byline from 'byline';
|
||||
import { rgPath } from '@vscode/ripgrep';
|
||||
import * as Parser from 'tree-sitter';
|
||||
import fetch from 'node-fetch';
|
||||
const { typescript } = require('tree-sitter-typescript');
|
||||
const product = require('../../product.json');
|
||||
|
||||
type NlsString = { value: string; nlsKey: string };
|
||||
|
||||
function isNlsString(value: string | NlsString | undefined): value is NlsString {
|
||||
return value ? typeof value !== 'string' : false;
|
||||
}
|
||||
|
||||
function isStringArray(value: (string | NlsString)[]): value is string[] {
|
||||
return !value.some(s => isNlsString(s));
|
||||
}
|
||||
|
||||
function isNlsStringArray(value: (string | NlsString)[]): value is NlsString[] {
|
||||
return value.every(s => isNlsString(s));
|
||||
}
|
||||
|
||||
interface Category {
|
||||
readonly moduleName: string;
|
||||
readonly name: NlsString;
|
||||
}
|
||||
|
||||
enum PolicyType {
|
||||
StringEnum
|
||||
}
|
||||
|
||||
interface Policy {
|
||||
readonly category: Category;
|
||||
readonly minimumVersion: string;
|
||||
renderADMX(regKey: string): string[];
|
||||
renderADMLStrings(translations?: LanguageTranslations): string[];
|
||||
renderADMLPresentation(): string;
|
||||
}
|
||||
|
||||
function renderADMLString(prefix: string, moduleName: string, nlsString: NlsString, translations?: LanguageTranslations): string {
|
||||
let value: string | undefined;
|
||||
|
||||
if (translations) {
|
||||
const moduleTranslations = translations[moduleName];
|
||||
|
||||
if (moduleTranslations) {
|
||||
value = moduleTranslations[nlsString.nlsKey];
|
||||
}
|
||||
}
|
||||
|
||||
if (!value) {
|
||||
value = nlsString.value;
|
||||
}
|
||||
|
||||
return `<string id="${prefix}_${nlsString.nlsKey}">${value}</string>`;
|
||||
}
|
||||
|
||||
abstract class BasePolicy implements Policy {
|
||||
constructor(
|
||||
protected policyType: PolicyType,
|
||||
protected name: string,
|
||||
readonly category: Category,
|
||||
readonly minimumVersion: string,
|
||||
protected description: NlsString,
|
||||
protected moduleName: string,
|
||||
) { }
|
||||
|
||||
protected renderADMLString(nlsString: NlsString, translations?: LanguageTranslations): string {
|
||||
return renderADMLString(this.name, this.moduleName, nlsString, translations);
|
||||
}
|
||||
|
||||
renderADMX(regKey: string) {
|
||||
return [
|
||||
`<policy name="${this.name}" class="Both" displayName="$(string.${this.name})" explainText="$(string.${this.name}_${this.description.nlsKey})" key="Software\\Policies\\Microsoft\\${regKey}" presentation="$(presentation.${this.name})">`,
|
||||
` <parentCategory ref="${this.category.name.nlsKey}" />`,
|
||||
` <supportedOn ref="Supported_${this.minimumVersion.replace(/\./g, '_')}" />`,
|
||||
` <elements>`,
|
||||
...this.renderADMXElements(),
|
||||
` </elements>`,
|
||||
`</policy>`
|
||||
];
|
||||
}
|
||||
|
||||
protected abstract renderADMXElements(): string[];
|
||||
|
||||
renderADMLStrings(translations?: LanguageTranslations) {
|
||||
return [
|
||||
`<string id="${this.name}">${this.name}</string>`,
|
||||
this.renderADMLString(this.description, translations)
|
||||
];
|
||||
}
|
||||
|
||||
renderADMLPresentation(): string {
|
||||
return `<presentation id="${this.name}">${this.renderADMLPresentationContents()}</presentation>`;
|
||||
}
|
||||
|
||||
protected abstract renderADMLPresentationContents(): string;
|
||||
}
|
||||
|
||||
class BooleanPolicy extends BasePolicy {
|
||||
|
||||
static from(
|
||||
name: string,
|
||||
category: Category,
|
||||
minimumVersion: string,
|
||||
description: NlsString,
|
||||
moduleName: string,
|
||||
settingNode: Parser.SyntaxNode
|
||||
): BooleanPolicy | undefined {
|
||||
const type = getStringProperty(settingNode, 'type');
|
||||
|
||||
if (type !== 'boolean') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return new BooleanPolicy(name, category, minimumVersion, description, moduleName);
|
||||
}
|
||||
|
||||
private constructor(
|
||||
name: string,
|
||||
category: Category,
|
||||
minimumVersion: string,
|
||||
description: NlsString,
|
||||
moduleName: string,
|
||||
) {
|
||||
super(PolicyType.StringEnum, name, category, minimumVersion, description, moduleName);
|
||||
}
|
||||
|
||||
protected renderADMXElements(): string[] {
|
||||
return [
|
||||
`<boolean id="${this.name}" valueName="${this.name}">`,
|
||||
` <trueValue><decimal value="1" /></trueValue><falseValue><decimal value="0" /></falseValue>`,
|
||||
`</boolean>`
|
||||
];
|
||||
}
|
||||
|
||||
renderADMLPresentationContents() {
|
||||
return `<checkBox refId="${this.name}">${this.name}</checkBox>`;
|
||||
}
|
||||
}
|
||||
|
||||
class IntPolicy extends BasePolicy {
|
||||
|
||||
static from(
|
||||
name: string,
|
||||
category: Category,
|
||||
minimumVersion: string,
|
||||
description: NlsString,
|
||||
moduleName: string,
|
||||
settingNode: Parser.SyntaxNode
|
||||
): IntPolicy | undefined {
|
||||
const type = getStringProperty(settingNode, 'type');
|
||||
|
||||
if (type !== 'number') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const defaultValue = getIntProperty(settingNode, 'default');
|
||||
|
||||
if (typeof defaultValue === 'undefined') {
|
||||
throw new Error(`Missing required 'default' property.`);
|
||||
}
|
||||
|
||||
return new IntPolicy(name, category, minimumVersion, description, moduleName, defaultValue);
|
||||
}
|
||||
|
||||
private constructor(
|
||||
name: string,
|
||||
category: Category,
|
||||
minimumVersion: string,
|
||||
description: NlsString,
|
||||
moduleName: string,
|
||||
protected readonly defaultValue: number,
|
||||
) {
|
||||
super(PolicyType.StringEnum, name, category, minimumVersion, description, moduleName);
|
||||
}
|
||||
|
||||
protected renderADMXElements(): string[] {
|
||||
return [
|
||||
`<decimal id="${this.name}" valueName="${this.name}" />`
|
||||
// `<decimal id="Quarantine_PurgeItemsAfterDelay" valueName="PurgeItemsAfterDelay" minValue="0" maxValue="10000000" />`
|
||||
];
|
||||
}
|
||||
|
||||
renderADMLPresentationContents() {
|
||||
return `<decimalTextBox refId="${this.name}" defaultValue="${this.defaultValue}">${this.name}</decimalTextBox>`;
|
||||
}
|
||||
}
|
||||
|
||||
class StringPolicy extends BasePolicy {
|
||||
|
||||
static from(
|
||||
name: string,
|
||||
category: Category,
|
||||
minimumVersion: string,
|
||||
description: NlsString,
|
||||
moduleName: string,
|
||||
settingNode: Parser.SyntaxNode
|
||||
): StringPolicy | undefined {
|
||||
const type = getStringProperty(settingNode, 'type');
|
||||
|
||||
if (type !== 'string') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return new StringPolicy(name, category, minimumVersion, description, moduleName);
|
||||
}
|
||||
|
||||
private constructor(
|
||||
name: string,
|
||||
category: Category,
|
||||
minimumVersion: string,
|
||||
description: NlsString,
|
||||
moduleName: string,
|
||||
) {
|
||||
super(PolicyType.StringEnum, name, category, minimumVersion, description, moduleName);
|
||||
}
|
||||
|
||||
protected renderADMXElements(): string[] {
|
||||
return [`<text id="${this.name}" valueName="${this.name}" required="true" />`];
|
||||
}
|
||||
|
||||
renderADMLPresentationContents() {
|
||||
return `<textBox refId="${this.name}"><label>${this.name}:</label></textBox>`;
|
||||
}
|
||||
}
|
||||
|
||||
class StringEnumPolicy extends BasePolicy {
|
||||
|
||||
static from(
|
||||
name: string,
|
||||
category: Category,
|
||||
minimumVersion: string,
|
||||
description: NlsString,
|
||||
moduleName: string,
|
||||
settingNode: Parser.SyntaxNode
|
||||
): StringEnumPolicy | undefined {
|
||||
const type = getStringProperty(settingNode, 'type');
|
||||
|
||||
if (type !== 'string') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const enum_ = getStringArrayProperty(settingNode, 'enum');
|
||||
|
||||
if (!enum_) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (!isStringArray(enum_)) {
|
||||
throw new Error(`Property 'enum' should not be localized.`);
|
||||
}
|
||||
|
||||
const enumDescriptions = getStringArrayProperty(settingNode, 'enumDescriptions');
|
||||
|
||||
if (!enumDescriptions) {
|
||||
throw new Error(`Missing required 'enumDescriptions' property.`);
|
||||
} else if (!isNlsStringArray(enumDescriptions)) {
|
||||
throw new Error(`Property 'enumDescriptions' should be localized.`);
|
||||
}
|
||||
|
||||
return new StringEnumPolicy(name, category, minimumVersion, description, moduleName, enum_, enumDescriptions);
|
||||
}
|
||||
|
||||
private constructor(
|
||||
name: string,
|
||||
category: Category,
|
||||
minimumVersion: string,
|
||||
description: NlsString,
|
||||
moduleName: string,
|
||||
protected enum_: string[],
|
||||
protected enumDescriptions: NlsString[],
|
||||
) {
|
||||
super(PolicyType.StringEnum, name, category, minimumVersion, description, moduleName);
|
||||
}
|
||||
|
||||
protected renderADMXElements(): string[] {
|
||||
return [
|
||||
`<enum id="${this.name}" valueName="${this.name}">`,
|
||||
...this.enum_.map((value, index) => ` <item displayName="$(string.${this.name}_${this.enumDescriptions[index].nlsKey})"><value><string>${value}</string></value></item>`),
|
||||
`</enum>`
|
||||
];
|
||||
}
|
||||
|
||||
renderADMLStrings(translations?: LanguageTranslations) {
|
||||
return [
|
||||
...super.renderADMLStrings(translations),
|
||||
...this.enumDescriptions.map(e => this.renderADMLString(e, translations))
|
||||
];
|
||||
}
|
||||
|
||||
renderADMLPresentationContents() {
|
||||
return `<dropdownList refId="${this.name}" />`;
|
||||
}
|
||||
}
|
||||
|
||||
interface QType<T> {
|
||||
Q: string;
|
||||
value(matches: Parser.QueryMatch[]): T | undefined;
|
||||
}
|
||||
|
||||
const IntQ: QType<number> = {
|
||||
Q: `(number) @value`,
|
||||
|
||||
value(matches: Parser.QueryMatch[]): number | undefined {
|
||||
const match = matches[0];
|
||||
|
||||
if (!match) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const value = match.captures.filter(c => c.name === 'value')[0]?.node.text;
|
||||
|
||||
if (!value) {
|
||||
throw new Error(`Missing required 'value' property.`);
|
||||
}
|
||||
|
||||
return parseInt(value);
|
||||
}
|
||||
};
|
||||
|
||||
const StringQ: QType<string | NlsString> = {
|
||||
Q: `[
|
||||
(string (string_fragment) @value)
|
||||
(call_expression function: (identifier) @localizeFn arguments: (arguments (string (string_fragment) @nlsKey) (string (string_fragment) @value)) (#eq? @localizeFn localize))
|
||||
]`,
|
||||
|
||||
value(matches: Parser.QueryMatch[]): string | NlsString | undefined {
|
||||
const match = matches[0];
|
||||
|
||||
if (!match) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const value = match.captures.filter(c => c.name === 'value')[0]?.node.text;
|
||||
|
||||
if (!value) {
|
||||
throw new Error(`Missing required 'value' property.`);
|
||||
}
|
||||
|
||||
const nlsKey = match.captures.filter(c => c.name === 'nlsKey')[0]?.node.text;
|
||||
|
||||
if (nlsKey) {
|
||||
return { value, nlsKey };
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const StringArrayQ: QType<(string | NlsString)[]> = {
|
||||
Q: `(array ${StringQ.Q})`,
|
||||
|
||||
value(matches: Parser.QueryMatch[]): (string | NlsString)[] | undefined {
|
||||
if (matches.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return matches.map(match => {
|
||||
return StringQ.value([match]) as string | NlsString;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function getProperty<T>(qtype: QType<T>, node: Parser.SyntaxNode, key: string): T | undefined {
|
||||
const query = new Parser.Query(
|
||||
typescript,
|
||||
`(
|
||||
(pair
|
||||
key: [(property_identifier)(string)] @key
|
||||
value: ${qtype.Q}
|
||||
)
|
||||
(#eq? @key ${key})
|
||||
)`
|
||||
);
|
||||
|
||||
return qtype.value(query.matches(node));
|
||||
}
|
||||
|
||||
function getIntProperty(node: Parser.SyntaxNode, key: string): number | undefined {
|
||||
return getProperty(IntQ, node, key);
|
||||
}
|
||||
|
||||
function getStringProperty(node: Parser.SyntaxNode, key: string): string | NlsString | undefined {
|
||||
return getProperty(StringQ, node, key);
|
||||
}
|
||||
|
||||
function getStringArrayProperty(node: Parser.SyntaxNode, key: string): (string | NlsString)[] | undefined {
|
||||
return getProperty(StringArrayQ, node, key);
|
||||
}
|
||||
|
||||
// TODO: add more policy types
|
||||
const PolicyTypes = [
|
||||
BooleanPolicy,
|
||||
IntPolicy,
|
||||
StringEnumPolicy,
|
||||
StringPolicy,
|
||||
];
|
||||
|
||||
function getPolicy(
|
||||
moduleName: string,
|
||||
configurationNode: Parser.SyntaxNode,
|
||||
settingNode: Parser.SyntaxNode,
|
||||
policyNode: Parser.SyntaxNode,
|
||||
categories: Map<string, Category>
|
||||
): Policy {
|
||||
const name = getStringProperty(policyNode, 'name');
|
||||
|
||||
if (!name) {
|
||||
throw new Error(`Missing required 'name' property.`);
|
||||
} else if (isNlsString(name)) {
|
||||
throw new Error(`Property 'name' should be a literal string.`);
|
||||
}
|
||||
|
||||
const categoryName = getStringProperty(configurationNode, 'title');
|
||||
|
||||
if (!categoryName) {
|
||||
throw new Error(`Missing required 'title' property.`);
|
||||
} else if (!isNlsString(categoryName)) {
|
||||
throw new Error(`Property 'title' should be localized.`);
|
||||
}
|
||||
|
||||
const categoryKey = `${categoryName.nlsKey}:${categoryName.value}`;
|
||||
let category = categories.get(categoryKey);
|
||||
|
||||
if (!category) {
|
||||
category = { moduleName, name: categoryName };
|
||||
categories.set(categoryKey, category);
|
||||
}
|
||||
|
||||
const minimumVersion = getStringProperty(policyNode, 'minimumVersion');
|
||||
|
||||
if (!minimumVersion) {
|
||||
throw new Error(`Missing required 'minimumVersion' property.`);
|
||||
} else if (isNlsString(minimumVersion)) {
|
||||
throw new Error(`Property 'minimumVersion' should be a literal string.`);
|
||||
}
|
||||
|
||||
const description = getStringProperty(settingNode, 'description');
|
||||
|
||||
if (!description) {
|
||||
throw new Error(`Missing required 'description' property.`);
|
||||
} if (!isNlsString(description)) {
|
||||
throw new Error(`Property 'description' should be localized.`);
|
||||
}
|
||||
|
||||
let result: Policy | undefined;
|
||||
|
||||
for (const policyType of PolicyTypes) {
|
||||
if (result = policyType.from(name, category, minimumVersion, description, moduleName, settingNode)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
throw new Error(`Failed to parse policy '${name}'.`);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function getPolicies(moduleName: string, node: Parser.SyntaxNode): Policy[] {
|
||||
const query = new Parser.Query(typescript, `
|
||||
(
|
||||
(call_expression
|
||||
function: (member_expression property: (property_identifier) @registerConfigurationFn) (#eq? @registerConfigurationFn registerConfiguration)
|
||||
arguments: (arguments (object (pair
|
||||
key: [(property_identifier)(string)] @propertiesKey (#eq? @propertiesKey properties)
|
||||
value: (object (pair
|
||||
key: [(property_identifier)(string)]
|
||||
value: (object (pair
|
||||
key: [(property_identifier)(string)] @policyKey (#eq? @policyKey policy)
|
||||
value: (object) @policy
|
||||
)) @setting
|
||||
))
|
||||
)) @configuration)
|
||||
)
|
||||
)
|
||||
`);
|
||||
|
||||
const categories = new Map<string, Category>();
|
||||
|
||||
return query.matches(node).map(m => {
|
||||
const configurationNode = m.captures.filter(c => c.name === 'configuration')[0].node;
|
||||
const settingNode = m.captures.filter(c => c.name === 'setting')[0].node;
|
||||
const policyNode = m.captures.filter(c => c.name === 'policy')[0].node;
|
||||
return getPolicy(moduleName, configurationNode, settingNode, policyNode, categories);
|
||||
});
|
||||
}
|
||||
|
||||
async function getFiles(root: string): Promise<string[]> {
|
||||
return new Promise((c, e) => {
|
||||
const result: string[] = [];
|
||||
const rg = spawn(rgPath, ['-l', 'registerConfiguration\\(', '-g', 'src/**/*.ts', '-g', '!src/**/test/**', root]);
|
||||
const stream = byline(rg.stdout.setEncoding('utf8'));
|
||||
stream.on('data', path => result.push(path));
|
||||
stream.on('error', err => e(err));
|
||||
stream.on('end', () => c(result));
|
||||
});
|
||||
}
|
||||
|
||||
function renderADMX(regKey: string, versions: string[], categories: Category[], policies: Policy[]) {
|
||||
versions = versions.map(v => v.replace(/\./g, '_'));
|
||||
|
||||
return `<?xml version="1.0" encoding="utf-8"?>
|
||||
<policyDefinitions revision="1.1" schemaVersion="1.0">
|
||||
<policyNamespaces>
|
||||
<target prefix="${regKey}" namespace="Microsoft.Policies.${regKey}" />
|
||||
</policyNamespaces>
|
||||
<resources minRequiredRevision="1.0" />
|
||||
<supportedOn>
|
||||
<definitions>
|
||||
${versions.map(v => `<definition name="Supported_${v}" displayName="$(string.Supported_${v})" />`).join(`\n `)}
|
||||
</definitions>
|
||||
</supportedOn>
|
||||
<categories>
|
||||
<category displayName="$(string.Application)" name="Application" />
|
||||
${categories.map(c => `<category displayName="$(string.Category_${c.name.nlsKey})" name="${c.name.nlsKey}"><parentCategory ref="Application" /></category>`).join(`\n `)}
|
||||
</categories>
|
||||
<policies>
|
||||
${policies.map(p => p.renderADMX(regKey)).flat().join(`\n `)}
|
||||
</policies>
|
||||
</policyDefinitions>
|
||||
`;
|
||||
}
|
||||
|
||||
function renderADML(appName: string, versions: string[], categories: Category[], policies: Policy[], translations?: LanguageTranslations) {
|
||||
return `<?xml version="1.0" encoding="utf-8"?>
|
||||
<policyDefinitionResources revision="1.0" schemaVersion="1.0">
|
||||
<displayName />
|
||||
<description />
|
||||
<resources>
|
||||
<stringTable>
|
||||
<string id="Application">${appName}</string>
|
||||
${versions.map(v => `<string id="Supported_${v.replace(/\./g, '_')}">${appName} >= ${v}</string>`)}
|
||||
${categories.map(c => renderADMLString('Category', c.moduleName, c.name, translations))}
|
||||
${policies.map(p => p.renderADMLStrings(translations)).flat().join(`\n `)}
|
||||
</stringTable>
|
||||
<presentationTable>
|
||||
${policies.map(p => p.renderADMLPresentation()).join(`\n `)}
|
||||
</presentationTable>
|
||||
</resources>
|
||||
</policyDefinitionResources>
|
||||
`;
|
||||
}
|
||||
|
||||
function renderGP(policies: Policy[], translations: Translations) {
|
||||
const appName = product.nameLong;
|
||||
const regKey = product.win32RegValueName;
|
||||
|
||||
const versions = [...new Set(policies.map(p => p.minimumVersion)).values()].sort();
|
||||
const categories = [...new Set(policies.map(p => p.category))];
|
||||
|
||||
return {
|
||||
admx: renderADMX(regKey, versions, categories, policies),
|
||||
adml: [
|
||||
{ languageId: 'en-us', contents: renderADML(appName, versions, categories, policies) },
|
||||
...translations.map(({ languageId, languageTranslations }) =>
|
||||
({ languageId, contents: renderADML(appName, versions, categories, policies, languageTranslations) }))
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
const Languages = {
|
||||
'fr': 'fr-fr',
|
||||
'it': 'it-it',
|
||||
'de': 'de-de',
|
||||
'es': 'es-es',
|
||||
'ru': 'ru-ru',
|
||||
'zh-hans': 'zh-cn',
|
||||
'zh-hant': 'zh-tw',
|
||||
'ja': 'ja-jp',
|
||||
'ko': 'ko-kr',
|
||||
'cs': 'cs-cz',
|
||||
'pt-br': 'pt-br',
|
||||
'tr': 'tr-tr',
|
||||
'pl': 'pl-pl',
|
||||
};
|
||||
|
||||
type LanguageTranslations = { [moduleName: string]: { [nlsKey: string]: string } };
|
||||
type Translations = { languageId: string; languageTranslations: LanguageTranslations }[];
|
||||
|
||||
async function getLatestStableVersion(updateUrl: string) {
|
||||
const res = await fetch(`${updateUrl}/api/update/darwin/stable/latest`);
|
||||
const { name: version } = await res.json() as { name: string };
|
||||
return version;
|
||||
}
|
||||
|
||||
async function getSpecificNLS(resourceUrlTemplate: string, languageId: string, version: string) {
|
||||
const resource = {
|
||||
publisher: 'ms-ceintl',
|
||||
name: `vscode-language-pack-${languageId}`,
|
||||
version,
|
||||
path: 'extension/translations/main.i18n.json'
|
||||
};
|
||||
|
||||
const url = resourceUrlTemplate.replace(/\{([^}]+)\}/g, (_, key) => resource[key as keyof typeof resource]);
|
||||
const res = await fetch(url);
|
||||
|
||||
if (res.status !== 200) {
|
||||
throw new Error(`[${res.status}] Error downloading language pack ${languageId}@${version}`);
|
||||
}
|
||||
|
||||
const { contents: result } = await res.json() as { contents: LanguageTranslations };
|
||||
return result;
|
||||
}
|
||||
|
||||
function previousVersion(version: string): string {
|
||||
const [, major, minor, patch] = /^(\d+)\.(\d+)\.(\d+)$/.exec(version)!;
|
||||
return `${major}.${parseInt(minor) - 1}.${patch}`;
|
||||
}
|
||||
|
||||
async function getNLS(resourceUrlTemplate: string, languageId: string, version: string) {
|
||||
try {
|
||||
return await getSpecificNLS(resourceUrlTemplate, languageId, version);
|
||||
} catch (err) {
|
||||
if (/\[404\]/.test(err.message)) {
|
||||
console.warn(`Language pack ${languageId}@${version} is missing. Downloading previous version...`);
|
||||
return await getSpecificNLS(resourceUrlTemplate, languageId, previousVersion(version));
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function parsePolicies(): Promise<Policy[]> {
|
||||
const parser = new Parser();
|
||||
parser.setLanguage(typescript);
|
||||
|
||||
const files = await getFiles(process.cwd());
|
||||
const base = path.join(process.cwd(), 'src');
|
||||
const policies = [];
|
||||
|
||||
for (const file of files) {
|
||||
const moduleName = path.relative(base, file).replace(/\.ts$/i, '').replace(/\\/g, '/');
|
||||
const contents = await fs.readFile(file, { encoding: 'utf8' });
|
||||
const tree = parser.parse(contents);
|
||||
policies.push(...getPolicies(moduleName, tree.rootNode));
|
||||
}
|
||||
|
||||
return policies;
|
||||
}
|
||||
|
||||
async function getTranslations(): Promise<Translations> {
|
||||
const updateUrl = product.updateUrl;
|
||||
|
||||
if (!updateUrl) {
|
||||
console.warn(`Skipping policy localization: No 'updateUrl' found in 'product.json'.`);
|
||||
return [];
|
||||
}
|
||||
|
||||
const resourceUrlTemplate = product.extensionsGallery?.resourceUrlTemplate;
|
||||
|
||||
if (!resourceUrlTemplate) {
|
||||
console.warn(`Skipping policy localization: No 'resourceUrlTemplate' found in 'product.json'.`);
|
||||
return [];
|
||||
}
|
||||
|
||||
const version = await getLatestStableVersion(updateUrl);
|
||||
const languageIds = Object.keys(Languages);
|
||||
|
||||
return await Promise.all(languageIds.map(
|
||||
languageId => getNLS(resourceUrlTemplate, languageId, version)
|
||||
.then(languageTranslations => ({ languageId, languageTranslations }))
|
||||
));
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const [policies, translations] = await Promise.all([parsePolicies(), getTranslations()]);
|
||||
const { admx, adml } = await renderGP(policies, translations);
|
||||
|
||||
const root = '.build/policies/win32';
|
||||
await fs.rm(root, { recursive: true, force: true });
|
||||
await fs.mkdir(root, { recursive: true });
|
||||
|
||||
await fs.writeFile(path.join(root, `${product.win32RegValueName}.admx`), admx.replace(/\r?\n/g, '\n'));
|
||||
|
||||
for (const { languageId, contents } of adml) {
|
||||
const languagePath = path.join(root, languageId === 'en-us' ? 'en-us' : Languages[languageId as keyof typeof Languages]);
|
||||
await fs.mkdir(languagePath, { recursive: true });
|
||||
await fs.writeFile(path.join(languagePath, `${product.win32RegValueName}.adml`), contents.replace(/\r?\n/g, '\n'));
|
||||
}
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
main().catch(err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// @ts-check
|
||||
const path = require("path");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user