mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-07 20:35:33 -04:00
Integrate mac architecture logic for mac setup
This commit is contained in:
parent
7dc132bcf5
commit
e526ef5d03
BIN
dist/index.js
generated
vendored
BIN
dist/index.js
generated
vendored
Binary file not shown.
BIN
dist/index.js.map
generated
vendored
BIN
dist/index.js.map
generated
vendored
Binary file not shown.
@ -47,7 +47,10 @@ class SetupMac {
|
|||||||
|
|
||||||
// Ignoring return code because the log seems to overflow the internal buffer which triggers
|
// Ignoring return code because the log seems to overflow the internal buffer which triggers
|
||||||
// a false error
|
// a false error
|
||||||
const errorCode = await exec(command, undefined, { silent, ignoreReturnCode: true });
|
const errorCode = await exec(command, undefined, {
|
||||||
|
silent,
|
||||||
|
ignoreReturnCode: true,
|
||||||
|
});
|
||||||
if (errorCode) {
|
if (errorCode) {
|
||||||
throw new Error(`There was an error installing the Unity Editor. See logs above for details.`);
|
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> {
|
private static async getLatestUnityHubVersion(): Promise<string> {
|
||||||
// Need to check if the latest version available is the same as the one we have cached
|
// 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 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 !== '') {
|
if (result.exitCode === 0 && result.stdout !== '') {
|
||||||
return result.stdout;
|
return result.stdout;
|
||||||
}
|
}
|
||||||
@ -72,6 +77,23 @@ class SetupMac {
|
|||||||
return '';
|
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[] {
|
private static getModuleParametersForTargetPlatform(targetPlatform: string): string[] {
|
||||||
const moduleArgument = [];
|
const moduleArgument = [];
|
||||||
switch (targetPlatform) {
|
switch (targetPlatform) {
|
||||||
@ -111,6 +133,7 @@ class SetupMac {
|
|||||||
|
|
||||||
const unityChangeset = await getUnityChangeset(buildParameters.editorVersion);
|
const unityChangeset = await getUnityChangeset(buildParameters.editorVersion);
|
||||||
const moduleArguments = SetupMac.getModuleParametersForTargetPlatform(buildParameters.targetPlatform);
|
const moduleArguments = SetupMac.getModuleParametersForTargetPlatform(buildParameters.targetPlatform);
|
||||||
|
const architectureArguments = SetupMac.getArchitectureParameters();
|
||||||
|
|
||||||
const execArguments: string[] = [
|
const execArguments: string[] = [
|
||||||
'--',
|
'--',
|
||||||
@ -119,12 +142,16 @@ class SetupMac {
|
|||||||
...['--version', buildParameters.editorVersion],
|
...['--version', buildParameters.editorVersion],
|
||||||
...['--changeset', unityChangeset.changeset],
|
...['--changeset', unityChangeset.changeset],
|
||||||
...moduleArguments,
|
...moduleArguments,
|
||||||
|
...architectureArguments,
|
||||||
'--childModules',
|
'--childModules',
|
||||||
];
|
];
|
||||||
|
|
||||||
// Ignoring return code because the log seems to overflow the internal buffer which triggers
|
// Ignoring return code because the log seems to overflow the internal buffer which triggers
|
||||||
// a false error
|
// 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) {
|
if (errorCode) {
|
||||||
throw new Error(`There was an error installing the Unity Editor. See logs above for details.`);
|
throw new Error(`There was an error installing the Unity Editor. See logs above for details.`);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user