Add 'enableGpu' param, allowing running Unity w/o -nographics (#636)

This commit is contained in:
Szymon Sirocki
2024-03-07 16:50:30 +01:00
committed by GitHub
parent e820c9ce7b
commit fc0a52b805
9 changed files with 41 additions and 2 deletions

View File

@@ -32,6 +32,7 @@ class BuildParameters {
public buildMethod!: string;
public buildVersion!: string;
public manualExit!: boolean;
public enableGpu!: boolean;
public androidVersionCode!: string;
public androidKeystoreName!: string;
public androidKeystoreBase64!: string;
@@ -157,6 +158,7 @@ class BuildParameters {
buildMethod: Input.buildMethod,
buildVersion,
manualExit: Input.manualExit,
enableGpu: Input.enableGpu,
androidVersionCode,
androidKeystoreName: Input.androidKeystoreName,
androidKeystoreBase64: Input.androidKeystoreBase64,

View File

@@ -42,6 +42,7 @@ class ImageEnvironmentFactory {
{ name: 'BUILD_FILE', value: parameters.buildFile },
{ name: 'BUILD_METHOD', value: parameters.buildMethod },
{ name: 'MANUAL_EXIT', value: parameters.manualExit },
{ name: 'ENABLE_GPU', value: parameters.enableGpu },
{ name: 'VERSION', value: parameters.buildVersion },
{ name: 'ANDROID_VERSION_CODE', value: parameters.androidVersionCode },
{ name: 'ANDROID_KEYSTORE_NAME', value: parameters.androidKeystoreName },

View File

@@ -122,6 +122,24 @@ describe('Input', () => {
});
});
describe('enableGpu', () => {
it('returns the default value', () => {
expect(Input.enableGpu).toStrictEqual(false);
});
it('returns true when string true is passed', () => {
const spy = jest.spyOn(core, 'getInput').mockReturnValue('true');
expect(Input.enableGpu).toStrictEqual(true);
expect(spy).toHaveBeenCalledTimes(1);
});
it('returns false when string false is passed', () => {
const spy = jest.spyOn(core, 'getInput').mockReturnValue('false');
expect(Input.enableGpu).toStrictEqual(false);
expect(spy).toHaveBeenCalledTimes(1);
});
});
describe('versioningStrategy', () => {
it('returns the default value', () => {
expect(Input.versioningStrategy).toStrictEqual('Semantic');

View File

@@ -133,6 +133,12 @@ class Input {
return input === 'true';
}
static get enableGpu(): boolean {
const input = Input.getInput('enableGpu') ?? false;
return input === 'true';
}
static get customParameters(): string {
return Input.getInput('customParameters') ?? '';
}

View File

@@ -189,6 +189,7 @@ class SetupMac {
process.env.CUSTOM_PARAMETERS = buildParameters.customParameters;
process.env.CHOWN_FILES_TO = buildParameters.chownFilesTo;
process.env.MANUAL_EXIT = buildParameters.manualExit.toString();
process.env.ENABLE_GPU = buildParameters.enableGpu.toString();
}
}