You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by su...@apache.org on 2017/11/15 00:17:38 UTC

[cordova-ios] branch master updated: CB-13523: Add flag for Xcode-managed provisioning

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

surajpindoria 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 5cb8bd1  CB-13523: Add flag for Xcode-managed provisioning
5cb8bd1 is described below

commit 5cb8bd199fe8df85272678d6d4c6343dd080f2a3
Author: Darryl Pogue <da...@ayogo.com>
AuthorDate: Tue Oct 31 16:32:18 2017 -0700

    CB-13523: Add flag for Xcode-managed provisioning
    
    This adds a `automaticProvisioning` option to the build config which
    passes flags to xcodebuild during the exporting step that allow it to
    automatically create and update provisioning profiles for automatic code
    signing.
---
 bin/templates/scripts/cordova/build        |  1 +
 bin/templates/scripts/cordova/lib/build.js |  9 +++++----
 bin/templates/scripts/cordova/run          |  1 +
 tests/spec/unit/build.spec.js              | 14 ++++++++++++++
 4 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/bin/templates/scripts/cordova/build b/bin/templates/scripts/cordova/build
index 61d26cc..bd5a619 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 f51b084..b68262e 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 470384b..c4cfca3 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 6cf005c..4b12336 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 () {

-- 
To stop receiving notification emails like this one, please contact
['"commits@cordova.apache.org" <co...@cordova.apache.org>'].

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