| 
									
										
										
										
											2020-06-24 22:02:05 +00:00
										 |  |  | import AndroidVersioning from './android-versioning'; | 
					
						
							| 
									
										
										
										
											2020-05-21 15:44:56 +00:00
										 |  |  | import Input from './input'; | 
					
						
							| 
									
										
										
										
											2020-01-20 23:06:14 +00:00
										 |  |  | import Platform from './platform'; | 
					
						
							| 
									
										
										
										
											2020-12-29 05:36:31 +00:00
										 |  |  | import UnityVersioning from './unity-versioning'; | 
					
						
							| 
									
										
										
										
											2020-05-21 15:44:56 +00:00
										 |  |  | import Versioning from './versioning'; | 
					
						
							| 
									
										
										
										
											2020-01-20 23:06:14 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | class BuildParameters { | 
					
						
							| 
									
										
										
										
											2021-05-23 04:08:40 +00:00
										 |  |  |   public version!: string; | 
					
						
							|  |  |  |   public customImage!: string; | 
					
						
							|  |  |  |   public runnerTempPath: string | undefined; | 
					
						
							|  |  |  |   public platform!: string; | 
					
						
							|  |  |  |   public projectPath!: string; | 
					
						
							|  |  |  |   public buildName!: string; | 
					
						
							|  |  |  |   public buildPath!: string; | 
					
						
							|  |  |  |   public buildFile!: string; | 
					
						
							|  |  |  |   public buildMethod!: string; | 
					
						
							|  |  |  |   public buildVersion!: string; | 
					
						
							|  |  |  |   public androidVersionCode!: string; | 
					
						
							|  |  |  |   public androidKeystoreName!: string; | 
					
						
							|  |  |  |   public androidKeystoreBase64!: string; | 
					
						
							|  |  |  |   public androidKeystorePass!: string; | 
					
						
							|  |  |  |   public androidKeyaliasName!: string; | 
					
						
							|  |  |  |   public androidKeyaliasPass!: string; | 
					
						
							|  |  |  |   public customParameters!: string; | 
					
						
							| 
									
										
										
										
											2021-05-28 21:51:10 +00:00
										 |  |  |   public sshAgent!: string; | 
					
						
							| 
									
										
										
										
											2021-05-23 04:08:40 +00:00
										 |  |  |   public remoteBuildCluster!: string; | 
					
						
							| 
									
										
										
										
											2021-08-13 19:59:01 +00:00
										 |  |  |   public awsBaseStackName!: string; | 
					
						
							| 
									
										
										
										
											2021-05-23 04:08:40 +00:00
										 |  |  |   public kubeConfig!: string; | 
					
						
							|  |  |  |   public githubToken!: string; | 
					
						
							|  |  |  |   public remoteBuildMemory!: string; | 
					
						
							|  |  |  |   public remoteBuildCpu!: string; | 
					
						
							|  |  |  |   public kubeVolumeSize!: string; | 
					
						
							|  |  |  |   public kubeVolume!: string; | 
					
						
							|  |  |  |   public chownFilesTo!: string; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   static async create(): Promise<BuildParameters> { | 
					
						
							| 
									
										
										
										
											2021-03-13 23:44:01 +00:00
										 |  |  |     const buildFile = this.parseBuildFile(Input.buildName, Input.targetPlatform, Input.androidAppBundle); | 
					
						
							| 
									
										
										
										
											2020-12-29 05:36:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-13 23:44:01 +00:00
										 |  |  |     const unityVersion = UnityVersioning.determineUnityVersion(Input.projectPath, Input.unityVersion); | 
					
						
							| 
									
										
										
										
											2020-12-29 05:36:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-13 23:44:01 +00:00
										 |  |  |     const buildVersion = await Versioning.determineVersion(Input.versioningStrategy, Input.specifiedVersion); | 
					
						
							| 
									
										
										
										
											2020-01-20 23:06:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-13 23:44:01 +00:00
										 |  |  |     const androidVersionCode = AndroidVersioning.determineVersionCode(buildVersion, Input.androidVersionCode); | 
					
						
							| 
									
										
										
										
											2020-06-24 22:02:05 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-20 23:06:14 +00:00
										 |  |  |     return { | 
					
						
							| 
									
										
										
										
											2020-12-29 05:36:31 +00:00
										 |  |  |       version: unityVersion, | 
					
						
							| 
									
										
										
										
											2020-09-18 16:41:31 +00:00
										 |  |  |       customImage: Input.customImage, | 
					
						
							| 
									
										
										
										
											2020-10-22 08:20:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-22 15:59:08 +00:00
										 |  |  |       runnerTempPath: process.env.RUNNER_TEMP, | 
					
						
							| 
									
										
										
										
											2020-05-21 15:44:56 +00:00
										 |  |  |       platform: Input.targetPlatform, | 
					
						
							|  |  |  |       projectPath: Input.projectPath, | 
					
						
							|  |  |  |       buildName: Input.buildName, | 
					
						
							|  |  |  |       buildPath: `${Input.buildsPath}/${Input.targetPlatform}`, | 
					
						
							|  |  |  |       buildFile, | 
					
						
							|  |  |  |       buildMethod: Input.buildMethod, | 
					
						
							| 
									
										
										
										
											2020-04-26 18:22:09 +00:00
										 |  |  |       buildVersion, | 
					
						
							| 
									
										
										
										
											2020-06-24 22:02:05 +00:00
										 |  |  |       androidVersionCode, | 
					
						
							| 
									
										
										
										
											2020-07-06 01:41:21 +00:00
										 |  |  |       androidKeystoreName: Input.androidKeystoreName, | 
					
						
							|  |  |  |       androidKeystoreBase64: Input.androidKeystoreBase64, | 
					
						
							|  |  |  |       androidKeystorePass: Input.androidKeystorePass, | 
					
						
							|  |  |  |       androidKeyaliasName: Input.androidKeyaliasName, | 
					
						
							|  |  |  |       androidKeyaliasPass: Input.androidKeyaliasPass, | 
					
						
							| 
									
										
										
										
											2020-05-21 15:44:56 +00:00
										 |  |  |       customParameters: Input.customParameters, | 
					
						
							| 
									
										
										
										
											2021-05-28 21:51:10 +00:00
										 |  |  |       sshAgent: Input.sshAgent, | 
					
						
							| 
									
										
										
										
											2021-05-01 23:23:15 +00:00
										 |  |  |       chownFilesTo: Input.chownFilesTo, | 
					
						
							| 
									
										
										
										
											2021-04-20 20:46:37 +00:00
										 |  |  |       remoteBuildCluster: Input.remoteBuildCluster, | 
					
						
							| 
									
										
										
										
											2021-08-13 19:59:01 +00:00
										 |  |  |       awsBaseStackName: Input.awsBaseStackName, | 
					
						
							| 
									
										
										
										
											2020-08-09 19:27:47 +00:00
										 |  |  |       kubeConfig: Input.kubeConfig, | 
					
						
							|  |  |  |       githubToken: Input.githubToken, | 
					
						
							| 
									
										
										
										
											2021-04-20 20:46:37 +00:00
										 |  |  |       remoteBuildMemory: Input.remoteBuildMemory, | 
					
						
							|  |  |  |       remoteBuildCpu: Input.remoteBuildCpu, | 
					
						
							| 
									
										
										
										
											2020-08-09 19:27:47 +00:00
										 |  |  |       kubeVolumeSize: Input.kubeVolumeSize, | 
					
						
							|  |  |  |       kubeVolume: Input.kubeVolume, | 
					
						
							| 
									
										
										
										
											2020-01-20 23:06:14 +00:00
										 |  |  |     }; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-06 01:41:21 +00:00
										 |  |  |   static parseBuildFile(filename, platform, androidAppBundle) { | 
					
						
							| 
									
										
										
										
											2020-01-20 23:06:14 +00:00
										 |  |  |     if (Platform.isWindows(platform)) { | 
					
						
							|  |  |  |       return `${filename}.exe`; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (Platform.isAndroid(platform)) { | 
					
						
							| 
									
										
										
										
											2020-07-06 01:41:21 +00:00
										 |  |  |       return androidAppBundle ? `${filename}.aab` : `${filename}.apk`; | 
					
						
							| 
									
										
										
										
											2020-01-20 23:06:14 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return filename; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default BuildParameters; |