diff --git a/extensions/microsoft-authentication/extension.webpack.config.js b/extensions/microsoft-authentication/extension.webpack.config.js index 2182e98e21316..a46d5a527dfec 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 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.arch; +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 1f0e528c99f3e..e86269833a8e5 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`);