2020-01-20 23:06:14 +00:00
|
|
|
import Platform from './platform';
|
|
|
|
|
|
|
|
class BuildParameters {
|
|
|
|
static create(parameters) {
|
|
|
|
const {
|
2020-04-26 18:22:09 +00:00
|
|
|
version,
|
2020-01-20 23:06:14 +00:00
|
|
|
targetPlatform,
|
|
|
|
projectPath,
|
|
|
|
buildName,
|
|
|
|
buildsPath,
|
|
|
|
buildMethod,
|
2020-04-26 18:22:09 +00:00
|
|
|
buildVersion,
|
2020-01-27 18:39:49 +00:00
|
|
|
customParameters,
|
2020-01-20 23:06:14 +00:00
|
|
|
} = parameters;
|
|
|
|
|
|
|
|
return {
|
2020-04-26 18:22:09 +00:00
|
|
|
version,
|
2020-01-20 23:06:14 +00:00
|
|
|
platform: targetPlatform,
|
|
|
|
projectPath,
|
|
|
|
buildName,
|
|
|
|
buildPath: `${buildsPath}/${targetPlatform}`,
|
|
|
|
buildFile: this.parseBuildFile(buildName, targetPlatform),
|
|
|
|
buildMethod,
|
2020-04-26 18:22:09 +00:00
|
|
|
buildVersion,
|
2020-01-27 18:39:49 +00:00
|
|
|
customParameters,
|
2020-01-20 23:06:14 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
static parseBuildFile(filename, platform) {
|
|
|
|
if (Platform.isWindows(platform)) {
|
|
|
|
return `${filename}.exe`;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Platform.isAndroid(platform)) {
|
|
|
|
return `${filename}.apk`;
|
|
|
|
}
|
|
|
|
|
|
|
|
return filename;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default BuildParameters;
|