Skip to content

Commit 37698d9

Browse files
committed
s/linux64FileExtension/linux64RemoveExecutableExtension/
and the rest that this entails. This PR should probably be squashed before merging, with attention paid to the commit message.
1 parent 3cbea9a commit 37698d9

File tree

7 files changed

+41
-33
lines changed

7 files changed

+41
-33
lines changed

action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,11 @@ inputs:
279279
description:
280280
'[Orchestrator] Specifies the repo for the unity builder. Useful if you forked the repo for testing, features, or
281281
fixes.'
282-
linux64FileExtension:
283-
default: ''
282+
linux64RemoveExecutableExtension:
283+
default: 'true'
284284
required: false
285285
description:
286-
'Specify the file extension of the executable when building for StandaloneLinux64. For example, ".x86_64"'
286+
'When building for StandaloneLinux64, remove the default file extension of `.x86_64`. (This matches the behavior of older versions of this action)'
287287

288288
outputs:
289289
volume:

dist/index.js

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/model/build-parameters.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,21 @@ describe('BuildParameters', () => {
104104
});
105105

106106
test.each`
107-
targetPlatform | expectedExtension | androidExportType | linux64FileExtension
108-
${Platform.types.Android} | ${'.apk'} | ${'androidPackage'} | ${'n/a'}
109-
${Platform.types.Android} | ${'.aab'} | ${'androidAppBundle'} | ${'n/a'}
110-
${Platform.types.Android} | ${''} | ${'androidStudioProject'} | ${'n/a'}
111-
${Platform.types.StandaloneWindows} | ${'.exe'} | ${'n/a'} | ${'n/a'}
112-
${Platform.types.StandaloneWindows64} | ${'.exe'} | ${'n/a'} | ${'n/a'}
113-
${Platform.types.StandaloneLinux64} | ${''} | ${'n/a'} | ${''}
114-
${Platform.types.StandaloneLinux64} | ${'.x86_64'} | ${'n/a'} | ${'.x86_64'}
107+
targetPlatform | expectedExtension | androidExportType | linux64RemoveExecutableExtension
108+
${Platform.types.Android} | ${'.apk'} | ${'androidPackage'} | ${false}
109+
${Platform.types.Android} | ${'.aab'} | ${'androidAppBundle'} | ${true}
110+
${Platform.types.Android} | ${''} | ${'androidStudioProject'} | ${false}
111+
${Platform.types.StandaloneWindows} | ${'.exe'} | ${'n/a'} | ${true}
112+
${Platform.types.StandaloneWindows64} | ${'.exe'} | ${'n/a'} | ${false}
113+
${Platform.types.StandaloneLinux64} | ${''} | ${'n/a'} | ${true}
114+
${Platform.types.StandaloneLinux64} | ${'.x86_64'} | ${'n/a'} | ${false}
115115
`(
116-
'appends $expectedExtension for $targetPlatform with androidExportType $androidExportType and linux64FileExtension $linux64FileExtension',
117-
async ({ targetPlatform, expectedExtension, androidExportType, linux64FileExtension }) => {
116+
'appends $expectedExtension for $targetPlatform with androidExportType $androidExportType and linux64RemoveExecutableExtension $linux64RemoveExecutableExtension',
117+
async ({ targetPlatform, expectedExtension, androidExportType, linux64RemoveExecutableExtension }) => {
118118
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
119119
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
120120
jest.spyOn(Input, 'androidExportType', 'get').mockReturnValue(androidExportType);
121-
jest.spyOn(Input, 'linux64FileExtension', 'get').mockReturnValue(linux64FileExtension);
121+
jest.spyOn(Input, 'linux64RemoveExecutableExtension', 'get').mockReturnValue(linux64RemoveExecutableExtension);
122122
await expect(BuildParameters.create()).resolves.toEqual(
123123
expect.objectContaining({ buildFile: `${targetPlatform}${expectedExtension}` }),
124124
);

src/model/build-parameters.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class BuildParameters {
116116
Input.buildName,
117117
Input.targetPlatform,
118118
Input.androidExportType,
119-
Input.linux64FileExtension,
119+
Input.linux64RemoveExecutableExtension,
120120
);
121121
const editorVersion = UnityVersioning.determineUnityVersion(Input.projectPath, Input.unityVersion);
122122
const buildVersion = await Versioning.determineBuildVersion(Input.versioningStrategy, Input.specifiedVersion);
@@ -254,7 +254,7 @@ class BuildParameters {
254254
filename: string,
255255
platform: string,
256256
androidExportType: string,
257-
linux64FileExtension: string,
257+
linux64RemoveExecutableExtension: boolean,
258258
): string {
259259
if (Platform.isWindows(platform)) {
260260
return `${filename}.exe`;
@@ -275,8 +275,8 @@ class BuildParameters {
275275
}
276276
}
277277

278-
if (platform === Platform.types.StandaloneLinux64) {
279-
return `${filename}${linux64FileExtension}`;
278+
if (platform === Platform.types.StandaloneLinux64 && !linux64RemoveExecutableExtension) {
279+
return `${filename}.x86_64`;
280280
}
281281

282282
return filename;

src/model/input.test.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,15 +335,20 @@ describe('Input', () => {
335335
});
336336
});
337337

338-
describe('linux64FileExtension', () => {
338+
describe('linux64RemoveExecutableExtension', () => {
339339
it('returns the default value', () => {
340-
expect(Input.linux64FileExtension).toStrictEqual('');
340+
expect(Input.linux64RemoveExecutableExtension).toStrictEqual(true);
341341
});
342342

343-
it('takes input from the users workflow', () => {
344-
const mockValue = '.x86_64';
345-
const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue);
346-
expect(Input.linux64FileExtension).toStrictEqual(mockValue);
343+
it('returns true when string true is passed', () => {
344+
const spy = jest.spyOn(core, 'getInput').mockReturnValue('true');
345+
expect(Input.linux64RemoveExecutableExtension).toStrictEqual(true);
346+
expect(spy).toHaveBeenCalledTimes(1);
347+
});
348+
349+
it('returns false when string false is passed', () => {
350+
const spy = jest.spyOn(core, 'getInput').mockReturnValue('false');
351+
expect(Input.linux64RemoveExecutableExtension).toStrictEqual(false);
347352
expect(spy).toHaveBeenCalledTimes(1);
348353
});
349354
});

src/model/input.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,10 @@ class Input {
282282
return Input.getInput('skipActivation')?.toLowerCase() ?? 'false';
283283
}
284284

285-
static get linux64FileExtension(): string {
286-
return Input.getInput('linux64FileExtension') ?? '';
285+
static get linux64RemoveExecutableExtension(): boolean {
286+
const input = Input.getInput('linux64RemoveExecutableExtension') ?? 'true';
287+
288+
return input === 'true';
287289
}
288290

289291
public static ToEnvVarFormat(input: string) {

0 commit comments

Comments
 (0)