mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-01 14:26:17 -07:00
Compare commits
4 Commits
chore/remo
...
linux-exte
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a38ec6caef | ||
|
|
37ce35f1a5 | ||
|
|
9d20e0b607 | ||
|
|
2321712bb4 |
@@ -178,6 +178,11 @@ inputs:
|
||||
default: 'false'
|
||||
required: false
|
||||
description: 'Skip the activation/deactivation of Unity. This assumes Unity is already activated.'
|
||||
linux64RemoveExecutableExtension:
|
||||
default: 'false'
|
||||
required: false
|
||||
description:
|
||||
'When building for StandaloneLinux64, remove the default file extension of `.x86_64`. Set to true to restore the extensionless behavior from v4.'
|
||||
|
||||
outputs:
|
||||
volume:
|
||||
|
||||
@@ -117,18 +117,21 @@ describe('BuildParameters', () => {
|
||||
});
|
||||
|
||||
test.each`
|
||||
targetPlatform | expectedExtension | androidExportType
|
||||
${Platform.types.Android} | ${'.apk'} | ${'androidPackage'}
|
||||
${Platform.types.Android} | ${'.aab'} | ${'androidAppBundle'}
|
||||
${Platform.types.Android} | ${''} | ${'androidStudioProject'}
|
||||
${Platform.types.StandaloneWindows} | ${'.exe'} | ${'n/a'}
|
||||
${Platform.types.StandaloneWindows64} | ${'.exe'} | ${'n/a'}
|
||||
targetPlatform | expectedExtension | androidExportType | linux64RemoveExecutableExtension
|
||||
${Platform.types.Android} | ${'.apk'} | ${'androidPackage'} | ${false}
|
||||
${Platform.types.Android} | ${'.aab'} | ${'androidAppBundle'} | ${true}
|
||||
${Platform.types.Android} | ${''} | ${'androidStudioProject'} | ${false}
|
||||
${Platform.types.StandaloneWindows} | ${'.exe'} | ${'n/a'} | ${true}
|
||||
${Platform.types.StandaloneWindows64} | ${'.exe'} | ${'n/a'} | ${false}
|
||||
${Platform.types.StandaloneLinux64} | ${'.x86_64'} | ${'n/a'} | ${false}
|
||||
${Platform.types.StandaloneLinux64} | ${''} | ${'n/a'} | ${true}
|
||||
`(
|
||||
'appends $expectedExtension for $targetPlatform with androidExportType $androidExportType',
|
||||
async ({ targetPlatform, expectedExtension, androidExportType }) => {
|
||||
'appends $expectedExtension for $targetPlatform with linux64RemoveExecutableExtension=$linux64RemoveExecutableExtension',
|
||||
async ({ targetPlatform, expectedExtension, androidExportType, linux64RemoveExecutableExtension }) => {
|
||||
vi.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
|
||||
vi.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
|
||||
vi.spyOn(Input, 'androidExportType', 'get').mockReturnValue(androidExportType);
|
||||
vi.spyOn(Input, 'linux64RemoveExecutableExtension', 'get').mockReturnValue(linux64RemoveExecutableExtension);
|
||||
await expect(BuildParameters.create()).resolves.toEqual(
|
||||
expect.objectContaining({ buildFile: `${targetPlatform}${expectedExtension}` }),
|
||||
);
|
||||
|
||||
@@ -73,6 +73,7 @@ class BuildParameters {
|
||||
Input.buildName,
|
||||
Input.targetPlatform,
|
||||
Input.androidExportType,
|
||||
Input.linux64RemoveExecutableExtension,
|
||||
);
|
||||
const editorVersion = UnityVersioning.determineUnityVersion(
|
||||
Input.projectPath,
|
||||
@@ -188,7 +189,12 @@ class BuildParameters {
|
||||
};
|
||||
}
|
||||
|
||||
static parseBuildFile(filename: string, platform: string, androidExportType: string): string {
|
||||
static parseBuildFile(
|
||||
filename: string,
|
||||
platform: string,
|
||||
androidExportType: string,
|
||||
linux64RemoveExecutableExtension: boolean,
|
||||
): string {
|
||||
if (Platform.isWindows(platform)) {
|
||||
return `${filename}.exe`;
|
||||
}
|
||||
@@ -208,6 +214,10 @@ class BuildParameters {
|
||||
}
|
||||
}
|
||||
|
||||
if (platform === Platform.types.StandaloneLinux64 && !linux64RemoveExecutableExtension) {
|
||||
return `${filename}.x86_64`;
|
||||
}
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
||||
@@ -353,4 +353,22 @@ describe('Input', () => {
|
||||
expect(spy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('linux64RemoveExecutableExtension', () => {
|
||||
it('returns the default value', () => {
|
||||
expect(Input.linux64RemoveExecutableExtension).toStrictEqual(false);
|
||||
});
|
||||
|
||||
it('returns true when string true is passed', () => {
|
||||
const spy = vi.spyOn(core, 'getInput').mockReturnValue('true');
|
||||
expect(Input.linux64RemoveExecutableExtension).toStrictEqual(true);
|
||||
expect(spy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('returns false when string false is passed', () => {
|
||||
const spy = vi.spyOn(core, 'getInput').mockReturnValue('false');
|
||||
expect(Input.linux64RemoveExecutableExtension).toStrictEqual(false);
|
||||
expect(spy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -284,6 +284,12 @@ class Input {
|
||||
return Input.getInput('skipActivation')?.toLowerCase() ?? 'false';
|
||||
}
|
||||
|
||||
static get linux64RemoveExecutableExtension(): boolean {
|
||||
const input = Input.getInput('linux64RemoveExecutableExtension') ?? 'false';
|
||||
|
||||
return input === 'true';
|
||||
}
|
||||
|
||||
public static ToEnvVarFormat(input: string) {
|
||||
if (input.toUpperCase() === input) {
|
||||
return input;
|
||||
|
||||
Reference in New Issue
Block a user