Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9B5E1200C61 for ; Tue, 25 Apr 2017 23:00:44 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 99E0E160BB3; Tue, 25 Apr 2017 21:00:44 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E0F06160B8E for ; Tue, 25 Apr 2017 23:00:43 +0200 (CEST) Received: (qmail 25254 invoked by uid 500); 25 Apr 2017 21:00:43 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 25245 invoked by uid 99); 25 Apr 2017 21:00:43 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Apr 2017 21:00:43 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E1935DFA1E; Tue, 25 Apr 2017 21:00:42 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: steven@apache.org To: commits@cordova.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: cordova-lib git commit: CB-8978: Add option to get resource-file from root Date: Tue, 25 Apr 2017 21:00:42 +0000 (UTC) archived-at: Tue, 25 Apr 2017 21:00:44 -0000 Repository: cordova-lib Updated Branches: refs/heads/master d1347c2ac -> 52d2a75cf CB-8978: Add option to get resource-file from root This will be needed for cleaning the resource-file targets, since they are at the top level of the platform's config.xml. This closes #547 Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/52d2a75c Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/52d2a75c Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/52d2a75c Branch: refs/heads/master Commit: 52d2a75cf11096909d71554cce47092043835711 Parents: d1347c2 Author: Darryl Pogue Authored: Thu Apr 20 23:45:12 2017 -0700 Committer: Steve Gill Committed: Tue Apr 25 14:00:24 2017 -0700 ---------------------------------------------------------------------- .../spec/ConfigParser/ConfigParser.spec.js | 4 ++++ cordova-common/spec/fixtures/test-config.xml | 1 + cordova-common/src/ConfigParser/ConfigParser.js | 17 ++++++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/52d2a75c/cordova-common/spec/ConfigParser/ConfigParser.spec.js ---------------------------------------------------------------------- diff --git a/cordova-common/spec/ConfigParser/ConfigParser.spec.js b/cordova-common/spec/ConfigParser/ConfigParser.spec.js index cfb125b..034f3d7 100644 --- a/cordova-common/spec/ConfigParser/ConfigParser.spec.js +++ b/cordova-common/spec/ConfigParser/ConfigParser.spec.js @@ -313,6 +313,10 @@ describe('config.xml parser', function () { expect(cfg.getFileResources('android').every(hasTargetPropertyDefined)).toBeTruthy(); expect(cfg.getFileResources('windows').every(hasArchPropertyDefined)).toBeTruthy(); }); + + it('should find resources at the top level', function() { + expect(cfg.getFileResources('android', true).length).toBe(3); + }); }); }); }); http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/52d2a75c/cordova-common/spec/fixtures/test-config.xml ---------------------------------------------------------------------- diff --git a/cordova-common/spec/fixtures/test-config.xml b/cordova-common/spec/fixtures/test-config.xml index 625d218..7969d64 100644 --- a/cordova-common/spec/fixtures/test-config.xml +++ b/cordova-common/spec/fixtures/test-config.xml @@ -106,6 +106,7 @@ + http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/52d2a75c/cordova-common/src/ConfigParser/ConfigParser.js ---------------------------------------------------------------------- diff --git a/cordova-common/src/ConfigParser/ConfigParser.js b/cordova-common/src/ConfigParser/ConfigParser.js index cd718de..0b02b4c 100644 --- a/cordova-common/src/ConfigParser/ConfigParser.js +++ b/cordova-common/src/ConfigParser/ConfigParser.js @@ -269,9 +269,11 @@ ConfigParser.prototype = { /** * Returns all resource-files for a specific platform. * @param {string} platform Platform name + * @param {boolean} includeGlobal Whether to return resource-files at the + * root level. * @return {Resource[]} Array of resource file objects. */ - getFileResources: function(platform) { + getFileResources: function(platform, includeGlobal) { var fileResources = []; if (platform) { // platform specific resources @@ -287,6 +289,19 @@ ConfigParser.prototype = { }); } + if (includeGlobal) { + this.doc.findall('resource-file').forEach(function(tag) { + fileResources.push({ + platform: platform || null, + src: tag.attrib.src, + target: tag.attrib.target, + versions: tag.attrib.versions, + deviceTarget: tag.attrib['device-target'], + arch: tag.attrib.arch + }); + }); + } + return fileResources; }, --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org