cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From surajpindo...@apache.org
Subject [cordova-ios] 04/06: CB-13523: Add flag for Xcode-managed provisioning
Date Wed, 15 Nov 2017 22:19:46 GMT
This is an automated email from the ASF dual-hosted git repository.

surajpindoria pushed a commit to branch 4.5.x
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git

commit 0e5e38c6bf144d99c85d5ad0cfb9180ff7ffca5b
Author: Darryl Pogue <darryl@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" <commits@cordova.apache.org>.

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


Mime
View raw message