Repository: cordova-ios
Updated Branches:
  refs/heads/master b5fb016b9 -> ff3df9b7e


CB-11792 - Fixed configuration file could not be parsed due to preprocessing 
errors

 This closes #259


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/ff3df9b7
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/ff3df9b7
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/ff3df9b7

Branch: refs/heads/master
Commit: ff3df9b7e7ab37e935e1e1d38a0b1cbeff46d029
Parents: b5fb016
Author: Shazron Abdullah <shaz...@apache.org>
Authored: Tue Sep 20 00:12:37 2016 -0700
Committer: Shazron Abdullah <shaz...@apache.org>
Committed: Tue Sep 20 10:49:42 2016 -0700

----------------------------------------------------------------------
 bin/lib/create.js                               |  3 ++
 bin/templates/project/pods-debug.xcconfig       |  1 +
 bin/templates/project/pods-release.xcconfig     |  1 +
 .../scripts/cordova/build-debug.xcconfig        |  4 ++-
 .../scripts/cordova/build-release.xcconfig      |  4 ++-
 bin/templates/scripts/cordova/lib/Podfile.js    | 22 ++++++++++++
 tests/spec/unit/Podfile.spec.js                 | 35 ++++++++++++++++++--
 7 files changed, 65 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ff3df9b7/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 920db72..89b9c8a 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -233,6 +233,9 @@ exports.createProject = function(project_path, 
package_name, project_name, opts)
     //Copy project template files
     copyTemplateFiles(project_path, project_name, project_template_dir, 
package_name);
 
+    // Copy xcconfig files
+    shell.cp('-rf', path.join(project_template_dir, '*.xcconfig'), 
project_path);
+
     //CordovaLib stuff
     copyJsAndCordovaLib(project_path, project_name, use_shared);
     copyScripts(project_path, project_name);

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ff3df9b7/bin/templates/project/pods-debug.xcconfig
----------------------------------------------------------------------
diff --git a/bin/templates/project/pods-debug.xcconfig 
b/bin/templates/project/pods-debug.xcconfig
new file mode 100644
index 0000000..116ea38
--- /dev/null
+++ b/bin/templates/project/pods-debug.xcconfig
@@ -0,0 +1 @@
+// DO NOT MODIFY -- auto-generated by Apache Cordova

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ff3df9b7/bin/templates/project/pods-release.xcconfig
----------------------------------------------------------------------
diff --git a/bin/templates/project/pods-release.xcconfig 
b/bin/templates/project/pods-release.xcconfig
new file mode 100644
index 0000000..d91e99c
--- /dev/null
+++ b/bin/templates/project/pods-release.xcconfig
@@ -0,0 +1 @@
+// DO NOT MODIFY -- auto-generated by Apache Cordova
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ff3df9b7/bin/templates/scripts/cordova/build-debug.xcconfig
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/build-debug.xcconfig 
b/bin/templates/scripts/cordova/build-debug.xcconfig
index a597502..3f4767d 100644
--- a/bin/templates/scripts/cordova/build-debug.xcconfig
+++ b/bin/templates/scripts/cordova/build-debug.xcconfig
@@ -27,4 +27,6 @@ GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1
 
 #include "build-extras.xcconfig"
 
-#include "Pods/Target Support 
Files/Pods-__PROJECT_NAME__/Pods-__PROJECT_NAME__.debug.xcconfig"
+// (CB-11792)
+// @COCOAPODS_SILENCE_WARNINGS@ //
+#include "../pods-debug.xcconfig"

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ff3df9b7/bin/templates/scripts/cordova/build-release.xcconfig
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/build-release.xcconfig 
b/bin/templates/scripts/cordova/build-release.xcconfig
index 46e828f..70b0f07 100644
--- a/bin/templates/scripts/cordova/build-release.xcconfig
+++ b/bin/templates/scripts/cordova/build-release.xcconfig
@@ -28,4 +28,6 @@ CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Distribution
 
 #include "build-extras.xcconfig"
 
-#include "Pods/Target Support 
Files/Pods-__PROJECT_NAME__/Pods-__PROJECT_NAME__.release.xcconfig"
\ No newline at end of file
+// (CB-11792)
+// @COCOAPODS_SILENCE_WARNINGS@ //
+#include "../pods-release.xcconfig"

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ff3df9b7/bin/templates/scripts/cordova/lib/Podfile.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/Podfile.js 
b/bin/templates/scripts/cordova/lib/Podfile.js
index c0e12f9..02be8a0 100644
--- a/bin/templates/scripts/cordova/lib/Podfile.js
+++ b/bin/templates/scripts/cordova/lib/Podfile.js
@@ -143,11 +143,30 @@ Podfile.prototype.isDirty = function() {
     return this.__dirty;
 };
 
+Podfile.prototype.before_install = function() {
+    // Template tokens in order: project name, project name, debug | release
+    var template =
+    '// DO NOT MODIFY -- auto-generated by Apache Cordova\n' + 
+    '#include "Pods/Target Support Files/Pods-%s/Pods-%s.%s.xcconfig"';
+
+    var debugContents = util.format(template, this.projectName, 
this.projectName, 'debug');
+    var releaseContents = util.format(template, this.projectName, 
this.projectName, 'release');
+
+    var debugConfigPath = path.join(this.path, '..', 'pods-debug.xcconfig');
+    var releaseConfigPath = path.join(this.path, '..', 
'pods-release.xcconfig');
+
+    fs.writeFileSync(debugConfigPath, debugContents, 'utf8');
+    fs.writeFileSync(releaseConfigPath, releaseContents, 'utf8');
+
+    return Q.resolve();
+};
+
 Podfile.prototype.install = function(requirementsCheckerFunction) {
     var opts = {};
     opts.cwd = path.join(this.path, '..'); // parent path of this Podfile
     opts.stdio = 'pipe';
     var first = true;
+    var self = this;
 
     if (!requirementsCheckerFunction) {
         requirementsCheckerFunction = Q();
@@ -155,6 +174,9 @@ Podfile.prototype.install = 
function(requirementsCheckerFunction) {
 
     return requirementsCheckerFunction()
     .then(function() {
+        return self.before_install();
+    })
+    .then(function() {
         return superspawn.spawn('pod', ['install', '--verbose'], opts)
         .progress(function (stdio){
             if (stdio.stderr) { console.error(stdio.stderr); }

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ff3df9b7/tests/spec/unit/Podfile.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/Podfile.spec.js b/tests/spec/unit/Podfile.spec.js
index b68d435..df48175 100644
--- a/tests/spec/unit/Podfile.spec.js
+++ b/tests/spec/unit/Podfile.spec.js
@@ -1,13 +1,18 @@
 var    path = require('path'),
        util = require('util'),
+       fs = require('fs'),
        CordovaError = require('cordova-common').CordovaError;
 
+var PROJECT_NAME = 'testProj';
 var Podfile = require(path.resolve(path.join(__dirname, '..', '..', '..', 
'bin', 'templates', 'scripts', 'cordova', 'lib', 'Podfile.js'))).Podfile;
-var fixturePodfile = path.resolve(__dirname, 'fixtures', 'testProj', 
'platforms', 'ios', 'Podfile');
+var fixturePodfile = path.resolve(__dirname, 'fixtures', PROJECT_NAME, 
'platforms', 'ios', 'Podfile');
+var fixturePodXcconfigDebug = path.resolve(__dirname, 'fixtures', 
PROJECT_NAME, 'platforms', 'ios', 'pods-debug.xcconfig');
+var fixturePodXcconfigRelease = path.resolve(__dirname, 'fixtures', 
PROJECT_NAME, 'platforms', 'ios', 'pods-release.xcconfig');
+
 
 // tests are nested in a describe to ensure clean up happens after all unit 
tests are run
 describe('unit tests for Podfile module', function () {
-       var podfile = new Podfile(fixturePodfile, 'testProj');
+       var podfile = new Podfile(fixturePodfile, PROJECT_NAME);
 
        describe('tests', function () {
 
@@ -81,7 +86,7 @@ describe('unit tests for Podfile module', function () {
                        podfile.write();
 
                        // verify by reading it back in a new Podfile 
-                       var newPodfile = new Podfile(fixturePodfile, 
'testProj2');
+                       var newPodfile = new Podfile(fixturePodfile, 
PROJECT_NAME + '2');
                        expect(newPodfile.existsSpec('Foo')).toBe(true);
                        expect(newPodfile.existsSpec('Bar')).toBe(true);
                        expect(newPodfile.existsSpec('Baz')).toBe(true);
@@ -92,10 +97,34 @@ describe('unit tests for Podfile module', function () {
                        
                });
 
+               it ('runs before_install to install xcconfig paths', function 
() {
+                       podfile.before_install();
+
+                       // Template tokens in order: project name, project 
name, debug | release
+                       var template =
+                       '// DO NOT MODIFY -- auto-generated by Apache 
Cordova\n' + 
+                       '#include "Pods/Target Support 
Files/Pods-%s/Pods-%s.%s.xcconfig"';
+
+                       var expectedDebugContents = util.format(template, 
PROJECT_NAME, PROJECT_NAME, 'debug');
+                       var expectedReleaseContents = util.format(template, 
PROJECT_NAME, PROJECT_NAME, 'release');
+
+                       var actualDebugContents = 
fs.readFileSync(fixturePodXcconfigDebug, 'utf8');
+                       var actualReleaseContents = 
fs.readFileSync(fixturePodXcconfigRelease, 'utf8');
+
+                       expect(actualDebugContents).toBe(expectedDebugContents);
+                       
expect(actualReleaseContents).toBe(expectedReleaseContents);
+               });
+               
+
        });
 
        it('tear down', function () {
                podfile.destroy();
+
+               var text = '// DO NOT MODIFY -- auto-generated by Apache 
Cordova\n';
+
+               fs.writeFileSync(fixturePodXcconfigDebug, text, 'utf8');
+               fs.writeFileSync(fixturePodXcconfigRelease, text, 'utf8');
        });
 });
 


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

Reply via email to