Fix changeset and remove unneeded env vars

pull/326/head
Andrew Kahr 2022-01-26 14:50:53 -08:00
parent d83c98b09b
commit 2bf0a38fb6
5 changed files with 17 additions and 24 deletions

19
dist/index.js vendored
View File

@ -64,7 +64,7 @@ function run() {
// default and local case // default and local case
default: default:
core.info('Building locally'); core.info('Building locally');
yield platform_setup_1.default.setup(buildParameters, actionFolder); yield platform_setup_1.default.setup(buildParameters);
if (process.platform === 'darwin') { if (process.platform === 'darwin') {
mac_builder_1.default.run(actionFolder, workspace, buildParameters); mac_builder_1.default.run(actionFolder, workspace, buildParameters);
} }
@ -1278,7 +1278,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
const platform_setup_1 = __webpack_require__(2014); const platform_setup_1 = __webpack_require__(2014);
const validate_windows_1 = __importDefault(__webpack_require__(41563)); const validate_windows_1 = __importDefault(__webpack_require__(41563));
class PlatformSetup { class PlatformSetup {
static setup(buildParameters, actionFolder) { static setup(buildParameters) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
switch (process.platform) { switch (process.platform) {
case 'win32': case 'win32':
@ -1286,7 +1286,7 @@ class PlatformSetup {
platform_setup_1.SetupWindows.setup(buildParameters); platform_setup_1.SetupWindows.setup(buildParameters);
break; break;
case 'darwin': case 'darwin':
yield platform_setup_1.SetupMac.setup(buildParameters, actionFolder); yield platform_setup_1.SetupMac.setup(buildParameters);
break; break;
//Add other baseOS's here //Add other baseOS's here
} }
@ -1338,14 +1338,14 @@ const unity_changeset_1 = __webpack_require__(4635);
const exec_1 = __webpack_require__(71514); const exec_1 = __webpack_require__(71514);
const fs_1 = __importDefault(__webpack_require__(35747)); const fs_1 = __importDefault(__webpack_require__(35747));
class SetupMac { class SetupMac {
static setup(buildParameters, actionFolder) { static setup(buildParameters) {
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`; const unityEditorPath = `/Applications/Unity/Hub/Editor/${buildParameters.version}/Unity.app/Contents/MacOS/Unity`;
if (!fs_1.default.existsSync(unityEditorPath)) { if (!fs_1.default.existsSync(unityEditorPath)) {
yield SetupMac.installUnityHub(); yield SetupMac.installUnityHub();
yield SetupMac.installUnity(buildParameters); yield SetupMac.installUnity(buildParameters);
} }
yield SetupMac.setEnvironmentVariables(buildParameters, actionFolder); yield SetupMac.setEnvironmentVariables(buildParameters);
}); });
} }
static installUnityHub(silent = false) { static installUnityHub(silent = false) {
@ -1358,23 +1358,20 @@ class SetupMac {
} }
static installUnity(buildParameters, silent = false) { static installUnity(buildParameters, silent = false) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const changeset = yield unity_changeset_1.getUnityChangeset(buildParameters.version).changeset; const unityChangeset = yield unity_changeset_1.getUnityChangeset(buildParameters.version);
const command = `${this.unityHubPath} -- --headless install \ const command = `${this.unityHubPath} -- --headless install \
--version ${buildParameters.version} \ --version ${buildParameters.version} \
--changeset ${changeset} \ --changeset ${unityChangeset.changeset} \
--module mac-il2cpp \ --module mac-il2cpp \
--childModules`; --childModules`;
yield exec_1.exec(command, undefined, { silent }); yield exec_1.exec(command, undefined, { silent });
}); });
} }
static setEnvironmentVariables(buildParameters, actionFolder) { static setEnvironmentVariables(buildParameters) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
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
process.env.ACTION_FOLDER = actionFolder;
process.env.UNITY_VERSION = buildParameters.version; process.env.UNITY_VERSION = buildParameters.version;
process.env.UNITY_CHANGESET = unityChangeset.changeset;
process.env.UNITY_SERIAL = buildParameters.unitySerial; process.env.UNITY_SERIAL = buildParameters.unitySerial;
process.env.PROJECT_PATH = buildParameters.projectPath; process.env.PROJECT_PATH = buildParameters.projectPath;
process.env.BUILD_TARGET = buildParameters.platform; process.env.BUILD_TARGET = buildParameters.platform;

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -28,7 +28,7 @@ async function run() {
// default and local case // default and local case
default: default:
core.info('Building locally'); core.info('Building locally');
await PlatformSetup.setup(buildParameters, actionFolder); await PlatformSetup.setup(buildParameters);
if (process.platform === 'darwin') { if (process.platform === 'darwin') {
MacBuilder.run(actionFolder, workspace, buildParameters); MacBuilder.run(actionFolder, workspace, buildParameters);
} else { } else {

View File

@ -3,14 +3,14 @@ import { SetupWindows, SetupMac } from './platform-setup/';
import ValidateWindows from './platform-validation/validate-windows'; import ValidateWindows from './platform-validation/validate-windows';
class PlatformSetup { class PlatformSetup {
static async setup(buildParameters: BuildParameters, actionFolder: string) { static async setup(buildParameters: BuildParameters) {
switch (process.platform) { switch (process.platform) {
case 'win32': case 'win32':
ValidateWindows.validate(buildParameters); ValidateWindows.validate(buildParameters);
SetupWindows.setup(buildParameters); SetupWindows.setup(buildParameters);
break; break;
case 'darwin': case 'darwin':
await SetupMac.setup(buildParameters, actionFolder); await SetupMac.setup(buildParameters);
break; break;
//Add other baseOS's here //Add other baseOS's here
} }

View File

@ -5,13 +5,13 @@ import fs from 'fs';
class SetupMac { class SetupMac {
static unityHubPath = `"/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"`; static unityHubPath = `"/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"`;
public static async setup(buildParameters: BuildParameters, actionFolder: string) { public static async setup(buildParameters: BuildParameters) {
const unityEditorPath = `/Applications/Unity/Hub/Editor/${buildParameters.version}/Unity.app/Contents/MacOS/Unity`; const unityEditorPath = `/Applications/Unity/Hub/Editor/${buildParameters.version}/Unity.app/Contents/MacOS/Unity`;
if (!fs.existsSync(unityEditorPath)) { if (!fs.existsSync(unityEditorPath)) {
await SetupMac.installUnityHub(); await SetupMac.installUnityHub();
await SetupMac.installUnity(buildParameters); await SetupMac.installUnity(buildParameters);
} }
await SetupMac.setEnvironmentVariables(buildParameters, actionFolder); await SetupMac.setEnvironmentVariables(buildParameters);
} }
private static async installUnityHub(silent = false) { private static async installUnityHub(silent = false) {
@ -22,23 +22,19 @@ class SetupMac {
} }
private static async installUnity(buildParameters: BuildParameters, silent = false) { private static async installUnity(buildParameters: BuildParameters, silent = false) {
const changeset = await getUnityChangeset(buildParameters.version).changeset; const unityChangeset = await getUnityChangeset(buildParameters.version);
const command = `${this.unityHubPath} -- --headless install \ const command = `${this.unityHubPath} -- --headless install \
--version ${buildParameters.version} \ --version ${buildParameters.version} \
--changeset ${changeset} \ --changeset ${unityChangeset.changeset} \
--module mac-il2cpp \ --module mac-il2cpp \
--childModules`; --childModules`;
await exec(command, undefined, { silent }); await exec(command, undefined, { silent });
} }
private static async setEnvironmentVariables(buildParameters: BuildParameters, actionFolder: string) { private static async setEnvironmentVariables(buildParameters: BuildParameters) {
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
//the scripts on the host for mac //the scripts on the host for mac
process.env.ACTION_FOLDER = actionFolder;
process.env.UNITY_VERSION = buildParameters.version; process.env.UNITY_VERSION = buildParameters.version;
process.env.UNITY_CHANGESET = unityChangeset.changeset;
process.env.UNITY_SERIAL = buildParameters.unitySerial; process.env.UNITY_SERIAL = buildParameters.unitySerial;
process.env.PROJECT_PATH = buildParameters.projectPath; process.env.PROJECT_PATH = buildParameters.projectPath;
process.env.BUILD_TARGET = buildParameters.platform; process.env.BUILD_TARGET = buildParameters.platform;