Try ts setup again

pull/326/head
Andrew Kahr 2022-01-26 14:14:39 -08:00
parent c8c5683763
commit b3c4dc6c2c
3 changed files with 56 additions and 1 deletions

30
dist/index.js vendored
View File

@ -1328,11 +1328,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
const unity_changeset_1 = __webpack_require__(4635); const unity_changeset_1 = __webpack_require__(4635);
const exec_1 = __webpack_require__(71514);
const fs_1 = __importDefault(__webpack_require__(35747));
class SetupMac { class SetupMac {
static setup(buildParameters, actionFolder) { static setup(buildParameters, actionFolder) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const unityEditorPath = `/Applications/Unity/Hub/Editor/${buildParameters.version}/Unity.app/Contents/MacOS/Unity`;
if (!fs_1.default.existsSync(unityEditorPath)) {
yield SetupMac.installUnityHub();
yield SetupMac.installUnity(buildParameters);
}
const unityChangeset = yield unity_changeset_1.getUnityChangeset(buildParameters.version); const unityChangeset = yield unity_changeset_1.getUnityChangeset(buildParameters.version);
//Need to set environment variables from here because we execute //Need to set environment variables from here because we execute
//the scripts on the host for mac //the scripts on the host for mac
@ -1359,7 +1369,27 @@ class SetupMac {
process.env.CHOWN_FILES_TO = buildParameters.chownFilesTo; process.env.CHOWN_FILES_TO = buildParameters.chownFilesTo;
}); });
} }
static installUnityHub(silent = false) {
return __awaiter(this, void 0, void 0, function* () {
const command = 'brew install unity-hub';
if (!fs_1.default.existsSync(this.unityHubPath)) {
yield exec_1.exec(command, [], { silent });
}
});
}
static installUnity(buildParameters, silent = false) {
return __awaiter(this, void 0, void 0, function* () {
const changeset = yield unity_changeset_1.getUnityChangeset(buildParameters.version).changeset;
const command = `${this.unityHubPath} -- --headless install \
--version ${buildParameters.version} \
--changeset ${changeset} \
--module mac-il2cpp \
--childModules`;
yield exec_1.exec(command, [], { silent });
});
}
} }
SetupMac.unityHubPath = '/Applications/Unity\\ Hub.app/Contents/MacOS/Unity\\ Hub';
exports.default = SetupMac; exports.default = SetupMac;

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,16 @@
import { BuildParameters } from '..'; import { BuildParameters } from '..';
import { getUnityChangeset } from 'unity-changeset'; import { getUnityChangeset } from 'unity-changeset';
import { exec } from '@actions/exec';
import fs from 'fs';
class SetupMac { class SetupMac {
static unityHubPath = '/Applications/Unity\\ Hub.app/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.version}/Unity.app/Contents/MacOS/Unity`;
if (!fs.existsSync(unityEditorPath)) {
await SetupMac.installUnityHub();
await SetupMac.installUnity(buildParameters);
}
const unityChangeset = await getUnityChangeset(buildParameters.version); const unityChangeset = await getUnityChangeset(buildParameters.version);
//Need to set environment variables from here because we execute //Need to set environment variables from here because we execute
@ -29,6 +37,23 @@ class SetupMac {
process.env.CUSTOM_PARAMETERS = buildParameters.customParameters; process.env.CUSTOM_PARAMETERS = buildParameters.customParameters;
process.env.CHOWN_FILES_TO = buildParameters.chownFilesTo; process.env.CHOWN_FILES_TO = buildParameters.chownFilesTo;
} }
private static async installUnityHub(silent = false) {
const command = 'brew install unity-hub';
if (!fs.existsSync(this.unityHubPath)) {
await exec(command, [], { silent });
}
}
private static async installUnity(buildParameters: BuildParameters, silent = false) {
const changeset = await getUnityChangeset(buildParameters.version).changeset;
const command = `${this.unityHubPath} -- --headless install \
--version ${buildParameters.version} \
--changeset ${changeset} \
--module mac-il2cpp \
--childModules`;
await exec(command, [], { silent });
}
} }
export default SetupMac; export default SetupMac;