Refactor models to allow for build parameters...
Build parameters have to be parsed because they can no longer be implicitly passed, as they need to be interpreted for detecting extensions.
This commit is contained in:
38
src/model/build-parameters.js
Normal file
38
src/model/build-parameters.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import Platform from './platform';
|
||||
|
||||
class BuildParameters {
|
||||
static create(parameters) {
|
||||
const {
|
||||
unityVersion,
|
||||
targetPlatform,
|
||||
projectPath,
|
||||
buildName,
|
||||
buildsPath,
|
||||
buildMethod,
|
||||
} = parameters;
|
||||
|
||||
return {
|
||||
version: unityVersion,
|
||||
platform: targetPlatform,
|
||||
projectPath,
|
||||
buildName,
|
||||
buildPath: `${buildsPath}/${targetPlatform}`,
|
||||
buildFile: this.parseBuildFile(buildName, targetPlatform),
|
||||
buildMethod,
|
||||
};
|
||||
}
|
||||
|
||||
static parseBuildFile(filename, platform) {
|
||||
if (Platform.isWindows(platform)) {
|
||||
return `${filename}.exe`;
|
||||
}
|
||||
|
||||
if (Platform.isAndroid(platform)) {
|
||||
return `${filename}.apk`;
|
||||
}
|
||||
|
||||
return filename;
|
||||
}
|
||||
}
|
||||
|
||||
export default BuildParameters;
|
||||
Reference in New Issue
Block a user