Add parameter `linux64FileExtension`
Allows the end-user to restore the default unity behavior of using the file extension `.x86_64`, instead of no file extension. Preserves the current behavior, to avoid surprise breakage.pull/726/head
parent
c6c8236152
commit
893ac807c0
|
@ -252,7 +252,7 @@ class BuildParameters {
|
|||
return buildParameters.maxRetainedWorkspaces > 0 && cloud_runner_1.default.lockedWorkspace !== ``;
|
||||
}
|
||||
static async create() {
|
||||
const buildFile = this.parseBuildFile(input_1.default.buildName, input_1.default.targetPlatform, input_1.default.androidExportType);
|
||||
const buildFile = this.parseBuildFile(input_1.default.buildName, input_1.default.targetPlatform, input_1.default.androidExportType, input_1.default.linux64FileExtension);
|
||||
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 androidVersionCode = android_versioning_1.default.determineVersionCode(buildVersion, input_1.default.androidVersionCode);
|
||||
|
@ -366,7 +366,7 @@ class BuildParameters {
|
|||
dockerWorkspacePath: input_1.default.dockerWorkspacePath,
|
||||
};
|
||||
}
|
||||
static parseBuildFile(filename, platform, androidExportType) {
|
||||
static parseBuildFile(filename, platform, androidExportType, linux64FileExtension) {
|
||||
if (platform_1.default.isWindows(platform)) {
|
||||
return `${filename}.exe`;
|
||||
}
|
||||
|
@ -382,6 +382,9 @@ class BuildParameters {
|
|||
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) {
|
||||
return `${filename}${linux64FileExtension}`;
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
static getSerialFromLicenseFile(license) {
|
||||
|
@ -7118,6 +7121,9 @@ class Input {
|
|||
static get skipActivation() {
|
||||
return Input.getInput('skipActivation')?.toLowerCase() ?? 'false';
|
||||
}
|
||||
static get linux64FileExtension() {
|
||||
return Input.getInput('linux64FileExtension') ?? '';
|
||||
}
|
||||
static ToEnvVarFormat(input) {
|
||||
if (input.toUpperCase() === input) {
|
||||
return input;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -104,18 +104,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 | linux64FileExtension
|
||||
${Platform.types.Android} | ${'.apk'} | ${'androidPackage'} | ${'n/a'}
|
||||
${Platform.types.Android} | ${'.aab'} | ${'androidAppBundle'} | ${'n/a'}
|
||||
${Platform.types.Android} | ${''} | ${'androidStudioProject'} | ${'n/a'}
|
||||
${Platform.types.StandaloneWindows} | ${'.exe'} | ${'n/a'} | ${'n/a'}
|
||||
${Platform.types.StandaloneWindows64} | ${'.exe'} | ${'n/a'} | ${'n/a'}
|
||||
${Platform.types.StandaloneLinux64} | ${''} | ${'n/a'} | ${''}
|
||||
${Platform.types.StandaloneLinux64} | ${'.x86_64'} | ${'n/a'} | ${'.x86_64'}
|
||||
`(
|
||||
'appends $expectedExtension for $targetPlatform with androidExportType $androidExportType',
|
||||
async ({ targetPlatform, expectedExtension, androidExportType }) => {
|
||||
'appends $expectedExtension for $targetPlatform with androidExportType $androidExportType and linux64FileExtension $linux64FileExtension',
|
||||
async ({ targetPlatform, expectedExtension, androidExportType, linux64FileExtension }) => {
|
||||
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
|
||||
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
|
||||
jest.spyOn(Input, 'androidExportType', 'get').mockReturnValue(androidExportType);
|
||||
jest.spyOn(Input, 'linux64FileExtension', 'get').mockReturnValue(linux64FileExtension);
|
||||
await expect(BuildParameters.create()).resolves.toEqual(
|
||||
expect.objectContaining({ buildFile: `${targetPlatform}${expectedExtension}` }),
|
||||
);
|
||||
|
|
|
@ -101,7 +101,12 @@ class BuildParameters {
|
|||
}
|
||||
|
||||
static async create(): Promise<BuildParameters> {
|
||||
const buildFile = this.parseBuildFile(Input.buildName, Input.targetPlatform, Input.androidExportType);
|
||||
const buildFile = this.parseBuildFile(
|
||||
Input.buildName,
|
||||
Input.targetPlatform,
|
||||
Input.androidExportType,
|
||||
Input.linux64FileExtension,
|
||||
);
|
||||
const editorVersion = UnityVersioning.determineUnityVersion(Input.projectPath, Input.unityVersion);
|
||||
const buildVersion = await Versioning.determineBuildVersion(Input.versioningStrategy, Input.specifiedVersion);
|
||||
const androidVersionCode = AndroidVersioning.determineVersionCode(buildVersion, Input.androidVersionCode);
|
||||
|
@ -223,7 +228,12 @@ class BuildParameters {
|
|||
};
|
||||
}
|
||||
|
||||
static parseBuildFile(filename: string, platform: string, androidExportType: string): string {
|
||||
static parseBuildFile(
|
||||
filename: string,
|
||||
platform: string,
|
||||
androidExportType: string,
|
||||
linux64FileExtension: string,
|
||||
): string {
|
||||
if (Platform.isWindows(platform)) {
|
||||
return `${filename}.exe`;
|
||||
}
|
||||
|
@ -243,6 +253,10 @@ class BuildParameters {
|
|||
}
|
||||
}
|
||||
|
||||
if (platform === Platform.types.StandaloneLinux64) {
|
||||
return `${filename}${linux64FileExtension}`;
|
||||
}
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
|
|
@ -334,4 +334,17 @@ describe('Input', () => {
|
|||
expect(spy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('linux64FileExtension', () => {
|
||||
it('returns the default value', () => {
|
||||
expect(Input.linux64FileExtension).toStrictEqual('');
|
||||
});
|
||||
|
||||
it('takes input from the users workflow', () => {
|
||||
const mockValue = '.x86_64';
|
||||
const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue);
|
||||
expect(Input.linux64FileExtension).toStrictEqual(mockValue);
|
||||
expect(spy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -282,6 +282,10 @@ class Input {
|
|||
return Input.getInput('skipActivation')?.toLowerCase() ?? 'false';
|
||||
}
|
||||
|
||||
static get linux64FileExtension(): string {
|
||||
return Input.getInput('linux64FileExtension') ?? '';
|
||||
}
|
||||
|
||||
public static ToEnvVarFormat(input: string) {
|
||||
if (input.toUpperCase() === input) {
|
||||
return input;
|
||||
|
|
Loading…
Reference in New Issue