Fix lint issues and make paths more understandable

pull/305/head
Andrew Kahr 2022-01-24 15:39:14 -08:00
parent b16eb09671
commit 3b3ea8c574
4 changed files with 154 additions and 149 deletions

16
dist/index.js vendored
View File

@ -116,9 +116,9 @@ class Action {
static get dockerfile() { static get dockerfile() {
const currentPlatform = process.platform; const currentPlatform = process.platform;
switch (currentPlatform) { switch (currentPlatform) {
case "linux": case 'linux':
return `${Action.actionFolder}/platforms/ubuntu/Dockerfile`; return `${Action.actionFolder}/platforms/ubuntu/Dockerfile`;
case "win32": case 'win32':
return `${Action.actionFolder}/platforms/windows/Dockerfile`; return `${Action.actionFolder}/platforms/windows/Dockerfile`;
default: default:
throw new Error(`No Dockerfile for currently unsupported platform: ${currentPlatform}`); throw new Error(`No Dockerfile for currently unsupported platform: ${currentPlatform}`);
@ -1351,7 +1351,8 @@ class ValidateWindows {
} }
static checkForWin10SDK() { static checkForWin10SDK() {
//Check for Windows 10 SDK on runner //Check for Windows 10 SDK on runner
if (!fs_1.default.existsSync('C:/Program Files (x86)/Windows Kits')) { 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 throw new Error(`Windows 10 SDK not found in default location. Make sure
the runner has a Windows 10 SDK installed in the default the runner has a Windows 10 SDK installed in the default
location.`); location.`);
@ -1359,11 +1360,12 @@ class ValidateWindows {
} }
static checkForVisualStudio() { static checkForVisualStudio() {
//Note: When upgrading to Server 2022, we will need to move to just "program files" since VS will be 64-bit //Note: When upgrading to Server 2022, we will need to move to just "program files" since VS will be 64-bit
if (!(fs_1.default.existsSync('C:/Program Files (x86)/Microsoft Visual Studio') && const visualStudioInstallPathExists = fs_1.default.existsSync('C:/Program Files (x86)/Microsoft Visual Studio');
fs_1.default.existsSync('C:/ProgramData/Microsoft/VisualStudio'))) { const visualStudioDataPathExists = fs_1.default.existsSync('C:/ProgramData/Microsoft/VisualStudio');
if (!visualStudioInstallPathExists || !visualStudioDataPathExists) {
throw new Error(`Visual Studio not found at the default location. throw new Error(`Visual Studio not found at the default location.
Make sure the runner has Visual Studio installed in the Make sure the runner has Visual Studio installed in the
default location`); default location`);
} }
} }
} }

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -32,9 +32,9 @@ class Action {
static get dockerfile() { static get dockerfile() {
const currentPlatform = process.platform; const currentPlatform = process.platform;
switch (currentPlatform) { switch (currentPlatform) {
case "linux": case 'linux':
return `${Action.actionFolder}/platforms/ubuntu/Dockerfile`; return `${Action.actionFolder}/platforms/ubuntu/Dockerfile`;
case "win32": case 'win32':
return `${Action.actionFolder}/platforms/windows/Dockerfile`; return `${Action.actionFolder}/platforms/windows/Dockerfile`;
default: default:
throw new Error(`No Dockerfile for currently unsupported platform: ${currentPlatform}`); throw new Error(`No Dockerfile for currently unsupported platform: ${currentPlatform}`);

View File

@ -3,7 +3,7 @@ import { BuildParameters } from '..';
class ValidateWindows { class ValidateWindows {
public static validate(buildParameters: BuildParameters) { public static validate(buildParameters: BuildParameters) {
ValidateWindows.validateWindowsPlatformRequirements(buildParameters.platform) ValidateWindows.validateWindowsPlatformRequirements(buildParameters.platform);
if (!(process.env.UNITY_EMAIL && process.env.UNITY_PASSWORD)) { if (!(process.env.UNITY_EMAIL && process.env.UNITY_PASSWORD)) {
throw new Error(`Unity email and password must be set for Windows based builds to 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 authenticate the license. Make sure to set them inside UNITY_EMAIL
@ -33,7 +33,8 @@ class ValidateWindows {
private static checkForWin10SDK() { private static checkForWin10SDK() {
//Check for Windows 10 SDK on runner //Check for Windows 10 SDK on runner
if (!fs.existsSync('C:/Program Files (x86)/Windows Kits')) { const windows10SDKPathExists = fs.existsSync('C:/Program Files (x86)/Windows Kits');
if (!windows10SDKPathExists) {
throw new Error(`Windows 10 SDK not found in default location. Make sure throw new Error(`Windows 10 SDK not found in default location. Make sure
the runner has a Windows 10 SDK installed in the default the runner has a Windows 10 SDK installed in the default
location.`); location.`);
@ -42,13 +43,15 @@ class ValidateWindows {
private static checkForVisualStudio() { private static checkForVisualStudio() {
//Note: When upgrading to Server 2022, we will need to move to just "program files" since VS will be 64-bit //Note: When upgrading to Server 2022, we will need to move to just "program files" since VS will be 64-bit
if (!(fs.existsSync('C:/Program Files (x86)/Microsoft Visual Studio') && const visualStudioInstallPathExists = fs.existsSync('C:/Program Files (x86)/Microsoft Visual Studio');
fs.existsSync('C:/ProgramData/Microsoft/VisualStudio'))) { const visualStudioDataPathExists = fs.existsSync('C:/ProgramData/Microsoft/VisualStudio');
throw new Error(`Visual Studio not found at the default location.
Make sure the runner has Visual Studio installed in the if (!visualStudioInstallPathExists || !visualStudioDataPathExists) {
default location`); throw new Error(`Visual Studio not found at the default location.
} Make sure the runner has Visual Studio installed in the
default location`);
} }
}
} }
export default ValidateWindows; export default ValidateWindows;