From 82bba44538f5559b4bc848c34a5e9d55c8b2bb74 Mon Sep 17 00:00:00 2001 From: Marcel Kinard Date: Wed, 30 Apr 2014 08:44:21 -0400 Subject: [PATCH 01/11] CB-6491 add CONTRIBUTING.md --- CONTRIBUTING.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..1594d125 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,16 @@ +# Contributing to Apache Cordova + +Anyone can contribute to Cordova. And we need your contributions. + +There are multiple ways to contribute: report bugs, improve the docs, and +contribute code. + +For instructions on this, start with the +[contribution overview](http://cordova.apache.org/#contribute). + +The details are explained there, but the important items are: + - Sign and submit an Apache ICLA (Contributor License Agreement). + - Have a Jira issue open that corresponds to your contribution. + - Run the tests so your patch doesn't break existing functionality. + +We look forward to your contributions! From 64fd87134fcb60280e816449704f386bd979ce8b Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Wed, 30 Apr 2014 10:54:47 -0700 Subject: [PATCH 02/11] CB-6552: added top level package.json --- package.json | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 00000000..d3e153ae --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "cordova-android", + "version": "3.4.0", + "description": "This is the release for cordova-android", + "main": "bin/create", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://git-wip-us.apache.org/repos/asf/cordova-android.git" + }, + "keywords": [ + "android", + "cordova" + ], + "author": "Joe Bowser", + "license": "Apache version 2.0", + "dependencies": { + "q": "^0.9.0", + "shelljs": "^0.2.6" + } +} From 3d4b8ce99ba21236dff1cdd43076391d507f499a Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Wed, 30 Apr 2014 11:59:29 -0700 Subject: [PATCH 03/11] CB-6552: updated test field --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d3e153ae..fd641c83 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "This is the release for cordova-android", "main": "bin/create", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test":"echo \"Error: please view test/readme.md\" && exit 1" }, "repository": { "type": "git", From c349892c5b6a5311cf404b39fe004ed19dfb35c9 Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Wed, 30 Apr 2014 12:55:28 -0700 Subject: [PATCH 04/11] CB-6552: updated author to apache software foundation in pacakge.json --- package.json | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index fd641c83..0d203c92 100644 --- a/package.json +++ b/package.json @@ -1,20 +1,18 @@ { "name": "cordova-android", "version": "3.4.0", - "description": "This is the release for cordova-android", + "description": "cordova-android release", "main": "bin/create", - "scripts": { - "test":"echo \"Error: please view test/readme.md\" && exit 1" - }, "repository": { "type": "git", "url": "https://git-wip-us.apache.org/repos/asf/cordova-android.git" }, "keywords": [ "android", - "cordova" + "cordova", + "apache" ], - "author": "Joe Bowser", + "author": "Apache Software Foundation", "license": "Apache version 2.0", "dependencies": { "q": "^0.9.0", From 8702c04d392cbd0d9e075705ff497b93ecf147de Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Tue, 6 May 2014 15:17:49 -0400 Subject: [PATCH 05/11] Revert accidentally removed lines from NOTICE --- NOTICE | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/NOTICE b/NOTICE index 8ec56a52..40c5e74c 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,17 @@ Apache Cordova -Copyright 2012 The Apache Software Foundation +Copyright 2014 The Apache Software Foundation This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). +The Apache Software Foundation (http://www.apache.org) + +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Android-specific code. == +========================================================================= + +This product includes software developed as part of +The Android Open Source Project (http://source.android.com). + +This software includes software developed at Square, Inc. +Copyright (C) 2013 Square, Inc. From 93c8ba920a27451fbb85afefc52e73569792e65e Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Thu, 3 Apr 2014 10:04:28 -0700 Subject: [PATCH 06/11] Added dash to test push --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 26ab1e52..8dc2f953 100755 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ Running Tests Please see details under test/README.md. Further Reading ---- +---- - [http://developer.android.com](http://developer.android.com) - [http://cordova.apache.org/](http://cordova.apache.org) From 00caa1c0a0f3b51064fbf832b9e646039f41a4b5 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Tue, 6 May 2014 15:51:14 -0700 Subject: [PATCH 07/11] Set VERSION to 3.6.0-dev (via coho) --- VERSION | 2 +- bin/templates/cordova/version | 2 +- framework/src/org/apache/cordova/CordovaWebView.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 414a102c..86bab9cf 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.5.0-dev +3.6.0-dev diff --git a/bin/templates/cordova/version b/bin/templates/cordova/version index 4250850f..ac3bb54d 100755 --- a/bin/templates/cordova/version +++ b/bin/templates/cordova/version @@ -20,6 +20,6 @@ */ // Coho updates this line: -var VERSION = "3.5.0-dev"; +var VERSION = "3.6.0-dev"; console.log(VERSION); diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java index b0e3d433..9e98ac6f 100755 --- a/framework/src/org/apache/cordova/CordovaWebView.java +++ b/framework/src/org/apache/cordova/CordovaWebView.java @@ -68,7 +68,7 @@ import android.widget.FrameLayout; public class CordovaWebView extends WebView { public static final String TAG = "CordovaWebView"; - public static final String CORDOVA_VERSION = "3.5.0-dev"; + public static final String CORDOVA_VERSION = "3.6.0-dev"; private ArrayList keyDownCodes = new ArrayList(); private ArrayList keyUpCodes = new ArrayList(); From cf42d31214ea5a437b4023ae2423d3eb5d595101 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Tue, 6 May 2014 15:51:17 -0700 Subject: [PATCH 08/11] Update JS snapshot to version 3.6.0-dev (via coho) --- framework/assets/www/cordova.js | 110 +++++++++++++++++++++++++++++++- 1 file changed, 108 insertions(+), 2 deletions(-) diff --git a/framework/assets/www/cordova.js b/framework/assets/www/cordova.js index 45c1943a..c09cc428 100644 --- a/framework/assets/www/cordova.js +++ b/framework/assets/www/cordova.js @@ -1,5 +1,5 @@ // Platform: android -// 3.5.0-dev-81f9a00 +// 3.6.0-dev-eb7268f /* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file @@ -19,7 +19,7 @@ under the License. */ ;(function() { -var CORDOVA_JS_BUILD_LABEL = '3.5.0-dev-81f9a00'; +var CORDOVA_JS_BUILD_LABEL = '3.6.0-dev-eb7268f'; // file: src/scripts/require.js /*jshint -W079 */ @@ -825,6 +825,7 @@ channel.createSticky('onNativeReady'); channel.createSticky('onCordovaReady'); // Event to indicate that all automatically loaded JS plugins are loaded and ready. +// FIXME remove this channel.createSticky('onPluginsReady'); // Event to indicate that Cordova is ready @@ -1245,6 +1246,111 @@ channel.join(function() { }, platformInitChannelsArray); +}); + +// file: src/common/init_b.js +define("cordova/init_b", function(require, exports, module) { + +var channel = require('cordova/channel'); +var cordova = require('cordova'); +var platform = require('cordova/platform'); + +var platformInitChannelsArray = [channel.onDOMContentLoaded, channel.onNativeReady]; + +// setting exec +cordova.exec = require('cordova/exec'); + +function logUnfiredChannels(arr) { + for (var i = 0; i < arr.length; ++i) { + if (arr[i].state != 2) { + console.log('Channel not fired: ' + arr[i].type); + } + } +} + +window.setTimeout(function() { + if (channel.onDeviceReady.state != 2) { + console.log('deviceready has not fired after 5 seconds.'); + logUnfiredChannels(platformInitChannelsArray); + logUnfiredChannels(channel.deviceReadyChannelsArray); + } +}, 5000); + +// Replace navigator before any modules are required(), to ensure it happens as soon as possible. +// We replace it so that properties that can't be clobbered can instead be overridden. +function replaceNavigator(origNavigator) { + var CordovaNavigator = function() {}; + CordovaNavigator.prototype = origNavigator; + var newNavigator = new CordovaNavigator(); + // This work-around really only applies to new APIs that are newer than Function.bind. + // Without it, APIs such as getGamepads() break. + if (CordovaNavigator.bind) { + for (var key in origNavigator) { + if (typeof origNavigator[key] == 'function') { + newNavigator[key] = origNavigator[key].bind(origNavigator); + } + } + } + return newNavigator; +} +if (window.navigator) { + window.navigator = replaceNavigator(window.navigator); +} + +if (!window.console) { + window.console = { + log: function(){} + }; +} +if (!window.console.warn) { + window.console.warn = function(msg) { + this.log("warn: " + msg); + }; +} + +// Register pause, resume and deviceready channels as events on document. +channel.onPause = cordova.addDocumentEventHandler('pause'); +channel.onResume = cordova.addDocumentEventHandler('resume'); +channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready'); + +// Listen for DOMContentLoaded and notify our channel subscribers. +if (document.readyState == 'complete' || document.readyState == 'interactive') { + channel.onDOMContentLoaded.fire(); +} else { + document.addEventListener('DOMContentLoaded', function() { + channel.onDOMContentLoaded.fire(); + }, false); +} + +// _nativeReady is global variable that the native side can set +// to signify that the native code is ready. It is a global since +// it may be called before any cordova JS is ready. +if (window._nativeReady) { + channel.onNativeReady.fire(); +} + +// Call the platform-specific initialization. +platform.bootstrap && platform.bootstrap(); + +/** + * Create all cordova objects once native side is ready. + */ +channel.join(function() { + + platform.initialize && platform.initialize(); + + // Fire event to notify that all objects are created + channel.onCordovaReady.fire(); + + // Fire onDeviceReady event once page has fully loaded, all + // constructors have run and cordova info has been received from native + // side. + channel.join(function() { + require('cordova').fireDocumentEvent('deviceready'); + }, channel.deviceReadyChannelsArray); + +}, platformInitChannelsArray); + }); // file: src/common/modulemapper.js From 50c4aef87328c9c932bcee869fc1691a259806da Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Thu, 8 May 2014 15:32:28 -0700 Subject: [PATCH 09/11] Update JS snapshot to version 3.6.0-dev (via coho) --- framework/assets/www/cordova.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/assets/www/cordova.js b/framework/assets/www/cordova.js index c09cc428..ed621c7b 100644 --- a/framework/assets/www/cordova.js +++ b/framework/assets/www/cordova.js @@ -1,5 +1,5 @@ // Platform: android -// 3.6.0-dev-eb7268f +// 3.6.0-dev-7e845f3 /* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file @@ -19,7 +19,7 @@ under the License. */ ;(function() { -var CORDOVA_JS_BUILD_LABEL = '3.6.0-dev-eb7268f'; +var CORDOVA_JS_BUILD_LABEL = '3.6.0-dev-7e845f3'; // file: src/scripts/require.js /*jshint -W079 */ From 1a17083e8c371f997809c9e34dada6f4fbb3e7fc Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Fri, 2 May 2014 10:51:24 -0400 Subject: [PATCH 10/11] Add more required methods on CordovaWebView interface --- .../src/org/apache/cordova/CordovaWebView.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java index e1e42948..ad746fd9 100644 --- a/framework/src/org/apache/cordova/CordovaWebView.java +++ b/framework/src/org/apache/cordova/CordovaWebView.java @@ -35,9 +35,19 @@ public interface CordovaWebView { Object getParent(); + void loadUrl(String url); + void loadUrl(String url, int splashscreenTime); - void loadUrl(String url); + void loadUrlNow(String url); + + void loadUrlIntoView(final String url); + + void loadUrlIntoView(final String url, boolean recreatePlugins); + + void loadUrlIntoView(final String url, final int splashscreenTime); + + void stopLoading(); boolean canGoBack(); @@ -58,7 +68,7 @@ public interface CordovaWebView { void postMessage(String id, Object data); void addJavascript(String statement); - + void sendJavascript(String statememt); CordovaChromeClient getWebChromeClient(); @@ -99,8 +109,6 @@ public interface CordovaWebView { void setOverScrollMode(int overScrollNever); - void loadUrlNow(String string); - void setNetworkAvailable(boolean online); CordovaResourceApi getResourceApi(); From 22b19593337eebbf80d399692218b569ae78d922 Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Thu, 22 May 2014 14:04:00 -0400 Subject: [PATCH 11/11] Manually fix Android sdk location to support library projects without local.properties --- bin/node_modules/which/LICENSE | 23 ++++++ bin/node_modules/which/README.md | 5 ++ bin/node_modules/which/bin/which | 14 ++++ bin/node_modules/which/package.json | 31 +++++++++ bin/node_modules/which/which.js | 104 ++++++++++++++++++++++++++++ bin/templates/cordova/lib/build.js | 7 ++ package.json | 3 +- 7 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 bin/node_modules/which/LICENSE create mode 100644 bin/node_modules/which/README.md create mode 100755 bin/node_modules/which/bin/which create mode 100644 bin/node_modules/which/package.json create mode 100644 bin/node_modules/which/which.js diff --git a/bin/node_modules/which/LICENSE b/bin/node_modules/which/LICENSE new file mode 100644 index 00000000..05a40109 --- /dev/null +++ b/bin/node_modules/which/LICENSE @@ -0,0 +1,23 @@ +Copyright 2009, 2010, 2011 Isaac Z. Schlueter. +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. diff --git a/bin/node_modules/which/README.md b/bin/node_modules/which/README.md new file mode 100644 index 00000000..ff1eb531 --- /dev/null +++ b/bin/node_modules/which/README.md @@ -0,0 +1,5 @@ +The "which" util from npm's guts. + +Finds the first instance of a specified executable in the PATH +environment variable. Does not cache the results, so `hash -r` is not +needed when the PATH changes. diff --git a/bin/node_modules/which/bin/which b/bin/node_modules/which/bin/which new file mode 100755 index 00000000..8432ce2f --- /dev/null +++ b/bin/node_modules/which/bin/which @@ -0,0 +1,14 @@ +#!/usr/bin/env node +var which = require("../") +if (process.argv.length < 3) { + console.error("Usage: which ") + process.exit(1) +} + +which(process.argv[2], function (er, thing) { + if (er) { + console.error(er.message) + process.exit(er.errno || 127) + } + console.log(thing) +}) diff --git a/bin/node_modules/which/package.json b/bin/node_modules/which/package.json new file mode 100644 index 00000000..c71cabb5 --- /dev/null +++ b/bin/node_modules/which/package.json @@ -0,0 +1,31 @@ +{ + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, + "name": "which", + "description": "Like which(1) unix command. Find the first instance of an executable in the PATH.", + "version": "1.0.5", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-which.git" + }, + "main": "which.js", + "bin": { + "which": "./bin/which" + }, + "engines": { + "node": "*" + }, + "dependencies": {}, + "devDependencies": {}, + "readme": "The \"which\" util from npm's guts.\n\nFinds the first instance of a specified executable in the PATH\nenvironment variable. Does not cache the results, so `hash -r` is not\nneeded when the PATH changes.\n", + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/isaacs/node-which/issues" + }, + "homepage": "https://github.com/isaacs/node-which", + "_id": "which@1.0.5", + "_from": "which@^1.0.5" +} diff --git a/bin/node_modules/which/which.js b/bin/node_modules/which/which.js new file mode 100644 index 00000000..db7e8f74 --- /dev/null +++ b/bin/node_modules/which/which.js @@ -0,0 +1,104 @@ +module.exports = which +which.sync = whichSync + +var path = require("path") + , fs + , COLON = process.platform === "win32" ? ";" : ":" + , isExe + +try { + fs = require("graceful-fs") +} catch (ex) { + fs = require("fs") +} + +if (process.platform == "win32") { + // On windows, there is no good way to check that a file is executable + isExe = function isExe () { return true } +} else { + isExe = function isExe (mod, uid, gid) { + //console.error(mod, uid, gid); + //console.error("isExe?", (mod & 0111).toString(8)) + var ret = (mod & 0001) + || (mod & 0010) && process.getgid && gid === process.getgid() + || (mod & 0100) && process.getuid && uid === process.getuid() + //console.error("isExe?", ret) + return ret + } +} + + + +function which (cmd, cb) { + if (isAbsolute(cmd)) return cb(null, cmd) + var pathEnv = (process.env.PATH || "").split(COLON) + , pathExt = [""] + if (process.platform === "win32") { + pathEnv.push(process.cwd()) + pathExt = (process.env.PATHEXT || ".EXE").split(COLON) + if (cmd.indexOf(".") !== -1) pathExt.unshift("") + } + //console.error("pathEnv", pathEnv) + ;(function F (i, l) { + if (i === l) return cb(new Error("not found: "+cmd)) + var p = path.resolve(pathEnv[i], cmd) + ;(function E (ii, ll) { + if (ii === ll) return F(i + 1, l) + var ext = pathExt[ii] + //console.error(p + ext) + fs.stat(p + ext, function (er, stat) { + if (!er && + stat && + stat.isFile() && + isExe(stat.mode, stat.uid, stat.gid)) { + //console.error("yes, exe!", p + ext) + return cb(null, p + ext) + } + return E(ii + 1, ll) + }) + })(0, pathExt.length) + })(0, pathEnv.length) +} + +function whichSync (cmd) { + if (isAbsolute(cmd)) return cmd + var pathEnv = (process.env.PATH || "").split(COLON) + , pathExt = [""] + if (process.platform === "win32") { + pathEnv.push(process.cwd()) + pathExt = (process.env.PATHEXT || ".EXE").split(COLON) + if (cmd.indexOf(".") !== -1) pathExt.unshift("") + } + for (var i = 0, l = pathEnv.length; i < l; i ++) { + var p = path.join(pathEnv[i], cmd) + for (var j = 0, ll = pathExt.length; j < ll; j ++) { + var cur = p + pathExt[j] + var stat + try { stat = fs.statSync(cur) } catch (ex) {} + if (stat && + stat.isFile() && + isExe(stat.mode, stat.uid, stat.gid)) return cur + } + } + throw new Error("not found: "+cmd) +} + +var isAbsolute = process.platform === "win32" ? absWin : absUnix + +function absWin (p) { + if (absUnix(p)) return true + // pull off the device/UNC bit from a windows path. + // from node's lib/path.js + var splitDeviceRe = + /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?([\\\/])?/ + , result = splitDeviceRe.exec(p) + , device = result[1] || '' + , isUnc = device && device.charAt(1) !== ':' + , isAbsolute = !!result[2] || isUnc // UNC paths are always absolute + + return isAbsolute +} + +function absUnix (p) { + return p.charAt(0) === "/" || p === "" +} diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js index 6336ecf5..9e5172cc 100644 --- a/bin/templates/cordova/lib/build.js +++ b/bin/templates/cordova/lib/build.js @@ -24,6 +24,7 @@ var shell = require('shelljs'), Q = require('q'), path = require('path'), fs = require('fs'), + which = require('which'), ROOT = path.join(__dirname, '..', '..'); @@ -32,6 +33,12 @@ function hasCustomRules() { } module.exports.getAntArgs = function(cmd) { var args = [cmd, '-f', path.join(ROOT, 'build.xml')]; + try { + // Specify sdk dir in case local properties are missing + args.push('-Dsdk.dir='+path.join(which.sync('android'), '../..')); + } catch(e) { + // Can't find android; don't push arg: assume all is okay + } // custom_rules.xml is required for incremental builds. if (hasCustomRules()) { args.push('-Dout.dir=ant-build', '-Dgen.absolute.dir=ant-gen'); diff --git a/package.json b/package.json index 0d203c92..f38c1873 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "license": "Apache version 2.0", "dependencies": { "q": "^0.9.0", - "shelljs": "^0.2.6" + "shelljs": "^0.2.6", + "which": "^1.0.5" } }