mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: make sure that we print warning for unsupported OS (#27610)
Also, fix some missing paths in download lists.
This commit is contained in:
parent
b2dc0d2fbd
commit
d83d9ce268
@ -20,7 +20,7 @@ import * as os from 'os';
|
||||
import childProcess from 'child_process';
|
||||
import * as utils from '../../utils';
|
||||
import { spawnAsync } from '../../utils/spawnAsync';
|
||||
import { hostPlatform } from '../../utils/hostPlatform';
|
||||
import { hostPlatform, isOfficiallySupportedPlatform } from '../../utils/hostPlatform';
|
||||
import { buildPlaywrightCLICommand } from '.';
|
||||
import { deps } from './nativeDeps';
|
||||
import { getPlaywrightVersion } from '../../utils/userAgent';
|
||||
@ -85,15 +85,13 @@ export async function installDependenciesWindows(targets: Set<DependencyGroup>,
|
||||
|
||||
export async function installDependenciesLinux(targets: Set<DependencyGroup>, dryRun: boolean) {
|
||||
const libraries: string[] = [];
|
||||
let platform = hostPlatform;
|
||||
if (platform === 'generic-linux' || platform === 'generic-linux-arm64') {
|
||||
console.warn('BEWARE: your OS is not officially supported by Playwright; installing dependencies for Ubuntu as a fallback.'); // eslint-disable-line no-console
|
||||
platform = hostPlatform === 'generic-linux' ? 'ubuntu20.04' : 'ubuntu20.04-arm64';
|
||||
}
|
||||
const platform = hostPlatform;
|
||||
if (!isOfficiallySupportedPlatform)
|
||||
console.warn(`BEWARE: your OS is not officially supported by Playwright; installing dependencies for ${platform} as a fallback.`); // eslint-disable-line no-console
|
||||
for (const target of targets) {
|
||||
const info = deps[platform];
|
||||
if (!info) {
|
||||
console.warn('Cannot install dependencies for this linux distribution!'); // eslint-disable-line no-console
|
||||
console.warn(`Cannot install dependencies for ${platform}!`); // eslint-disable-line no-console
|
||||
return;
|
||||
}
|
||||
libraries.push(...info[target]);
|
||||
|
||||
@ -25,7 +25,7 @@ import { fetchData } from '../../utils/network';
|
||||
import { getEmbedderName } from '../../utils/userAgent';
|
||||
import { getFromENV, getAsBooleanFromENV, calculateSha1, wrapInASCIIBox, getPackageManagerExecCommand } from '../../utils';
|
||||
import { removeFolders, existsAsync, canAccessFile } from '../../utils/fileUtils';
|
||||
import { hostPlatform } from '../../utils/hostPlatform';
|
||||
import { type HostPlatform, hostPlatform, isOfficiallySupportedPlatform } from '../../utils/hostPlatform';
|
||||
import { spawnAsync } from '../../utils/spawnAsync';
|
||||
import type { DependencyGroup } from './dependencies';
|
||||
import { transformCommandsForRoot, dockerVersion, readDockerVersionSync } from './dependencies';
|
||||
@ -73,11 +73,10 @@ const EXECUTABLE_PATHS = {
|
||||
},
|
||||
};
|
||||
|
||||
const DOWNLOAD_PATHS = {
|
||||
type DownloadPaths = Record<HostPlatform, string | undefined>;
|
||||
const DOWNLOAD_PATHS: Record<BrowserName | InternalTool, DownloadPaths> = {
|
||||
'chromium': {
|
||||
'<unknown>': undefined,
|
||||
'generic-linux': 'builds/chromium/%s/chromium-linux.zip',
|
||||
'generic-linux-arm64': 'builds/chromium/%s/chromium-linux-arm64.zip',
|
||||
'ubuntu18.04': 'builds/chromium/%s/chromium-linux.zip',
|
||||
'ubuntu20.04': 'builds/chromium/%s/chromium-linux.zip',
|
||||
'ubuntu22.04': 'builds/chromium/%s/chromium-linux.zip',
|
||||
@ -101,8 +100,6 @@ const DOWNLOAD_PATHS = {
|
||||
},
|
||||
'chromium-tip-of-tree': {
|
||||
'<unknown>': undefined,
|
||||
'generic-linux': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux.zip',
|
||||
'generic-linux-arm64': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux-arm64.zip',
|
||||
'ubuntu18.04': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux.zip',
|
||||
'ubuntu20.04': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux.zip',
|
||||
'ubuntu22.04': 'builds/chromium-tip-of-tree/%s/chromium-tip-of-tree-linux.zip',
|
||||
@ -126,8 +123,6 @@ const DOWNLOAD_PATHS = {
|
||||
},
|
||||
'chromium-with-symbols': {
|
||||
'<unknown>': undefined,
|
||||
'generic-linux': 'builds/chromium/%s/chromium-with-symbols-linux.zip',
|
||||
'generic-linux-arm64': 'builds/chromium/%s/chromium-with-symbols-linux-arm64.zip',
|
||||
'ubuntu18.04': 'builds/chromium/%s/chromium-with-symbols-linux.zip',
|
||||
'ubuntu20.04': 'builds/chromium/%s/chromium-with-symbols-linux.zip',
|
||||
'ubuntu22.04': 'builds/chromium/%s/chromium-with-symbols-linux.zip',
|
||||
@ -151,8 +146,6 @@ const DOWNLOAD_PATHS = {
|
||||
},
|
||||
'firefox': {
|
||||
'<unknown>': undefined,
|
||||
'generic-linux': 'builds/firefox/%s/firefox-ubuntu-20.04.zip',
|
||||
'generic-linux-arm64': 'builds/firefox/%s/firefox-ubuntu-20.04-arm64.zip',
|
||||
'ubuntu18.04': 'builds/firefox/%s/firefox-ubuntu-18.04.zip',
|
||||
'ubuntu20.04': 'builds/firefox/%s/firefox-ubuntu-20.04.zip',
|
||||
'ubuntu22.04': 'builds/firefox/%s/firefox-ubuntu-22.04.zip',
|
||||
@ -176,8 +169,6 @@ const DOWNLOAD_PATHS = {
|
||||
},
|
||||
'firefox-beta': {
|
||||
'<unknown>': undefined,
|
||||
'generic-linux': 'builds/firefox-beta/%s/firefox-beta-ubuntu-20.04.zip',
|
||||
'generic-linux-arm64': undefined,
|
||||
'ubuntu18.04': 'builds/firefox-beta/%s/firefox-beta-ubuntu-18.04.zip',
|
||||
'ubuntu20.04': 'builds/firefox-beta/%s/firefox-beta-ubuntu-20.04.zip',
|
||||
'ubuntu22.04': 'builds/firefox-beta/%s/firefox-beta-ubuntu-22.04.zip',
|
||||
@ -201,8 +192,6 @@ const DOWNLOAD_PATHS = {
|
||||
},
|
||||
'firefox-asan': {
|
||||
'<unknown>': undefined,
|
||||
'generic-linux': 'builds/firefox/%s/firefox-asan-ubuntu-20.04.zip',
|
||||
'generic-linux-arm64': undefined,
|
||||
'ubuntu18.04': undefined,
|
||||
'ubuntu20.04': undefined,
|
||||
'ubuntu22.04': 'builds/firefox/%s/firefox-asan-ubuntu-22.04.zip',
|
||||
@ -211,6 +200,8 @@ const DOWNLOAD_PATHS = {
|
||||
'ubuntu22.04-arm64': undefined,
|
||||
'debian11': undefined,
|
||||
'debian11-arm64': undefined,
|
||||
'debian12': undefined,
|
||||
'debian12-arm64': undefined,
|
||||
'mac10.13': 'builds/firefox/%s/firefox-asan-mac-13.zip',
|
||||
'mac10.14': 'builds/firefox/%s/firefox-asan-mac-13.zip',
|
||||
'mac10.15': 'builds/firefox/%s/firefox-asan-mac-13.zip',
|
||||
@ -224,8 +215,6 @@ const DOWNLOAD_PATHS = {
|
||||
},
|
||||
'webkit': {
|
||||
'<unknown>': undefined,
|
||||
'generic-linux': 'builds/webkit/%s/webkit-ubuntu-20.04.zip',
|
||||
'generic-linux-arm64': 'builds/webkit/%s/webkit-ubuntu-20.04-arm64.zip',
|
||||
'ubuntu18.04': 'builds/deprecated-webkit-ubuntu-18.04/%s/deprecated-webkit-ubuntu-18.04.zip',
|
||||
'ubuntu20.04': 'builds/webkit/%s/webkit-ubuntu-20.04.zip',
|
||||
'ubuntu22.04': 'builds/webkit/%s/webkit-ubuntu-22.04.zip',
|
||||
@ -249,8 +238,6 @@ const DOWNLOAD_PATHS = {
|
||||
},
|
||||
'ffmpeg': {
|
||||
'<unknown>': undefined,
|
||||
'generic-linux': 'builds/ffmpeg/%s/ffmpeg-linux.zip',
|
||||
'generic-linux-arm64': 'builds/ffmpeg/%s/ffmpeg-linux-arm64.zip',
|
||||
'ubuntu18.04': 'builds/ffmpeg/%s/ffmpeg-linux.zip',
|
||||
'ubuntu20.04': 'builds/ffmpeg/%s/ffmpeg-linux.zip',
|
||||
'ubuntu22.04': 'builds/ffmpeg/%s/ffmpeg-linux.zip',
|
||||
@ -274,6 +261,26 @@ const DOWNLOAD_PATHS = {
|
||||
},
|
||||
'android': {
|
||||
'<unknown>': 'builds/android/%s/android.zip',
|
||||
'ubuntu18.04': 'builds/android/%s/android.zip',
|
||||
'ubuntu20.04': 'builds/android/%s/android.zip',
|
||||
'ubuntu22.04': 'builds/android/%s/android.zip',
|
||||
'ubuntu18.04-arm64': 'builds/android/%s/android.zip',
|
||||
'ubuntu20.04-arm64': 'builds/android/%s/android.zip',
|
||||
'ubuntu22.04-arm64': 'builds/android/%s/android.zip',
|
||||
'debian11': 'builds/android/%s/android.zip',
|
||||
'debian11-arm64': 'builds/android/%s/android.zip',
|
||||
'debian12': 'builds/android/%s/android.zip',
|
||||
'debian12-arm64': 'builds/android/%s/android.zip',
|
||||
'mac10.13': 'builds/android/%s/android.zip',
|
||||
'mac10.14': 'builds/android/%s/android.zip',
|
||||
'mac10.15': 'builds/android/%s/android.zip',
|
||||
'mac11': 'builds/android/%s/android.zip',
|
||||
'mac11-arm64': 'builds/android/%s/android.zip',
|
||||
'mac12': 'builds/android/%s/android.zip',
|
||||
'mac12-arm64': 'builds/android/%s/android.zip',
|
||||
'mac13': 'builds/android/%s/android.zip',
|
||||
'mac13-arm64': 'builds/android/%s/android.zip',
|
||||
'win64': 'builds/android/%s/android.zip',
|
||||
},
|
||||
};
|
||||
|
||||
@ -878,8 +885,8 @@ export class Registry {
|
||||
const downloadURLs = this._downloadURLs(descriptor);
|
||||
if (!downloadURLs.length)
|
||||
throw new Error(`ERROR: Playwright does not support ${descriptor.name} on ${hostPlatform}`);
|
||||
if (hostPlatform === 'generic-linux' || hostPlatform === 'generic-linux-arm64')
|
||||
logPolitely('BEWARE: your OS is not officially supported by Playwright; downloading fallback build.');
|
||||
if (!isOfficiallySupportedPlatform)
|
||||
logPolitely(`BEWARE: your OS is not officially supported by Playwright; downloading fallback build for ${hostPlatform}.`);
|
||||
|
||||
const displayName = descriptor.name.split('-').map(word => {
|
||||
return word === 'ffmpeg' ? 'FFMPEG' : word.charAt(0).toUpperCase() + word.slice(1);
|
||||
|
||||
@ -23,15 +23,15 @@ export type HostPlatform = 'win64' |
|
||||
'mac10.15' |
|
||||
'mac11' | 'mac11-arm64' |
|
||||
'mac12' | 'mac12-arm64' |
|
||||
'mac13' | 'mac13-arm64' |
|
||||
'ubuntu18.04' | 'ubuntu18.04-arm64' |
|
||||
'ubuntu20.04' | 'ubuntu20.04-arm64' |
|
||||
'ubuntu22.04' | 'ubuntu22.04-arm64' |
|
||||
'debian11' | 'debian11-arm64' |
|
||||
'debian12' | 'debian12-arm64' |
|
||||
'generic-linux' | 'generic-linux-arm64' |
|
||||
'<unknown>';
|
||||
|
||||
export const hostPlatform = ((): HostPlatform => {
|
||||
function calculatePlatform(): { hostPlatform: HostPlatform, isOfficiallySupportedPlatform: boolean } {
|
||||
const platform = os.platform();
|
||||
if (platform === 'darwin') {
|
||||
const ver = os.release().split('.').map((a: string) => parseInt(a, 10));
|
||||
@ -52,7 +52,7 @@ export const hostPlatform = ((): HostPlatform => {
|
||||
if (os.cpus().some(cpu => cpu.model.includes('Apple')))
|
||||
macVersion += '-arm64';
|
||||
}
|
||||
return macVersion as HostPlatform;
|
||||
return { hostPlatform: macVersion as HostPlatform, isOfficiallySupportedPlatform: true };
|
||||
}
|
||||
if (platform === 'linux') {
|
||||
const archSuffix = os.arch() === 'arm64' ? '-arm64' : '';
|
||||
@ -62,23 +62,26 @@ export const hostPlatform = ((): HostPlatform => {
|
||||
// KDE Neon is ubuntu-based and has the same versions.
|
||||
// TUXEDO OS is ubuntu-based and has the same versions.
|
||||
if (distroInfo?.id === 'ubuntu' || distroInfo?.id === 'pop' || distroInfo?.id === 'neon' || distroInfo?.id === 'tuxedo') {
|
||||
const isOfficiallySupportedPlatform = distroInfo?.id === 'ubuntu';
|
||||
if (parseInt(distroInfo.version, 10) <= 19)
|
||||
return ('ubuntu18.04' + archSuffix) as HostPlatform;
|
||||
return { hostPlatform: ('ubuntu18.04' + archSuffix) as HostPlatform, isOfficiallySupportedPlatform };
|
||||
if (parseInt(distroInfo.version, 10) <= 21)
|
||||
return ('ubuntu20.04' + archSuffix) as HostPlatform;
|
||||
return ('ubuntu22.04' + archSuffix) as HostPlatform;
|
||||
return { hostPlatform: ('ubuntu20.04' + archSuffix) as HostPlatform, isOfficiallySupportedPlatform };
|
||||
return { hostPlatform: ('ubuntu22.04' + archSuffix) as HostPlatform, isOfficiallySupportedPlatform };
|
||||
}
|
||||
if (distroInfo?.id === 'debian' && distroInfo?.version === '11')
|
||||
return ('debian11' + archSuffix) as HostPlatform;
|
||||
return { hostPlatform: ('debian11' + archSuffix) as HostPlatform, isOfficiallySupportedPlatform: true };
|
||||
if (distroInfo?.id === 'debian' && distroInfo?.version === '12')
|
||||
return ('debian12' + archSuffix) as HostPlatform;
|
||||
return { hostPlatform: ('debian12' + archSuffix) as HostPlatform, isOfficiallySupportedPlatform: true };
|
||||
// use most recent supported release for 'debian testing' and 'unstable'.
|
||||
// they never include a numeric version entry in /etc/os-release.
|
||||
if (distroInfo?.id === 'debian' && distroInfo?.version === '')
|
||||
return ('debian12' + archSuffix) as HostPlatform;
|
||||
return ('generic-linux' + archSuffix) as HostPlatform;
|
||||
return { hostPlatform: ('debian12' + archSuffix) as HostPlatform, isOfficiallySupportedPlatform: true };
|
||||
return { hostPlatform: ('ubuntu20.04' + archSuffix) as HostPlatform, isOfficiallySupportedPlatform: false };
|
||||
}
|
||||
if (platform === 'win32')
|
||||
return 'win64';
|
||||
return '<unknown>';
|
||||
})();
|
||||
return { hostPlatform: 'win64', isOfficiallySupportedPlatform: true };
|
||||
return { hostPlatform: '<unknown>', isOfficiallySupportedPlatform: false };
|
||||
}
|
||||
|
||||
export const { hostPlatform, isOfficiallySupportedPlatform } = calculatePlatform();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user