This repository was archived by the owner on May 27, 2021. It is now read-only.
forked from alunny/node-xcode
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathaddXCConfigurationList.js
More file actions
115 lines (102 loc) · 5.63 KB
/
addXCConfigurationList.js
File metadata and controls
115 lines (102 loc) · 5.63 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
var fullProject = require('./fixtures/full-project')
fullProjectStr = JSON.stringify(fullProject),
pbx = require('../lib/pbxProject'),
proj = new pbx('.'),
debugConfiguration = {
isa: 'XCBuildConfiguration',
buildSettings: {
GCC_PREPROCESSOR_DEFINITIONS: [
'"DEBUG=1"',
'"$(inherited)"',
],
INFOPLIST_FILE: "Info.Plist",
LD_RUNPATH_SEARCH_PATHS: '"$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"',
PRODUCT_NAME: '"${TARGET_NAME}"',
SKIP_INSTALL: 'YES'
},
name: 'Debug'
},
releaseConfiguration = {
isa: 'XCBuildConfiguration',
buildSettings: {
INFOPLIST_FILE: "Info.Plist",
LD_RUNPATH_SEARCH_PATHS: '"$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"',
PRODUCT_NAME: '"${TARGET_NAME}"',
SKIP_INSTALL: 'YES'
},
name: 'Release'
};
function cleanHash() {
return JSON.parse(fullProjectStr);
}
exports.setUp = function (callback) {
proj.hash = cleanHash();
callback();
}
exports.addXCConfigurationList = {
'should return an XCConfigurationList': function (test) {
var myProj = new pbx('test/parser/projects/full.pbxproj').parseSync(),
xcConfigurationList = myProj.addXCConfigurationList([debugConfiguration, releaseConfiguration], 'Release', 'XCConfigurationList Comment');
test.ok(typeof xcConfigurationList === 'object');
test.done();
},
'should set a uuid on the XCConfigurationList': function (test) {
var myProj = new pbx('test/parser/projects/full.pbxproj').parseSync(),
xcConfigurationList = myProj.addXCConfigurationList([debugConfiguration, releaseConfiguration], 'Release', 'XCConfigurationList Comment');
test.ok(xcConfigurationList.uuid);
test.done();
},
'should add configurations to pbxBuildConfigurationSection': function (test) {
var myProj = new pbx('test/parser/projects/full.pbxproj').parseSync(),
pbxBuildConfigurationSection = myProj.pbxXCBuildConfigurationSection(),
xcConfigurationList = myProj.addXCConfigurationList([debugConfiguration, releaseConfiguration], 'Release', 'XCConfigurationList Comment'),
xcConfigurationListConfigurations = xcConfigurationList.xcConfigurationList.buildConfigurations;
for (var index = 0; index < xcConfigurationListConfigurations.length; index++) {
var configuration = xcConfigurationListConfigurations[index];
test.ok(pbxBuildConfigurationSection[configuration.value]);
}
test.done();
},
'should add XCConfigurationList to pbxXCConfigurationListSection': function (test) {
var myProj = new pbx('test/parser/projects/full.pbxproj').parseSync(),
pbxXCConfigurationListSection = myProj.pbxXCConfigurationList();
xcConfigurationList = myProj.addXCConfigurationList([debugConfiguration, releaseConfiguration], 'Release', 'XCConfigurationList Comment');
test.ok(pbxXCConfigurationListSection[xcConfigurationList.uuid]);
test.done();
},
'should add XCConfigurationList object correctly': function (test) {
var myProj = new pbx('test/parser/projects/full.pbxproj').parseSync(),
pbxXCConfigurationListSection = myProj.pbxXCConfigurationList();
xcConfigurationList = myProj.addXCConfigurationList([debugConfiguration, releaseConfiguration], 'Release', 'XCConfigurationList Comment'),
xcConfigurationListInPbx = pbxXCConfigurationListSection[xcConfigurationList.uuid];
test.deepEqual(xcConfigurationListInPbx, xcConfigurationList.xcConfigurationList);
test.done();
},
'should add correct configurations to XCConfigurationList and to pbxBuildConfigurationSection': function (test) {
var myProj = new pbx('test/parser/projects/full.pbxproj').parseSync(),
pbxXCConfigurationListSection = myProj.pbxXCConfigurationList();
pbxBuildConfigurationSection = myProj.pbxXCBuildConfigurationSection(),
xcConfigurationList = myProj.addXCConfigurationList([debugConfiguration, releaseConfiguration], 'Release', 'XCConfigurationList Comment'),
xcConfigurationListConfigurations = xcConfigurationList.xcConfigurationList.buildConfigurations,
expectedConfigurations = [],
xcConfigurationListInPbx = pbxXCConfigurationListSection[xcConfigurationList.uuid];
for (var index = 0; index < xcConfigurationListConfigurations.length; index++) {
var configuration = xcConfigurationListConfigurations[index];
expectedConfigurations.push(pbxBuildConfigurationSection[configuration.value]);
}
test.deepEqual(expectedConfigurations, [debugConfiguration, releaseConfiguration]);
test.deepEqual(xcConfigurationListInPbx.buildConfigurations, xcConfigurationListConfigurations);
test.done();
},
'should set comments for pbxBuildConfigurations': function (test) {
var myProj = new pbx('test/parser/projects/full.pbxproj').parseSync(),
pbxBuildConfigurationSection = myProj.pbxXCBuildConfigurationSection(),
xcConfigurationList = myProj.addXCConfigurationList([debugConfiguration, releaseConfiguration], 'Release', 'XCConfigurationList Comment'),
xcConfigurationListConfigurations = xcConfigurationList.xcConfigurationList.buildConfigurations;
for (var index = 0; index < xcConfigurationListConfigurations.length; index++) {
var configuration = xcConfigurationListConfigurations[index];
test.ok(pbxBuildConfigurationSection[configuration.value + '_comment']);
}
test.done();
}
}