@@ -35503,19 +35503,27 @@ async function ValidateInputs() {
3550335503 core.info(` > ${module}`);
3550435504 }
3550535505 }
35506+ if (modules.length === 0) {
35507+ core.info(` > None`);
35508+ }
3550635509 core.info(`buildTargets:`);
3550735510 const moduleMap = getPlatformTargetModuleMap();
3550835511 for (const target of buildTargets) {
3550935512 const module = moduleMap[target];
3551035513 if (module === undefined) {
35511- core.warning(`${target} not a valid build target!`);
35514+ if (target.toLowerCase() !== 'none') {
35515+ core.warning(`${target} is not a valid build target for ${os.type()}`);
35516+ }
3551235517 continue;
3551335518 }
3551435519 if (!modules.includes(module)) {
3551535520 modules.push(module);
3551635521 core.info(` > ${target} -> ${module}`);
3551735522 }
3551835523 }
35524+ if (buildTargets.length == 0) {
35525+ core.info(` > None`);
35526+ }
3551935527 const versions = getUnityVersionsFromInput(architecture);
3552035528 const versionFilePath = await getVersionFilePath();
3552135529 const unityProjectPath = versionFilePath !== undefined ? path.join(versionFilePath, '..', '..') : undefined;
@@ -35534,6 +35542,9 @@ async function ValidateInputs() {
3553435542 for (const unityVersion of versions) {
3553535543 core.info(` > ${unityVersion.toString()}`);
3553635544 }
35545+ if (versions.length === 0) {
35546+ core.info(` > None`);
35547+ }
3553735548 let installPath = core.getInput('install-path');
3553835549 if (installPath) {
3553935550 installPath = path.normalize(installPath.trim());
@@ -35574,40 +35585,41 @@ function getInstallationArch() {
3557435585}
3557535586function getPlatformTargetModuleMap() {
3557635587 const osType = os.type();
35577- let moduleMap = undefined;
35578- if (osType == 'Linux') {
35579- moduleMap = {
35580- "StandaloneLinux64": "linux-il2cpp",
35581- "Android": "android",
35582- "WebGL": "webgl",
35583- "iOS": "ios",
35584- };
35585- }
35586- else if (osType == 'Darwin') {
35587- moduleMap = {
35588- "StandaloneOSX": "mac-il2cpp",
35589- "iOS": "ios",
35590- "Android": "android",
35591- "tvOS": "appletv",
35592- "StandaloneLinux64": "linux-il2cpp",
35593- "WebGL": "webgl",
35594- "VisionOS": "visionos"
35595- };
35596- }
35597- else if (osType == 'Windows_NT') {
35598- moduleMap = {
35599- "StandaloneWindows64": "windows-il2cpp",
35600- "WSAPlayer": "universal-windows-platform",
35601- "Android": "android",
35602- "iOS": "ios",
35603- "tvOS": "appletv",
35604- "StandaloneLinux64": "linux-il2cpp",
35605- "Lumin": "lumin",
35606- "WebGL": "webgl",
35607- };
35608- }
35609- else {
35610- throw Error(`${osType} not supported`);
35588+ let moduleMap;
35589+ switch (osType) {
35590+ case 'Linux':
35591+ moduleMap = {
35592+ "StandaloneLinux64": "linux-il2cpp",
35593+ "Android": "android",
35594+ "WebGL": "webgl",
35595+ "iOS": "ios",
35596+ };
35597+ break;
35598+ case 'Darwin':
35599+ moduleMap = {
35600+ "StandaloneOSX": "mac-il2cpp",
35601+ "iOS": "ios",
35602+ "Android": "android",
35603+ "tvOS": "appletv",
35604+ "StandaloneLinux64": "linux-il2cpp",
35605+ "WebGL": "webgl",
35606+ "VisionOS": "visionos"
35607+ };
35608+ break;
35609+ case 'Windows_NT':
35610+ moduleMap = {
35611+ "StandaloneWindows64": "windows-il2cpp",
35612+ "WSAPlayer": "universal-windows-platform",
35613+ "Android": "android",
35614+ "iOS": "ios",
35615+ "tvOS": "appletv",
35616+ "StandaloneLinux64": "linux-il2cpp",
35617+ "Lumin": "lumin",
35618+ "WebGL": "webgl",
35619+ };
35620+ break;
35621+ default:
35622+ throw Error(`${osType} not supported`);
3561135623 }
3561235624 return moduleMap;
3561335625}
@@ -35894,35 +35906,39 @@ function init() {
3589435906 }
3589535907}
3589635908async function Get() {
35909+ let isCleanInstall = false;
3589735910 try {
3589835911 await fs.promises.access(hubPath, fs.constants.X_OK);
3589935912 }
3590035913 catch (error) {
3590135914 hubPath = await installUnityHub();
35902- }
35903- const hubVersion = await getInstalledHubVersion();
35904- if (!semver.valid(hubVersion)) {
35905- throw new Error(`Failed to get installed Unity Hub version ${hubVersion}!`);
35906- }
35907- core.info(`Unity Hub Version:\n > ${hubVersion}`);
35908- const latestHubVersion = await getLatestHubVersion();
35909- if (!semver.valid(latestHubVersion)) {
35910- throw new Error(`Failed to get latest Unity Hub version!`);
35911- }
35912- core.debug(`Latest Unity Hub Version:\n > ${latestHubVersion}`);
35913- core.debug(`Comparing versions:\n > ${hubVersion} < ${latestHubVersion} => ${semver.compare(hubVersion, latestHubVersion)}`);
35914- if (semver.compare(hubVersion, latestHubVersion) < 0) {
35915- core.info(`Installing Latest Unity Hub Version:\n > ${latestHubVersion}`);
35916- if (process.platform !== 'linux') {
35917- core.info(`Removing previous Unity Hub version:\n > ${hubVersion}`);
35918- await (0, utility_1.RemovePath)(hubPath);
35919- hubPath = await installUnityHub();
35920- }
35921- else {
35922- const scriptPath = __nccwpck_require__.ab + "update-unityhub-linux.sh";
35923- const exitCode = await exec.exec('sh', [__nccwpck_require__.ab + "update-unityhub-linux.sh"]);
35924- if (exitCode !== 0) {
35925- throw new Error(`Failed to install Unity Hub: ${exitCode}`);
35915+ isCleanInstall = true;
35916+ }
35917+ if (!isCleanInstall) {
35918+ const hubVersion = await getInstalledHubVersion();
35919+ if (!semver.valid(hubVersion)) {
35920+ throw new Error(`Failed to get installed Unity Hub version ${hubVersion}!`);
35921+ }
35922+ core.info(`Installed Unity Hub Version:\n > ${hubVersion}`);
35923+ const latestHubVersion = await getLatestHubVersion();
35924+ if (!semver.valid(latestHubVersion)) {
35925+ throw new Error(`Failed to get latest Unity Hub version!`);
35926+ }
35927+ core.debug(`Latest Unity Hub Version:\n > ${latestHubVersion}`);
35928+ core.debug(`Comparing versions:\n > ${hubVersion} < ${latestHubVersion} => ${semver.compare(hubVersion, latestHubVersion)}`);
35929+ if (semver.compare(hubVersion, latestHubVersion) < 0) {
35930+ core.info(`Installing Latest Unity Hub Version:\n > ${latestHubVersion}`);
35931+ if (process.platform !== 'linux') {
35932+ core.info(`Removing previous Unity Hub version:\n > ${hubVersion}`);
35933+ await (0, utility_1.RemovePath)(hubPath);
35934+ hubPath = await installUnityHub();
35935+ }
35936+ else {
35937+ const scriptPath = __nccwpck_require__.ab + "update-unityhub-linux.sh";
35938+ const exitCode = await exec.exec('sh', [__nccwpck_require__.ab + "update-unityhub-linux.sh"]);
35939+ if (exitCode !== 0) {
35940+ throw new Error(`Failed to install Unity Hub: ${exitCode}`);
35941+ }
3592635942 }
3592735943 }
3592835944 }
@@ -36214,6 +36230,15 @@ async function installUnity(unityVersion, modules) {
3621436230 return await installUnity4x(unityVersion);
3621536231 }
3621636232 core.startGroup(`Installing Unity ${unityVersion.toString()}...`);
36233+ if (process.platform === 'linux') {
36234+ const installLinuxDepsScript = __nccwpck_require__.ab + "install-linux-dependencies.sh";
36235+ const exitCode = await exec.exec('sh', [__nccwpck_require__.ab + "install-linux-dependencies.sh", unityVersion.version], {
36236+ ignoreReturnCode: true
36237+ });
36238+ if (exitCode !== 0) {
36239+ throw new Error(`Failed to install additional Linux dependencies for Unity ${unityVersion.toString()}: ${exitCode}`);
36240+ }
36241+ }
3621736242 const args = ['install', '--version', unityVersion.version];
3621836243 if (unityVersion.changeset) {
3621936244 args.push('--changeset', unityVersion.changeset);
@@ -36248,7 +36273,9 @@ async function installUnity4x(unityVersion) {
3624836273 const installPath = path.join(installDir, `Unity ${unityVersion.version}`);
3624936274 if (!fs.existsSync(installPath)) {
3625036275 const scriptPath = __nccwpck_require__.ab + "unity-editor-installer.ps1";
36251- const exitCode = await exec.exec('pwsh', [__nccwpck_require__.ab + "unity-editor-installer.ps1", unityVersion.version, installDir]);
36276+ const exitCode = await exec.exec('pwsh', [__nccwpck_require__.ab + "unity-editor-installer.ps1", unityVersion.version, installDir], {
36277+ ignoreReturnCode: true
36278+ });
3625236279 if (exitCode !== 0) {
3625336280 throw new Error(`Failed to install Unity ${unityVersion.toString()}: ${exitCode}`);
3625436281 }
@@ -36261,8 +36288,9 @@ async function installUnity4x(unityVersion) {
3626136288 const installPath = path.join(installDir, `Unity ${unityVersion.version}`, 'Unity.app');
3626236289 if (!fs.existsSync(installPath)) {
3626336290 const scriptPath = __nccwpck_require__.ab + "unity-editor-installer.sh";
36264- await fs.promises.chmod(__nccwpck_require__.ab + "unity-editor-installer.sh", 0o755);
36265- const exitCode = await exec.exec('sh', [__nccwpck_require__.ab + "unity-editor-installer.sh", unityVersion.version, installDir]);
36291+ const exitCode = await exec.exec('sh', [__nccwpck_require__.ab + "unity-editor-installer.sh", unityVersion.version, installDir], {
36292+ ignoreReturnCode: true
36293+ });
3626636294 if (exitCode !== 0) {
3626736295 throw new Error(`Failed to install Unity ${unityVersion.toString()}: ${exitCode}`);
3626836296 }
@@ -36441,26 +36469,25 @@ async function getEditorReleaseInfo(unityVersion) {
3644136469 return results[0];
3644236470}
3644336471async function fallbackVersionLookup(unityVersion) {
36444- let version = unityVersion.version.split('.')[0];
36445- if (/^\d{1,4}\.0(\.0)?$/.test(unityVersion.version)) {
36446- version = unityVersion.version.split('.')[0];
36447- }
36448- const url = `https://unity.com/releases/editor/whats-new/${version}`;
36472+ const url = `https://unity.com/releases/editor/whats-new/${unityVersion.version}`;
3644936473 core.debug(`Fetching release page: "${url}"`);
3645036474 let response;
3645136475 try {
3645236476 response = await fetch(url);
3645336477 }
3645436478 catch (error) {
36455- core.warning(`Failed to fetch changeset for Unity ${unityVersion.toString()} [network error] : ${error}`);
36479+ core.warning(`Failed to fetch changeset for Unity ${unityVersion.toString()}: ${error}`);
3645636480 return unityVersion;
3645736481 }
36482+ const responseText = await response.text();
36483+ if (core.isDebug()) {
36484+ core.info(responseText);
36485+ }
3645836486 if (!response.ok) {
36459- throw new Error(`Failed to fetch changeset [${response.status}] "${url}"`);
36487+ throw new Error(`Failed to fetch changeset for Unity ${unityVersion.toString()} [${response.status}] "${url}"`);
3646036488 }
36461- const data = await response.text();
36462- core.debug(`Release page content:\n${data}`);
36463- const match = data.match(/unityhub:\/\/(?<version>\d+\.\d+\.\d+[abcfpx]?\d*)\/(?<changeset>[a-zA-Z0-9]+)/);
36489+ core.debug(`Release page content: \n${responseText}`);
36490+ const match = responseText.match(/unityhub:\/\/(?<version>\d+\.\d+\.\d+[abcfpx]?\d*)\/(?<changeset>[a-zA-Z0-9]+)/);
3646436491 if (match && match.groups && match.groups.changeset) {
3646536492 return new unity_version_1.UnityVersion(match.groups.version, match.groups.changeset, unityVersion.architecture);
3646636493 }
0 commit comments