This is an automated email from the ASF dual-hosted git repository. shazron pushed a commit to branch 4.5.x in repository https://gitbox.apache.org/repos/asf/cordova-ios.git
The following commit(s) were added to refs/heads/4.5.x by this push: new 92b639f CB-12940: [IOS] Use deployment-target from config.xml for platform version in Podfile (#469) 92b639f is described below commit 92b639fd23d044b3dd9c85bed238fc98e2e47be3 Author: Jonathan Vukovich-Tribouharet <188946+jonathantribouha...@users.noreply.github.com> AuthorDate: Wed Jan 9 07:24:01 2019 +0100 CB-12940: [IOS] Use deployment-target from config.xml for platform version in Podfile (#469) --- bin/templates/scripts/cordova/Api.js | 6 ++++-- bin/templates/scripts/cordova/lib/Podfile.js | 7 ++++--- tests/spec/unit/Api.spec.js | 6 +++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bin/templates/scripts/cordova/Api.js b/bin/templates/scripts/cordova/Api.js index dd50d11..ae9d909 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 49173c4..ffb975a 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 || '8.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, \'8.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 14e178e..eef7f72 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, --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org