You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by dp...@apache.org on 2019/03/06 04:33:23 UTC

[cordova-ios] branch master updated: (ios) Fix setting of target-device to handset in combination with plugins and resource-file

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

dpogue 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 f8b99a9  (ios) Fix setting of target-device to handset in combination with plugins and resource-file
f8b99a9 is described below

commit f8b99a9fe5aa253770900db2ca38d53f87b747fd
Author: Sebastian Kocks <se...@inform-software.com>
AuthorDate: Fri Feb 22 11:05:12 2019 +0100

    (ios) Fix setting of target-device to handset in combination with plugins and resource-file
---
 bin/templates/scripts/cordova/lib/prepare.js | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/bin/templates/scripts/cordova/lib/prepare.js b/bin/templates/scripts/cordova/lib/prepare.js
index 29f6cc2..f81085f 100644
--- a/bin/templates/scripts/cordova/lib/prepare.js
+++ b/bin/templates/scripts/cordova/lib/prepare.js
@@ -22,7 +22,6 @@ var Q = require('q');
 var fs = require('fs');
 var path = require('path');
 var shell = require('shelljs');
-var xcode = require('xcode');
 var unorm = require('unorm');
 var plist = require('plist');
 var URL = require('url');
@@ -282,15 +281,15 @@ function handleBuildSettings (platformConfig, locations, infoPlist) {
     var needUpdatedBuildSettingsForLaunchStoryboard = checkIfBuildSettingsNeedUpdatedForLaunchStoryboard(platformConfig, infoPlist);
     var swiftVersion = platformConfig.getPreference('SwiftVersion', 'ios');
 
-    var proj = new xcode.project(locations.pbxproj); /* eslint new-cap : 0 */
+    var project;
 
     try {
-        proj.parseSync();
+        project = projectFile.parse(locations);
     } catch (err) {
         return Q.reject(new CordovaError('Could not parse ' + locations.pbxproj + ': ' + err));
     }
 
-    var origPkg = proj.getBuildProperty('PRODUCT_BUNDLE_IDENTIFIER');
+    var origPkg = project.xcode.getBuildProperty('PRODUCT_BUNDLE_IDENTIFIER');
 
     // no build settings provided and we don't need to update build settings for launch storyboards,
     // then we don't need to parse and update .pbxproj file
@@ -300,27 +299,27 @@ function handleBuildSettings (platformConfig, locations, infoPlist) {
 
     if (origPkg !== pkg) {
         events.emit('verbose', 'Set PRODUCT_BUNDLE_IDENTIFIER to ' + pkg + '.');
-        proj.updateBuildProperty('PRODUCT_BUNDLE_IDENTIFIER', pkg);
+        project.xcode.updateBuildProperty('PRODUCT_BUNDLE_IDENTIFIER', pkg);
     }
 
     if (targetDevice) {
         events.emit('verbose', 'Set TARGETED_DEVICE_FAMILY to ' + targetDevice + '.');
-        proj.updateBuildProperty('TARGETED_DEVICE_FAMILY', targetDevice);
+        project.xcode.updateBuildProperty('TARGETED_DEVICE_FAMILY', targetDevice);
     }
 
     if (deploymentTarget) {
         events.emit('verbose', 'Set IPHONEOS_DEPLOYMENT_TARGET to "' + deploymentTarget + '".');
-        proj.updateBuildProperty('IPHONEOS_DEPLOYMENT_TARGET', deploymentTarget);
+        project.xcode.updateBuildProperty('IPHONEOS_DEPLOYMENT_TARGET', deploymentTarget);
     }
 
     if (swiftVersion) {
         events.emit('verbose', 'Set SwiftVersion to "' + swiftVersion + '".');
-        proj.updateBuildProperty('SWIFT_VERSION', swiftVersion);
+        project.xcode.updateBuildProperty('SWIFT_VERSION', swiftVersion);
     }
 
-    updateBuildSettingsForLaunchStoryboard(proj, platformConfig, infoPlist);
+    updateBuildSettingsForLaunchStoryboard(project.xcode, platformConfig, infoPlist);
 
-    fs.writeFileSync(locations.pbxproj, proj.writeSync(), 'utf-8');
+    project.write();
 
     return Q();
 }
@@ -962,7 +961,7 @@ function processAccessAndAllowNavigationEntries (config) {
     var allow_navigations = config.getAllowNavigations();
 
     return allow_navigations
-        // we concat allow_navigations and accesses, after processing accesses
+    // we concat allow_navigations and accesses, after processing accesses
         .concat(accesses.map(function (obj) {
             // map accesses to a common key interface using 'href', not origin
             obj.href = obj.origin;


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