Repository: cordova-lib Updated Branches: refs/heads/master da884bf14 -> ffc17dd1b
Revert "CB-6698 Resolve android <framework> relative to plugin_dir when custom=true" This reverts commit 04588a42067a5ba0d303f4b69f99f44640c3b9e0. Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/95772a17 Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/95772a17 Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/95772a17 Branch: refs/heads/master Commit: 95772a1774906b5abc3dee46a19b3d7a1c2fcce5 Parents: da884bf Author: Martin Bektchiev <[email protected]> Authored: Fri Jun 13 18:12:02 2014 +0300 Committer: Andrew Grieve <[email protected]> Committed: Mon Jun 16 23:03:09 2014 -0400 ---------------------------------------------------------------------- cordova-lib/spec-plugman/platforms/android.spec.js | 13 ++++++------- cordova-lib/src/plugman/platforms/android.js | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/95772a17/cordova-lib/spec-plugman/platforms/android.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-plugman/platforms/android.spec.js b/cordova-lib/spec-plugman/platforms/android.spec.js index 33906e6..00dac74 100644 --- a/cordova-lib/spec-plugman/platforms/android.spec.js +++ b/cordova-lib/spec-plugman/platforms/android.spec.js @@ -137,22 +137,21 @@ describe('android project handler', function() { afterEach(function() { android.purgeProjectFileCache(temp); }); - it('with custom=true should update the main and library projects', function() { + it('should update the main and library projects', function() { var frameworkElement = { attrib: { src: "LibraryPath", custom: true } }; - var subDir = path.resolve(dummyplugin, frameworkElement.attrib.src); + var subDir = path.resolve(temp, frameworkElement.attrib.src); var mainProjectPropsFile = path.resolve(temp, "project.properties"); var subProjectPropsFile = path.resolve(subDir, "project.properties"); var existsSync = spyOn( fs, 'existsSync').andReturn(true); var writeFileSync = spyOn(fs, 'writeFileSync'); var readFileSync = spyOn(fs, 'readFileSync').andCallFake(function (file) { - file = path.normalize(file); - if (file === mainProjectPropsFile) { + if (path.normalize(file) === mainProjectPropsFile) { return '#Some comment\ntarget=android-19\nandroid.library.reference.1=ExistingLibRef1\nandroid.library.reference.2=ExistingLibRef2'; - } else if (file === subProjectPropsFile) { + } else if (path.normalize(file) === subProjectPropsFile) { return '#Some comment\ntarget=android-17\nandroid.library=true'; } else { - throw new Error("Trying to read from an unexpected file " + file + '\n expected: ' + mainProjectPropsFile + '\n' + subProjectPropsFile); + throw new Error("Trying to read from an unexpected file " + file); } }) var exec = spyOn(shell, 'exec'); @@ -161,7 +160,7 @@ describe('android project handler', function() { android.parseProjectFile(temp).write(); expect(_.any(writeFileSync.argsForCall, function (callArgs) { - return callArgs[0] === mainProjectPropsFile && !!/\nandroid.library.reference.3=.*?LibraryPath/.exec(callArgs[1]); + return callArgs[0] === mainProjectPropsFile && callArgs[1].indexOf('\nandroid.library.reference.3=LibraryPath') > -1; })).toBe(true, 'Reference to library not added'); expect(_.any(writeFileSync.argsForCall, function (callArgs) { return callArgs[0] === subProjectPropsFile && callArgs[1].indexOf('\ntarget=android-19') > -1; http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/95772a17/cordova-lib/src/plugman/platforms/android.js ---------------------------------------------------------------------- diff --git a/cordova-lib/src/plugman/platforms/android.js b/cordova-lib/src/plugman/platforms/android.js index 349b818..06aee30 100644 --- a/cordova-lib/src/plugman/platforms/android.js +++ b/cordova-lib/src/plugman/platforms/android.js @@ -93,7 +93,7 @@ module.exports = { var parentDir = parent ? path.resolve(project_dir, parent) : project_dir; var subDir; if (custom) { - subDir = path.resolve(plugin_dir, src); + subDir = path.resolve(project_dir, src); } else { var localProperties = properties_parser.createEditor(path.resolve(project_dir, "local.properties")); subDir = path.resolve(localProperties.get("sdk.dir"), src);
