You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2017/04/15 01:10:55 UTC
[34/39] cordova-lib git commit: CB-12606 Fix plugin dependency
installation
CB-12606 Fix plugin dependency installation
Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/4c99c0d4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/4c99c0d4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/4c99c0d4
Branch: refs/heads/common-2.0.x
Commit: 4c99c0d4e08c5a48ab5d2d48e627b58c45c4b8d2
Parents: 43d7eaf
Author: Alexander Sorokin <al...@akvelon.com>
Authored: Mon Mar 27 18:22:35 2017 +0300
Committer: Alexander Sorokin <al...@akvelon.com>
Committed: Mon Mar 27 22:37:59 2017 +0300
----------------------------------------------------------------------
cordova-lib/spec-plugman/install.spec.js | 31 +++++++++++--
.../spec-plugman/plugins/dependencies/README.md | 1 +
.../plugins/dependencies/Test4/package.json | 11 +++++
.../plugins/dependencies/Test4/plugin.xml | 46 ++++++++++++++++++++
.../dependencies/Test4/src/android/Test4.java | 1 +
.../dependencies/Test4/www/plugin-test.js | 1 +
cordova-lib/src/plugman/install.js | 3 +-
7 files changed, 90 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4c99c0d4/cordova-lib/spec-plugman/install.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/install.spec.js b/cordova-lib/spec-plugman/install.spec.js
index 713df96..a2bb680 100644
--- a/cordova-lib/spec-plugman/install.spec.js
+++ b/cordova-lib/spec-plugman/install.spec.js
@@ -18,6 +18,7 @@
*/
/* jshint sub:true */
+/* globals fail*/
var helpers = require('../spec-cordova/helpers'),
path = require('path'),
@@ -65,10 +66,11 @@ var helpers = require('../spec-cordova/helpers'),
'C@1.0.0' : path.join(plugins_dir, 'dependencies', 'C@1.0.0'),
'Test1' : path.join(plugins_dir, 'dependencies', 'Test1'),
'Test2' : path.join(plugins_dir, 'dependencies', 'Test2'),
- 'Test3' : path.join(plugins_dir, 'dependencies', 'Test3')
+ 'Test3' : path.join(plugins_dir, 'dependencies', 'Test3'),
+ 'Test4' : path.join(plugins_dir, 'dependencies', 'Test4')
},
results = {},
- TIMEOUT = 60000,
+ TIMEOUT = 90000,
superspawn = require('cordova-common').superspawn;
@@ -649,11 +651,34 @@ describe('end-to-end plugin dependency tests', function() {
}, TIMEOUT)
.fin(done);
}, TIMEOUT);
+
+ it('Test 033 : should use a dev version of a dependent plugin if it is already installed', function(done) {
+ //Test4 has this dependency in its plugin.xml:
+ //<dependency id="cordova-plugin-file" url="https://github.com/apache/cordova-plugin-file" />
+ cordova.raw.create('hello3')
+ .then(function() {
+ process.chdir(project);
+ return cordova.raw.platform('add', 'android', {'fetch': true});
+ })
+ .then(function() {
+ return cordova.raw.plugin('add', 'https://github.com/apache/cordova-plugin-file');
+ })
+ .then(function() {
+ return cordova.raw.plugin('add', plugins['Test4'], {'fetch': true});
+ })
+ .then(function() {
+ expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist();
+ expect(path.join(pluginsDir, 'Test4')).toExist();
+ }, function (error) {
+ fail(error);
+ })
+ .fin(done);
+ }, TIMEOUT);
});
describe('end', function() {
- it('Test 033 : end', function() {
+ it('Test 034 : end', function() {
shell.rm('-rf', temp_dir);
}, TIMEOUT);
});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4c99c0d4/cordova-lib/spec-plugman/plugins/dependencies/README.md
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/dependencies/README.md b/cordova-lib/spec-plugman/plugins/dependencies/README.md
index 4709fc5..546d7f3 100644
--- a/cordova-lib/spec-plugman/plugins/dependencies/README.md
+++ b/cordova-lib/spec-plugman/plugins/dependencies/README.md
@@ -14,4 +14,5 @@ I -> C@1.0.0
Test1 --> cordova-plugin-file@2.0.0
Test2 --> cordova-plugin-file@2.X.0
Test3 --> cordova-plugin-file@3.0.0
+Test4 --> cordova-plugin-file@https://github.com/apache/cordova-plugin-file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4c99c0d4/cordova-lib/spec-plugman/plugins/dependencies/Test4/package.json
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/dependencies/Test4/package.json b/cordova-lib/spec-plugman/plugins/dependencies/Test4/package.json
new file mode 100644
index 0000000..327e319
--- /dev/null
+++ b/cordova-lib/spec-plugman/plugins/dependencies/Test4/package.json
@@ -0,0 +1,11 @@
+{
+ "name": "test4",
+ "version": "0.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "",
+ "license": "ISC"
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4c99c0d4/cordova-lib/spec-plugman/plugins/dependencies/Test4/plugin.xml
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/dependencies/Test4/plugin.xml b/cordova-lib/spec-plugman/plugins/dependencies/Test4/plugin.xml
new file mode 100644
index 0000000..684d592
--- /dev/null
+++ b/cordova-lib/spec-plugman/plugins/dependencies/Test4/plugin.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2013 Anis Kadri
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ id="Test4"
+ version="0.0.0">
+
+ <name>Plugin Test4</name>
+
+ <dependency id="cordova-plugin-file" url="https://github.com/apache/cordova-plugin-file" />
+
+ <asset src="www/plugin-test.js" target="plugin-test.js" />
+
+ <config-file target="config.xml" parent="/*">
+ <access origin="build.phonegap.com" />
+ </config-file>
+
+ <!-- android -->
+ <platform name="android">
+ <config-file target="res/xml/config.xml" parent="plugins">
+ <plugin name="Test4"
+ value="org.test.Test4.Test4"/>
+ </config-file>
+
+ <source-file src="src/android/Test4.java"
+ target-dir="src/com/phonegap/Test4" />
+ </platform>
+</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4c99c0d4/cordova-lib/spec-plugman/plugins/dependencies/Test4/src/android/Test4.java
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/dependencies/Test4/src/android/Test4.java b/cordova-lib/spec-plugman/plugins/dependencies/Test4/src/android/Test4.java
new file mode 100644
index 0000000..adafa4e
--- /dev/null
+++ b/cordova-lib/spec-plugman/plugins/dependencies/Test4/src/android/Test4.java
@@ -0,0 +1 @@
+./dependencies/Test3/src/android/Test4.java
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4c99c0d4/cordova-lib/spec-plugman/plugins/dependencies/Test4/www/plugin-test.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/plugins/dependencies/Test4/www/plugin-test.js b/cordova-lib/spec-plugman/plugins/dependencies/Test4/www/plugin-test.js
new file mode 100644
index 0000000..f47fb7c
--- /dev/null
+++ b/cordova-lib/spec-plugman/plugins/dependencies/Test4/www/plugin-test.js
@@ -0,0 +1 @@
+./dependencies/Test4/www/plugin-test.js
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4c99c0d4/cordova-lib/src/plugman/install.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/install.js b/cordova-lib/src/plugman/install.js
index b555d4b..3e8da38 100644
--- a/cordova-lib/src/plugman/install.js
+++ b/cordova-lib/src/plugman/install.js
@@ -558,7 +558,8 @@ function installDependency(dep, install, options) {
if (options.force ||
semver.satisfies(version_installed, version_required, /*loose=*/true) ||
version_required === null ||
- version_required === undefined ) {
+ version_required === undefined ||
+ version_required === '' ) {
events.emit('log', 'Plugin dependency "' + (version_installed ? dep.id+'@'+version_installed : dep.id) + '" already fetched, using that version.');
} else {
var msg = 'Version of installed plugin: "' +
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org