Further migrate mac scripts to align with linux scripts

pull/326/head
Andrew Kahr 2022-01-26 14:37:57 -08:00
parent 4a3b6dab05
commit 039a8e2029
7 changed files with 71 additions and 62 deletions

49
dist/index.js vendored
View File

@ -1217,8 +1217,10 @@ const exec_1 = __webpack_require__(71514);
class MacBuilder {
static run(actionFolder, workspace, buildParameters, silent = false) {
return __awaiter(this, void 0, void 0, function* () {
const command = `bash`;
yield exec_1.exec(command, [`-x`, `${actionFolder}/platforms/mac/entrypoint.sh`], { silent });
yield exec_1.exec('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], {
silent,
cwd: `${actionFolder}/platforms/mac`,
});
});
}
}
@ -1343,6 +1345,30 @@ class SetupMac {
yield SetupMac.installUnityHub();
yield SetupMac.installUnity(buildParameters);
}
yield SetupMac.setEnvironmentVariables(buildParameters, actionFolder);
});
}
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, undefined, { 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, undefined, { silent });
});
}
static setEnvironmentVariables(buildParameters, actionFolder) {
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
//the scripts on the host for mac
@ -1369,25 +1395,6 @@ class SetupMac {
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, undefined, { 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, undefined, { silent });
});
}
}
SetupMac.unityHubPath = `"/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"`;
exports.default = SetupMac;

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,12 +1,25 @@
#!/usr/bin/env bash
#
# Create directory for license activation
#
# Make directory for license
sudo mkdir /Library/Application\ Support/Unity
sudo chmod -R 777 /Library/Application\ Support/Unity
#
# Run steps
#
source $ACTION_FOLDER/platforms/mac/steps/setup.sh
source $ACTION_FOLDER/platforms/mac/steps/activate.sh
source $ACTION_FOLDER/platforms/mac/steps/build.sh
source $ACTION_FOLDER/platforms/mac/steps/return_license.sh
source /steps/activate.sh
source /steps/build.sh
source /steps/return_license.sh
#
# Remove license activation directory
#
sudo rm -r /Library/Application\ Support/Unity
#
# Instructions for debugging

View File

@ -2,10 +2,6 @@
echo "Requesting activation"
# Make directory for license
sudo mkdir /Library/Application\ Support/Unity
sudo chmod -R 777 /Library/Application\ Support/Unity
# Activate license
/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS/Unity \
-logFile /dev/stdout \

View File

@ -1,13 +0,0 @@
#!/usr/bin/env bash
echo "Installing Unity Hub"
brew install unity-hub
echo "Installing Unity Editor $UNITY_VERSION ($UNITY_CHANGESET)"
/Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install \
--version $UNITY_VERSION \
--changeset $UNITY_CHANGESET \
--module mac-il2cpp \
--childModules

View File

@ -3,8 +3,10 @@ import { BuildParameters } from '.';
class MacBuilder {
public static async run(actionFolder, workspace, buildParameters: BuildParameters, silent = false) {
const command = `bash`;
await exec(command, [`-x`, `${actionFolder}/platforms/mac/entrypoint.sh`], { silent });
await exec('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], {
silent,
cwd: `${actionFolder}/platforms/mac`,
});
}
}

View File

@ -11,6 +11,27 @@ class SetupMac {
await SetupMac.installUnityHub();
await SetupMac.installUnity(buildParameters);
}
await SetupMac.setEnvironmentVariables(buildParameters, actionFolder);
}
private static async installUnityHub(silent = false) {
const command = 'brew install unity-hub';
if (!fs.existsSync(this.unityHubPath)) {
await exec(command, undefined, { 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, undefined, { silent });
}
private static async setEnvironmentVariables(buildParameters: BuildParameters, actionFolder: string) {
const unityChangeset = await getUnityChangeset(buildParameters.version);
//Need to set environment variables from here because we execute
@ -37,23 +58,6 @@ class SetupMac {
process.env.CUSTOM_PARAMETERS = buildParameters.customParameters;
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, undefined, { 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, undefined, { silent });
}
}
export default SetupMac;