mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
Fix base path so that existsSync works as intended (#551)
This commit is contained in:
parent
857a41e877
commit
21da302529
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.
@ -6,8 +6,8 @@ import { restoreCache, saveCache } from '@actions/cache';
|
|||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
|
|
||||||
class SetupMac {
|
class SetupMac {
|
||||||
static unityHubBasePath = `/Applications/"Unity Hub.app"`;
|
static unityHubBasePath = `/Applications/Unity Hub.app`;
|
||||||
static unityHubExecPath = `${SetupMac.unityHubBasePath}/Contents/MacOS/"Unity Hub"`;
|
static unityHubExecPath = `${SetupMac.unityHubBasePath}/Contents/MacOS/Unity Hub`;
|
||||||
|
|
||||||
public static async setup(buildParameters: BuildParameters, actionFolder: string) {
|
public static async setup(buildParameters: BuildParameters, actionFolder: string) {
|
||||||
const unityEditorPath = `/Applications/Unity/Hub/Editor/${buildParameters.editorVersion}/Unity.app/Contents/MacOS/Unity`;
|
const unityEditorPath = `/Applications/Unity/Hub/Editor/${buildParameters.editorVersion}/Unity.app/Contents/MacOS/Unity`;
|
||||||
@ -72,23 +72,23 @@ class SetupMac {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
private static getModuleParametersForTargetPlatform(targetPlatform: string): string {
|
private static getModuleParametersForTargetPlatform(targetPlatform: string): string[] {
|
||||||
let moduleArgument = '';
|
const moduleArgument = [];
|
||||||
switch (targetPlatform) {
|
switch (targetPlatform) {
|
||||||
case 'iOS':
|
case 'iOS':
|
||||||
moduleArgument += `--module ios `;
|
moduleArgument.push('--module', 'ios');
|
||||||
break;
|
break;
|
||||||
case 'tvOS':
|
case 'tvOS':
|
||||||
moduleArgument += '--module tvos ';
|
moduleArgument.push('--module', 'tvos');
|
||||||
break;
|
break;
|
||||||
case 'StandaloneOSX':
|
case 'StandaloneOSX':
|
||||||
moduleArgument += `--module mac-il2cpp `;
|
moduleArgument.push('--module', 'mac-il2cpp');
|
||||||
break;
|
break;
|
||||||
case 'Android':
|
case 'Android':
|
||||||
moduleArgument += `--module android `;
|
moduleArgument.push('--module', 'android');
|
||||||
break;
|
break;
|
||||||
case 'WebGL':
|
case 'WebGL':
|
||||||
moduleArgument += '--module webgl ';
|
moduleArgument.push('--module', 'webgl');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unsupported module for target platform: ${targetPlatform}.`);
|
throw new Error(`Unsupported module for target platform: ${targetPlatform}.`);
|
||||||
@ -110,17 +110,23 @@ class SetupMac {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const unityChangeset = await getUnityChangeset(buildParameters.editorVersion);
|
const unityChangeset = await getUnityChangeset(buildParameters.editorVersion);
|
||||||
const moduleArgument = SetupMac.getModuleParametersForTargetPlatform(buildParameters.targetPlatform);
|
const moduleArguments = SetupMac.getModuleParametersForTargetPlatform(buildParameters.targetPlatform);
|
||||||
|
|
||||||
const command = `${this.unityHubExecPath} -- --headless install \
|
const execArguments: string[] = [
|
||||||
--version ${buildParameters.editorVersion} \
|
'--',
|
||||||
--changeset ${unityChangeset.changeset} \
|
'--headless',
|
||||||
${moduleArgument} \
|
'install',
|
||||||
--childModules `;
|
...['--version', buildParameters.editorVersion],
|
||||||
|
...['--changeset', unityChangeset.changeset],
|
||||||
|
...moduleArguments,
|
||||||
|
'--childModules',
|
||||||
|
];
|
||||||
|
|
||||||
|
const escapedExecPath = this.unityHubExecPath.replace(/ /g, '\\ ');
|
||||||
|
|
||||||
// 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(escapedExecPath, 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