Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 36BBF18B12 for ; Mon, 14 Sep 2015 12:38:04 +0000 (UTC) Received: (qmail 76303 invoked by uid 500); 14 Sep 2015 12:37:46 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 76283 invoked by uid 500); 14 Sep 2015 12:37:46 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 76257 invoked by uid 99); 14 Sep 2015 12:37:46 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Sep 2015 12:37:46 +0000 Date: Mon, 14 Sep 2015 12:37:46 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CB-9617) Add plugin or platform doesn't create www/plugins folder MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-9617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14743448#comment-14743448 ] ASF GitHub Bot commented on CB-9617: ------------------------------------ Github user TimBarham commented on a diff in the pull request: https://github.com/apache/cordova-lib/pull/304#discussion_r39388053 --- Diff: cordova-lib/src/cordova/plugin.js --- @@ -283,6 +283,31 @@ module.exports = function plugin(command, targets, opts) { } }; +/** + * Calls `platformApi.prepare` for each platform in project + * + * @param {string[]} platformList List of platforms, added to current project + * @param {string} projectRoot Project root directory + * + * @return {Promise} + */ +function preparePlatforms (platformList, projectRoot) { + return Q.all(platformList.map(function(platform) { + // TODO: this need to be replaced by real projectInfo + // instance for current project. + var project = { + root: projectRoot, + projectConfig: new ConfigParser(cordova_util.projectConfig(projectRoot)), + locations: { + plugins: path.join(projectRoot, 'plugins'), + www: cordova_util.projectWww(projectRoot) + } + }; + + return platforms.getPlatformApi(platform).prepare(project); + })); +} + --- End diff -- Logic looks good to me. Just one suggestion - the guts of `preparePlatforms()` is an exact duplicate of code within `prepare.js`, correct? Why not add a `preparePlatform()` method in `prepare.js`, and call that from within the loop here and within the loop in `prepare`? I guess one argument against that would be that this logic will become pretty simplistic once there is a real `projectInfo` instance for the project, but on the other hand, sharing this code means you don't have to update that in two places. So... I guess up to you :smile:. > Add plugin or platform doesn't create www/plugins folder > -------------------------------------------------------- > > Key: CB-9617 > URL: https://issues.apache.org/jira/browse/CB-9617 > Project: Apache Cordova > Issue Type: Bug > Components: CordovaLib > Affects Versions: Master > Reporter: Tim Barham > Assignee: Vladimir Kotikov > Labels: PlatformApi > > Since the new Platform API polyfill, adding a platform or a plugin doesn't create the www/plugins folder, or copy the plugin/plugins there. > *Repo adding a platform:* > 1. Create a new blank project > 2. {{cordova plugin add cordova-plugin-camera}} > 3. {{cordova platform add browser}} > *Expected:* > The {{platforms/browser/www}} folder contains a {{plugins}} folder that contains a {{cordova-plugin-camera}} folder. > *Actual:* > It doesn't. > *Repo adding a plugin:* > If you add the platform before the plugin, the same result occurs. Also, consider this scenario: > 1. Create a new blank project > 2. {{cordova platform add browser}} > 3. {{cordova plugin add cordova-plugin-camera}} > 4. {{cordova prepare}} > 5. {{cordova plugin add cordova-plugin-device}} > *Expected:* > The platforms\browser\www\plugins folder should contain folders for {{cordova-plugin-camera}} and {{cordova-plugin-device}}. > *Actual:* > It only contains a folder for {{cordova-plugin-camera}}. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org For additional commands, e-mail: issues-help@cordova.apache.org