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-05-21 15:44:56 +00:00
|
|
|
import Versioning from './versioning';
|
2020-01-20 23:06:14 +00:00
|
|
|
|
|
|
|
class BuildParameters {
|
2020-05-21 15:44:56 +00:00
|
|
|
static async create() {
|
2020-07-06 01:41:21 +00:00
|
|
|
const buildFile = this.parseBuildFile(
|
|
|
|
Input.buildName,
|
|
|
|
Input.targetPlatform,
|
|
|
|
Input.androidAppBundle,
|
|
|
|
);
|
2020-05-21 15:44:56 +00:00
|
|
|
const buildVersion = await Versioning.determineVersion(
|
|
|
|
Input.versioningStrategy,
|
|
|
|
Input.specifiedVersion,
|
|
|
|
);
|
2020-01-20 23:06:14 +00:00
|
|
|
|
2020-06-24 22:02:05 +00:00
|
|
|
const androidVersionCode = AndroidVersioning.determineVersionCode(
|
|
|
|
buildVersion,
|
|
|
|
Input.androidVersionCode,
|
|
|
|
);
|
|
|
|
|
2020-01-20 23:06:14 +00:00
|
|
|
return {
|
2020-05-21 15:44:56 +00:00
|
|
|
version: Input.unityVersion,
|
|
|
|
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,
|
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;
|