You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/02/26 05:48:00 UTC

[jira] [Commented] (CB-12940) Use deployment-target for platform version in Podfile

    [ https://issues.apache.org/jira/browse/CB-12940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16376413#comment-16376413 ] 

ASF GitHub Bot commented on CB-12940:
-------------------------------------

shazron closed pull request #335: CB-12940: [IOS] Use deployment-target from config.xml for platform version in Podfile
URL: https://github.com/apache/cordova-ios/pull/335
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/bin/templates/scripts/cordova/Api.js b/bin/templates/scripts/cordova/Api.js
index dd50d11f8..ae9d909ab 100644
--- a/bin/templates/scripts/cordova/Api.js
+++ b/bin/templates/scripts/cordova/Api.js
@@ -30,6 +30,7 @@ var events = require('cordova-common').events;
 var PluginManager = require('cordova-common').PluginManager;
 var Q = require('q');
 var util = require('util');
+var ConfigParser = require('cordova-common').ConfigParser;
 
 function setupEvents (externalEventEmitter) {
     if (externalEventEmitter) {
@@ -179,7 +180,7 @@ Api.prototype.getPlatformInfo = function () {
     result.root = this.root;
     result.name = this.platform;
     result.version = require('./version');
-    result.projectConfig = this._config;
+    result.projectConfig = new ConfigParser(this.locations.configXml);
 
     return result;
 };
@@ -247,6 +248,7 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
 
             var project_dir = self.locations.root;
             var project_name = self.locations.xcodeCordovaProj.split('/').pop();
+            var minDeploymentTarget = self.getPlatformInfo().projectConfig.getPreference('deployment-target', 'ios');
 
             var Podfile = require('./lib/Podfile').Podfile;
             var PodsJson = require('./lib/PodsJson').PodsJson;
@@ -254,7 +256,7 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
             events.emit('verbose', 'Adding pods since the plugin contained <framework>(s) with type="podspec"');
 
             var podsjsonFile = new PodsJson(path.join(project_dir, PodsJson.FILENAME));
-            var podfileFile = new Podfile(path.join(project_dir, Podfile.FILENAME), project_name);
+            var podfileFile = new Podfile(path.join(project_dir, Podfile.FILENAME), project_name, minDeploymentTarget);
 
             frameworkPods.forEach(function (obj) {
                 var podJson = {
diff --git a/bin/templates/scripts/cordova/lib/Podfile.js b/bin/templates/scripts/cordova/lib/Podfile.js
index 13e618028..ffa5be226 100644
--- a/bin/templates/scripts/cordova/lib/Podfile.js
+++ b/bin/templates/scripts/cordova/lib/Podfile.js
@@ -28,11 +28,12 @@ var CordovaError = require('cordova-common').CordovaError;
 
 Podfile.FILENAME = 'Podfile';
 
-function Podfile (podFilePath, projectName) {
+function Podfile (podFilePath, projectName, minDeploymentTarget) {
     this.podToken = '##INSERT_POD##';
 
     this.path = podFilePath;
     this.projectName = projectName;
+    this.minDeploymentTarget = minDeploymentTarget || '9.0';
     this.contents = null;
     this.pods = null;
     this.__dirty = false;
@@ -97,12 +98,12 @@ Podfile.prototype.getTemplate = function () {
     var projectName = this.escapeSingleQuotes(this.projectName);
     return util.format(
         '# DO NOT MODIFY -- auto-generated by Apache Cordova\n' +
-            'platform :ios, \'9.0\'\n' +
+            'platform :ios, \'%s\'\n' +
             'target \'%s\' do\n' +
             '\tproject \'%s.xcodeproj\'\n' +
             '%s\n' +
             'end\n',
-        projectName, projectName, this.podToken);
+        this.minDeploymentTarget, projectName, projectName, this.podToken);
 };
 
 Podfile.prototype.addSpec = function (name, spec) {
diff --git a/tests/spec/unit/Api.spec.js b/tests/spec/unit/Api.spec.js
index 14e178ec4..eef7f7275 100644
--- a/tests/spec/unit/Api.spec.js
+++ b/tests/spec/unit/Api.spec.js
@@ -127,13 +127,13 @@ describe('Platform Api', function () {
 
     describe('.prototype', function () {
         var api;
-        var projectRoot = '/some/path';
+        var projectRoot = iosProjectFixture;
         beforeEach(function () {
-            spyOn(fs, 'readdirSync').and.returnValue([projectRoot + '/cordova.xcodeproj']);
+            api = new Api('ios', projectRoot);
+            spyOn(fs, 'readdirSync').and.returnValue([api.locations.xcodeProjDir]);
             spyOn(projectFile, 'parse').and.returnValue({
                 getPackageName: function () { return 'ios.cordova.io'; }
             });
-            api = new Api('ios', projectRoot);
         });
 
         // See the comment at the top of this file, in the list of requires,


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Use deployment-target for platform version in Podfile
> -----------------------------------------------------
>
>                 Key: CB-12940
>                 URL: https://issues.apache.org/jira/browse/CB-12940
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: cordova-ios
>    Affects Versions: cordova-ios@4.4.0
>            Reporter: Todd Miller
>            Assignee: Shazron Abdullah
>            Priority: Major
>              Labels: backlog
>             Fix For: cordova-ios@4.5.1
>
>
> The current Podfile.js script is hardcoded to set the platform ios version to 8.0. However, there are some pods that require 9.0 or they will fail to install. The deployment-target preference should be honored and used when generating the Podfile.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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