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

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

surajpindoria closed pull request #347: CB-13523: Add flag for Xcode-managed 
provisioning
URL: https://github.com/apache/cordova-ios/pull/347
 
 
   

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/build 
b/bin/templates/scripts/cordova/build
index 61d26cca3..bd5a61947 100755
--- a/bin/templates/scripts/cordova/build
+++ b/bin/templates/scripts/cordova/build
@@ -42,6 +42,7 @@ var buildOpts = nopt({
     'codeSignIdentity': String,
     'codeSignResourceRules': String,
     'provisioningProfile': String,
+    'automaticProvisioning': Boolean,
     'developmentTeam': String,
     'packageType': String,
     'buildConfig' : String,
diff --git a/bin/templates/scripts/cordova/lib/build.js 
b/bin/templates/scripts/cordova/lib/build.js
index f51b084c1..b68262e9d 100644
--- a/bin/templates/scripts/cordova/lib/build.js
+++ b/bin/templates/scripts/cordova/lib/build.js
@@ -97,7 +97,7 @@ module.exports.run = function (buildOpts) {
             var buildType = buildOpts.release ? 'release' : 'debug';
             var config = buildConfig.ios[buildType];
             if (config) {
-                ['codeSignIdentity', 'codeSignResourceRules', 
'provisioningProfile', 'developmentTeam', 'packageType', 'buildFlag', 
'iCloudContainerEnvironment'].forEach(
+                ['codeSignIdentity', 'codeSignResourceRules', 
'provisioningProfile', 'developmentTeam', 'packageType', 'buildFlag', 
'iCloudContainerEnvironment', 'automaticProvisioning'].forEach(
                     function (key) {
                         buildOpts[key] = buildOpts[key] || config[key];
                     });
@@ -225,7 +225,7 @@ module.exports.run = function (buildOpts) {
             }
 
             function packageArchive () {
-                var xcodearchiveArgs = getXcodeArchiveArgs(projectName, 
projectPath, buildOutputDir, exportOptionsPath);
+                var xcodearchiveArgs = getXcodeArchiveArgs(projectName, 
projectPath, buildOutputDir, exportOptionsPath, 
buildOpts.automaticProvisioning);
                 return spawn('xcodebuild', xcodearchiveArgs, projectPath);
             }
 
@@ -337,15 +337,16 @@ function getXcodeBuildArgs (projectName, projectPath, 
configuration, isDevice, b
  * @param  {String}  projectPath        Path to project file. Will be used to 
set CWD for xcodebuild
  * @param  {String}  outputPath         Output directory to contain the IPA
  * @param  {String}  exportOptionsPath  Path to the exportOptions.plist file
+ * @param  {Boolean} autoProvisioning   Whether to allow Xcode to 
automatically update provisioning
  * @return {Array}                      Array of arguments that could be 
passed directly to spawn method
  */
-function getXcodeArchiveArgs (projectName, projectPath, outputPath, 
exportOptionsPath) {
+function getXcodeArchiveArgs (projectName, projectPath, outputPath, 
exportOptionsPath, autoProvisioning) {
     return [
         '-exportArchive',
         '-archivePath', projectName + '.xcarchive',
         '-exportOptionsPlist', exportOptionsPath,
         '-exportPath', outputPath
-    ];
+    ].concat(autoProvisioning ? ['-allowProvisioningUpdates'] : []);
 }
 
 function parseBuildFlag (buildFlag, args) {
diff --git a/bin/templates/scripts/cordova/run 
b/bin/templates/scripts/cordova/run
index 470384b52..c4cfca30a 100755
--- a/bin/templates/scripts/cordova/run
+++ b/bin/templates/scripts/cordova/run
@@ -45,6 +45,7 @@ var opts = nopt({
     'codeSignIdentity': String,
     'codeSignResourceRules': String,
     'provisioningProfile': String,
+    'automaticProvisioning': Boolean,
     'buildConfig' : String,
     'noSign' : Boolean
 }, { 'd' : '--verbose' }, args);
diff --git a/tests/spec/unit/build.spec.js b/tests/spec/unit/build.spec.js
index 6cf005c80..4b123361f 100644
--- a/tests/spec/unit/build.spec.js
+++ b/tests/spec/unit/build.spec.js
@@ -199,6 +199,20 @@ describe('build', function () {
             expect(archiveArgs.length).toEqual(7);
             done();
         });
+
+        it('should generate the appropriate arguments for automatic 
provisioning', function (done) {
+            var archiveArgs = getXcodeArchiveArgs('TestProjectName', 
testProjectPath, '/test/output/path', '/test/export/options/path', true);
+            expect(archiveArgs[0]).toEqual('-exportArchive');
+            expect(archiveArgs[1]).toEqual('-archivePath');
+            expect(archiveArgs[2]).toEqual('TestProjectName.xcarchive');
+            expect(archiveArgs[3]).toEqual('-exportOptionsPlist');
+            expect(archiveArgs[4]).toEqual('/test/export/options/path');
+            expect(archiveArgs[5]).toEqual('-exportPath');
+            expect(archiveArgs[6]).toEqual('/test/output/path');
+            expect(archiveArgs[7]).toEqual('-allowProvisioningUpdates');
+            expect(archiveArgs.length).toEqual(8);
+            done();
+        });
     });
 
     describe('parseBuildFlag method', function () {


 

----------------------------------------------------------------
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:
us...@infra.apache.org


> Add build config option to enable Xcode automatic provisioning
> --------------------------------------------------------------
>
>                 Key: CB-13523
>                 URL: https://issues.apache.org/jira/browse/CB-13523
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: cordova-ios
>         Environment: Xcode 9
> Cordova-iOS 4.5.3
>            Reporter: Darryl Pogue
>            Assignee: Darryl Pogue
>
> Xcode 9 made more changes to how provisioning works for apps, particularly 
> around manual vs automatic signing.
> The changes required to support manual signing of release builds was 
> implemented as part of CB-13315.
> In order for automatic signing to work, we need to pass an additional flag to 
> xcodebuild to allow Xcode to manage automatically updating provisioning 
> profiles as needed. I want to keep this being a build config option because 
> many people may not want to grant Xcode such power by default.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to