Skip to content

Commit d1ff114

Browse files
kelvinhokkshazron
authored andcommitted
Fixed bug where comment is not removed on removing embedded frameworks. (#5)
1 parent fadff44 commit d1ff114

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

lib/pbxProject.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,11 @@ pbxProject.prototype.removeFromPbxBuildFileSection = function(file) {
484484
if (this.pbxBuildFileSection()[uuid].fileRef_comment == file.basename) {
485485
file.uuid = uuid;
486486
delete this.pbxBuildFileSection()[uuid];
487+
488+
var commentKey = f("%s_comment", uuid);
489+
delete this.pbxBuildFileSection()[commentKey];
487490
}
488491
}
489-
var commentKey = f("%s_comment", file.uuid);
490-
delete this.pbxBuildFileSection()[commentKey];
491492
}
492493

493494
pbxProject.prototype.addPbxGroup = function(filePathsArray, name, path, sourceTree) {

test/removeFramework.js

+27
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,33 @@ exports.removeFramework = {
165165
test.ok(current.indexOf(expectedPath) == -1);
166166
}
167167

168+
test.done();
169+
},
170+
'should remove embedded frameworks': function (test) {
171+
var newFile = proj.addFramework('/path/to/Custom.framework', { customFramework: true, embed:true, sign:true }),
172+
frameworks = proj.pbxFrameworksBuildPhaseObj(),
173+
buildFileSection = proj.pbxBuildFileSection(),
174+
bfsLength = Object.keys(buildFileSection).length;
175+
176+
test.equal(frameworks.files.length, 16);
177+
test.equal(62, bfsLength);
178+
179+
var deletedFile = proj.removeFramework('/path/to/Custom.framework', { customFramework: true, embed:true }),
180+
frameworks = proj.pbxFrameworksBuildPhaseObj(),
181+
buildFileSection = proj.pbxBuildFileSection(),
182+
bfsLength = Object.keys(buildFileSection).length;
183+
184+
test.equal(frameworks.files.length, 15);
185+
test.equal(58, bfsLength);
186+
187+
var frameworkPaths = frameworkSearchPaths(proj);
188+
expectedPath = '"/path/to"';
189+
190+
for (i = 0; i < frameworkPaths.length; i++) {
191+
var current = frameworkPaths[i];
192+
test.ok(current.indexOf(expectedPath) == -1);
193+
}
194+
168195
test.done();
169196
}
170197
}

0 commit comments

Comments
 (0)