s/linux64FileExtension/linux64RemoveExecutableExtension/
and the rest that this entails. This PR should probably be squashed before merging, with attention paid to the commit message.pull/726/head
parent
dc38016ce0
commit
20df14858d
|
@ -265,11 +265,11 @@ inputs:
|
||||||
default: 'false'
|
default: 'false'
|
||||||
required: false
|
required: false
|
||||||
description: 'Skip the activation/deactivation of Unity. This assumes Unity is already activated.'
|
description: 'Skip the activation/deactivation of Unity. This assumes Unity is already activated.'
|
||||||
linux64FileExtension:
|
linux64RemoveExecutableExtension:
|
||||||
default: ''
|
default: 'true'
|
||||||
required: false
|
required: false
|
||||||
description:
|
description:
|
||||||
'Specify the file extension of the executable when building for StandaloneLinux64. For example, ".x86_64"'
|
'When building for StandaloneLinux64, remove the default file extension of `.x86_64`. (This matches the behavior of older versions of this action)'
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
volume:
|
volume:
|
||||||
|
|
|
@ -252,7 +252,7 @@ class BuildParameters {
|
||||||
return buildParameters.maxRetainedWorkspaces > 0 && cloud_runner_1.default.lockedWorkspace !== ``;
|
return buildParameters.maxRetainedWorkspaces > 0 && cloud_runner_1.default.lockedWorkspace !== ``;
|
||||||
}
|
}
|
||||||
static async create() {
|
static async create() {
|
||||||
const buildFile = this.parseBuildFile(input_1.default.buildName, input_1.default.targetPlatform, input_1.default.androidExportType, input_1.default.linux64FileExtension);
|
const buildFile = this.parseBuildFile(input_1.default.buildName, input_1.default.targetPlatform, input_1.default.androidExportType, input_1.default.linux64RemoveExecutableExtension);
|
||||||
const editorVersion = unity_versioning_1.default.determineUnityVersion(input_1.default.projectPath, input_1.default.unityVersion);
|
const editorVersion = unity_versioning_1.default.determineUnityVersion(input_1.default.projectPath, input_1.default.unityVersion);
|
||||||
const buildVersion = await versioning_1.default.determineBuildVersion(input_1.default.versioningStrategy, input_1.default.specifiedVersion);
|
const buildVersion = await versioning_1.default.determineBuildVersion(input_1.default.versioningStrategy, input_1.default.specifiedVersion);
|
||||||
const androidVersionCode = android_versioning_1.default.determineVersionCode(buildVersion, input_1.default.androidVersionCode);
|
const androidVersionCode = android_versioning_1.default.determineVersionCode(buildVersion, input_1.default.androidVersionCode);
|
||||||
|
@ -366,7 +366,7 @@ class BuildParameters {
|
||||||
dockerWorkspacePath: input_1.default.dockerWorkspacePath,
|
dockerWorkspacePath: input_1.default.dockerWorkspacePath,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
static parseBuildFile(filename, platform, androidExportType, linux64FileExtension) {
|
static parseBuildFile(filename, platform, androidExportType, linux64RemoveExecutableExtension) {
|
||||||
if (platform_1.default.isWindows(platform)) {
|
if (platform_1.default.isWindows(platform)) {
|
||||||
return `${filename}.exe`;
|
return `${filename}.exe`;
|
||||||
}
|
}
|
||||||
|
@ -382,8 +382,8 @@ class BuildParameters {
|
||||||
throw new Error(`Unknown Android Export Type: ${androidExportType}. Must be one of androidPackage for apk, androidAppBundle for aab, androidStudioProject for android project`);
|
throw new Error(`Unknown Android Export Type: ${androidExportType}. Must be one of androidPackage for apk, androidAppBundle for aab, androidStudioProject for android project`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (platform === platform_1.default.types.StandaloneLinux64) {
|
if (platform === platform_1.default.types.StandaloneLinux64 && !linux64RemoveExecutableExtension) {
|
||||||
return `${filename}${linux64FileExtension}`;
|
return `${filename}.x86_64`;
|
||||||
}
|
}
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
@ -7121,8 +7121,9 @@ class Input {
|
||||||
static get skipActivation() {
|
static get skipActivation() {
|
||||||
return Input.getInput('skipActivation')?.toLowerCase() ?? 'false';
|
return Input.getInput('skipActivation')?.toLowerCase() ?? 'false';
|
||||||
}
|
}
|
||||||
static get linux64FileExtension() {
|
static get linux64RemoveExecutableExtension() {
|
||||||
return Input.getInput('linux64FileExtension') ?? '';
|
const input = Input.getInput('linux64RemoveExecutableExtension') ?? 'true';
|
||||||
|
return input === 'true';
|
||||||
}
|
}
|
||||||
static ToEnvVarFormat(input) {
|
static ToEnvVarFormat(input) {
|
||||||
if (input.toUpperCase() === input) {
|
if (input.toUpperCase() === input) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -104,21 +104,21 @@ describe('BuildParameters', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test.each`
|
test.each`
|
||||||
targetPlatform | expectedExtension | androidExportType | linux64FileExtension
|
targetPlatform | expectedExtension | androidExportType | linux64RemoveExecutableExtension
|
||||||
${Platform.types.Android} | ${'.apk'} | ${'androidPackage'} | ${'n/a'}
|
${Platform.types.Android} | ${'.apk'} | ${'androidPackage'} | ${false}
|
||||||
${Platform.types.Android} | ${'.aab'} | ${'androidAppBundle'} | ${'n/a'}
|
${Platform.types.Android} | ${'.aab'} | ${'androidAppBundle'} | ${true}
|
||||||
${Platform.types.Android} | ${''} | ${'androidStudioProject'} | ${'n/a'}
|
${Platform.types.Android} | ${''} | ${'androidStudioProject'} | ${false}
|
||||||
${Platform.types.StandaloneWindows} | ${'.exe'} | ${'n/a'} | ${'n/a'}
|
${Platform.types.StandaloneWindows} | ${'.exe'} | ${'n/a'} | ${true}
|
||||||
${Platform.types.StandaloneWindows64} | ${'.exe'} | ${'n/a'} | ${'n/a'}
|
${Platform.types.StandaloneWindows64} | ${'.exe'} | ${'n/a'} | ${false}
|
||||||
${Platform.types.StandaloneLinux64} | ${''} | ${'n/a'} | ${''}
|
${Platform.types.StandaloneLinux64} | ${''} | ${'n/a'} | ${true}
|
||||||
${Platform.types.StandaloneLinux64} | ${'.x86_64'} | ${'n/a'} | ${'.x86_64'}
|
${Platform.types.StandaloneLinux64} | ${'.x86_64'} | ${'n/a'} | ${false}
|
||||||
`(
|
`(
|
||||||
'appends $expectedExtension for $targetPlatform with androidExportType $androidExportType and linux64FileExtension $linux64FileExtension',
|
'appends $expectedExtension for $targetPlatform with androidExportType $androidExportType and linux64RemoveExecutableExtension $linux64RemoveExecutableExtension',
|
||||||
async ({ targetPlatform, expectedExtension, androidExportType, linux64FileExtension }) => {
|
async ({ targetPlatform, expectedExtension, androidExportType, linux64RemoveExecutableExtension }) => {
|
||||||
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
|
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
|
||||||
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
|
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
|
||||||
jest.spyOn(Input, 'androidExportType', 'get').mockReturnValue(androidExportType);
|
jest.spyOn(Input, 'androidExportType', 'get').mockReturnValue(androidExportType);
|
||||||
jest.spyOn(Input, 'linux64FileExtension', 'get').mockReturnValue(linux64FileExtension);
|
jest.spyOn(Input, 'linux64RemoveExecutableExtension', 'get').mockReturnValue(linux64RemoveExecutableExtension);
|
||||||
await expect(BuildParameters.create()).resolves.toEqual(
|
await expect(BuildParameters.create()).resolves.toEqual(
|
||||||
expect.objectContaining({ buildFile: `${targetPlatform}${expectedExtension}` }),
|
expect.objectContaining({ buildFile: `${targetPlatform}${expectedExtension}` }),
|
||||||
);
|
);
|
||||||
|
|
|
@ -105,7 +105,7 @@ class BuildParameters {
|
||||||
Input.buildName,
|
Input.buildName,
|
||||||
Input.targetPlatform,
|
Input.targetPlatform,
|
||||||
Input.androidExportType,
|
Input.androidExportType,
|
||||||
Input.linux64FileExtension,
|
Input.linux64RemoveExecutableExtension,
|
||||||
);
|
);
|
||||||
const editorVersion = UnityVersioning.determineUnityVersion(Input.projectPath, Input.unityVersion);
|
const editorVersion = UnityVersioning.determineUnityVersion(Input.projectPath, Input.unityVersion);
|
||||||
const buildVersion = await Versioning.determineBuildVersion(Input.versioningStrategy, Input.specifiedVersion);
|
const buildVersion = await Versioning.determineBuildVersion(Input.versioningStrategy, Input.specifiedVersion);
|
||||||
|
@ -232,7 +232,7 @@ class BuildParameters {
|
||||||
filename: string,
|
filename: string,
|
||||||
platform: string,
|
platform: string,
|
||||||
androidExportType: string,
|
androidExportType: string,
|
||||||
linux64FileExtension: string,
|
linux64RemoveExecutableExtension: boolean,
|
||||||
): string {
|
): string {
|
||||||
if (Platform.isWindows(platform)) {
|
if (Platform.isWindows(platform)) {
|
||||||
return `${filename}.exe`;
|
return `${filename}.exe`;
|
||||||
|
@ -253,8 +253,8 @@ class BuildParameters {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platform === Platform.types.StandaloneLinux64) {
|
if (platform === Platform.types.StandaloneLinux64 && !linux64RemoveExecutableExtension) {
|
||||||
return `${filename}${linux64FileExtension}`;
|
return `${filename}.x86_64`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return filename;
|
return filename;
|
||||||
|
|
|
@ -335,15 +335,20 @@ describe('Input', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('linux64FileExtension', () => {
|
describe('linux64RemoveExecutableExtension', () => {
|
||||||
it('returns the default value', () => {
|
it('returns the default value', () => {
|
||||||
expect(Input.linux64FileExtension).toStrictEqual('');
|
expect(Input.linux64RemoveExecutableExtension).toStrictEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('takes input from the users workflow', () => {
|
it('returns true when string true is passed', () => {
|
||||||
const mockValue = '.x86_64';
|
const spy = jest.spyOn(core, 'getInput').mockReturnValue('true');
|
||||||
const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue);
|
expect(Input.linux64RemoveExecutableExtension).toStrictEqual(true);
|
||||||
expect(Input.linux64FileExtension).toStrictEqual(mockValue);
|
expect(spy).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns false when string false is passed', () => {
|
||||||
|
const spy = jest.spyOn(core, 'getInput').mockReturnValue('false');
|
||||||
|
expect(Input.linux64RemoveExecutableExtension).toStrictEqual(false);
|
||||||
expect(spy).toHaveBeenCalledTimes(1);
|
expect(spy).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -282,8 +282,10 @@ class Input {
|
||||||
return Input.getInput('skipActivation')?.toLowerCase() ?? 'false';
|
return Input.getInput('skipActivation')?.toLowerCase() ?? 'false';
|
||||||
}
|
}
|
||||||
|
|
||||||
static get linux64FileExtension(): string {
|
static get linux64RemoveExecutableExtension(): boolean {
|
||||||
return Input.getInput('linux64FileExtension') ?? '';
|
const input = Input.getInput('linux64RemoveExecutableExtension') ?? 'true';
|
||||||
|
|
||||||
|
return input === 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ToEnvVarFormat(input: string) {
|
public static ToEnvVarFormat(input: string) {
|
||||||
|
|
Loading…
Reference in New Issue