Skip to content

Commit ccf2194

Browse files
author
Anis Kadri
committed
Merge branch 'Mitko-Kerezov-add-build-output-files'
2 parents 34f4d68 + dbaa2e7 commit ccf2194

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

lib/pbxProject.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,12 @@ function pbxFileReferenceObj(file) {
770770

771771
if (file.fileEncoding)
772772
obj.fileEncoding = file.fileEncoding;
773+
774+
if (file.explicitFileType)
775+
obj.explicitFileType = file.explicitFileType;
776+
777+
if ('includeInIndex' in file)
778+
obj.includeInIndex = file.includeInIndex;
773779

774780
return obj;
775781
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
var jsonProject = require('./fixtures/full-project')
2+
fullProjectStr = JSON.stringify(jsonProject),
3+
pbx = require('../lib/pbxProject'),
4+
pbxFile = require('../lib/pbxFile'),
5+
myProj = new pbx('.');
6+
7+
function cleanHash() {
8+
return JSON.parse(fullProjectStr);
9+
}
10+
11+
exports.setUp = function (callback) {
12+
myProj.hash = cleanHash();
13+
callback();
14+
}
15+
16+
exports['addToPbxFileReferenceSection function'] = {
17+
'should add file and comment to fileReferenceSection': function (test) {
18+
var file = new pbxFile('file.m');
19+
file.fileRef = myProj.generateUuid();
20+
21+
myProj.addToPbxFileReferenceSection(file)
22+
23+
test.equal(myProj.pbxFileReferenceSection()[file.fileRef].isa, 'PBXFileReference');
24+
test.equal(myProj.pbxFileReferenceSection()[file.fileRef].lastKnownFileType, 'sourcecode.c.objc');
25+
test.equal(myProj.pbxFileReferenceSection()[file.fileRef].name, '"file.m"');
26+
test.equal(myProj.pbxFileReferenceSection()[file.fileRef].path, '"file.m"');
27+
test.equal(myProj.pbxFileReferenceSection()[file.fileRef].sourceTree, '"<group>"');
28+
test.equal(myProj.pbxFileReferenceSection()[file.fileRef].fileEncoding, 4);
29+
test.equal(myProj.pbxFileReferenceSection()[file.fileRef + "_comment"], 'file.m');
30+
test.done();
31+
},
32+
'should add file with preset explicitFileType to fileReferenceSection correctly': function (test) {
33+
var appexFile = { fileRef: myProj.generateUuid(), isa: 'PBXFileReference', explicitFileType: '"wrapper.app-extension"', path: "WatchKit Extension.appex"};
34+
35+
myProj.addToPbxFileReferenceSection(appexFile)
36+
37+
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].isa, 'PBXFileReference');
38+
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].explicitFileType, '"wrapper.app-extension"');
39+
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].path, '"WatchKit Extension.appex"');
40+
test.done();
41+
},
42+
'should add file with preset includeInIndex to fileReferenceSection correctly': function (test) {
43+
var appexFile = { fileRef: myProj.generateUuid(), isa: 'PBXFileReference', includeInIndex: 0, path: "WatchKit Extension.appex"};
44+
45+
myProj.addToPbxFileReferenceSection(appexFile)
46+
47+
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].isa, 'PBXFileReference');
48+
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].includeInIndex, 0);
49+
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].path, '"WatchKit Extension.appex"');
50+
test.done();
51+
},
52+
'should add file with preset sourceTree to fileReferenceSection correctly': function (test) {
53+
var appexFile = { fileRef: myProj.generateUuid(), isa: 'PBXFileReference', sourceTree: 'BUILT_PRODUCTS_DIR', path: "WatchKit Extension.appex"};
54+
55+
myProj.addToPbxFileReferenceSection(appexFile)
56+
57+
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].isa, 'PBXFileReference');
58+
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].sourceTree, 'BUILT_PRODUCTS_DIR');
59+
test.equal(myProj.pbxFileReferenceSection()[appexFile.fileRef].path, '"WatchKit Extension.appex"');
60+
test.done();
61+
}
62+
}

0 commit comments

Comments
 (0)