Compare commits

..

7 Commits

Author SHA1 Message Date
Joe Bowser
221b10b1e6 Set VERSION to 3.2.0 (via coho) 2013-11-18 13:18:48 -08:00
Joe Bowser
dd4e2a6a62 Update JS snapshot to version 3.2.0 (via coho) 2013-11-18 13:18:48 -08:00
Steven Gill
1febd02592 Merge branch '3.2.x' of https://git-wip-us.apache.org/repos/asf/cordova-android into 3.2.x 2013-11-11 16:38:05 -08:00
Steven Gill
499efecd7f CB-5349: fixed regression in update script 2013-11-11 16:36:24 -08:00
Marcel Kinard
fce9be7b0b CB-5301 add missing license headers
(cherry picked from commit 04f812c136)
2013-11-06 16:29:24 -05:00
Joe Bowser
fb3fb416b1 Set VERSION to 3.2.0-rc1 (via coho) 2013-11-04 09:50:38 -08:00
Joe Bowser
31195a1817 Update JS snapshot to version 3.2.0-rc1 (via coho) 2013-11-04 09:50:37 -08:00
18 changed files with 182 additions and 114 deletions

View File

@@ -1 +1 @@
3.2.0-dev
3.2.0

View File

@@ -20,17 +20,20 @@
*/
var path = require('path');
var create = require('./lib/create');
var args = require('./lib/simpleargs').getArgs(process.argv);
var args = process.argv;
if (args['--help'] || args._.length === 0) {
console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'create')) + ' <path_to_new_project> <package_name> <project_name> [<template_path>] [--shared]');
// Support basic help commands
if(args.length < 3 || (args[2] == '--help' || args[2] == '/?' || args[2] == '-h' ||
args[2] == 'help' || args[2] == '-help' || args[2] == '/help')) {
console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'create')) + ' <path_to_new_project> <package_name> <project_name>');
console.log(' <path_to_new_project>: Path to your new Cordova Android project');
console.log(' <package_name>: Package name, following reverse-domain style convention');
console.log(' <project_name>: Project name');
console.log(' <template_path>: Path to a custom application template to use');
console.log(' --shared will use the CordovaLib project directly instead of making a copy.');
process.exit(1);
} else {
create.createProject(args[2], args[3], args[4], args[5]).done(null, function(err) {
console.error(err);
process.exit(2);
});
}
create.createProject(args._[0], args._[1], args._[2], args._[3], args['--shared']).done();

View File

@@ -29,13 +29,14 @@ var shell = require('shelljs'),
// Returns a promise.
function exec(command, opt_cwd) {
var d = Q.defer();
console.log('Running: ' + command);
child_process.exec(command, { cwd: opt_cwd }, function(err, stdout, stderr) {
stdout && console.log(stdout);
stderr && console.error(stderr);
if (err) d.reject(err);
else d.resolve(stdout);
});
try {
child_process.exec(command, { cwd: opt_cwd }, function(err, stdout, stderr) {
if (err) d.reject(err);
else d.resolve(stdout);
});
} catch(e) {
return Q.reject('Command error on execution: ' + command + '\n' + e);
}
return d.promise;
}
@@ -46,45 +47,32 @@ function setShellFatal(value, func) {
shell.config.fatal = oldVal;
}
function getFrameworkDir(projectPath, shared) {
return shared ? path.join(ROOT, 'framework') : path.join(projectPath, 'CordovaLib');
// Returns a promise.
function ensureJarIsBuilt(version, target_api) {
var isDevVersion = /-dev$/.test(version);
if (isDevVersion || !fs.existsSync(path.join(ROOT, 'framework', 'cordova-' + version + '.jar')) && fs.existsSync(path.join(ROOT, 'framework'))) {
var valid_target = check_reqs.get_target();
console.log('Building cordova-' + version + '.jar');
// update the cordova-android framework for the desired target
return exec('android --silent update lib-project --target "' + target_api + '" --path "' + path.join(ROOT, 'framework') + '"')
.then(function() {
// compile cordova.js and cordova.jar
return exec('ant jar', path.join(ROOT, 'framework'));
});
}
return Q();
}
function copyJsAndLibrary(projectPath, shared, projectName) {
var nestedCordovaLibPath = getFrameworkDir(projectPath, false);
function copyJsAndJar(projectPath, version) {
shell.cp('-f', path.join(ROOT, 'framework', 'assets', 'www', 'cordova.js'), path.join(projectPath, 'assets', 'www', 'cordova.js'));
// Don't fail if there are no old jars.
setShellFatal(false, function() {
shell.ls(path.join(projectPath, 'libs', 'cordova-*.jar')).forEach(function(oldJar) {
console.log("Deleting " + oldJar);
shell.rm('-f', oldJar);
shell.rm('-f', path.join(oldJar));
});
// Delete old library project if it existed.
if (shared) {
shell.rm('-rf', nestedCordovaLibPath);
} else {
// Delete only the src, since eclipse can't handle its .project file being deleted.
shell.rm('-rf', path.join(nestedCordovaLibPath, 'src'));
}
});
if (!shared) {
shell.mkdir('-p', nestedCordovaLibPath);
shell.cp('-f', path.join(ROOT, 'framework', 'AndroidManifest.xml'), nestedCordovaLibPath);
shell.cp('-f', path.join(ROOT, 'framework', 'project.properties'), nestedCordovaLibPath);
shell.cp('-r', path.join(ROOT, 'framework', 'src'), nestedCordovaLibPath);
// Create an eclipse project file and set the name of it to something unique.
// Without this, you can't import multiple CordovaLib projects into the same workspace.
var eclipseProjectFilePath = path.join(nestedCordovaLibPath, '.project');
if (!fs.existsSync(eclipseProjectFilePath)) {
var data = '<?xml version="1.0" encoding="UTF-8"?><projectDescription><name>' + projectName + '-' + 'CordovaLib</name></projectDescription>';
fs.writeFileSync(eclipseProjectFilePath, data, 'utf8');
}
}
}
function runAndroidUpdate(projectPath, target_api, shared) {
var targetFrameworkDir = getFrameworkDir(projectPath, shared);
return exec('android update project --subprojects --path "' + projectPath + '" --target ' + target_api + ' --library "' + path.relative(projectPath, targetFrameworkDir) + '"');
shell.cp('-f', path.join(ROOT, 'framework', 'cordova-' + version + '.jar'), path.join(projectPath, 'libs', 'cordova-' + version + '.jar'));
}
function copyScripts(projectPath) {
@@ -116,7 +104,7 @@ function copyScripts(projectPath) {
* Returns a promise.
*/
exports.createProject = function(project_path, package_name, project_name, project_template_dir, use_shared_project) {
exports.createProject = function(project_path, package_name, project_name, project_template_dir) {
var VERSION = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim();
// Set default values for path, package and name
@@ -154,6 +142,9 @@ exports.createProject = function(project_path, package_name, project_name, proje
console.log('\tName: ' + project_name);
console.log('\tAndroid target: ' + target_api);
// build from source. distro should have these files
return ensureJarIsBuilt(VERSION, target_api);
}).then(function() {
console.log('Copying template files...');
setShellFatal(true, function() {
@@ -165,7 +156,7 @@ exports.createProject = function(project_path, package_name, project_name, proje
// copy cordova.js, cordova.jar and res/xml
shell.cp('-r', path.join(ROOT, 'framework', 'res', 'xml'), path.join(project_path, 'res'));
copyJsAndLibrary(project_path, use_shared_project, safe_activity_name);
copyJsAndJar(project_path, VERSION);
// interpolate the activity name and package
shell.mkdir('-p', activity_dir);
@@ -181,7 +172,8 @@ exports.createProject = function(project_path, package_name, project_name, proje
copyScripts(project_path);
});
// Link it to local android install.
return runAndroidUpdate(project_path, target_api, use_shared_project);
console.log('Running "android update project"');
return exec('android --silent update project --target "'+target_api+'" --path "'+ project_path+'"');
}).then(function() {
console.log('Project successfully created.');
});
@@ -189,17 +181,16 @@ exports.createProject = function(project_path, package_name, project_name, proje
// Returns a promise.
exports.updateProject = function(projectPath) {
var version = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim();
// Check that requirements are met and proper targets are installed
return check_reqs.run()
.then(function() {
var version = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim();
var target_api = check_reqs.get_target();
copyJsAndLibrary(projectPath, false, null);
return ensureJarIsBuilt(version, target_api);
}).then(function() {
copyJsAndJar(projectPath, version);
copyScripts(projectPath);
return runAndroidUpdate(projectPath, target_api, false)
.then(function() {
console.log('Android project is now at version ' + version);
});
console.log('Android project is now at version ' + version);
});
};

View File

@@ -1,32 +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.
*/
exports.getArgs = function(argv) {
var ret = {};
var posArgs = [];
for (var i = 2, arg; arg = argv[i] || i < argv.length; ++i) {
if (/^--/.exec(arg)) {
ret[arg] = true;
} else {
posArgs.push(arg);
}
}
ret._ = posArgs;
return ret;
};

View File

@@ -5,9 +5,9 @@
:: 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
@@ -18,7 +18,7 @@
@ECHO OFF
SET script_path="%~dp0build"
IF EXIST %script_path% (
node %script_path% %*
node "%script_path%" %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'build' script in 'cordova' folder, aborting...>&2

View File

@@ -5,9 +5,9 @@
:: 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
@@ -18,7 +18,7 @@
@ECHO OFF
SET script_path="%~dp0clean"
IF EXIST %script_path% (
node %script_path% %*
node "%script_path%" %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'clean' script in 'cordova' folder, aborting...>&2

View File

@@ -37,10 +37,10 @@ module.exports.run = function(build_type) {
var cmd;
switch(build_type) {
case '--debug' :
cmd = 'ant debug -f "' + path.join(ROOT, 'build.xml') + '"';
cmd = 'ant debug -f ' + path.join(ROOT, 'build.xml');
break;
case '--release' :
cmd = 'ant release -f "' + path.join(ROOT, 'build.xml') + '"';
cmd = 'ant release -f ' + path.join(ROOT, 'build.xml');
break;
case '--nobuild' :
console.log('Skipping build...');

View File

@@ -28,7 +28,7 @@ var exec = require('./exec'),
* Returns a promise.
*/
module.exports.run = function() {
return exec('ant clean -f "' + path.join(ROOT, 'build.xml') + '"');
return exec('ant clean -f ' + path.join(ROOT, 'build.xml'));
}
module.exports.help = function() {

View File

@@ -5,9 +5,9 @@
:: 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
@@ -18,7 +18,7 @@
@ECHO OFF
SET script_path="%~dp0log"
IF EXIST %script_path% (
node %script_path% %*
node "%script_path%" %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'log' script in 'cordova' folder, aborting...>&2

View File

@@ -5,9 +5,9 @@
:: 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
@@ -18,7 +18,7 @@
@ECHO OFF
SET script_path="%~dp0run"
IF EXIST %script_path% (
node %script_path% %*
node "%script_path%" %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'run' script in 'cordova' folder, aborting...>&2

View File

@@ -20,6 +20,6 @@
*/
// Coho updates this line:
var VERSION = "3.2.0-dev";
var VERSION = "3.2.0";
console.log(VERSION);

View File

@@ -5,9 +5,9 @@
:: 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
@@ -18,7 +18,7 @@
@ECHO OFF
SET script_path="%~dp0version"
IF EXIST %script_path% (
node %script_path% %*
node "%script_path%" %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'version' script in 'cordova' folder, aborting...>&2

View File

@@ -19,13 +19,18 @@
under the License.
*/
var path = require('path');
var args = process.argv;
var create = require('./lib/create');
var args = require('./lib/simpleargs').getArgs(process.argv);
if (args['--help'] || args._.length === 0) {
console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'update')) + ' <path_to_project> [--shared]');
console.log(' --shared will use the CordovaLib project directly instead of making a copy.');
// Support basic help commands
if(args.length < 3 || (args[2] == '--help' || args[2] == '/?' || args[2] == '-h' ||
args[2] == 'help' || args[2] == '-help' || args[2] == '/help')) {
console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'update')) + ' <path_to_project>');
process.exit(1);
} else {
create.updateProject(args[2]).done(null, function(err) {
console.error(err);
process.exit(2);
});
}
create.updateProject(args._[0], args['--shared']).done();

View File

@@ -17,7 +17,43 @@
specific language governing permissions and limitations
under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:windowSoftInputMode="adjustPan"
package="org.apache.cordova" android:versionName="1.0" android:versionCode="1">
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<!-- android:xlargeScreens="true" screen supported only after Android-9 -->
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.RECORD_VIDEO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:debuggable="true">
<activity android:name="org.apache.cordova.DroidGap" android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="8" />
</manifest>

View File

@@ -1,5 +1,5 @@
// Platform: android
// 3.2.0-dev-5ad41a7
// 3.2.0
/*
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.2.0-dev-5ad41a7';
var CORDOVA_JS_BUILD_LABEL = '3.2.0';
// file: lib/scripts/require.js
/*jshint -W079 */
@@ -1074,6 +1074,36 @@ module.exports = androidExec;
});
// file: lib/common/exec/proxy.js
define("cordova/exec/proxy", function(require, exports, module) {
// internal map of proxy function
var CommandProxyMap = {};
module.exports = {
// example: cordova.commandProxy.add("Accelerometer",{getCurrentAcceleration: function(successCallback, errorCallback, options) {...},...);
add:function(id,proxyObj) {
console.log("adding proxy for " + id);
CommandProxyMap[id] = proxyObj;
return proxyObj;
},
// cordova.commandProxy.remove("Accelerometer");
remove:function(id) {
var proxy = CommandProxyMap[id];
delete CommandProxyMap[id];
CommandProxyMap[id] = null;
return proxy;
},
get:function(service,action) {
return ( CommandProxyMap[service] ? CommandProxyMap[service][action] : null );
}
};
});
// file: lib/common/init.js
define("cordova/init", function(require, exports, module) {

View File

@@ -61,7 +61,7 @@ public class CordovaWebView extends WebView {
public static final String TAG = "CordovaWebView";
public static final String CORDOVA_VERSION = "3.2.0-dev";
public static final String CORDOVA_VERSION = "3.2.0";
private ArrayList<Integer> keyDownCodes = new ArrayList<Integer>();
private ArrayList<Integer> keyUpCodes = new ArrayList<Integer>();

View File

@@ -1,3 +1,20 @@
# 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.
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses

View File

@@ -1,4 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
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.
-->
<resources>
<string name="app_name">CordovaTests</string>
</resources>