manualExit suppresses -quit, useful for buildMethods with async calls (#574)

* `manualExit` suppresses `-quit`, useful for buildMethods with async calls

* Use boolean
This commit is contained in:
Toby Harris 2023-09-20 22:41:17 +01:00 committed by GitHub
parent 2190fd5667
commit a13443a746
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 32 additions and 1 deletions

View File

@ -31,6 +31,10 @@ inputs:
required: false required: false
default: '' default: ''
description: 'Path to a Namespace.Class.StaticMethod to run to perform the build.' description: 'Path to a Namespace.Class.StaticMethod to run to perform the build.'
manualExit:
required: false
default: ''
description: 'Suppresses `-quit`. Exit your build method using `EditorApplication.Exit(0)` instead.'
customParameters: customParameters:
required: false required: false
default: '' default: ''

BIN
dist/index.js generated vendored

Binary file not shown.

BIN
dist/index.js.map generated vendored

Binary file not shown.

View File

@ -119,7 +119,7 @@ echo ""
unity-editor \ unity-editor \
-logfile /dev/stdout \ -logfile /dev/stdout \
-quit \ $( [ "${MANUAL_EXIT}" == "true" ] || echo "-quit" ) \
-customBuildName "$BUILD_NAME" \ -customBuildName "$BUILD_NAME" \
-projectPath "$UNITY_PROJECT_PATH" \ -projectPath "$UNITY_PROJECT_PATH" \
-buildTarget "$BUILD_TARGET" \ -buildTarget "$BUILD_TARGET" \

View File

@ -29,6 +29,7 @@ class BuildParameters {
public buildFile!: string; public buildFile!: string;
public buildMethod!: string; public buildMethod!: string;
public buildVersion!: string; public buildVersion!: string;
public manualExit!: boolean;
public androidVersionCode!: string; public androidVersionCode!: string;
public androidKeystoreName!: string; public androidKeystoreName!: string;
public androidKeystoreBase64!: string; public androidKeystoreBase64!: string;
@ -139,6 +140,7 @@ class BuildParameters {
buildFile, buildFile,
buildMethod: Input.buildMethod, buildMethod: Input.buildMethod,
buildVersion, buildVersion,
manualExit: Input.manualExit,
androidVersionCode, androidVersionCode,
androidKeystoreName: Input.androidKeystoreName, androidKeystoreName: Input.androidKeystoreName,
androidKeystoreBase64: Input.androidKeystoreBase64, androidKeystoreBase64: Input.androidKeystoreBase64,

View File

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

View File

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

View File

@ -126,6 +126,12 @@ class Input {
return Input.getInput('buildMethod') || ''; // Processed in docker file return Input.getInput('buildMethod') || ''; // Processed in docker file
} }
static get manualExit(): boolean {
const input = Input.getInput('manualExit') || false;
return input === 'true';
}
static get customParameters(): string { static get customParameters(): string {
return Input.getInput('customParameters') || ''; return Input.getInput('customParameters') || '';
} }