Skip to content

Commit 4c96903

Browse files
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
1 parent fd9cf8e commit 4c96903

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

extensions/microsoft-authentication/extension.webpack.config.js

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,41 @@ import CopyWebpackPlugin from 'copy-webpack-plugin';
88
import path from 'path';
99

1010
const isWindows = process.platform === 'win32';
11-
const windowsArches = ['x64'];
1211
const isMacOS = process.platform === 'darwin';
13-
const macOSArches = ['arm64'];
12+
const isLinux = !isWindows && !isMacOS;
13+
14+
const windowsArches = ['x64'];
15+
const linuxArches = ['x64'];
16+
17+
let platformFolder;
18+
switch (process.platform) {
19+
case 'win32':
20+
platformFolder = 'windows';
21+
break;
22+
case 'darwin':
23+
platformFolder = 'macos';
24+
break;
25+
case 'linux':
26+
platformFolder = 'linux';
27+
break;
28+
default:
29+
throw new Error(`Unsupported platform: ${process.platform}`);
30+
}
1431

15-
const arch = process.arch;
32+
const arch = process.env.VSCODE_ARCH || process.arch;
1633
console.log(`Building Microsoft Authentication Extension for ${process.platform} (${arch})`);
1734

1835
const plugins = [...nodePlugins(import.meta.dirname)];
19-
if ((isWindows && windowsArches.includes(arch)) || (isMacOS && macOSArches.includes(arch))) {
36+
if (
37+
(isWindows && windowsArches.includes(arch)) ||
38+
isMacOS ||
39+
(isLinux && linuxArches.includes(arch))
40+
) {
2041
plugins.push(new CopyWebpackPlugin({
2142
patterns: [
2243
{
2344
// The native files we need to ship with the extension
24-
from: '**/dist/(lib|)msal*.(node|dll|dylib)',
45+
from: `**/dist/${platformFolder}/${arch}/(lib|)msal*.(node|dll|dylib|so)`,
2546
to: '[name][ext]'
2647
}
2748
]

extensions/microsoft-authentication/src/node/cachedPublicClientApplication.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ export class CachedPublicClientApplication implements ICachedPublicClientApplica
5151

5252
const loggerOptions = new MsalLoggerOptions(_logger, telemetryReporter);
5353
let broker: BrokerOptions | undefined;
54-
if (process.platform !== 'win32' && process.platform !== 'darwin') {
55-
this._logger.info(`[${this._clientId}] Native Broker is only available on Windows and macOS`);
56-
} else if (env.uiKind === UIKind.Web) {
54+
if (env.uiKind === UIKind.Web) {
5755
this._logger.info(`[${this._clientId}] Native Broker is not available in web UI`);
5856
} else if (workspace.getConfiguration('microsoft-authentication').get<'msal' | 'msal-no-broker'>('implementation') === 'msal-no-broker') {
5957
this._logger.info(`[${this._clientId}] Native Broker disabled via settings`);

0 commit comments

Comments
 (0)