forked from AtomicGameEngine/AtomicGameEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuildConfig.js
More file actions
86 lines (75 loc) · 2.85 KB
/
BuildConfig.js
File metadata and controls
86 lines (75 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
var os = require('os');
var path = require('path');
var spawnSync = require('child_process').spawnSync;
var fs = require('fs-extra');
// function from BuildCommon, checks to see if a file exists
function programFileExists(filePath)
{
try
{
return fs.statSync(filePath).isFile();
}
catch (err)
{
return false;
}
}
// checks to see if a folder exists
function programDirectoryExists(filePath)
{
try
{
return fs.statSync(filePath).isDirectory();
}
catch (err)
{
return false;
}
}
function processOptions(config) {
config["config"] = config["debug"] ? "Debug" : "Release";
// AtomicNET
if (config["nonet"]) {
config["with-atomicnet"] = false;
} else {
if (os.platform() == "win32") {
config["with-atomicnet"] = true;
} else if (os.platform() == "darwin") {
// see if xbuild is available
config["with-atomicnet"] = false;
if ( spawnSync)
config["with-atomicnet"] = spawnSync("which", ["xbuild"]).status == 1 ? false : true;
} else if (os.platform() == "linux") { // see if xbuild is available on linux
var hasXbuild = programFileExists('/usr/bin/xbuild');
var hasMonoFile = programFileExists('/usr/bin/mono');
var hasMonoDir = programDirectoryExists('/usr/bin/mono/');
config["with-atomicnet"] = hasXbuild && ( hasMonoFile || hasMonoDir );
}
}
// paths
config.atomicRoot = path.resolve(__dirname, "../..") + "/";
config.artifactsRoot = config.atomicRoot + "Artifacts/";
config.editorAppFolder = (os.platform() == "darwin") ? config.artifactsRoot + "/AtomicEditor/AtomicEditor.app/" : config.artifactsRoot + "AtomicEditor/";
config.toolDataFolder = config.editorAppFolder + (os.platform() == "darwin" ? "Contents/Resources/ToolData/" : "Resources/ToolData/");
// jenkins, TODO: abstract anything that requires jenkins
config.jenkins = process.env.ATOMIC_JENKINS_BUILD == 1;
config.buildSHA = process.env.ATOMIC_BUILD_SHA ? process.env.ATOMIC_BUILD_SHA : "UNKNOWN_BUILD_SHA";
config.devIDApp = process.env.ATOMIC_DEV_ID_APP ? process.env.ATOMIC_DEV_ID_APP : "";
config.pfxFile = process.env.ATOMIC_PFX_FILE ? process.env.ATOMIC_PFX_FILE : "";
config.pfxPW = process.env.ATOMIC_PFX_PW ? process.env.ATOMIC_PFX_PW : "";
config.certSubjectName = process.env.ATOMIC_CERT_SUBJECTNAME ? process.env.ATOMIC_CERT_SUBJECTNAME : "";
return config;
}
exports = module.exports = processOptions(require('minimist')(process.argv.slice(2), {
"default" : {
"noclean" : false,
"debug" : false,
"nonet" : false,
"with-web" : false,
"with-android" : false,
"with-ios" : false,
"with-docs" : false,
"noexamples" : false,
"package" : false
}
}));