You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ra...@apache.org on 2020/07/03 16:53:17 UTC
[cordova-android] branch master updated: Remove unnecessary stuff
(#1015)
This is an automated email from the ASF dual-hosted git repository.
raphinesse pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-android.git
The following commit(s) were added to refs/heads/master by this push:
new d86cb99 Remove unnecessary stuff (#1015)
d86cb99 is described below
commit d86cb99dd5d08cebdf2294caaaf7e5e2b2cab87a
Author: Raphael von der Grün <ra...@gmail.com>
AuthorDate: Fri Jul 3 18:53:10 2020 +0200
Remove unnecessary stuff (#1015)
* Remove licenses for previously bundled packages
* Remove utils module with duplicate function
* Remove unused function check_reqs.check_ant
* Remove unused test helper
---
LICENSE | 65 --------------
bin/lib/create.js | 2 +-
bin/lib/utils.js | 47 ----------
bin/templates/cordova/lib/check_reqs.js | 12 ---
spec/e2e/helpers/projectActions.js | 149 --------------------------------
spec/unit/create.spec.js | 2 +-
6 files changed, 2 insertions(+), 275 deletions(-)
diff --git a/LICENSE b/LICENSE
index 292d876..c2f944b 100644
--- a/LICENSE
+++ b/LICENSE
@@ -200,68 +200,3 @@
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.
-
- ADDITIONAL LICENSES:
-
-================================================================================
-bin/node_modules/q
-================================================================================
-
-Copyright 2009–2017 Kristopher Michael Kowal. All rights reserved.
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-IN THE SOFTWARE.
-
-================================================================================
-bin/node_modules/nopt
-================================================================================
-
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-================================================================================
-bin/node_modules/which
-================================================================================
-
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 3f86947..4b8eb92 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -19,7 +19,7 @@
var path = require('path');
var fs = require('fs-extra');
-var utils = require('../../bin/lib/utils');
+var utils = require('../templates/cordova/lib/utils');
var check_reqs = require('./../templates/cordova/lib/check_reqs');
var ROOT = path.join(__dirname, '..', '..');
diff --git a/bin/lib/utils.js b/bin/lib/utils.js
deleted file mode 100644
index 71925e8..0000000
--- a/bin/lib/utils.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
-*/
-
-/*
- Provides a set of utility methods, which can also be spied on during unit tests.
-*/
-
-// TODO: Perhaps this should live in cordova-common?
-
-const fs = require('fs-extra');
-
-/**
- * Reads, searches, and replaces the found occurences with replacementString and then writes the file back out.
- * A backup is not made.
- *
- * @param {string} file A file path to a readable & writable file
- * @param {RegExp} searchRegex The search regex
- * @param {string} replacementString The string to replace the found occurences
- * @returns {void}
- */
-exports.replaceFileContents = function (file, searchRegex, replacementString) {
- // let contents;
- try {
- var contents = fs.readFileSync(file).toString();
- } catch (ex) {
- console.log('TRYING TO READ: ', file);
- throw ex;
- }
- contents = contents.replace(searchRegex, replacementString);
- fs.writeFileSync(file, contents);
-};
diff --git a/bin/templates/cordova/lib/check_reqs.js b/bin/templates/cordova/lib/check_reqs.js
index 21d90f7..d16b874 100644
--- a/bin/templates/cordova/lib/check_reqs.js
+++ b/bin/templates/cordova/lib/check_reqs.js
@@ -98,18 +98,6 @@ module.exports.get_target = function () {
return target;
};
-// Returns a promise. Called only by build and clean commands.
-module.exports.check_ant = function () {
- return execa('ant', ['-version']).then(({ stdout: output }) => {
- // Parse Ant version from command output
- return /version ((?:\d+\.)+(?:\d+))/i.exec(output)[1];
- }).catch(function (err) {
- if (err) {
- throw new CordovaError('Failed to run `ant -version`. Make sure you have `ant` on your $PATH.');
- }
- });
-};
-
module.exports.get_gradle_wrapper = function () {
var androidStudioPath;
var i = 0;
diff --git a/spec/e2e/helpers/projectActions.js b/spec/e2e/helpers/projectActions.js
deleted file mode 100644
index b513955..0000000
--- a/spec/e2e/helpers/projectActions.js
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
- */
-
-var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
-const fs = require('fs-extra');
-var cp = require('child_process');
-var path = require('path');
-var util = require('util');
-
-var cordova_bin = path.join(__dirname, '../../../bin');
-
-/**
- * Creates a project using platform create script with given parameters
- * @param {string} projectname - name of the project
- * @param {string} projectid - id of the project
- * @param {string} platformpath - path to the platform
- * @param {function} callback - function which is called (without arguments) when the project is created or (with error object) when error occurs
- */
-module.exports.createProject = function (projectname, projectid, platformpath, callback) {
- // platformpath is optional
- if (!callback && typeof platformpath === 'function') {
- callback = platformpath;
- platformpath = null;
- }
- var projectDirName = getDirName(projectid);
- var createScriptPath = platformpath ? path.join(platformpath, 'bin/create') : path.join(cordova_bin, 'create');
-
- // remove existing folder
- module.exports.removeProject(projectid);
-
- // create the project
- var command = util.format('"%s" %s %s "%s"', createScriptPath, projectDirName, projectid, projectname);
- cp.exec(command, function (error, stdout, stderr) {
- if (error) {
- console.log(stdout);
- console.error(stderr);
- }
- callback(error);
- });
-};
-
-/**
- * Updates a project using platform update script with given parameters
- * @param {string} projectid - id of the project
- * @param {string} platformpath - path to the platform
- * @param {function} callback - function which is called (without arguments) when the project is updated or (with error object) when error occurs
- */
-module.exports.updateProject = function (projectid, platformpath, callback) {
- // platformpath is optional
- if (!callback && typeof platformpath === 'function') {
- callback = platformpath;
- platformpath = null;
- }
- var projectDirName = getDirName(projectid);
- var updateScriptPath = platformpath ? path.join(platformpath, 'bin/update') : path.join(cordova_bin, 'update');
- var command = util.format('"%s" %s', updateScriptPath, projectDirName);
- cp.exec(command, function (error, stdout, stderr) {
- if (error) {
- console.log(stdout);
- console.error(stderr);
- }
- callback(error);
- });
-};
-
-/**
- * Builds a project using platform build script with given parameters
- * @param {string} projectid - id of the project
- * @param {function} callback - function which is called (without arguments) when the project is built or (with error object) when error occurs
- */
-module.exports.buildProject = function (projectid, callback) {
- var projectDirName = getDirName(projectid);
- var command = path.join(projectDirName, 'cordova/build');
-
- cp.exec(command, function (error, stdout, stderr) {
- if (error) {
- console.log(stdout);
- console.error(stderr);
- }
- callback(error);
- });
-};
-
-/**
- * Removes a project
- * @param {string} projectid - id of the project
- */
-module.exports.removeProject = function (projectid) {
- var projectDirName = getDirName(projectid);
- fs.removeSync(projectDirName);
-};
-
-/**
- * Add a plugin to a project using platform api
- * @param {string} projectid - id of the project
- * @param {string} plugindir - path to a plugin
- * @param {function} callback - function which is called (without arguments) when the plugin is added or (with error object) when error occurs
- */
-module.exports.addPlugin = function (projectid, plugindir, callback) {
- var projectDirName = getDirName(projectid);
- var pip = new PluginInfoProvider();
- var pluginInfo = pip.get(plugindir);
- var Api = require(path.join(__dirname, '../../..', projectDirName, 'cordova', 'Api.js'));
- var api = new Api('android', projectDirName);
-
- api.addPlugin(pluginInfo).then(function () {
- callback(null);
- }, function (error) {
- console.error(error);
- callback(error);
- });
-};
-
-/**
- * Gets a version number from project using platform script
- * @param {string} projectid - id of the project
- * @param {function} callback - function which is called with platform version as an argument
- */
-module.exports.getPlatformVersion = function (projectid, callback) {
- var command = path.join(getDirName(projectid), 'cordova/version');
-
- cp.exec(command, function (error, stdout, stderr) {
- if (error) {
- console.log(stdout);
- console.error(stderr);
- }
- callback(stdout.trim());
- });
-};
-
-function getDirName (projectid) {
- return 'test-' + projectid;
-}
diff --git a/spec/unit/create.spec.js b/spec/unit/create.spec.js
index 82ace72..621a531 100644
--- a/spec/unit/create.spec.js
+++ b/spec/unit/create.spec.js
@@ -18,7 +18,7 @@
*/
var rewire = require('rewire');
-var utils = require('../../bin/lib/utils');
+var utils = require('../../bin/templates/cordova/lib/utils');
var create = rewire('../../bin/lib/create');
var check_reqs = require('../../bin/templates/cordova/lib/check_reqs');
var fs = require('fs-extra');
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org