Initial Support for Windows Based Builds (#305)
* Implemented logic for windows based docker builds. Moved dockerfiles and scripts to platform specific folders. * Add missing newline character * Add build-tests for windows and a unity project configured to output il2cpp * Add additional build targets (uwp and tvOS) Adjustments to build scripts to not require win10 sdk when not needed (tvOS) Platform-based prereq setup Setup image tags for the new platforms with errors if building on the wrong base os Rename test-project-il2cpp to test-project-windows to be used for all windows based project building (IL2CPP backend selected instead of mono) Fix tests to be platform based * Update dist/platforms/windows/steps/return_license.ps1 Co-authored-by: Webber Takken <webber.nl@gmail.com> * Update src/model/docker.ts Co-authored-by: Webber Takken <webber.nl@gmail.com> * Update src/model/docker.ts Co-authored-by: Webber Takken <webber.nl@gmail.com> * Update src/model/docker.ts Co-authored-by: Webber Takken <webber.nl@gmail.com> * Fix outdated repository and homepage links in dockerfiles * Fix comment style and rename validateWindowsPrereqs to validateWindowsPlatformRequirements * Remove redundant comment * Remove windows unity test project, add ProjectSettings for the il2cpp backend, and add logic to replace the projectsettings file with the il2cpp one on windows test builds. * Fix action.test.ts to accept windows as a base platform * Fix camelcase for wsaPlayer * Switch from add to copy in windows dockerfile * Change slash direction * Switch ADD to COPY to conform with best practices, change ls to dir on windows dockerfile * Improve error message for unset UNITY_EMAIL and UNITY_PASSWORD * Further improve missing email and password error. Remove temppaths being mounted to docker image * Add debug statement. TODO: Remove these * Add more debug * Explicitly pass in unity email to docker run * Remove debug and fix environment variables for activation/deactivation scripts * Prevent Unity serial from leaking to console * Debug folder listings * More debug print dirs * fix debug print path * fix reg export command * Remove debug directory listings and try setSecret to mask serial * Update src/model/action.ts Co-authored-by: Webber Takken <webber.nl@gmail.com> * Update src/model/docker.ts Co-authored-by: Webber Takken <webber.nl@gmail.com> * Update src/model/image-tag.ts Co-authored-by: David Finol <davidmfinol@gmail.com> * Update .github/workflows/build-tests.yml Co-authored-by: David Finol <davidmfinol@gmail.com> * Move platform validation and setup out of docker and into its own layer, remove branching on docker run command * Fix test failure due to missing license * Fix camelCase and duplicate variables * Fix lint issues and make paths more understandable * Fix typo in build-tests.yml * Fix move command in build-tests.yml * Different method to force move file * Fix missing quote and backslash * Pass unity email and password to builder action for windows build tests * Push serial to windows test builds * Make windows build tests only run on push to main Co-authored-by: Webber Takken <webber.nl@gmail.com> Co-authored-by: David Finol <davidmfinol@gmail.com>
This commit is contained in:
438
dist/index.js
generated
vendored
438
dist/index.js
generated
vendored
@@ -35,9 +35,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
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 }));
|
||||
const core = __importStar(__webpack_require__(42186));
|
||||
const model_1 = __webpack_require__(41359);
|
||||
const platform_setup_1 = __importDefault(__webpack_require__(64423));
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
@@ -59,6 +63,7 @@ function run() {
|
||||
// default and local case
|
||||
default:
|
||||
core.info('Building locally');
|
||||
platform_setup_1.default.setup(buildParameters);
|
||||
builtImage = yield model_1.Docker.build({ path: actionFolder, dockerfile, baseImage });
|
||||
yield model_1.Docker.run(builtImage, Object.assign({ workspace }, buildParameters));
|
||||
break;
|
||||
@@ -88,7 +93,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const path_1 = __importDefault(__webpack_require__(85622));
|
||||
class Action {
|
||||
static get supportedPlatforms() {
|
||||
return ['linux'];
|
||||
return ['linux', 'win32'];
|
||||
}
|
||||
static get isRunningLocally() {
|
||||
return process.env.RUNNER_WORKSPACE === undefined;
|
||||
@@ -109,7 +114,15 @@ class Action {
|
||||
return `${Action.rootFolder}/dist`;
|
||||
}
|
||||
static get dockerfile() {
|
||||
return `${Action.actionFolder}/Dockerfile`;
|
||||
const currentPlatform = process.platform;
|
||||
switch (currentPlatform) {
|
||||
case 'linux':
|
||||
return `${Action.actionFolder}/platforms/ubuntu/Dockerfile`;
|
||||
case 'win32':
|
||||
return `${Action.actionFolder}/platforms/windows/Dockerfile`;
|
||||
default:
|
||||
throw new Error(`No Dockerfile for currently unsupported platform: ${currentPlatform}`);
|
||||
}
|
||||
}
|
||||
static get workspace() {
|
||||
return process.env.GITHUB_WORKSPACE;
|
||||
@@ -194,6 +207,25 @@ exports.default = AndroidVersioning;
|
||||
|
||||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
@@ -207,6 +239,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const core = __importStar(__webpack_require__(42186));
|
||||
const android_versioning_1 = __importDefault(__webpack_require__(43059));
|
||||
const input_1 = __importDefault(__webpack_require__(91933));
|
||||
const platform_1 = __importDefault(__webpack_require__(9707));
|
||||
@@ -220,9 +253,25 @@ class BuildParameters {
|
||||
const buildVersion = yield versioning_1.default.determineVersion(input_1.default.versioningStrategy, input_1.default.specifiedVersion);
|
||||
const androidVersionCode = android_versioning_1.default.determineVersionCode(buildVersion, input_1.default.androidVersionCode);
|
||||
const androidSdkManagerParameters = android_versioning_1.default.determineSdkManagerParameters(input_1.default.androidTargetSdkVersion);
|
||||
let unitySerial = '';
|
||||
if (!process.env.UNITY_SERIAL) {
|
||||
//No serial was present so it is a personal license that we need to convert
|
||||
if (!process.env.UNITY_LICENSE) {
|
||||
throw new Error(`Missing Unity License File and no Serial was found. If this
|
||||
is a personal license, make sure to follow the activation
|
||||
steps and set the UNITY_LICENSE GitHub secret or enter a Unity
|
||||
serial number inside the UNITY_SERIAL GitHub secret.`);
|
||||
}
|
||||
unitySerial = this.getSerialFromLicenseFile(process.env.UNITY_LICENSE);
|
||||
}
|
||||
else {
|
||||
unitySerial = process.env.UNITY_SERIAL;
|
||||
}
|
||||
core.setSecret(unitySerial);
|
||||
return {
|
||||
version: unityVersion,
|
||||
customImage: input_1.default.customImage,
|
||||
unitySerial,
|
||||
runnerTempPath: process.env.RUNNER_TEMP,
|
||||
platform: input_1.default.targetPlatform,
|
||||
projectPath: input_1.default.projectPath,
|
||||
@@ -263,6 +312,17 @@ class BuildParameters {
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
static getSerialFromLicenseFile(license) {
|
||||
const startKey = `<DeveloperData Value="`;
|
||||
const endKey = `"/>`;
|
||||
const startIndex = license.indexOf(startKey) + startKey.length;
|
||||
if (startIndex < 0) {
|
||||
throw new Error(`License File was corrupted, unable to locate serial`);
|
||||
}
|
||||
const endIndex = license.indexOf(endKey, startIndex);
|
||||
// Slice off the first 4 characters as they are garbage values
|
||||
return Buffer.from(license.slice(startIndex, endIndex), 'base64').toString('binary').slice(4);
|
||||
}
|
||||
}
|
||||
exports.default = BuildParameters;
|
||||
|
||||
@@ -359,61 +419,77 @@ class Docker {
|
||||
}
|
||||
static run(image, parameters, silent = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { version, workspace, runnerTempPath, platform, projectPath, buildName, buildPath, buildFile, buildMethod, buildVersion, androidVersionCode, androidKeystoreName, androidKeystoreBase64, androidKeystorePass, androidKeyaliasName, androidKeyaliasPass, androidTargetSdkVersion, androidSdkManagerParameters, customParameters, sshAgent, gitPrivateToken, chownFilesTo, } = parameters;
|
||||
const command = `docker run \
|
||||
--workdir /github/workspace \
|
||||
--rm \
|
||||
--env UNITY_LICENSE \
|
||||
--env UNITY_LICENSE_FILE \
|
||||
--env UNITY_EMAIL \
|
||||
--env UNITY_PASSWORD \
|
||||
--env UNITY_SERIAL \
|
||||
--env UNITY_VERSION="${version}" \
|
||||
--env USYM_UPLOAD_AUTH_TOKEN \
|
||||
--env PROJECT_PATH="${projectPath}" \
|
||||
--env BUILD_TARGET="${platform}" \
|
||||
--env BUILD_NAME="${buildName}" \
|
||||
--env BUILD_PATH="${buildPath}" \
|
||||
--env BUILD_FILE="${buildFile}" \
|
||||
--env BUILD_METHOD="${buildMethod}" \
|
||||
--env VERSION="${buildVersion}" \
|
||||
--env ANDROID_VERSION_CODE="${androidVersionCode}" \
|
||||
--env ANDROID_KEYSTORE_NAME="${androidKeystoreName}" \
|
||||
--env ANDROID_KEYSTORE_BASE64="${androidKeystoreBase64}" \
|
||||
--env ANDROID_KEYSTORE_PASS="${androidKeystorePass}" \
|
||||
--env ANDROID_KEYALIAS_NAME="${androidKeyaliasName}" \
|
||||
--env ANDROID_KEYALIAS_PASS="${androidKeyaliasPass}" \
|
||||
--env ANDROID_TARGET_SDK_VERSION="${androidTargetSdkVersion}" \
|
||||
--env ANDROID_SDK_MANAGER_PARAMETERS="${androidSdkManagerParameters}" \
|
||||
--env CUSTOM_PARAMETERS="${customParameters}" \
|
||||
--env CHOWN_FILES_TO="${chownFilesTo}" \
|
||||
--env GITHUB_REF \
|
||||
--env GITHUB_SHA \
|
||||
--env GITHUB_REPOSITORY \
|
||||
--env GITHUB_ACTOR \
|
||||
--env GITHUB_WORKFLOW \
|
||||
--env GITHUB_HEAD_REF \
|
||||
--env GITHUB_BASE_REF \
|
||||
--env GITHUB_EVENT_NAME \
|
||||
--env GITHUB_WORKSPACE=/github/workspace \
|
||||
--env GITHUB_ACTION \
|
||||
--env GITHUB_EVENT_PATH \
|
||||
--env RUNNER_OS \
|
||||
--env RUNNER_TOOL_CACHE \
|
||||
--env RUNNER_TEMP \
|
||||
--env RUNNER_WORKSPACE \
|
||||
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
|
||||
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
|
||||
--volume "/var/run/docker.sock":"/var/run/docker.sock" \
|
||||
--volume "${runnerTempPath}/_github_home":"/root" \
|
||||
--volume "${runnerTempPath}/_github_workflow":"/github/workflow" \
|
||||
--volume "${workspace}":"/github/workspace" \
|
||||
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
||||
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''} \
|
||||
${image}`;
|
||||
yield exec_1.exec(command, undefined, { silent });
|
||||
const { version, workspace, unitySerial, runnerTempPath, platform, projectPath, buildName, buildPath, buildFile, buildMethod, buildVersion, androidVersionCode, androidKeystoreName, androidKeystoreBase64, androidKeystorePass, androidKeyaliasName, androidKeyaliasPass, androidTargetSdkVersion, androidSdkManagerParameters, customParameters, sshAgent, gitPrivateToken, chownFilesTo, } = parameters;
|
||||
const baseOsSpecificArguments = this.getBaseOsSpecificArguments(process.platform, workspace, unitySerial, runnerTempPath, sshAgent);
|
||||
const runCommand = `docker run \
|
||||
--workdir /github/workspace \
|
||||
--rm \
|
||||
--env UNITY_LICENSE \
|
||||
--env UNITY_LICENSE_FILE \
|
||||
--env UNITY_EMAIL \
|
||||
--env UNITY_PASSWORD \
|
||||
--env UNITY_VERSION="${version}" \
|
||||
--env USYM_UPLOAD_AUTH_TOKEN \
|
||||
--env PROJECT_PATH="${projectPath}" \
|
||||
--env BUILD_TARGET="${platform}" \
|
||||
--env BUILD_NAME="${buildName}" \
|
||||
--env BUILD_PATH="${buildPath}" \
|
||||
--env BUILD_FILE="${buildFile}" \
|
||||
--env BUILD_METHOD="${buildMethod}" \
|
||||
--env VERSION="${buildVersion}" \
|
||||
--env ANDROID_VERSION_CODE="${androidVersionCode}" \
|
||||
--env ANDROID_KEYSTORE_NAME="${androidKeystoreName}" \
|
||||
--env ANDROID_KEYSTORE_BASE64="${androidKeystoreBase64}" \
|
||||
--env ANDROID_KEYSTORE_PASS="${androidKeystorePass}" \
|
||||
--env ANDROID_KEYALIAS_NAME="${androidKeyaliasName}" \
|
||||
--env ANDROID_KEYALIAS_PASS="${androidKeyaliasPass}" \
|
||||
--env ANDROID_TARGET_SDK_VERSION="${androidTargetSdkVersion}" \
|
||||
--env ANDROID_SDK_MANAGER_PARAMETERS="${androidSdkManagerParameters}" \
|
||||
--env CUSTOM_PARAMETERS="${customParameters}" \
|
||||
--env CHOWN_FILES_TO="${chownFilesTo}" \
|
||||
--env GITHUB_REF \
|
||||
--env GITHUB_SHA \
|
||||
--env GITHUB_REPOSITORY \
|
||||
--env GITHUB_ACTOR \
|
||||
--env GITHUB_WORKFLOW \
|
||||
--env GITHUB_HEAD_REF \
|
||||
--env GITHUB_BASE_REF \
|
||||
--env GITHUB_EVENT_NAME \
|
||||
--env GITHUB_WORKSPACE=/github/workspace \
|
||||
--env GITHUB_ACTION \
|
||||
--env GITHUB_EVENT_PATH \
|
||||
--env RUNNER_OS \
|
||||
--env RUNNER_TOOL_CACHE \
|
||||
--env RUNNER_TEMP \
|
||||
--env RUNNER_WORKSPACE \
|
||||
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
|
||||
${baseOsSpecificArguments} \
|
||||
${image}`;
|
||||
yield exec_1.exec(runCommand, undefined, { silent });
|
||||
});
|
||||
}
|
||||
static getBaseOsSpecificArguments(baseOs, workspace, unitySerial, runnerTemporaryPath, sshAgent) {
|
||||
switch (baseOs) {
|
||||
case 'linux':
|
||||
return `--env UNITY_SERIAL \
|
||||
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
|
||||
--volume "/var/run/docker.sock":"/var/run/docker.sock" \
|
||||
--volume "${runnerTemporaryPath}/_github_home":"/root" \
|
||||
--volume "${runnerTemporaryPath}/_github_workflow":"/github/workflow" \
|
||||
--volume "${workspace}":"/github/workspace" \
|
||||
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
||||
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''}`;
|
||||
case 'win32':
|
||||
return `--env UNITY_SERIAL="${unitySerial}" \
|
||||
--volume "${workspace}":"c:/github/workspace" \
|
||||
--volume "c:/regkeys":"c:/regkeys" \
|
||||
--volume "C:/Program Files (x86)/Microsoft Visual Studio":"C:/Program Files (x86)/Microsoft Visual Studio" \
|
||||
--volume "C:/Program Files (x86)/Windows Kits":"C:/Program Files (x86)/Windows Kits" \
|
||||
--volume "C:/ProgramData/Microsoft/VisualStudio":"C:/ProgramData/Microsoft/VisualStudio"`;
|
||||
//Note: When upgrading to Server 2022, we will need to move to just "program files" since VS will be 64-bit
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
exports.default = Docker;
|
||||
|
||||
@@ -487,23 +563,36 @@ class ImageTag {
|
||||
webgl: 'webgl',
|
||||
mac: 'mac-mono',
|
||||
windows: 'windows-mono',
|
||||
windowsIl2cpp: 'windows-il2cpp',
|
||||
wsaPlayer: 'universal-windows-platform',
|
||||
linux: 'base',
|
||||
linuxIl2cpp: 'linux-il2cpp',
|
||||
android: 'android',
|
||||
ios: 'ios',
|
||||
tvos: 'appletv',
|
||||
facebook: 'facebook',
|
||||
};
|
||||
}
|
||||
static getTargetPlatformToImageSuffixMap(platform, version) {
|
||||
const { generic, webgl, mac, windows, linux, linuxIl2cpp, android, ios, facebook } = ImageTag.imageSuffixes;
|
||||
const { generic, webgl, mac, windows, windowsIl2cpp, wsaPlayer, linux, linuxIl2cpp, android, ios, tvos, facebook, } = ImageTag.imageSuffixes;
|
||||
const [major, minor] = version.split('.').map((digit) => Number(digit));
|
||||
// @see: https://docs.unity3d.com/ScriptReference/BuildTarget.html
|
||||
switch (platform) {
|
||||
case platform_1.default.types.StandaloneOSX:
|
||||
return mac;
|
||||
case platform_1.default.types.StandaloneWindows:
|
||||
return windows;
|
||||
case platform_1.default.types.StandaloneWindows64:
|
||||
// Can only build windows-il2cpp on a windows based system
|
||||
if (process.platform === 'win32') {
|
||||
// Unity versions before 2019.3 do not support il2cpp
|
||||
if (major >= 2020 || (major === 2019 && minor >= 3)) {
|
||||
return windowsIl2cpp;
|
||||
}
|
||||
else {
|
||||
throw new Error(`Windows-based builds are only supported on 2019.3.X+ versions of Unity.
|
||||
If you are trying to build for windows-mono, please use a Linux based OS.`);
|
||||
}
|
||||
}
|
||||
return windows;
|
||||
case platform_1.default.types.StandaloneLinux64: {
|
||||
// Unity versions before 2019.3 do not support il2cpp
|
||||
@@ -519,13 +608,19 @@ class ImageTag {
|
||||
case platform_1.default.types.WebGL:
|
||||
return webgl;
|
||||
case platform_1.default.types.WSAPlayer:
|
||||
return windows;
|
||||
if (process.platform !== 'win32') {
|
||||
throw new Error(`WSAPlayer can only be built on a windows base OS`);
|
||||
}
|
||||
return wsaPlayer;
|
||||
case platform_1.default.types.PS4:
|
||||
return windows;
|
||||
case platform_1.default.types.XboxOne:
|
||||
return windows;
|
||||
case platform_1.default.types.tvOS:
|
||||
return windows;
|
||||
if (process.platform !== 'win32') {
|
||||
throw new Error(`tvOS can only be built on a windows base OS`);
|
||||
}
|
||||
return tvos;
|
||||
case platform_1.default.types.Switch:
|
||||
return windows;
|
||||
// Unsupported
|
||||
@@ -549,7 +644,15 @@ class ImageTag {
|
||||
}
|
||||
}
|
||||
get tag() {
|
||||
return `${this.version}-${this.builderPlatform}`.replace(/-+$/, '');
|
||||
//We check the host os so we know what type of the images we need to pull
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
return `windows-${this.version}-${this.builderPlatform}`.replace(/-+$/, '');
|
||||
case 'linux':
|
||||
return `${this.version}-${this.builderPlatform}`.replace(/-+$/, '');
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
get image() {
|
||||
return `${this.repository}/${this.name}`.replace(/^\/+/, '');
|
||||
@@ -1113,6 +1216,162 @@ class Output {
|
||||
exports.default = Output;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 64423:
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
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 }));
|
||||
const setup_windows_1 = __importDefault(__webpack_require__(37449));
|
||||
const validate_windows_1 = __importDefault(__webpack_require__(41563));
|
||||
class PlatformSetup {
|
||||
static setup(buildParameters) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
validate_windows_1.default.validate(buildParameters);
|
||||
setup_windows_1.default.setup(buildParameters);
|
||||
break;
|
||||
//Add other baseOS's here
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.default = PlatformSetup;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 37449:
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
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 }));
|
||||
const exec_1 = __webpack_require__(71514);
|
||||
const fs_1 = __importDefault(__webpack_require__(35747));
|
||||
class SetupWindows {
|
||||
static setup(buildParameters) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield SetupWindows.setupWindowsRun(buildParameters.platform);
|
||||
});
|
||||
}
|
||||
//Setup prerequisite files/folders for a windows-based docker run
|
||||
static setupWindowsRun(platform, silent = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!fs_1.default.existsSync('c:/regkeys')) {
|
||||
fs_1.default.mkdirSync('c:/regkeys');
|
||||
}
|
||||
switch (platform) {
|
||||
//These all need the Windows 10 SDK
|
||||
case 'StandaloneWindows':
|
||||
case 'StandaloneWindows64':
|
||||
case 'WSAPlayer':
|
||||
this.generateWinSDKRegKeys(silent);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
static generateWinSDKRegKeys(silent = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Export registry keys that point to the location of the windows 10 sdk
|
||||
const exportWinSDKRegKeysCommand = 'reg export "HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0" c:/regkeys/winsdk.reg /y';
|
||||
yield exec_1.exec(exportWinSDKRegKeysCommand, undefined, { silent });
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.default = SetupWindows;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 41563:
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const fs_1 = __importDefault(__webpack_require__(35747));
|
||||
class ValidateWindows {
|
||||
static validate(buildParameters) {
|
||||
ValidateWindows.validateWindowsPlatformRequirements(buildParameters.platform);
|
||||
if (!(process.env.UNITY_EMAIL && process.env.UNITY_PASSWORD)) {
|
||||
throw new Error(`Unity email and password must be set for Windows based builds to
|
||||
authenticate the license. Make sure to set them inside UNITY_EMAIL
|
||||
and UNITY_PASSWORD in Github Secrets and pass them into the environment.`);
|
||||
}
|
||||
}
|
||||
static validateWindowsPlatformRequirements(platform) {
|
||||
switch (platform) {
|
||||
case 'StandaloneWindows':
|
||||
this.checkForVisualStudio();
|
||||
this.checkForWin10SDK();
|
||||
break;
|
||||
case 'StandaloneWindows64':
|
||||
this.checkForVisualStudio();
|
||||
this.checkForWin10SDK();
|
||||
break;
|
||||
case 'WSAPlayer':
|
||||
this.checkForVisualStudio();
|
||||
this.checkForWin10SDK();
|
||||
break;
|
||||
case 'tvOS':
|
||||
this.checkForVisualStudio();
|
||||
break;
|
||||
}
|
||||
}
|
||||
static checkForWin10SDK() {
|
||||
//Check for Windows 10 SDK on runner
|
||||
const windows10SDKPathExists = fs_1.default.existsSync('C:/Program Files (x86)/Windows Kits');
|
||||
if (!windows10SDKPathExists) {
|
||||
throw new Error(`Windows 10 SDK not found in default location. Make sure
|
||||
the runner has a Windows 10 SDK installed in the default
|
||||
location.`);
|
||||
}
|
||||
}
|
||||
static checkForVisualStudio() {
|
||||
//Note: When upgrading to Server 2022, we will need to move to just "program files" since VS will be 64-bit
|
||||
const visualStudioInstallPathExists = fs_1.default.existsSync('C:/Program Files (x86)/Microsoft Visual Studio');
|
||||
const visualStudioDataPathExists = fs_1.default.existsSync('C:/ProgramData/Microsoft/VisualStudio');
|
||||
if (!visualStudioInstallPathExists || !visualStudioDataPathExists) {
|
||||
throw new Error(`Visual Studio not found at the default location.
|
||||
Make sure the runner has Visual Studio installed in the
|
||||
default location`);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.default = ValidateWindows;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9707:
|
||||
@@ -2468,6 +2727,7 @@ class Versioning {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const numberOfCommitsAsString = yield system_1.default.run('sh', undefined, {
|
||||
input: Buffer.from('git tag --list --merged HEAD | grep v[0-9]* | wc -l'),
|
||||
cwd: this.projectPath,
|
||||
silent: false,
|
||||
});
|
||||
const numberOfCommits = Number.parseInt(numberOfCommitsAsString, 10);
|
||||
@@ -129104,8 +129364,6 @@ module.exports.MaxBufferError = MaxBufferError;
|
||||
/***/ 47625:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
exports.alphasort = alphasort
|
||||
exports.alphasorti = alphasorti
|
||||
exports.setopts = setopts
|
||||
exports.ownProp = ownProp
|
||||
exports.makeAbs = makeAbs
|
||||
@@ -129118,17 +129376,14 @@ function ownProp (obj, field) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, field)
|
||||
}
|
||||
|
||||
var fs = __webpack_require__(35747)
|
||||
var path = __webpack_require__(85622)
|
||||
var minimatch = __webpack_require__(83973)
|
||||
var isAbsolute = __webpack_require__(38714)
|
||||
var Minimatch = minimatch.Minimatch
|
||||
|
||||
function alphasorti (a, b) {
|
||||
return a.toLowerCase().localeCompare(b.toLowerCase())
|
||||
}
|
||||
|
||||
function alphasort (a, b) {
|
||||
return a.localeCompare(b)
|
||||
return a.localeCompare(b, 'en')
|
||||
}
|
||||
|
||||
function setupIgnores (self, options) {
|
||||
@@ -129187,6 +129442,7 @@ function setopts (self, pattern, options) {
|
||||
self.stat = !!options.stat
|
||||
self.noprocess = !!options.noprocess
|
||||
self.absolute = !!options.absolute
|
||||
self.fs = options.fs || fs
|
||||
|
||||
self.maxLength = options.maxLength || Infinity
|
||||
self.cache = options.cache || Object.create(null)
|
||||
@@ -129256,7 +129512,7 @@ function finish (self) {
|
||||
all = Object.keys(all)
|
||||
|
||||
if (!self.nosort)
|
||||
all = all.sort(self.nocase ? alphasorti : alphasort)
|
||||
all = all.sort(alphasort)
|
||||
|
||||
// at *some* point we statted all of these
|
||||
if (self.mark) {
|
||||
@@ -129393,7 +129649,6 @@ function childrenIgnored (self, path) {
|
||||
|
||||
module.exports = glob
|
||||
|
||||
var fs = __webpack_require__(35747)
|
||||
var rp = __webpack_require__(46863)
|
||||
var minimatch = __webpack_require__(83973)
|
||||
var Minimatch = minimatch.Minimatch
|
||||
@@ -129404,8 +129659,6 @@ var assert = __webpack_require__(42357)
|
||||
var isAbsolute = __webpack_require__(38714)
|
||||
var globSync = __webpack_require__(29010)
|
||||
var common = __webpack_require__(47625)
|
||||
var alphasort = common.alphasort
|
||||
var alphasorti = common.alphasorti
|
||||
var setopts = common.setopts
|
||||
var ownProp = common.ownProp
|
||||
var inflight = __webpack_require__(52492)
|
||||
@@ -129856,7 +130109,7 @@ Glob.prototype._readdirInGlobStar = function (abs, cb) {
|
||||
var lstatcb = inflight(lstatkey, lstatcb_)
|
||||
|
||||
if (lstatcb)
|
||||
fs.lstat(abs, lstatcb)
|
||||
self.fs.lstat(abs, lstatcb)
|
||||
|
||||
function lstatcb_ (er, lstat) {
|
||||
if (er && er.code === 'ENOENT')
|
||||
@@ -129897,7 +130150,7 @@ Glob.prototype._readdir = function (abs, inGlobStar, cb) {
|
||||
}
|
||||
|
||||
var self = this
|
||||
fs.readdir(abs, readdirCb(this, abs, cb))
|
||||
self.fs.readdir(abs, readdirCb(this, abs, cb))
|
||||
}
|
||||
|
||||
function readdirCb (self, abs, cb) {
|
||||
@@ -130101,13 +130354,13 @@ Glob.prototype._stat = function (f, cb) {
|
||||
var self = this
|
||||
var statcb = inflight('stat\0' + abs, lstatcb_)
|
||||
if (statcb)
|
||||
fs.lstat(abs, statcb)
|
||||
self.fs.lstat(abs, statcb)
|
||||
|
||||
function lstatcb_ (er, lstat) {
|
||||
if (lstat && lstat.isSymbolicLink()) {
|
||||
// If it's a symlink, then treat it as the target, unless
|
||||
// the target does not exist, then treat it as a file.
|
||||
return fs.stat(abs, function (er, stat) {
|
||||
return self.fs.stat(abs, function (er, stat) {
|
||||
if (er)
|
||||
self._stat2(f, abs, null, lstat, cb)
|
||||
else
|
||||
@@ -130151,7 +130404,6 @@ Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
|
||||
module.exports = globSync
|
||||
globSync.GlobSync = GlobSync
|
||||
|
||||
var fs = __webpack_require__(35747)
|
||||
var rp = __webpack_require__(46863)
|
||||
var minimatch = __webpack_require__(83973)
|
||||
var Minimatch = minimatch.Minimatch
|
||||
@@ -130161,8 +130413,6 @@ var path = __webpack_require__(85622)
|
||||
var assert = __webpack_require__(42357)
|
||||
var isAbsolute = __webpack_require__(38714)
|
||||
var common = __webpack_require__(47625)
|
||||
var alphasort = common.alphasort
|
||||
var alphasorti = common.alphasorti
|
||||
var setopts = common.setopts
|
||||
var ownProp = common.ownProp
|
||||
var childrenIgnored = common.childrenIgnored
|
||||
@@ -130398,7 +130648,7 @@ GlobSync.prototype._readdirInGlobStar = function (abs) {
|
||||
var lstat
|
||||
var stat
|
||||
try {
|
||||
lstat = fs.lstatSync(abs)
|
||||
lstat = this.fs.lstatSync(abs)
|
||||
} catch (er) {
|
||||
if (er.code === 'ENOENT') {
|
||||
// lstat failed, doesn't exist
|
||||
@@ -130435,7 +130685,7 @@ GlobSync.prototype._readdir = function (abs, inGlobStar) {
|
||||
}
|
||||
|
||||
try {
|
||||
return this._readdirEntries(abs, fs.readdirSync(abs))
|
||||
return this._readdirEntries(abs, this.fs.readdirSync(abs))
|
||||
} catch (er) {
|
||||
this._readdirError(abs, er)
|
||||
return null
|
||||
@@ -130594,7 +130844,7 @@ GlobSync.prototype._stat = function (f) {
|
||||
if (!stat) {
|
||||
var lstat
|
||||
try {
|
||||
lstat = fs.lstatSync(abs)
|
||||
lstat = this.fs.lstatSync(abs)
|
||||
} catch (er) {
|
||||
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
|
||||
this.statCache[abs] = false
|
||||
@@ -130604,7 +130854,7 @@ GlobSync.prototype._stat = function (f) {
|
||||
|
||||
if (lstat && lstat.isSymbolicLink()) {
|
||||
try {
|
||||
stat = fs.statSync(abs)
|
||||
stat = this.fs.statSync(abs)
|
||||
} catch (er) {
|
||||
stat = lstat
|
||||
}
|
||||
@@ -171451,7 +171701,24 @@ function execSync(cmd, opts, pipe) {
|
||||
stderrFile: stderrFile,
|
||||
};
|
||||
|
||||
fs.writeFileSync(paramsFile, JSON.stringify(paramsToSerialize), 'utf8');
|
||||
// Create the files and ensure these are locked down (for read and write) to
|
||||
// the current user. The main concerns here are:
|
||||
//
|
||||
// * If we execute a command which prints sensitive output, then
|
||||
// stdoutFile/stderrFile must not be readable by other users.
|
||||
// * paramsFile must not be readable by other users, or else they can read it
|
||||
// to figure out the path for stdoutFile/stderrFile and create these first
|
||||
// (locked down to their own access), which will crash exec() when it tries
|
||||
// to write to the files.
|
||||
function writeFileLockedDown(filePath, data) {
|
||||
fs.writeFileSync(filePath, data, {
|
||||
encoding: 'utf8',
|
||||
mode: parseInt('600', 8),
|
||||
});
|
||||
}
|
||||
writeFileLockedDown(stdoutFile, '');
|
||||
writeFileLockedDown(stderrFile, '');
|
||||
writeFileLockedDown(paramsFile, JSON.stringify(paramsToSerialize));
|
||||
|
||||
var execArgs = [
|
||||
__webpack_require__.ab + "exec-child.js",
|
||||
@@ -171494,6 +171761,7 @@ function execSync(cmd, opts, pipe) {
|
||||
}
|
||||
|
||||
// No biggie if we can't erase the files now -- they're in a temp dir anyway
|
||||
// and we locked down permissions (see the note above).
|
||||
try { common.unlinkSync(paramsFile); } catch (e) {}
|
||||
try { common.unlinkSync(stderrFile); } catch (e) {}
|
||||
try { common.unlinkSync(stdoutFile); } catch (e) {}
|
||||
@@ -197077,7 +197345,7 @@ let fillPool = bytes => {
|
||||
poolOffset += bytes
|
||||
}
|
||||
let random = bytes => {
|
||||
fillPool(bytes)
|
||||
fillPool((bytes -= 0))
|
||||
return pool.subarray(poolOffset - bytes, poolOffset)
|
||||
}
|
||||
let customRandom = (alphabet, size, getRandom) => {
|
||||
@@ -197097,7 +197365,7 @@ let customRandom = (alphabet, size, getRandom) => {
|
||||
}
|
||||
let customAlphabet = (alphabet, size) => customRandom(alphabet, size, random)
|
||||
let nanoid = (size = 21) => {
|
||||
fillPool(size)
|
||||
fillPool((size -= 0))
|
||||
let id = ''
|
||||
for (let i = poolOffset - size; i < poolOffset; i++) {
|
||||
id += urlAlphabet[pool[i] & 63]
|
||||
|
||||
Reference in New Issue
Block a user