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

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

shazron closed pull request #358: CB-13523: Pass automaticProvisioning to build 
step
URL: https://github.com/apache/cordova-ios/pull/358
 
 
   

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/lib/build.js 
b/bin/templates/scripts/cordova/lib/build.js
index b68262e9d..b102152b2 100644
--- a/bin/templates/scripts/cordova/lib/build.js
+++ b/bin/templates/scripts/cordova/lib/build.js
@@ -171,7 +171,7 @@ module.exports.run = function (buildOpts) {
             // remove the build/device folder before building
             return spawn('rm', [ '-rf', buildOutputDir ], projectPath)
                 .then(function () {
-                    var xcodebuildArgs = getXcodeBuildArgs(projectName, 
projectPath, configuration, buildOpts.device, buildOpts.buildFlag, 
emulatorTarget);
+                    var xcodebuildArgs = getXcodeBuildArgs(projectName, 
projectPath, configuration, buildOpts.device, buildOpts.buildFlag, 
emulatorTarget, buildOpts.automaticProvisioning);
                     return spawn('xcodebuild', xcodebuildArgs, projectPath);
                 });
 
@@ -268,9 +268,10 @@ module.exports.findXCodeProjectIn = findXCodeProjectIn;
  * @param  {Boolean} isDevice       Flag that specify target for package 
(device/emulator)
  * @param  {Array}   buildFlags
  * @param  {String}  emulatorTarget Target for emulator (rather than default)
+ * @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 getXcodeBuildArgs (projectName, projectPath, configuration, isDevice, 
buildFlags, emulatorTarget) {
+function getXcodeBuildArgs (projectName, projectPath, configuration, isDevice, 
buildFlags, emulatorTarget, autoProvisioning) {
     var xcodebuildArgs;
     var options;
     var buildActions;
@@ -307,6 +308,10 @@ function getXcodeBuildArgs (projectName, projectPath, 
configuration, isDevice, b
         if (customArgs.sdk) {
             customArgs.otherFlags = customArgs.otherFlags.concat(['-sdk', 
customArgs.sdk]);
         }
+
+        if (autoProvisioning) {
+            options = options.concat(['-allowProvisioningUpdates']);
+        }
     } else { // emulator
         options = [
             '-xcconfig', customArgs.xcconfig || path.join(__dirname, '..', 
'build-' + configuration.toLowerCase() + '.xcconfig'),
diff --git a/tests/spec/unit/build.spec.js b/tests/spec/unit/build.spec.js
index 4b123361f..df5304284 100644
--- a/tests/spec/unit/build.spec.js
+++ b/tests/spec/unit/build.spec.js
@@ -181,6 +181,29 @@ describe('build', function () {
             expect(args.length).toEqual(17);
             done();
         });
+
+        it('should generate appropriate args for automatic provisioning', 
function (done) {
+            var isDevice = true;
+            var args = getXcodeBuildArgs('TestProjectName', testProjectPath, 
'TestConfiguration', isDevice, null, null, true);
+            expect(args[0]).toEqual('-xcconfig');
+            expect(args[1]).toEqual(path.join('/test', 
'build-testconfiguration.xcconfig'));
+            expect(args[2]).toEqual('-workspace');
+            expect(args[3]).toEqual('TestProjectName.xcworkspace');
+            expect(args[4]).toEqual('-scheme');
+            expect(args[5]).toEqual('TestProjectName');
+            expect(args[6]).toEqual('-configuration');
+            expect(args[7]).toEqual('TestConfiguration');
+            expect(args[8]).toEqual('-destination');
+            expect(args[9]).toEqual('generic/platform=iOS');
+            expect(args[10]).toEqual('-archivePath');
+            expect(args[11]).toEqual('TestProjectName.xcarchive');
+            expect(args[12]).toEqual('-allowProvisioningUpdates');
+            expect(args[13]).toEqual('archive');
+            expect(args[14]).toEqual('CONFIGURATION_BUILD_DIR=' + 
path.join(testProjectPath, 'build', 'device'));
+            expect(args[15]).toEqual('SHARED_PRECOMPS_DIR=' + 
path.join(testProjectPath, 'build', 'sharedpch'));
+            expect(args.length).toEqual(16);
+            done();
+        });
     });
 
     describe('getXcodeArchiveArgs 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
>            Priority: Major
>             Fix For: cordova-ios@4.5.4
>
>
> 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
(v7.6.3#76005)

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

Reply via email to