From 4c9690360822f00568772dba45b86554c0e86de5 Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt <2644648+TylerLeonhardt@users.noreply.github.com> Date: Thu, 20 Nov 2025 17:42:11 -0800 Subject: [PATCH] Support brokering from Linux x64 and Intel Macs (#278689) * Support Linux & Intel Macs This grabs the native files directly since the ones at the root are not expected to work in our cases, namely Intel Mac where we use arm machines to build the x64 build. * actually include macOS intel bits --- .../extension.webpack.config.js | 31 ++++++++++++++++--- .../src/node/cachedPublicClientApplication.ts | 4 +-- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/extensions/microsoft-authentication/extension.webpack.config.js b/extensions/microsoft-authentication/extension.webpack.config.js index 2182e98e213..a46d5a527df 100644 --- a/extensions/microsoft-authentication/extension.webpack.config.js +++ b/extensions/microsoft-authentication/extension.webpack.config.js @@ -8,20 +8,41 @@ import CopyWebpackPlugin from 'copy-webpack-plugin'; import path from 'path'; const isWindows = process.platform === 'win32'; -const windowsArches = ['x64']; const isMacOS = process.platform === 'darwin'; -const macOSArches = ['arm64']; +const isLinux = !isWindows && !isMacOS; -const arch = process.arch; +const windowsArches = ['x64']; +const linuxArches = ['x64']; + +let platformFolder; +switch (process.platform) { + case 'win32': + platformFolder = 'windows'; + break; + case 'darwin': + platformFolder = 'macos'; + break; + case 'linux': + platformFolder = 'linux'; + break; + default: + throw new Error(`Unsupported platform: ${process.platform}`); +} + +const arch = process.env.VSCODE_ARCH || process.arch; console.log(`Building Microsoft Authentication Extension for ${process.platform} (${arch})`); const plugins = [...nodePlugins(import.meta.dirname)]; -if ((isWindows && windowsArches.includes(arch)) || (isMacOS && macOSArches.includes(arch))) { +if ( + (isWindows && windowsArches.includes(arch)) || + isMacOS || + (isLinux && linuxArches.includes(arch)) +) { plugins.push(new CopyWebpackPlugin({ patterns: [ { // The native files we need to ship with the extension - from: '**/dist/(lib|)msal*.(node|dll|dylib)', + from: `**/dist/${platformFolder}/${arch}/(lib|)msal*.(node|dll|dylib|so)`, to: '[name][ext]' } ] diff --git a/extensions/microsoft-authentication/src/node/cachedPublicClientApplication.ts b/extensions/microsoft-authentication/src/node/cachedPublicClientApplication.ts index 1f0e528c99f..e86269833a8 100644 --- a/extensions/microsoft-authentication/src/node/cachedPublicClientApplication.ts +++ b/extensions/microsoft-authentication/src/node/cachedPublicClientApplication.ts @@ -51,9 +51,7 @@ export class CachedPublicClientApplication implements ICachedPublicClientApplica const loggerOptions = new MsalLoggerOptions(_logger, telemetryReporter); let broker: BrokerOptions | undefined; - if (process.platform !== 'win32' && process.platform !== 'darwin') { - this._logger.info(`[${this._clientId}] Native Broker is only available on Windows and macOS`); - } else if (env.uiKind === UIKind.Web) { + if (env.uiKind === UIKind.Web) { this._logger.info(`[${this._clientId}] Native Broker is not available in web UI`); } else if (workspace.getConfiguration('microsoft-authentication').get<'msal' | 'msal-no-broker'>('implementation') === 'msal-no-broker') { this._logger.info(`[${this._clientId}] Native Broker disabled via settings`);