Integrate mac architecture logic for mac setup
parent
7dc132bcf5
commit
e526ef5d03
|
@ -7197,7 +7197,10 @@ class SetupMac {
|
|||
const command = `brew install unity-hub${commandSuffix}`;
|
||||
// Ignoring return code because the log seems to overflow the internal buffer which triggers
|
||||
// a false error
|
||||
const errorCode = await (0, exec_1.exec)(command, undefined, { silent, ignoreReturnCode: true });
|
||||
const errorCode = await (0, exec_1.exec)(command, undefined, {
|
||||
silent,
|
||||
ignoreReturnCode: true,
|
||||
});
|
||||
if (errorCode) {
|
||||
throw new Error(`There was an error installing the Unity Editor. See logs above for details.`);
|
||||
}
|
||||
|
@ -7212,12 +7215,28 @@ class SetupMac {
|
|||
static async getLatestUnityHubVersion() {
|
||||
// Need to check if the latest version available is the same as the one we have cached
|
||||
const hubVersionCommand = `/bin/bash -c "brew info unity-hub | grep -o '[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+'"`;
|
||||
const result = await (0, exec_1.getExecOutput)(hubVersionCommand, undefined, { silent: true });
|
||||
const result = await (0, exec_1.getExecOutput)(hubVersionCommand, undefined, {
|
||||
silent: true,
|
||||
});
|
||||
if (result.exitCode === 0 && result.stdout !== '') {
|
||||
return result.stdout;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
static getArchitectureParameters() {
|
||||
const architectureArgument = [];
|
||||
switch (process.arch) {
|
||||
case 'x64':
|
||||
architectureArgument.push('--architecture', 'x86_64');
|
||||
break;
|
||||
case 'arm64':
|
||||
architectureArgument.push('--architecture', 'arm64');
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unsupported architecture: ${process.arch}.`);
|
||||
}
|
||||
return architectureArgument;
|
||||
}
|
||||
static getModuleParametersForTargetPlatform(targetPlatform) {
|
||||
const moduleArgument = [];
|
||||
switch (targetPlatform) {
|
||||
|
@ -7253,6 +7272,7 @@ class SetupMac {
|
|||
}
|
||||
const unityChangeset = await (0, unity_changeset_1.getUnityChangeset)(buildParameters.editorVersion);
|
||||
const moduleArguments = SetupMac.getModuleParametersForTargetPlatform(buildParameters.targetPlatform);
|
||||
const architectureArguments = SetupMac.getArchitectureParameters();
|
||||
const execArguments = [
|
||||
'--',
|
||||
'--headless',
|
||||
|
@ -7260,11 +7280,15 @@ class SetupMac {
|
|||
...['--version', buildParameters.editorVersion],
|
||||
...['--changeset', unityChangeset.changeset],
|
||||
...moduleArguments,
|
||||
...architectureArguments,
|
||||
'--childModules',
|
||||
];
|
||||
// Ignoring return code because the log seems to overflow the internal buffer which triggers
|
||||
// a false error
|
||||
const errorCode = await (0, exec_1.exec)(this.unityHubExecPath, execArguments, { silent, ignoreReturnCode: true });
|
||||
const errorCode = await (0, exec_1.exec)(this.unityHubExecPath, execArguments, {
|
||||
silent,
|
||||
ignoreReturnCode: true,
|
||||
});
|
||||
if (errorCode) {
|
||||
throw new Error(`There was an error installing the Unity Editor. See logs above for details.`);
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -47,7 +47,10 @@ class SetupMac {
|
|||
|
||||
// Ignoring return code because the log seems to overflow the internal buffer which triggers
|
||||
// a false error
|
||||
const errorCode = await exec(command, undefined, { silent, ignoreReturnCode: true });
|
||||
const errorCode = await exec(command, undefined, {
|
||||
silent,
|
||||
ignoreReturnCode: true,
|
||||
});
|
||||
if (errorCode) {
|
||||
throw new Error(`There was an error installing the Unity Editor. See logs above for details.`);
|
||||
}
|
||||
|
@ -64,7 +67,9 @@ class SetupMac {
|
|||
private static async getLatestUnityHubVersion(): Promise<string> {
|
||||
// Need to check if the latest version available is the same as the one we have cached
|
||||
const hubVersionCommand = `/bin/bash -c "brew info unity-hub | grep -o '[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+'"`;
|
||||
const result = await getExecOutput(hubVersionCommand, undefined, { silent: true });
|
||||
const result = await getExecOutput(hubVersionCommand, undefined, {
|
||||
silent: true,
|
||||
});
|
||||
if (result.exitCode === 0 && result.stdout !== '') {
|
||||
return result.stdout;
|
||||
}
|
||||
|
@ -72,6 +77,23 @@ class SetupMac {
|
|||
return '';
|
||||
}
|
||||
|
||||
private static getArchitectureParameters(): string[] {
|
||||
const architectureArgument = [];
|
||||
|
||||
switch (process.arch) {
|
||||
case 'x64':
|
||||
architectureArgument.push('--architecture', 'x86_64');
|
||||
break;
|
||||
case 'arm64':
|
||||
architectureArgument.push('--architecture', 'arm64');
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unsupported architecture: ${process.arch}.`);
|
||||
}
|
||||
|
||||
return architectureArgument;
|
||||
}
|
||||
|
||||
private static getModuleParametersForTargetPlatform(targetPlatform: string): string[] {
|
||||
const moduleArgument = [];
|
||||
switch (targetPlatform) {
|
||||
|
@ -111,6 +133,7 @@ class SetupMac {
|
|||
|
||||
const unityChangeset = await getUnityChangeset(buildParameters.editorVersion);
|
||||
const moduleArguments = SetupMac.getModuleParametersForTargetPlatform(buildParameters.targetPlatform);
|
||||
const architectureArguments = SetupMac.getArchitectureParameters();
|
||||
|
||||
const execArguments: string[] = [
|
||||
'--',
|
||||
|
@ -119,12 +142,16 @@ class SetupMac {
|
|||
...['--version', buildParameters.editorVersion],
|
||||
...['--changeset', unityChangeset.changeset],
|
||||
...moduleArguments,
|
||||
...architectureArguments,
|
||||
'--childModules',
|
||||
];
|
||||
|
||||
// Ignoring return code because the log seems to overflow the internal buffer which triggers
|
||||
// a false error
|
||||
const errorCode = await exec(this.unityHubExecPath, execArguments, { silent, ignoreReturnCode: true });
|
||||
const errorCode = await exec(this.unityHubExecPath, execArguments, {
|
||||
silent,
|
||||
ignoreReturnCode: true,
|
||||
});
|
||||
if (errorCode) {
|
||||
throw new Error(`There was an error installing the Unity Editor. See logs above for details.`);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue