Skip to content
Draft
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/install-vscode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.mi
rm -f packages.microsoft.gpg

apt update
apt install -y code-insiders libsecret-1-dev libxkbfile-dev libkrb5-dev
apt install -y code-insiders libglib2.0-dev libsecret-1-dev libxkbfile-dev libkrb5-dev
6 changes: 3 additions & 3 deletions .github/workflows/chat-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
sudo apt install -y \
build-essential pkg-config \
libx11-dev libx11-xcb-dev libxkbfile-dev \
libnotify-bin libkrb5-dev \
libnotify-bin libkrb5-dev libglib2.0-dev \
xvfb sqlite3 \
libnss3 libatk1.0-0 libatk-bridge2.0-0 \
libcups2t64 libdrm2 libxcomposite1 libxdamage1 \
Expand Down Expand Up @@ -228,7 +228,7 @@ jobs:
sudo apt install -y \
build-essential pkg-config \
libx11-dev libx11-xcb-dev libxkbfile-dev \
libnotify-bin libkrb5-dev \
libnotify-bin libkrb5-dev libglib2.0-dev \
xvfb sqlite3 \
libnss3 libatk1.0-0 libatk-bridge2.0-0 \
libcups2t64 libdrm2 libxcomposite1 libxdamage1 \
Expand Down Expand Up @@ -410,7 +410,7 @@ jobs:
sudo apt install -y \
build-essential pkg-config \
libx11-dev libx11-xcb-dev libxkbfile-dev \
libnotify-bin libkrb5-dev \
libnotify-bin libkrb5-dev libglib2.0-dev \
xvfb \
libnss3 libatk1.0-0 libatk-bridge2.0-0 \
libcups2t64 libdrm2 libxcomposite1 libxdamage1 \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get install -y pkg-config \
xvfb \
libgtk-3-0 \
libglib2.0-dev \
libxkbfile-dev \
libkrb5-dev \
libgbm1 \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/monaco-editor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
run: |
sudo apt update
sudo apt install -y libxkbfile-dev pkg-config libkrb5-dev libxss1
sudo apt install -y libglib2.0-dev libxkbfile-dev pkg-config libkrb5-dev libxss1
- name: Execute npm
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
env:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr-linux-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get install -y pkg-config \
xvfb \
libgtk-3-0 \
libglib2.0-dev \
libxkbfile-dev \
libkrb5-dev \
libgbm1 \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-node-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- name: Install build tools
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: sudo apt update -y && sudo apt install -y build-essential pkg-config libx11-dev libx11-xcb-dev libxkbfile-dev libnotify-bin libkrb5-dev
run: sudo apt update -y && sudo apt install -y build-essential pkg-config libglib2.0-dev libx11-dev libx11-xcb-dev libxkbfile-dev libnotify-bin libkrb5-dev

- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

- name: Install build tools
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: sudo apt update -y && sudo apt install -y build-essential pkg-config libx11-dev libx11-xcb-dev libxkbfile-dev libnotify-bin libkrb5-dev
run: sudo apt update -y && sudo apt install -y build-essential pkg-config libglib2.0-dev libx11-dev libx11-xcb-dev libxkbfile-dev libnotify-bin libkrb5-dev

- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sessions-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
node-version-file: .nvmrc

- name: Install build tools
run: sudo apt update -y && sudo apt install -y build-essential pkg-config libx11-dev libx11-xcb-dev libxkbfile-dev libnotify-bin libkrb5-dev xvfb
run: sudo apt update -y && sudo apt install -y build-essential pkg-config libglib2.0-dev libx11-dev libx11-xcb-dev libxkbfile-dev libnotify-bin libkrb5-dev xvfb

- name: Install dependencies
run: npm ci
Expand Down
7 changes: 7 additions & 0 deletions build/.moduleignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ vsda/**
!vsda/rust/web/**
!vsda/rust/bundler/**

@vscode/metered/build/**
@vscode/metered/src/**
@vscode/metered/binding.gyp
@vscode/metered/README.md
@vscode/metered/index.d.ts
!@vscode/metered/build/Release/vscode-metered.node
Comment thread
dmitrivMS marked this conversation as resolved.

@vscode/policy-watcher/build/**
@vscode/policy-watcher/.husky/**
@vscode/policy-watcher/src/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
displayName: "Pull qemu-user-static image"
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), eq(variables['NPM_ARCH'], 'arm64'))

- script: sudo apt-get update && sudo apt-get install -y libkrb5-dev
- script: sudo apt-get update && sudo apt-get install -y libglib2.0-dev libkrb5-dev
displayName: Install build dependencies
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))

Expand Down
2 changes: 1 addition & 1 deletion build/azure-pipelines/alpine/product-build-alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
displayName: "Pull qemu-user-static image"
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), eq(variables['NPM_ARCH'], 'arm64'))

- script: sudo apt-get update && sudo apt-get install -y libkrb5-dev
- script: sudo apt-get update && sudo apt-get install -y libglib2.0-dev libkrb5-dev
displayName: Install build dependencies
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))

Expand Down
31 changes: 21 additions & 10 deletions build/azure-pipelines/linux/setup-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,31 @@ fi

export VSCODE_CLIENT_SYSROOT_DIR=$PWD/.build/sysroots/glibc-2.28-gcc-10.5.0
export VSCODE_REMOTE_SYSROOT_DIR=$PWD/.build/sysroots/glibc-2.28-gcc-8.5.0
if [ -d "$VSCODE_CLIENT_SYSROOT_DIR" ]; then
echo "Using cached client sysroot"
else
echo "Downloading client sysroot"
SYSROOT_ARCH="$SYSROOT_ARCH" VSCODE_SYSROOT_DIR="$VSCODE_CLIENT_SYSROOT_DIR" node -e 'import { getVSCodeSysroot } from "./build/linux/debian/install-sysroot.ts"; (async () => { await getVSCodeSysroot(process.env["SYSROOT_ARCH"]); })()'
fi
echo "Ensuring client sysroot"
SYSROOT_ARCH="$SYSROOT_ARCH" VSCODE_SYSROOT_DIR="$VSCODE_CLIENT_SYSROOT_DIR" node -e 'import { getVSCodeSysroot } from "./build/linux/debian/install-sysroot.ts"; (async () => { await getVSCodeSysroot(process.env["SYSROOT_ARCH"]); })()'

if [ -d "$VSCODE_REMOTE_SYSROOT_DIR" ]; then
echo "Using cached remote sysroot"
echo "Ensuring remote sysroot"
SYSROOT_ARCH="$SYSROOT_ARCH" VSCODE_SYSROOT_DIR="$VSCODE_REMOTE_SYSROOT_DIR" VSCODE_SYSROOT_PREFIX="-glibc-2.28-gcc-8.5.0" node -e 'import { getVSCodeSysroot } from "./build/linux/debian/install-sysroot.ts"; (async () => { await getVSCodeSysroot(process.env["SYSROOT_ARCH"]); })()'

if [ "$npm_config_arch" == "x64" ]; then
VSCODE_CLIENT_TOOLCHAIN_TRIPLE="x86_64-linux-gnu"
VSCODE_CLIENT_LIBRARY_TRIPLE="x86_64-linux-gnu"
elif [ "$npm_config_arch" == "arm64" ]; then
VSCODE_CLIENT_TOOLCHAIN_TRIPLE="aarch64-linux-gnu"
VSCODE_CLIENT_LIBRARY_TRIPLE="aarch64-linux-gnu"
elif [ "$npm_config_arch" == "arm" ]; then
VSCODE_CLIENT_TOOLCHAIN_TRIPLE="arm-rpi-linux-gnueabihf"
VSCODE_CLIENT_LIBRARY_TRIPLE="arm-linux-gnueabihf"
else
echo "Downloading remote sysroot"
SYSROOT_ARCH="$SYSROOT_ARCH" VSCODE_SYSROOT_DIR="$VSCODE_REMOTE_SYSROOT_DIR" VSCODE_SYSROOT_PREFIX="-glibc-2.28-gcc-8.5.0" node -e 'import { getVSCodeSysroot } from "./build/linux/debian/install-sysroot.ts"; (async () => { await getVSCodeSysroot(process.env["SYSROOT_ARCH"]); })()'
echo "Unsupported npm architecture: $npm_config_arch" >&2
exit 1
fi

VSCODE_CLIENT_SYSROOT="$VSCODE_CLIENT_SYSROOT_DIR/$VSCODE_CLIENT_TOOLCHAIN_TRIPLE/$VSCODE_CLIENT_TOOLCHAIN_TRIPLE/sysroot"
export PKG_CONFIG_SYSROOT_DIR="$VSCODE_CLIENT_SYSROOT"
export PKG_CONFIG_LIBDIR="$VSCODE_CLIENT_SYSROOT/usr/lib/$VSCODE_CLIENT_LIBRARY_TRIPLE/pkgconfig:$VSCODE_CLIENT_SYSROOT/usr/lib/pkgconfig:$VSCODE_CLIENT_SYSROOT/usr/share/pkgconfig"
unset PKG_CONFIG_PATH

mkdir -p "$HOME/.gyp"
cat > "$HOME/.gyp/include.gypi" << 'EOF'
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- script: |
set -e
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get update
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get install -y libkrb5-dev
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get install -y libglib2.0-dev libkrb5-dev
displayName: Setup system services
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))

Expand Down
2 changes: 1 addition & 1 deletion build/azure-pipelines/web/product-build-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
- script: |
set -e
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get update
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get install -y libkrb5-dev
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get install -y libglib2.0-dev libkrb5-dev
displayName: Setup system services
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))

Expand Down
14 changes: 7 additions & 7 deletions build/checksums/vscode-sysroot.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
38fa5acc4e4f17cb7e3f599b5226a511b22cbdceeb38277d224b45f7280f518f aarch64-linux-gnu-glibc-2.28-gcc-10.5.0.tar.gz
bcff71257397f76a4f7a76bbcfc425b4b60b16449e10b01a2cfce574c21d60da aarch64-linux-gnu-glibc-2.28-gcc-8.5.0.tar.gz
58cd59ee4038291fe8a7f4adccac0ecbe8d23cbad1cb650b381e45e7e1e22424 aarch64-linux-musl-gcc-10.3.0.tar.gz
a0a1573e93191ae5e3735eb6107f4daeb4be7f99c5af229114d990ac77db33eb arm-rpi-linux-gnueabihf-glibc-2.28-gcc-10.5.0.tar.gz
375ecbb95c7eed95d6c7918af3c4418f2907e92e2f8d1b827a65bf46a8bbfc74 arm-rpi-linux-gnueabihf-glibc-2.28-gcc-8.5.0.tar.gz
ac4b6b14b4cec027a22a51bbbb049b3504958a78106c8a8d5cec144206b767d1 x86_64-linux-gnu-glibc-2.28-gcc-10.5.0.tar.gz
1ebb6ef1fe2983269fd0855a88f9c9a37f9b515d16524a9146198e4cabdf34f7 x86_64-linux-gnu-glibc-2.28-gcc-8.5.0.tar.gz
101468da438ec4cdbc77cfc03f9c97a1b397a7eefa7a4ab15aaaa17607b7462e aarch64-linux-gnu-glibc-2.28-gcc-10.5.0.tar.gz
31e0d57ea86232f577295a57987cfc1d3c96e295094be4e93f8322a413be1a7f aarch64-linux-gnu-glibc-2.28-gcc-8.5.0.tar.gz
03cbb3f523d6dcff9d5eaafb12e86389b8f712ce4e324a357d9ec09be921603d aarch64-linux-musl-gcc-10.3.0.tar.gz
eadc69f945fc71c9455c15b57a47b84b7e8a7b592ef03c9805a7c482ea9e4570 arm-rpi-linux-gnueabihf-glibc-2.28-gcc-10.5.0.tar.gz
3314fe2f81f0b849647ec111c776c80bc33ca199444714871c1d44ac95010c3d arm-rpi-linux-gnueabihf-glibc-2.28-gcc-8.5.0.tar.gz
c4719c3944276de3051e3200d92c162e95cab79665f11d023b1f393263cf2e49 x86_64-linux-gnu-glibc-2.28-gcc-10.5.0.tar.gz
6546ca42b458b8655957e701e2d02a8536bc11544efe61da3bc5f82fc09e0e7d x86_64-linux-gnu-glibc-2.28-gcc-8.5.0.tar.gz
11 changes: 6 additions & 5 deletions build/linux/debian/install-sysroot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type { DebianArchString } from './types.ts';
const URL_PREFIX = 'https://msftelectronbuild.z5.web.core.windows.net';
const URL_PATH = 'sysroots/toolchain';
const REPO_ROOT = path.dirname(path.dirname(path.dirname(import.meta.dirname)));
const VSCODE_SYSROOT_VERSION = '20260909-472333';

const ghApiHeaders: Record<string, string> = {
Accept: 'application/vnd.github.v3+json',
Expand Down Expand Up @@ -70,16 +71,15 @@ function getVSCodeSysrootChecksum(expectedName: string) {
* tar implementation for that reason.
*/
async function fetchUrl(options: IFetchOptions): Promise<void> {
const version = '20260212-405735';
const releaseUrl = `https://api.github.com/repos/Microsoft/vscode-linux-build-agent/releases/tags/v${version}`;
const releaseUrl = `https://api.github.com/repos/Microsoft/vscode-linux-build-agent/releases/tags/v${VSCODE_SYSROOT_VERSION}`;
const downloadOptions = {
attempts: 11,
onRetry: (error: Error) => console.log(`Fetching failed: ${error}`)
};
const releaseContents = await download(releaseUrl, { ...downloadOptions, headers: ghApiHeaders });
const asset = JSON.parse(Buffer.from(releaseContents).toString()).assets.find((a: { name: string }) => a.name === options.assetName);
if (!asset) {
throw new Error(`Could not find asset in release of Microsoft/vscode-linux-build-agent @ ${version}`);
throw new Error(`Could not find asset in release of Microsoft/vscode-linux-build-agent @ ${VSCODE_SYSROOT_VERSION}`);
}

console.log(`Found asset ${options.assetName} @ ${asset.url}.`);
Expand Down Expand Up @@ -130,11 +130,12 @@ export async function getVSCodeSysroot(arch: DebianArchString, isMusl: boolean =
}
const sysroot = process.env['VSCODE_SYSROOT_DIR'] ?? path.join(tmpdir(), `vscode-${arch}-sysroot`);
const stamp = path.join(sysroot, '.stamp');
const expectedStamp = `${VSCODE_SYSROOT_VERSION}/${expectedName}`;
let result = `${sysroot}/${triple}/${triple}/sysroot`;
if (isMusl) {
result = `${sysroot}/output/${triple}`;
}
if (fs.existsSync(stamp) && fs.readFileSync(stamp).toString() === expectedName) {
if (fs.existsSync(stamp) && fs.readFileSync(stamp).toString() === expectedStamp) {
return result;
}
console.log(`Installing ${arch} root image: ${sysroot}`);
Expand All @@ -145,7 +146,7 @@ export async function getVSCodeSysroot(arch: DebianArchString, isMusl: boolean =
assetName: expectedName,
dest: sysroot
});
fs.writeFileSync(stamp, expectedName);
fs.writeFileSync(stamp, expectedStamp);
return result;
}

Expand Down
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,7 @@ export default defineConfig(
'@vscode/vscode-languagedetection',
'@vscode/ripgrep-universal',
'@vscode/iconv-lite-umd',
'@vscode/metered',
'@vscode/native-watchdog',
'@vscode/policy-watcher',
'@vscode/proxy-agent',
Expand Down
24 changes: 24 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
"@vscode/diff": "0.0.2-7",
"@vscode/fs-copyfile": "2.0.0",
"@vscode/iconv-lite-umd": "0.7.1",
"@vscode/metered": "^0.1.0",
Comment thread
dmitrivMS marked this conversation as resolved.
Comment thread
dmitrivMS marked this conversation as resolved.
"@vscode/native-watchdog": "^1.4.6",
"@vscode/os-proxy-resolver": "^0.4.0",
"@vscode/policy-watcher": "^1.4.0",
Expand Down Expand Up @@ -314,6 +315,7 @@
"@vscode/native-watchdog@1.4.6": true,
"@vscode/ripgrep@1.17.1": true,
"@vscode/deviceid@0.1.5": true,
"@vscode/metered@0.1.0": true,
"@vscode/policy-watcher@1.4.0": true,
"@vscode/spdlog@0.15.8": true,
"@vscode/sqlite3@5.1.12-vscode": true,
Expand Down
6 changes: 4 additions & 2 deletions src/vs/code/electron-main/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,9 @@ export class CodeApplication extends Disposable {

// Metered connection telemetry
appInstantiationService.invokeFunction(accessor => {
(accessor.get(IMeteredConnectionService) as MeteredConnectionMainService).setTelemetryService(accessor.get(ITelemetryService));
const meteredConnectionService = accessor.get(IMeteredConnectionService) as MeteredConnectionMainService;
meteredConnectionService.setTelemetryService(accessor.get(ITelemetryService));
meteredConnectionService.start();
Comment thread
dmitrivMS marked this conversation as resolved.
});

// Auth Handler
Expand Down Expand Up @@ -1240,7 +1242,7 @@ export class CodeApplication extends Disposable {
services.set(IGlobalKeybindingsMainService, new SyncDescriptor(GlobalKeybindingsMainService, [globalShortcut]));

// Metered Connection
const meteredConnectionService = new MeteredConnectionMainService(this.configurationService);
const meteredConnectionService = this._register(new MeteredConnectionMainService(undefined, this.configurationService, this.logService));
services.set(IMeteredConnectionService, meteredConnectionService);

// Web Contents Extractor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ flakySuite('Native Modules (all platforms)', () => {
assert.ok(typeof watcher.createWatcher === 'function', testErrorMessage('@vscode/policy-watcher'));
});

test('@vscode/metered', async () => {
const metered = await import('@vscode/metered');
assert.ok(typeof metered.createMonitor === 'function', testErrorMessage('@vscode/metered'));
metered.createMonitor().dispose();
});

test('node-pty', async () => {
const nodePty = await import('node-pty');
assert.ok(typeof nodePty.spawn === 'function', testErrorMessage('node-pty'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,43 @@
import { toDisposable } from '../../../base/common/lifecycle.js';
import { IConfigurationService } from '../../configuration/common/configuration.js';
import { InstantiationType, registerSingleton } from '../../instantiation/common/extensions.js';
import { AbstractMeteredConnectionService, getIsBrowserConnectionMetered, IMeteredConnectionService, NavigatorWithConnection } from '../common/meteredConnection.js';
import { AbstractMeteredConnectionService, IMeteredConnectionService } from '../common/meteredConnection.js';

/**
* Browser Network Information API properties used for metered detection.
* See https://developer.mozilla.org/en-US/docs/Web/API/Network_Information_API
*/
interface NetworkInformation {
saveData?: boolean;
metered?: boolean;
effectiveType?: 'slow-2g' | '2g' | '3g' | '4g';
addEventListener(type: 'change', listener: () => void): void;
removeEventListener(type: 'change', listener: () => void): void;
}

/**
* Extends Navigator with the optional browser Network Information API.
*/
interface NavigatorWithConnection {
readonly connection?: NetworkInformation;
}

/**
* Returns whether the browser Network Information API indicates a metered connection.
*/
function getIsBrowserConnectionMetered(): boolean {
const connection = (navigator as NavigatorWithConnection).connection;
if (!connection) {
return false;
}

if (connection.saveData || connection.metered) {
return true;
}

const effectiveType = connection.effectiveType;
return effectiveType === '2g' || effectiveType === 'slow-2g';
}

/**
* Browser implementation of the metered connection service.
Expand All @@ -18,7 +54,7 @@ export class MeteredConnectionService extends AbstractMeteredConnectionService {

const connection = (navigator as NavigatorWithConnection).connection;
if (connection) {
const onChange = () => this.setIsBrowserConnectionMetered(getIsBrowserConnectionMetered());
const onChange = () => this.setIsUnderlyingConnectionMetered(getIsBrowserConnectionMetered());
connection.addEventListener('change', onChange);
this._register(toDisposable(() => connection.removeEventListener('change', onChange)));
}
Expand Down
Loading
Loading