Return-Path: X-Original-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A31B5D6A6 for ; Tue, 9 Oct 2012 21:24:34 +0000 (UTC) Received: (qmail 85803 invoked by uid 500); 9 Oct 2012 21:24:34 -0000 Delivered-To: apmail-incubator-callback-commits-archive@incubator.apache.org Received: (qmail 85777 invoked by uid 500); 9 Oct 2012 21:24:34 -0000 Mailing-List: contact callback-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-commits@incubator.apache.org Received: (qmail 85770 invoked by uid 99); 9 Oct 2012 21:24:34 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Oct 2012 21:24:34 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 15CDC3CE32; Tue, 9 Oct 2012 21:24:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: gtanner@apache.org To: callback-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: js commit: Allow testing of platform specific modules Message-Id: <20121009212434.15CDC3CE32@tyr.zones.apache.org> Date: Tue, 9 Oct 2012 21:24:34 +0000 (UTC) Updated Branches: refs/heads/master 2033fdc37 -> e4561c438 Allow testing of platform specific modules - bundle in platform specific modules for the cordova.test.js file - get rid of caching in the packager, was causing issues for how we generate webworks as well as browser based testing - fixed the browser test runner to run platform specific tests (small regex fix) - removed symlinks to android packages now that they are bundled in - changed the included test platform in the btest from an injected script to a generated route that builds each time it is requested. Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/e4561c43 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/e4561c43 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/e4561c43 Branch: refs/heads/master Commit: e4561c438ae29795e0626a0559896ed2ea5a2033 Parents: 2033fdc Author: Gord Tanner Authored: Tue Oct 9 17:04:38 2012 -0400 Committer: Gord Tanner Committed: Tue Oct 9 17:17:47 2012 -0400 ---------------------------------------------------------------------- build/packager.js | 33 +++++++++-------- lib/test/plugin/android/nativeapiprovider.js | 1 - lib/test/plugin/android/promptbasednativeapi.js | 1 - test/runner.js | 17 +++++++-- test/suite.html | 7 ++-- 5 files changed, 33 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e4561c43/build/packager.js ---------------------------------------------------------------------- diff --git a/build/packager.js b/build/packager.js index e956bde..2ce12ca 100644 --- a/build/packager.js +++ b/build/packager.js @@ -70,6 +70,20 @@ packager.bundle = function(platform, debug, commitId ) { copyProps(modules, collectFiles(path.join('lib', 'webworks/common'))) copyProps(modules, collectFiles(path.join('lib', 'webworks/' + lang))) } + else if (platform === 'test') { + copyProps(modules, collectFiles(path.join('lib', platform))); + + //Test platform needs to bring in platform specific plugin's for testing + copyProps(modules, collectFiles(path.join('lib', 'webworks', 'air', 'plugin', 'air'), 'plugin/air')); + copyProps(modules, collectFiles(path.join('lib', 'webworks', 'java', 'plugin', 'java'), 'plugin/java')); + copyProps(modules, collectFiles(path.join('lib', 'webworks', 'qnx', 'plugin', 'qnx'), 'plugin/qnx')); + copyProps(modules, collectFiles(path.join('lib', 'tizen', 'plugin', 'tizen'), 'plubin/tizen')); + copyProps(modules, collectFiles(path.join('lib', 'wp7', 'plugin', 'wp7'), 'plugin/wp7')); + copyProps(modules, collectFiles(path.join('lib', 'windows8', 'plugin', 'windows8'), 'plugin/windows8')); + copyProps(modules, collectFiles(path.join('lib', 'ios', 'plugin', 'ios'), 'plugin/ios/')); + copyProps(modules, collectFiles(path.join('lib', 'bada', 'plugin', 'bada'), 'plugin/bada/')); + copyProps(modules, collectFiles(path.join('lib', 'android', 'plugin', 'android'), 'plugin/android/')); + } else { copyProps(modules, collectFiles(path.join('lib', platform))) } @@ -121,7 +135,6 @@ packager.bundle = function(platform, debug, commitId ) { } //------------------------------------------------------------------------------ -var CollectedFiles = {} function collectFile(dir, id, entry) { if (!id) id = '' @@ -130,7 +143,7 @@ function collectFile(dir, id, entry) { var stat = fs.statSync(fileName) - var result = CollectedFiles[dir] || {}; + var result = {}; moduleId = getModuleId(moduleId) result[moduleId] = fileName @@ -140,10 +153,6 @@ function collectFile(dir, id, entry) { function collectFiles(dir, id) { if (!id) id = '' - - if (CollectedFiles[dir]) { - return copyProps({}, CollectedFiles[dir]) - } var result = {} @@ -157,7 +166,7 @@ function collectFiles(dir, id) { }) entries.forEach(function(entry) { - var moduleId = path.join(id, entry) + var moduleId = path.join(id, entry) var fileName = path.join(dir, entry) var stat = fs.statSync(fileName) @@ -170,8 +179,6 @@ function collectFiles(dir, id) { } }) - CollectedFiles[dir] = result - return copyProps({}, result) } @@ -201,14 +208,8 @@ function writeModule(oFile, fileName, moduleId, debug) { } //------------------------------------------------------------------------------ -var FileContents = {} - function getContents(file) { - if (!FileContents.hasOwnProperty(file)) { - FileContents[file] = fs.readFileSync(file, 'utf8') - } - - return FileContents[file] + return fs.readFileSync(file, 'utf8'); } //------------------------------------------------------------------------------ http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e4561c43/lib/test/plugin/android/nativeapiprovider.js ---------------------------------------------------------------------- diff --git a/lib/test/plugin/android/nativeapiprovider.js b/lib/test/plugin/android/nativeapiprovider.js deleted file mode 120000 index 70a680d..0000000 --- a/lib/test/plugin/android/nativeapiprovider.js +++ /dev/null @@ -1 +0,0 @@ -../../../android/plugin/android/nativeapiprovider.js \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e4561c43/lib/test/plugin/android/promptbasednativeapi.js ---------------------------------------------------------------------- diff --git a/lib/test/plugin/android/promptbasednativeapi.js b/lib/test/plugin/android/promptbasednativeapi.js deleted file mode 120000 index 9fe7b2f..0000000 --- a/lib/test/plugin/android/promptbasednativeapi.js +++ /dev/null @@ -1 +0,0 @@ -../../../android/plugin/android/promptbasednativeapi.js \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e4561c43/test/runner.js ---------------------------------------------------------------------- diff --git a/test/runner.js b/test/runner.js index 7f3aeee..d854d86 100644 --- a/test/runner.js +++ b/test/runner.js @@ -105,20 +105,29 @@ module.exports = { connect.static(_path.join(__dirname, '..', 'thirdparty')), connect.static(__dirname), connect.router(function (app) { + app.get('/cordova.test.js', function (req, res) { + res.writeHead(200, { + "Cache-Control": "no-cache", + "Content-Type": "text/javascript" + }); + res.end(packager.bundle('test')); + }), app.get('/', function (req, res) { res.writeHead(200, { "Cache-Control": "no-cache", "Content-Type": "text/html" }); + + //create the script tags to include tests = []; collect(__dirname, tests); - specs = tests.map(function (file, path) { - return ''; }).join(''); - modules = packager.bundle('test'); - doc = html.replace(//g, specs).replace(/"##MODULES##"/g, modules); + + //inject in the test script includes and write the document + doc = html.replace(//g, specs); res.end(doc); }); }) http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e4561c43/test/suite.html ---------------------------------------------------------------------- diff --git a/test/suite.html b/test/suite.html index 881ba00..7a10689 100644 --- a/test/suite.html +++ b/test/suite.html @@ -54,18 +54,17 @@ })(); + + - -