You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ni...@apache.org on 2021/01/31 15:32:32 UTC

[cordova-ios] branch master updated: fix: plugin podspec with no config elements (#1067)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new e1cc096  fix: plugin podspec with no config elements (#1067)
e1cc096 is described below

commit e1cc0966b3594e7afc380f5cd585eb6c5973c7c4
Author: エリス <er...@users.noreply.github.com>
AuthorDate: Mon Feb 1 00:32:21 2021 +0900

    fix: plugin podspec with no config elements (#1067)
---
 bin/templates/scripts/cordova/Api.js | 86 ++++++++++++++++++++----------------
 1 file changed, 47 insertions(+), 39 deletions(-)

diff --git a/bin/templates/scripts/cordova/Api.js b/bin/templates/scripts/cordova/Api.js
index ae8d097..9490f62 100644
--- a/bin/templates/scripts/cordova/Api.js
+++ b/bin/templates/scripts/cordova/Api.js
@@ -354,52 +354,60 @@ Api.prototype.addPodSpecs = function (plugin, podSpecs, frameworkPods, installOp
         events.emit('verbose', 'Adding pods since the plugin contained <podspecs>');
         podSpecs.forEach(obj => {
             // declarations
-            Object.keys(obj.declarations).forEach(key => {
-                if (obj.declarations[key] === 'true') {
-                    const declaration = Podfile.proofDeclaration(key);
+            if (obj.declarations) {
+                Object.keys(obj.declarations).forEach(key => {
+                    if (obj.declarations[key] === 'true') {
+                        const declaration = Podfile.proofDeclaration(key);
+                        const podJson = {
+                            declaration
+                        };
+                        const val = podsjsonFile.getDeclaration(declaration);
+                        if (val) {
+                            podsjsonFile.incrementDeclaration(declaration);
+                        } else {
+                            podJson.count = 1;
+                            podsjsonFile.setJsonDeclaration(declaration, podJson);
+                            podfileFile.addDeclaration(podJson.declaration);
+                        }
+                    }
+                });
+            }
+
+            // sources
+            if (obj.sources) {
+                Object.keys(obj.sources).forEach(key => {
                     const podJson = {
-                        declaration
+                        source: obj.sources[key].source
                     };
-                    const val = podsjsonFile.getDeclaration(declaration);
+                    const val = podsjsonFile.getSource(key);
                     if (val) {
-                        podsjsonFile.incrementDeclaration(declaration);
+                        podsjsonFile.incrementSource(key);
                     } else {
                         podJson.count = 1;
-                        podsjsonFile.setJsonDeclaration(declaration, podJson);
-                        podfileFile.addDeclaration(podJson.declaration);
+                        podsjsonFile.setJsonSource(key, podJson);
+                        podfileFile.addSource(podJson.source);
                     }
-                }
-            });
-            // sources
-            Object.keys(obj.sources).forEach(key => {
-                const podJson = {
-                    source: obj.sources[key].source
-                };
-                const val = podsjsonFile.getSource(key);
-                if (val) {
-                    podsjsonFile.incrementSource(key);
-                } else {
-                    podJson.count = 1;
-                    podsjsonFile.setJsonSource(key, podJson);
-                    podfileFile.addSource(podJson.source);
-                }
-            });
+                });
+            }
+
             // libraries
-            Object.keys(obj.libraries).forEach(key => {
-                const podJson = Object.assign({}, obj.libraries[key]);
-                if (podJson.spec) {
-                    podJson.spec = getVariableSpec(podJson.spec, installOptions);
-                }
-                const val = podsjsonFile.getLibrary(key);
-                if (val) {
-                    events.emit('warn', `${plugin.id} depends on ${podJson.name}, which may conflict with another plugin. ${podJson.name}@${val.spec} is already installed and was not overwritten.`);
-                    podsjsonFile.incrementLibrary(key);
-                } else {
-                    podJson.count = 1;
-                    podsjsonFile.setJsonLibrary(key, podJson);
-                    podfileFile.addSpec(podJson.name, podJson);
-                }
-            });
+            if (obj.libraries) {
+                Object.keys(obj.libraries).forEach(key => {
+                    const podJson = Object.assign({}, obj.libraries[key]);
+                    if (podJson.spec) {
+                        podJson.spec = getVariableSpec(podJson.spec, installOptions);
+                    }
+                    const val = podsjsonFile.getLibrary(key);
+                    if (val) {
+                        events.emit('warn', `${plugin.id} depends on ${podJson.name}, which may conflict with another plugin. ${podJson.name}@${val.spec} is already installed and was not overwritten.`);
+                        podsjsonFile.incrementLibrary(key);
+                    } else {
+                        podJson.count = 1;
+                        podsjsonFile.setJsonLibrary(key, podJson);
+                        podfileFile.addSpec(podJson.name, podJson);
+                    }
+                });
+            }
         });
     }
 


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