Skip to content

Commit

Permalink
Fixed bug where comment is not removed on removing embedded frameworks.
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinhokk committed Nov 1, 2017
1 parent ba195a8 commit 3d5657e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/pbxProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,11 @@ pbxProject.prototype.removeFromPbxBuildFileSection = function(file) {
if (this.pbxBuildFileSection()[uuid].fileRef_comment == file.basename) {
file.uuid = uuid;
delete this.pbxBuildFileSection()[uuid];

var commentKey = f("%s_comment", uuid);
delete this.pbxBuildFileSection()[commentKey];
}
}
var commentKey = f("%s_comment", file.uuid);
delete this.pbxBuildFileSection()[commentKey];
}

pbxProject.prototype.addPbxGroup = function(filePathsArray, name, path, sourceTree) {
Expand Down
27 changes: 27 additions & 0 deletions test/removeFramework.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,33 @@ exports.removeFramework = {
test.ok(current.indexOf(expectedPath) == -1);
}

test.done();
},
'should remove embedded frameworks': function (test) {
var newFile = proj.addFramework('/path/to/Custom.framework', { customFramework: true, embed:true, sign:true }),
frameworks = proj.pbxFrameworksBuildPhaseObj(),
buildFileSection = proj.pbxBuildFileSection(),
bfsLength = Object.keys(buildFileSection).length;

test.equal(frameworks.files.length, 16);
test.equal(62, bfsLength);

var deletedFile = proj.removeFramework('/path/to/Custom.framework', { customFramework: true, embed:true }),
frameworks = proj.pbxFrameworksBuildPhaseObj(),
buildFileSection = proj.pbxBuildFileSection(),
bfsLength = Object.keys(buildFileSection).length;

test.equal(frameworks.files.length, 15);
test.equal(58, bfsLength);

var frameworkPaths = frameworkSearchPaths(proj);
expectedPath = '"/path/to"';

for (i = 0; i < frameworkPaths.length; i++) {
var current = frameworkPaths[i];
test.ok(current.indexOf(expectedPath) == -1);
}

test.done();
}
}

0 comments on commit 3d5657e

Please sign in to comment.