Change exit strategy for activation step

This commit is contained in:
Webber 2020-01-08 00:39:53 +01:00 committed by Webber Takken
parent a76c6a7321
commit 53bec7beb4
4 changed files with 36 additions and 25 deletions

File diff suppressed because one or more lines are too long

View File

@ -17,24 +17,30 @@ if [[ -n "$UNITY_LICENSE" ]]; then
# Copy license file from Github variables
echo "$UNITY_LICENSE" | tr -d '\r' > $FILE_PATH
##
## Activate license
##
#
# Activate license
#
# This is expected to always exit with code 1 (both success and failure).
#
echo "Requesting activation"
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
ACTIVATION_OUTPUT=$(xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
/opt/Unity/Editor/Unity \
-batchmode \
-nographics \
-logFile /dev/stdout \
-quit \
-manualLicenseFile $FILE_PATH
# This is expected to always exit with code 1 (both success and failure).
-manualLicenseFile $FILE_PATH)
# Convert to exit code 0 by echoing the current exit code.
echo $?
# Exit code is now 0
# TODO - remove debugging
echo $ACTIVATION_OUTPUT
echo $ACTIVATION_OUTPUT | grep 'config is NOT valid, switching to default'
echo $ACTIVATION_OUTPUT | grep 'config is NOT valid, switching to default' | wc -l
# TODO - Derive exit code by grepping success statement
UNITY_EXIT_CODE=0
UNITY_EXIT_CODE=$(echo $ACTIVATION_OUTPUT | grep 'config is NOT valid, switching to default' | wc -l)
# Display information about the result
if [ $UNITY_EXIT_CODE -eq 0 ]; then
@ -48,7 +54,9 @@ if [[ -n "$UNITY_LICENSE" ]]; then
rm -f $FILE_PATH
# Exit with the code from the license verification step
exit $UNITY_EXIT_CODE
if [ $UNITY_EXIT_CODE -ne 0 ]; then
exit $UNITY_EXIT_CODE
fi
else
#

View File

@ -38,32 +38,35 @@ export default class ImageTag {
windows: 'windows',
android: 'android',
ios: 'ios',
facebook: 'facebook',
};
}
static get targetPlatformToBuilderPlatformMap() {
const { generic, webgl, mac, windows, android, ios } = ImageTag.builderPlatforms;
const { generic, webgl, mac, windows, android, ios, facebook } = ImageTag.builderPlatforms;
// @see: https://docs.unity3d.com/ScriptReference/BuildTarget.html
return {
Test: generic,
WebGL: webgl,
StandaloneOSX: mac,
StandaloneWindows: windows,
StandaloneWindows64: windows,
StandaloneLinux64: generic,
PS4: generic,
XboxOne: generic,
Switch: generic,
Android: android,
StandaloneLinux64: windows,
iOS: ios,
tvOS: generic,
Lumin: generic,
BJM: generic,
Stadia: generic,
WSAPlayer: generic,
Facebook: generic,
Android: android,
WebGL: webgl,
WSAPlayer: windows,
PS4: windows,
XboxOne: windows,
tvOS: windows,
Switch: windows,
// Unsupported
Lumin: windows,
BJM: windows,
Stadia: windows,
Facebook: facebook,
NoTarget: generic,
// Test specific
Test: generic,
};
}

View File

@ -5,7 +5,7 @@ describe('UnityImageVersion', () => {
repository: 'test1',
name: 'test2',
version: '2099.9.f9f9',
platform: 'Stadia',
platform: 'Test',
builderPlatform: '',
};
@ -59,7 +59,7 @@ describe('UnityImageVersion', () => {
});
it('returns no specific build platform for generic targetPlatforms', () => {
const image = new ImageTag({ platform: 'Stadia' });
const image = new ImageTag({ platform: 'NoTarget' });
expect(image.toString()).toStrictEqual(`${defaults.image}:2019.2.11f1`);
});