Skip to content

Commit

Permalink
add il2cpp support for linux from 2019.3 (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
webbertakken authored Nov 13, 2020
1 parent 9e2a1b2 commit 8eeb848
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 33 deletions.
2 changes: 1 addition & 1 deletion action/index.js

Large diffs are not rendered by default.

96 changes: 64 additions & 32 deletions src/model/image-tag.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { has, get, trimEnd, trimStart } from 'lodash-es';
import { trimEnd, trimStart } from 'lodash-es';
import Platform from './platform';

class ImageTag {
Expand All @@ -15,15 +15,7 @@ class ImageTag {
throw new Error(`Invalid version "${version}".`);
}

if (!has(ImageTag.targetPlatformToImageSuffixMap, platform)) {
throw new Error(`Platform "${platform}" is currently not supported.`);
}

const builderPlatform = get(
ImageTag.targetPlatformToImageSuffixMap,
platform,
ImageTag.imageSuffixes.generic,
);
const builderPlatform = ImageTag.getTargetPlatformToImageSuffixMap(platform, version);

Object.assign(this, { repository, name, version, platform, builderPlatform, customImage });
}
Expand All @@ -39,38 +31,78 @@ class ImageTag {
mac: 'mac-mono',
windows: 'windows-mono',
linux: 'base',
linuxIl2cpp: 'linux-il2cpp',
android: 'android',
ios: 'ios',
facebook: 'facebook',
};
}

static get targetPlatformToImageSuffixMap() {
const { generic, webgl, mac, windows, linux, android, ios, facebook } = ImageTag.imageSuffixes;
static getTargetPlatformToImageSuffixMap(platform, version) {
const {
generic,
webgl,
mac,
windows,
linux,
linuxIl2cpp,
android,
ios,
facebook,
} = ImageTag.imageSuffixes;

const [major, minor] = version.split('.');
// @see: https://docs.unity3d.com/ScriptReference/BuildTarget.html
return {
[Platform.types.StandaloneOSX]: mac,
[Platform.types.StandaloneWindows]: windows,
[Platform.types.StandaloneWindows64]: windows,
[Platform.types.StandaloneLinux64]: linux,
[Platform.types.iOS]: ios,
[Platform.types.Android]: android,
[Platform.types.WebGL]: webgl,
[Platform.types.WSAPlayer]: windows,
[Platform.types.PS4]: windows,
[Platform.types.XboxOne]: windows,
[Platform.types.tvOS]: windows,
[Platform.types.Switch]: windows,
switch (platform) {
case Platform.types.StandaloneOSX:
return mac;
case Platform.types.StandaloneWindows:
return windows;
case Platform.types.StandaloneWindows64:
return windows;
case Platform.types.StandaloneLinux64: {
// Unity versions before 2019.3 do not support il2cpp
if (major >= 2020 || (major === 2019 && minor >= 3)) {
return linuxIl2cpp;
}
return linux;
}
case Platform.types.iOS:
return ios;
case Platform.types.Android:
return android;
case Platform.types.WebGL:
return webgl;
case Platform.types.WSAPlayer:
return windows;
case Platform.types.PS4:
return windows;
case Platform.types.XboxOne:
return windows;
case Platform.types.tvOS:
return windows;
case Platform.types.Switch:
return windows;
// Unsupported
[Platform.types.Lumin]: windows,
[Platform.types.BJM]: windows,
[Platform.types.Stadia]: windows,
[Platform.types.Facebook]: facebook,
[Platform.types.NoTarget]: generic,
case Platform.types.Lumin:
return windows;
case Platform.types.BJM:
return windows;
case Platform.types.Stadia:
return windows;
case Platform.types.Facebook:
return facebook;
case Platform.types.NoTarget:
return generic;

// Test specific
[Platform.types.Test]: generic,
};
case Platform.types.Test:
return generic;
default:
throw new Error(`
Platform must be one of the ones described in the documentation.
"${platform}" is currently not supported.`);
}
}

get tag() {
Expand Down

0 comments on commit 8eeb848

Please sign in to comment.