This is an automated email from the ASF dual-hosted git repository.

shazron pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-node-xcode.git


The following commit(s) were added to refs/heads/master by this push:
     new d1ff114  Fixed bug where comment is not removed on removing embedded 
frameworks. (#5)
d1ff114 is described below

commit d1ff114a9495743dc3ca1a965d590e2f186e40a7
Author: kelvinhokk <kelvinh...@users.noreply.github.com>
AuthorDate: Tue May 22 14:35:52 2018 +0800

    Fixed bug where comment is not removed on removing embedded frameworks. (#5)
---
 lib/pbxProject.js       |  5 +++--
 test/removeFramework.js | 27 +++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/lib/pbxProject.js b/lib/pbxProject.js
index c14f28b..0c05d09 100644
--- a/lib/pbxProject.js
+++ b/lib/pbxProject.js
@@ -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) {
diff --git a/test/removeFramework.js b/test/removeFramework.js
index 248a1e7..20cdbde 100644
--- a/test/removeFramework.js
+++ b/test/removeFramework.js
@@ -166,5 +166,32 @@ exports.removeFramework = {
         }
 
         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();
     }
 }

-- 
To stop receiving notification emails like this one, please contact
shaz...@apache.org.

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to