Code cleanup (#511)

* Enable noImplicitAny
Add types to all implicit any variables
Bump target to ES2020 for recent language features (optional chaining)
Code cleanup
Add debug configuration for vscode
Remove autorun flag from jest to remove warning
Bump packages to fix dependency version mismatch warning
Changed @arkweid/lefthook to @evilmartians/lefthook as @arkweid/lefthook has been deprecated in favor of @evilmartians/lefthook
Added concurrency groups to integrity check and build workflows. New commits to branches will cancel superseded runs on the same branch/pr
Update imports to not use require syntax
Use node packages (ie node:fs rather than fs)
AndroidVersionCode is now a string rather than a number as it gets converted to a string when passed out of the system
Reduce timeout for windows builds
Remove 2020.1.17f1 from windows builds due to repeated license activation errors
Update naming scheme of workflows for consistency
Update build names so target platform and unity version aren't cut off by github actions UI

* Add exclude to test matrix for 2022.2 on android until Unity bug is fixed

---------

Co-authored-by: AndrewKahr <AndrewKahr@users.noreply.github.com>
This commit is contained in:
AndrewKahr
2023-03-03 16:25:40 -08:00
committed by GitHub
parent 3de97ed24a
commit ef38f5a88a
86 changed files with 9861 additions and 144996 deletions

View File

@@ -1,21 +1,18 @@
import Platform from './platform';
import BuildParameters from './build-parameters';
import Input from './input';
class ImageTag {
public repository: string;
public name: string;
public cloudRunnerBuilderPlatform!: string | undefined;
public cloudRunnerBuilderPlatform!: string;
public editorVersion: string;
public targetPlatform: any;
public targetPlatform: string;
public builderPlatform: string;
public customImage: any;
public customImage: string;
public imageRollingVersion: number;
public imagePlatformPrefix: string;
constructor(imageProperties: Partial<BuildParameters>) {
const { editorVersion = '2019.2.11f1', targetPlatform, customImage, cloudRunnerBuilderPlatform } = imageProperties;
constructor(imageProperties: { [key: string]: string }) {
const { editorVersion, targetPlatform, customImage, cloudRunnerBuilderPlatform } = imageProperties;
if (!ImageTag.versionPattern.test(editorVersion)) {
throw new Error(`Invalid version "${editorVersion}".`);
@@ -39,8 +36,8 @@ class ImageTag {
this.imageRollingVersion = 1; // Will automatically roll to the latest non-breaking version.
}
static get versionPattern() {
return /^20\d{2}\.\d\.\w{3,4}|3$/;
static get versionPattern(): RegExp {
return /^(20\d{2}\.\d\.\w{3,4}|3)$/;
}
static get targetPlatformSuffixes() {
@@ -60,7 +57,7 @@ class ImageTag {
};
}
static getImagePlatformPrefixes(platform) {
static getImagePlatformPrefixes(platform: string): string {
switch (platform) {
case 'win32':
return 'windows';
@@ -71,7 +68,7 @@ class ImageTag {
}
}
static getTargetPlatformToTargetPlatformSuffixMap(platform, version) {
static getTargetPlatformToTargetPlatformSuffixMap(platform: string, version: string): string {
const { generic, webgl, mac, windows, windowsIl2cpp, wsaPlayer, linux, linuxIl2cpp, android, ios, tvos, facebook } =
ImageTag.targetPlatformSuffixes;
@@ -84,7 +81,7 @@ class ImageTag {
case Platform.types.StandaloneWindows:
case Platform.types.StandaloneWindows64:
// Can only build windows-il2cpp on a windows based system
if (Input.useIL2Cpp && process.platform === 'win32') {
if (process.platform === 'win32') {
// Unity versions before 2019.3 do not support il2cpp
if (major >= 2020 || (major === 2019 && minor >= 3)) {
return windowsIl2cpp;
@@ -97,7 +94,7 @@ class ImageTag {
return windows;
case Platform.types.StandaloneLinux64: {
// Unity versions before 2019.3 do not support il2cpp
if ((Input.useIL2Cpp && major >= 2020) || (major === 2019 && minor >= 3)) {
if (major >= 2020 || (major === 2019 && minor >= 3)) {
return linuxIl2cpp;
}
@@ -150,17 +147,17 @@ class ImageTag {
}
}
get tag() {
get tag(): string {
const versionAndPlatform = `${this.editorVersion}-${this.builderPlatform}`.replace(/-+$/, '');
return `${this.imagePlatformPrefix}-${versionAndPlatform}-${this.imageRollingVersion}`;
}
get image() {
get image(): string {
return `${this.repository}/${this.name}`.replace(/^\/+/, '');
}
toString() {
toString(): string {
const { image, tag, customImage } = this;
if (customImage) return customImage;