Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DDA8510F44 for ; Tue, 11 Jun 2013 00:03:43 +0000 (UTC) Received: (qmail 27506 invoked by uid 500); 11 Jun 2013 00:03:41 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 27399 invoked by uid 500); 11 Jun 2013 00:03:41 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 25857 invoked by uid 99); 11 Jun 2013 00:03:39 -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, 11 Jun 2013 00:03:39 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id DB4178A2F96; Tue, 11 Jun 2013 00:03:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: filmaj@apache.org To: commits@cordova.apache.org Date: Tue, 11 Jun 2013 00:04:26 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [50/52] [partial] start of lazy loading: axe all vendored-in libs http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/LICENSE ---------------------------------------------------------------------- diff --git a/lib/cordova-android/LICENSE b/lib/cordova-android/LICENSE deleted file mode 100644 index 7a4a3ea..0000000 --- a/lib/cordova-android/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/NOTICE ---------------------------------------------------------------------- diff --git a/lib/cordova-android/NOTICE b/lib/cordova-android/NOTICE deleted file mode 100644 index b8172a6..0000000 --- a/lib/cordova-android/NOTICE +++ /dev/null @@ -1,17 +0,0 @@ -Apache Cordova -Copyright 2012 The Apache Software Foundation - -This product includes software developed at -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. == -========================================================================= - -Android Code -Copyright 2005-2008 The Android Open Source Project - -This product includes software developed as part of -The Android Open Source Project (http://source.android.com). http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/README.md ---------------------------------------------------------------------- diff --git a/lib/cordova-android/README.md b/lib/cordova-android/README.md deleted file mode 100755 index aca3242..0000000 --- a/lib/cordova-android/README.md +++ /dev/null @@ -1,125 +0,0 @@ - -Cordova Android -=== - -Cordova Android is an Android application library that allows for Cordova-based -projects to be built for the Android Platform. Cordova based applications are, -at the core, applications written with web technology: HTML, CSS and JavaScript. - -[Apache Cordova](http://cordova.io) is a project at The Apache Software Foundation (ASF). - - -Requires ---- - -- Java JDK 1.5 or greater -- Apache ANT 1.8.0 or greater -- Android SDK [http://developer.android.com](http://developer.android.com) -- Apache Commons Codec [http://commons.apache.org/codec/](http://commons.apache.org/codec/) - - -Cordova Android Developer Tools ---- - -The Cordova developer tooling is split between general tooling and project level tooling. - -To enable the command-line tools available in the ./bin directory, make -sure you have all of the dependencies installed. You will need -[NodeJS](http://nodejs.org) (which should come with `npm`). To install -the dependencies: - - $ cd bin - $ npm install - -General Commands - - ./bin/create [path package activity] ... create the ./example app or a cordova android project - ./bin/bench ............................ generate a bench proj - ./bin/autotest ......................... test the cli tools - ./bin/test ............................. run mobile-spec - -Project Commands - -These commands live in a generated Cordova Android project. - - ./cordova/debug [path] ..................... install to first device - ./cordova/emulate .......................... start avd (emulator) named default - ./cordova/log .............................. starts logcat - -Running the Example Project ---- - -Start avd (emulator) named `default`: - - ./bin/emulate - -Create the example project and build it to the first device: - - ./bin/create - cd example - ./cordova/debug - -Start adb logcat (console.log calls output here): - - ./cordova/log - -Creating a new Cordova Android Project ---- - - ./bin/create ~/Desktop/myapp com.myapp.special MyApp - -Importing a Cordova Android Project into Eclipse ----- - -1. File > New > Project... -2. Android > Android Project -3. Create project from existing source (point to the generated app found in tmp/android) -4. Right click on libs/cordova.jar and add to build path -5. Right click on the project root: Run as > Run Configurations -6. Click on the Target tab and select Manual (this way you can choose the emulator or device to build to) - -Building without the Tooling ---- -Note: The Developer Tools handle this. This is only to be done if the tooling fails, or if -you are developing directly against the framework. - - -To create your `cordova.jar` file, copy the commons codec: - - mv commons-codec-1.7.jar framework/libs - -then run in the framework directory: - - android update project -p . -t android-17 - ant jar - - -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) -- [http://wiki.apache.org/cordova/](http://wiki.apache.org/cordova/) http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/VERSION ---------------------------------------------------------------------- diff --git a/lib/cordova-android/VERSION b/lib/cordova-android/VERSION deleted file mode 100644 index 834f262..0000000 --- a/lib/cordova-android/VERSION +++ /dev/null @@ -1 +0,0 @@ -2.8.0 http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/check_reqs ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/check_reqs b/lib/cordova-android/bin/check_reqs deleted file mode 100755 index 0032778..0000000 --- a/lib/cordova-android/bin/check_reqs +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/bash -# 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. -# -ROOT="$( cd "$( dirname "$0" )/.." && pwd )" -cmd=`android list target` -if [[ $? != 0 ]]; then - echo "The command `android` failed. Make sure you have the latest Android SDK installed, and the `android` command (inside the tools/ folder) added to your path." - exit 2 -elif [[ ! $cmd =~ "android-17" ]]; then - echo "Please install Android target 17 (the Android 4.2 SDK). Make sure you have the latest Android tools installed as well. Run `android` from your command-line to install/update any missing SDKs or tools." - exit 2 -else - cmd="android update project -p $ROOT -t android-17 1> /dev/null 2>&1" - eval $cmd - if [[ $? != 0 ]]; then - echo "Error updating the Cordova library to work with your Android environment." - exit 2 - fi -fi \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/check_reqs.bat ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/check_reqs.bat b/lib/cordova-android/bin/check_reqs.bat deleted file mode 100644 index 12da1e7..0000000 --- a/lib/cordova-android/bin/check_reqs.bat +++ /dev/null @@ -1,26 +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. - -@ECHO OFF -SET full_path=%~dp0 -IF EXIST %full_path%check_reqs.js ( - cscript "%full_path%check_reqs.js" //nologo -) ELSE ( - ECHO. - ECHO ERROR: Could not find 'check_reqs.js' in 'bin' folder, aborting...>&2 - EXIT /B 1 -) http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/check_reqs.js ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/check_reqs.js b/lib/cordova-android/bin/check_reqs.js deleted file mode 100644 index ef30991..0000000 --- a/lib/cordova-android/bin/check_reqs.js +++ /dev/null @@ -1,81 +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. - -var ROOT = WScript.ScriptFullName.split('\\bin\\check_reqs.js').join(''), - shell = WScript.CreateObject("WScript.Shell"), - fso = WScript.CreateObject('Scripting.FileSystemObject'); - - -// executes a command in the shell, returns stdout or stderr if error -function exec_out(command) { - var oExec=shell.Exec(command); - var output = new String(); - while (oExec.Status == 0) { - if (!oExec.StdOut.AtEndOfStream) { - var line = oExec.StdOut.ReadAll(); - // XXX: Change to verbose mode - // WScript.StdOut.WriteLine(line); - output += line; - } - WScript.sleep(100); - } - //Check to make sure our scripts did not encounter an error - if (!oExec.StdErr.AtEndOfStream) { - var line = oExec.StdErr.ReadAll(); - return {'error' : true, 'output' : line}; - } else if (!oExec.StdOut.AtEndOfStream) { - var line = oExec.StdOut.ReadAll(); - // XXX: Change to verbose mode - // WScript.StdOut.WriteLine(line); - output += line; - } - return {'error' : false, 'output' : output}; -} - -// log to stdout or stderr -function Log(msg, error) { - if (error) { - WScript.StdErr.WriteLine(msg); - } - else { - WScript.StdOut.WriteLine(msg); - } -} - -// checks that android requirements are met -function check_requirements() { - var result = exec_out('%comspec% /c android list target'); - if(result.error) { - Log('The command `android` failed. Make sure you have the latest Android SDK installed, and the `android` command (inside the tools/ folder) added to your path. Output: ' + result.output, true); - WScript.Quit(2); - } - else if(!result.output.match(/android[-]17/)) { - Log('Please install Android target 17 (the Android 4.2 SDK). Make sure you have the latest Android tools installed as well. Run `android` from your command-line to install/update any missing SDKs or tools.', true); - Log('Output : ' + result.output); - WScript.Quit(2); - } - else { - var cmd = '%comspec% /c android update project -p ' + ROOT + '\\framework -t android-17'; - result = exec_out(cmd); - if(result.error) { - Log('Error updating the Cordova library to work with your Android environment. Command run: "' + cmd + '", output: ' + result.output, true); - WScript.Quit(2); - } - } -} - -check_requirements(); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/create ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/create b/lib/cordova-android/bin/create deleted file mode 100755 index b38ed51..0000000 --- a/lib/cordova-android/bin/create +++ /dev/null @@ -1,164 +0,0 @@ -#! /bin/bash -# 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. -# -# create a cordova/android project -# -# USAGE -# ./create [path package activity] -# -set -e - -if [ -z "$1" ] || [ "$1" == "-h" ] -then - echo "Usage: $0 " - echo "Make sure the Android SDK tools folder is in your PATH!" - echo " : Path to your new Cordova iOS project" - echo " : Package name, following reverse-domain style convention" - echo " : Project name" - exit 0 -fi - -BUILD_PATH="$( cd "$( dirname "$0" )/.." && pwd )" -VERSION=$(cat "$BUILD_PATH"/VERSION) - -PROJECT_PATH="${1:-'./example'}" -PACKAGE=${2:-"org.apache.cordova.example"} -ACTIVITY=${3:-"cordovaExample"} - -# clobber any existing example -if [ -d "$PROJECT_PATH" ] -then - echo "Project already exists! Delete and recreate" - exit 1 -fi - -function createAppInfoJar { - pushd "$BUILD_PATH"/bin/templates/cordova/ApplicationInfo > /dev/null - javac ApplicationInfo.java - jar -cfe ../appinfo.jar ApplicationInfo ApplicationInfo.class - popd > /dev/null -} - -function on_error { - echo "An unexpected error occurred: $previous_command exited with $?" - echo "Deleting project..." - [ -d "$PROJECT_PATH" ] && rm -rf "$PROJECT_PATH" - exit 1 -} - -function replace { - local pattern=$1 - local filename=$2 - # Mac OS X requires -i argument - if [[ "$OSTYPE" =~ "darwin" ]] - then - /usr/bin/sed -i '' -e $pattern "$filename" - elif [[ "$OSTYPE" =~ "linux" ]] - then - /bin/sed -i -e $pattern "$filename" - fi -} - -# we do not want the script to silently fail -trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG -trap on_error ERR - -ANDROID_BIN="${ANDROID_BIN:=$( which android )}" -PACKAGE_AS_PATH=$(echo $PACKAGE | sed 's/\./\//g') -ACTIVITY_PATH="$PROJECT_PATH"/src/$PACKAGE_AS_PATH/$ACTIVITY.java -MANIFEST_PATH="$PROJECT_PATH"/AndroidManifest.xml - -TARGET=$("$ANDROID_BIN" list targets | grep id: | tail -1 | cut -f 2 -d ' ' ) -API_LEVEL=$("$ANDROID_BIN" list target | grep "API level:" | tail -n 1 | cut -f 2 -d ':' | tr -d ' ') - -# check that build targets exist -if [ -z "$TARGET" ] || [ -z "$API_LEVEL" ] -then - echo "No Android Targets are installed. Please install at least one via the android SDK" - exit 1 -fi - -# if this a distribution release no need to build a jar -if [ ! -e "$BUILD_PATH"/cordova-$VERSION.jar ] && [ -d "$BUILD_PATH"/framework ] -then - # update the cordova-android framework for the desired target - "$ANDROID_BIN" update project --target $TARGET --path "$BUILD_PATH"/framework &> /dev/null - - if [ ! -e "$BUILD_PATH"/framework/libs/commons-codec-1.7.jar ]; then - # Use curl to get the jar (TODO: Support Apache Mirrors) - curl -OL http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.7-bin.zip &> /dev/null - unzip commons-codec-1.7-bin.zip &> /dev/null - mkdir -p "$BUILD_PATH"/framework/libs - cp commons-codec-1.7/commons-codec-1.7.jar "$BUILD_PATH"/framework/libs - # cleanup yo - rm commons-codec-1.7-bin.zip && rm -rf commons-codec-1.7 - fi - - # compile cordova.js and cordova.jar - pushd "$BUILD_PATH"/framework > /dev/null - ant jar > /dev/null - popd > /dev/null -fi - -# create new android project -"$ANDROID_BIN" create project --target $TARGET --path "$PROJECT_PATH" --package $PACKAGE --activity $ACTIVITY &> /dev/null - -# copy project template -cp -r "$BUILD_PATH"/bin/templates/project/assets "$PROJECT_PATH" -cp -r "$BUILD_PATH"/bin/templates/project/res "$PROJECT_PATH" - -# copy cordova.js, cordova.jar and res/xml -if [ -d "$BUILD_PATH"/framework ] -then - cp -r "$BUILD_PATH"/framework/res/xml "$PROJECT_PATH"/res - cp "$BUILD_PATH"/framework/assets/www/cordova.js "$PROJECT_PATH"/assets/www/cordova.js - cp "$BUILD_PATH"/framework/cordova-$VERSION.jar "$PROJECT_PATH"/libs/cordova-$VERSION.jar -else - cp -r "$BUILD_PATH"/xml "$PROJECT_PATH"/res/xml - cp "$BUILD_PATH"/cordova.js "$PROJECT_PATH"/assets/www/cordova.js - cp "$BUILD_PATH"/cordova-$VERSION.jar "$PROJECT_PATH"/libs/cordova-$VERSION.jar -fi - -# interpolate the activity name and package -cp "$BUILD_PATH"/bin/templates/project/Activity.java "$ACTIVITY_PATH" -replace "s/__ACTIVITY__/${ACTIVITY}/g" "$ACTIVITY_PATH" -replace "s/__ID__/${PACKAGE}/g" "$ACTIVITY_PATH" - -cp "$BUILD_PATH"/bin/templates/project/AndroidManifest.xml "$MANIFEST_PATH" -replace "s/__ACTIVITY__/${ACTIVITY}/g" "$MANIFEST_PATH" -replace "s/__PACKAGE__/${PACKAGE}/g" "$MANIFEST_PATH" -replace "s/__APILEVEL__/${API_LEVEL}/g" "$MANIFEST_PATH" - -# creating cordova folder and copying run/build/log/launch scripts -mkdir "$PROJECT_PATH"/cordova -mkdir "$PROJECT_PATH"/cordova/lib -createAppInfoJar -cp "$BUILD_PATH"/bin/templates/cordova/appinfo.jar "$PROJECT_PATH"/cordova/appinfo.jar -cp "$BUILD_PATH"/bin/templates/cordova/build "$PROJECT_PATH"/cordova/build -cp "$BUILD_PATH"/bin/templates/cordova/clean "$PROJECT_PATH"/cordova/clean -cp "$BUILD_PATH"/bin/templates/cordova/log "$PROJECT_PATH"/cordova/log -cp "$BUILD_PATH"/bin/templates/cordova/run "$PROJECT_PATH"/cordova/run -cp "$BUILD_PATH"/bin/templates/cordova/version "$PROJECT_PATH"/cordova/version -cp "$BUILD_PATH"/bin/templates/cordova/lib/cordova "$PROJECT_PATH"/cordova/lib/cordova -cp "$BUILD_PATH"/bin/templates/cordova/lib/install-device "$PROJECT_PATH"/cordova/lib/install-device -cp "$BUILD_PATH"/bin/templates/cordova/lib/install-emulator "$PROJECT_PATH"/cordova/lib/install-emulator -cp "$BUILD_PATH"/bin/templates/cordova/lib/list-devices "$PROJECT_PATH"/cordova/lib/list-devices -cp "$BUILD_PATH"/bin/templates/cordova/lib/list-emulator-images "$PROJECT_PATH"/cordova/lib/list-emulator-images -cp "$BUILD_PATH"/bin/templates/cordova/lib/list-started-emulators "$PROJECT_PATH"/cordova/lib/list-started-emulators -cp "$BUILD_PATH"/bin/templates/cordova/lib/start-emulator "$PROJECT_PATH"/cordova/lib/start-emulator - http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/create.bat ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/create.bat b/lib/cordova-android/bin/create.bat deleted file mode 100644 index 7f0346f..0000000 --- a/lib/cordova-android/bin/create.bat +++ /dev/null @@ -1,54 +0,0 @@ -@ECHO OFF -GOTO BEGIN -:: 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. - -:BEGIN - IF NOT DEFINED JAVA_HOME GOTO MISSING_JAVA_HOME - - FOR %%X in (java.exe javac.exe ant.bat android.bat) do ( - IF [%%~$PATH:X]==[] ( - ECHO Cannot locate %%X using the PATH environment variable. - ECHO Retry after adding directory containing %%X to the PATH variable. - ECHO Remember to open a new command window after updating the PATH variable. - IF "%%X"=="java.exe" GOTO GET_JAVA - IF "%%X"=="javac.exe" GOTO GET_JAVA - IF "%%X"=="ant.bat" GOTO GET_ANT - IF "%%X"=="android.bat" GOTO GET_ANDROID - GOTO ERROR - ) - ) - cscript "%~dp0\create.js" %* //nologo - GOTO END -:MISSING_JAVA_HOME - ECHO The JAVA_HOME environment variable is not set. - ECHO Set JAVA_HOME to an existing JRE directory. - ECHO Remember to also add JAVA_HOME to the PATH variable. - ECHO After updating system variables, open a new command window and retry. - GOTO ERROR -:GET_JAVA - ECHO Visit http://java.oracle.com if you need to install Java (JDK). - GOTO ERROR -:GET_ANT - ECHO Visit http://ant.apache.org if you need to install Apache Ant. - GOTO ERROR -:GET_ANDROID - ECHO Visit http://developer.android.com if you need to install the Android SDK. - GOTO ERROR -:ERROR -EXIT /B 1 -:END http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/create.js ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/create.js b/lib/cordova-android/bin/create.js deleted file mode 100644 index b1de5fe..0000000 --- a/lib/cordova-android/bin/create.js +++ /dev/null @@ -1,267 +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. -*/ - -/* - * create a cordova/android project - * - * USAGE - * ./create [path package activity] - */ - -var args = WScript.Arguments, PROJECT_PATH="example", - PACKAGE="org.apache.cordova.example", ACTIVITY="cordovaExample", - shell=WScript.CreateObject("WScript.Shell"), - fso = WScript.CreateObject('Scripting.FileSystemObject'); - -function Usage() { - Log("Usage: create PathTONewProject [ PackageName AppName ]"); - Log(" PathTONewProject : The path to where you wish to create the project"); - Log(" PackageName : The package for the project (default is org.apache.cordova.example)") - Log(" AppName : The name of the application/activity (default is cordovaExample)"); - Log("examples:"); - Log(" create C:\\Users\\anonymous\\Desktop\\MyProject"); - Log(" create C:\\Users\\anonymous\\Desktop\\MyProject io.Cordova.Example AnApp"); -} - -// logs messaged to stdout and stderr -function Log(msg, error) { - if (error) { - WScript.StdErr.WriteLine(msg); - } - else { - WScript.StdOut.WriteLine(msg); - } -} - -function read(filename) { - var fso=WScript.CreateObject("Scripting.FileSystemObject"); - var f=fso.OpenTextFile(filename, 1); - var s=f.ReadAll(); - f.Close(); - return s; -} - -function checkTargets(targets) { - if(!targets) { - Log("You do not have any android targets setup. Please create at least one target with the `android` command", true); - WScript.Quit(69); - } -} - -function setTarget() { - var targets = shell.Exec('android.bat list targets').StdOut.ReadAll().match(/id:\s\d+/g); - checkTargets(targets); - return targets[targets.length - 1].replace(/id: /, ""); // TODO: give users the option to set their target -} -function setApiLevel() { - var targets = shell.Exec('android.bat list targets').StdOut.ReadAll().match(/API level:\s\d+/g); - checkTargets(targets); - return targets[targets.length - 1].replace(/API level: /, ""); -} -function write(filename, contents) { - var fso=WScript.CreateObject("Scripting.FileSystemObject"); - var f=fso.OpenTextFile(filename, 2, true); - f.Write(contents); - f.Close(); -} -function replaceInFile(filename, regexp, replacement) { - write(filename, read(filename).replace(regexp, replacement)); -} -function exec(command) { - var oShell=shell.Exec(command); - while (oShell.Status == 0) { - if(!oShell.StdOut.AtEndOfStream) { - var line = oShell.StdOut.ReadLine(); - // XXX: Change to verbose mode - // WScript.StdOut.WriteLine(line); - } - WScript.sleep(100); - } -} - -function createAppInfoJar() { - if(!fso.FileExists(ROOT+"\\bin\\templates\\cordova\\appinfo.jar")) { - Log("Creating appinfo.jar..."); - var cur = shell.CurrentDirectory; - shell.CurrentDirectory = ROOT+"\\bin\\templates\\cordova\\ApplicationInfo"; - exec("javac ApplicationInfo.java"); - exec("jar -cfe ..\\appinfo.jar ApplicationInfo ApplicationInfo.class"); - shell.CurrentDirectory = cur; - } -} - -function cleanup() { - // Cleanup -// if(fso.FileExists(ROOT + '\\framework\\libs\\commons-codec-1.6.jar')) { -// fso.DeleteFile(ROOT + '\\framework\\libs\\commons-codec-1.6.jar'); -// fso.DeleteFolder(ROOT + '\\framework\\libs', true); -// } - if(fso.FileExists(ROOT + '\\framework\\cordova-'+VERSION+'.jar')) { - fso.DeleteFile(ROOT + '\\framework\\cordova-'+VERSION+'.jar'); - } - if(fso.FileExists(ROOT + '\\framework\\assets\\www\\cordova-'+VERSION+'.js')) { - fso.DeleteFile(ROOT + '\\framework\\assets\\www\\cordova-'+VERSION+'.js'); - } -} - -function downloadCommonsCodec() { - if (!fso.FileExists(ROOT + '\\framework\\libs\\commons-codec-1.7.jar')) { - // We need the .jar - var url = 'http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.7-bin.zip'; - var libsPath = ROOT + '\\framework\\libs'; - var savePath = libsPath + '\\commons-codec-1.7-bin.zip'; - if (!fso.FileExists(savePath)) { - if(!fso.FolderExists(ROOT + '\\framework\\libs')) { - fso.CreateFolder(libsPath); - } - // We need the zip to get the jar - var xhr = WScript.CreateObject('MSXML2.XMLHTTP'); - xhr.open('GET', url, false); - xhr.send(); - if (xhr.status == 200) { - var stream = WScript.CreateObject('ADODB.Stream'); - stream.Open(); - stream.Type = 1; - stream.Write(xhr.ResponseBody); - stream.Position = 0; - stream.SaveToFile(savePath); - stream.Close(); - } else { - Log('Could not retrieve the commons-codec. Please download it yourself and put into the framework/libs directory. This process may fail now. Sorry.'); - } - } - var app = WScript.CreateObject('Shell.Application'); - var source = app.NameSpace(savePath).Items(); - var target = app.NameSpace(ROOT + '\\framework\\libs'); - target.CopyHere(source, 256); - - // Move the jar into libs - fso.MoveFile(ROOT + '\\framework\\libs\\commons-codec-1.7\\commons-codec-1.7.jar', ROOT + '\\framework\\libs\\commons-codec-1.7.jar'); - - // Clean up - fso.DeleteFile(ROOT + '\\framework\\libs\\commons-codec-1.7-bin.zip'); - fso.DeleteFolder(ROOT + '\\framework\\libs\\commons-codec-1.7', true); - } -} - -// working dir -var ROOT = WScript.ScriptFullName.split('\\bin\\create.js').join(''); -if (args.Count() > 0) { - // support help flags - if (args(0) == "--help" || args(0) == "/?" || - args(0) == "help" || args(0) == "-help" || args(0) == "/help" || args(0) == "-h") { - Usage(); - WScript.Quit(2); - } - - PROJECT_PATH=args(0); - if (args.Count() > 1) { - PACKAGE = args(1); - } - if (args.Count() > 2) { - ACTIVITY = args(2); - } -} -else { - Log("Error : No project path provided."); - Usage(); - WScript.Quit(2); -} - -if(fso.FolderExists(PROJECT_PATH)) { - Log("Project path already exists!", true); - WScript.Quit(2); -} - -var PACKAGE_AS_PATH=PACKAGE.replace(/\./g, '\\'); -var ACTIVITY_DIR=PROJECT_PATH + '\\src\\' + PACKAGE_AS_PATH; -var ACTIVITY_PATH=ACTIVITY_DIR+'\\'+ACTIVITY+'.java'; -var MANIFEST_PATH=PROJECT_PATH+'\\AndroidManifest.xml'; -var TARGET=setTarget(); -var API_LEVEL=setApiLevel(); -var VERSION=read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,''); -// create the project -Log("Creating new android project..."); -exec('android.bat create project --target "'+TARGET+'" --path "'+PROJECT_PATH+'" --package "'+PACKAGE+'" --activity "'+ACTIVITY+'"'); - -// build from source. distro should have these files -if (!fso.FileExists(ROOT+'\\cordova-'+VERSION+'.jar') && - !fso.FileExists(ROOT+'\\cordova.js')) { - Log("Building jar and js files..."); - // update the cordova framework project to a target that exists on this machine - exec('android.bat update project --target "'+TARGET+'" --path "'+ROOT+'\\framework"'); - // pull down commons codec if necessary - downloadCommonsCodec(); - exec('ant.bat -f "'+ ROOT +'\\framework\\build.xml" jar'); -} - -// copy in the project template -Log("Copying template files..."); -exec('%comspec% /c xcopy "'+ ROOT + '\\bin\\templates\\project\\res" "'+PROJECT_PATH+'\\res\\" /E /Y'); -exec('%comspec% /c xcopy "'+ ROOT + '\\bin\\templates\\project\\assets" "'+PROJECT_PATH+'\\assets\\" /E /Y'); -exec('%comspec% /c copy "'+ROOT+'\\bin\\templates\\project\\AndroidManifest.xml" "' + PROJECT_PATH + '\\AndroidManifest.xml" /Y'); -exec('%comspec% /c mkdir "' + ACTIVITY_DIR + '"'); -exec('%comspec% /c copy "' + ROOT + '"\\bin\\templates\\project\\Activity.java "' + ACTIVITY_PATH + '" /Y'); - -// check if we have the source or the distro files -Log("Copying js, jar & config.xml files..."); -if(fso.FolderExists(ROOT + '\\framework')) { - exec('%comspec% /c copy "'+ROOT+'\\framework\\assets\\www\\cordova.js" "'+PROJECT_PATH+'\\assets\\www\\cordova.js" /Y'); - exec('%comspec% /c copy "'+ROOT+'\\framework\\cordova-'+VERSION+'.jar" "'+PROJECT_PATH+'\\libs\\cordova-'+VERSION+'.jar" /Y'); - fso.CreateFolder(PROJECT_PATH + '\\res\\xml'); - exec('%comspec% /c copy "'+ROOT+'\\framework\\res\\xml\\config.xml" "' + PROJECT_PATH + '\\res\\xml\\config.xml" /Y'); -} else { - // copy in cordova.js - exec('%comspec% /c copy "'+ROOT+'\\cordova.js" "'+PROJECT_PATH+'\\assets\\www\\cordova.js" /Y'); - // copy in cordova.jar - exec('%comspec% /c copy "'+ROOT+'\\cordova-'+VERSION+'.jar" "'+PROJECT_PATH+'\\libs\\cordova-'+VERSION+'.jar" /Y'); - // copy in xml - fso.CreateFolder(PROJECT_PATH + '\\res\\xml'); - exec('%comspec% /c copy "'+ROOT+'\\xml\\config.xml" "' + PROJECT_PATH + '\\res\\xml\\config.xml" /Y'); -} - -// copy cordova scripts -fso.CreateFolder(PROJECT_PATH + '\\cordova'); -fso.CreateFolder(PROJECT_PATH + '\\cordova\\lib'); -createAppInfoJar(); -Log("Copying cordova command tools..."); -exec('%comspec% /c copy "'+ROOT+'\\bin\\templates\\cordova\\appinfo.jar" "' + PROJECT_PATH + '\\cordova\\appinfo.jar" /Y'); -exec('%comspec% /c copy "'+ROOT+'\\bin\\templates\\cordova\\lib\\cordova.js" "' + PROJECT_PATH + '\\cordova\\lib\\cordova.js" /Y'); -exec('%comspec% /c copy "'+ROOT+'\\bin\\templates\\cordova\\lib\\install-device.bat" "' + PROJECT_PATH + '\\cordova\\lib\\install-device.bat" /Y'); -exec('%comspec% /c copy "'+ROOT+'\\bin\\templates\\cordova\\lib\\install-emulator.bat" "' + PROJECT_PATH + '\\cordova\\lib\\install-emulator.bat" /Y'); -exec('%comspec% /c copy "'+ROOT+'\\bin\\templates\\cordova\\lib\\list-emulator-images.bat" "' + PROJECT_PATH + '\\cordova\\lib\\list-emulator-images.bat" /Y'); -exec('%comspec% /c copy "'+ROOT+'\\bin\\templates\\cordova\\lib\\list-devices.bat" "' + PROJECT_PATH + '\\cordova\\lib\\list-devices.bat" /Y'); -exec('%comspec% /c copy "'+ROOT+'\\bin\\templates\\cordova\\lib\\list-started-emulators.bat" "' + PROJECT_PATH + '\\cordova\\lib\\list-started-emulators.bat" /Y'); -exec('%comspec% /c copy "'+ROOT+'\\bin\\templates\\cordova\\lib\\start-emulator.bat" "' + PROJECT_PATH + '\\cordova\\lib\\start-emulator.bat" /Y'); -exec('%comspec% /c copy "'+ROOT+'\\bin\\templates\\cordova\\cordova.bat" "' + PROJECT_PATH + '\\cordova\\cordova.bat" /Y'); -exec('%comspec% /c copy "'+ROOT+'\\bin\\templates\\cordova\\clean.bat" "' + PROJECT_PATH + '\\cordova\\clean.bat" /Y'); -exec('%comspec% /c copy "'+ROOT+'\\bin\\templates\\cordova\\build.bat" "' + PROJECT_PATH + '\\cordova\\build.bat" /Y'); -exec('%comspec% /c copy "'+ROOT+'\\bin\\templates\\cordova\\log.bat" "' + PROJECT_PATH + '\\cordova\\log.bat" /Y'); -exec('%comspec% /c copy "'+ROOT+'\\bin\\templates\\cordova\\run.bat" "' + PROJECT_PATH + '\\cordova\\run.bat" /Y'); - -// interpolate the activity name and package -Log("Updating AndroidManifest.xml and Main Activity..."); -replaceInFile(ACTIVITY_PATH, /__ACTIVITY__/, ACTIVITY); -replaceInFile(ACTIVITY_PATH, /__ID__/, PACKAGE); - -replaceInFile(MANIFEST_PATH, /__ACTIVITY__/, ACTIVITY); -replaceInFile(MANIFEST_PATH, /__PACKAGE__/, PACKAGE); -replaceInFile(MANIFEST_PATH, /__APILEVEL__/, API_LEVEL); - -cleanup(); http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/create.xml ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/create.xml b/lib/cordova-android/bin/create.xml deleted file mode 100644 index 720697c..0000000 --- a/lib/cordova-android/bin/create.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - package-as-path=${package} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/package.json ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/package.json b/lib/cordova-android/bin/package.json deleted file mode 100644 index 27cb0eb..0000000 --- a/lib/cordova-android/bin/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "cordova-android-cli", - "description": "CLI tooling for the cordova-android project", - "version": "0.0.1", - "licenses": [{ - "type": "APL 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0" - }], - "main" : "./create", - "bin": { - "create": "./create", - "bench": "./bench", - "autotest": "./autotest", - "BOOM": "./BOOM", - "test": "./test" - }, - "homepage": "http://incubator.apache.org/cordova", - "repository": { - "type": "git", - "url": "http://git-wip-us.apache.org/repos/asf/incubator-cordova-android.git" - } -} http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/templates/cordova/ApplicationInfo/ApplicationInfo.java ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/templates/cordova/ApplicationInfo/ApplicationInfo.java b/lib/cordova-android/bin/templates/cordova/ApplicationInfo/ApplicationInfo.java deleted file mode 100644 index c344b65..0000000 --- a/lib/cordova-android/bin/templates/cordova/ApplicationInfo/ApplicationInfo.java +++ /dev/null @@ -1,61 +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. - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import org.xml.sax.SAXException; -import java.io.IOException; - -public class ApplicationInfo { - private static void parseAndroidManifest(String path) { - // System.out.println(path); - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - Document dom; - try { - DocumentBuilder db = dbf.newDocumentBuilder(); - dom = db.parse(path); - - // getting package information - Element manifest = dom.getDocumentElement(); - String pakkage = manifest.getAttribute("package"); - - // getting activity name - String activity = ((Element)dom.getElementsByTagName("activity").item(0)).getAttribute("android:name"); - System.out.println(String.format("%s/.%s", pakkage, activity.replace(".", ""))); - } catch(ParserConfigurationException pce) { - pce.printStackTrace(); - } catch(SAXException se) { - se.printStackTrace(); - } catch(IOException ioe) { - ioe.printStackTrace(); - } - - } - - public static void main(String[] args) { - String path; - if(args.length > 0) { - path = args[0]; - } else { - path = System.getProperty("user.dir") + "/../AndroidManifest.xml"; - } - parseAndroidManifest(path); - } -} http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/templates/cordova/build ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/templates/cordova/build b/lib/cordova-android/bin/templates/cordova/build deleted file mode 100755 index 3cbd9c1..0000000 --- a/lib/cordova-android/bin/templates/cordova/build +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# 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. - -set -e - -CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd ) - -bash "$CORDOVA_PATH"/lib/cordova build "$@" http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/templates/cordova/build.bat ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/templates/cordova/build.bat b/lib/cordova-android/bin/templates/cordova/build.bat deleted file mode 100644 index 392f374..0000000 --- a/lib/cordova-android/bin/templates/cordova/build.bat +++ /dev/null @@ -1,18 +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. -@ECHO OFF -%~dp0\cordova.bat build %* http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/templates/cordova/clean ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/templates/cordova/clean b/lib/cordova-android/bin/templates/cordova/clean deleted file mode 100755 index f52966a..0000000 --- a/lib/cordova-android/bin/templates/cordova/clean +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# 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. - -set -e - -CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd ) - -bash "$CORDOVA_PATH"/lib/cordova clean "$@" http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/templates/cordova/clean.bat ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/templates/cordova/clean.bat b/lib/cordova-android/bin/templates/cordova/clean.bat deleted file mode 100644 index 643c8d5..0000000 --- a/lib/cordova-android/bin/templates/cordova/clean.bat +++ /dev/null @@ -1,18 +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. -@ECHO OFF -%~dp0\cordova.bat clean %* http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/templates/cordova/cordova.bat ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/templates/cordova/cordova.bat b/lib/cordova-android/bin/templates/cordova/cordova.bat deleted file mode 100644 index 6235fdb..0000000 --- a/lib/cordova-android/bin/templates/cordova/cordova.bat +++ /dev/null @@ -1,31 +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. -@ECHO OFF -IF NOT DEFINED JAVA_HOME GOTO MISSING -FOR %%X in (java.exe ant.bat android.bat) do ( - SET FOUND=%%~$PATH:X - IF NOT DEFINED FOUND GOTO MISSING -) -cscript %~dp0\lib\cordova.js %* //nologo -GOTO END -:MISSING -ECHO Missing one of the following: -ECHO JDK: http://java.oracle.com -ECHO Android SDK: http://developer.android.com -ECHO Apache ant: http://ant.apache.org -EXIT /B 1 -:END http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/91c74886/lib/cordova-android/bin/templates/cordova/lib/cordova ---------------------------------------------------------------------- diff --git a/lib/cordova-android/bin/templates/cordova/lib/cordova b/lib/cordova-android/bin/templates/cordova/lib/cordova deleted file mode 100755 index 294df49..0000000 --- a/lib/cordova-android/bin/templates/cordova/lib/cordova +++ /dev/null @@ -1,386 +0,0 @@ -#!/bin/bash -# 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. - -PROJECT_PATH=$( cd "$( dirname "$0" )/../.." && pwd ) - -function list_devices { - IFS=$'\n' - devices=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep -v 'emulator'` - device_list=($devices) - if [[ ${#device_list[@]} > 0 ]] ; then - for i in ${devices[@]} - do - # remove space and 'device' - echo ${i/[^a-zA-Z0-9._]device/} - done - else - echo "No devices found." - exit 2 - fi -} - -function list_started_emulators { - IFS=$'\n' - devices=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep 'emulator'` - emulator_list=($devices) - if [[ ${#emulator_list[@]} > 0 ]] ; then - for i in ${emulator_list[@]} - do - # remove space and 'device' - echo ${i/[^a-zA-Z0-9._]device/} - done - else - echo "No started emulators found, you can start an emulator by using the command" - echo " 'cordova/lib/start-emulator'" - exit 2 - fi -} - -function list_emulator_images { - emulator_images=`android list avds | grep "Name:" | cut -f 2 -d ":"` - emulator_list=($emulator_images) - if [[ ${#emulator_list[@]} > 0 ]] ; then - for i in ${emulator_list[@]} - do - echo ${i/[^a-zA-Z0-9._]/} - done - else - echo "No emulators found, if you would like to create an emulator follow the instructions" - echo " provided here : http://developer.android.com/tools/devices/index.html" - echo " Or run 'android create avd --name --target ' in on the command line." - exit 2 - fi -} - -function start_emulator { - emulator_images=`android list avds | grep "Name:" | cut -f 2 -d ":"` - # if target emulator is provided - if [[ "$#" -eq 1 ]] ; then - # check that it exists - if [[ $emulator_images =~ $1 ]] ; then - #xterm -e emulator -avd $1 & - emulator -avd $1 1> /dev/null 2>&1 & - else - echo "Could not find the provided emulator, make sure the emulator exists" - echo " by checking 'cordova/lib/list-emulator-images'" - exit 2 - fi - else - # start first emulator - emulator_list=($emulator_images) - if [[ ${#emulator_list[@]} > 0 ]] ; then - #xterm -e emulator -avd ${emulator_list[0]} & - emulator -avd ${emulator_list[0]/[^a-zA-Z0-9._]/} 1> /dev/null 2>&1 & - else - echo "No emulators found, if you would like to create an emulator follow the instructions" - echo " provided here : http://developer.android.com/tools/devices/index.html" - echo " Or run 'android create avd --name --target ' in on the command line." - exit 2 - fi - fi -} - -function install_device { - IFS=$'\n' - devices=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep -v 'emulator'` - device_list=($devices) - if [[ ${#device_list[@]} > 0 ]] ; then - apks=`find $PROJECT_PATH/bin -type f -maxdepth 1 | egrep '\.apk$'` - apk_list=($apks) - if [[ ${#apk_list[@]} > 0 ]] ; then - local target - # handle target emulator - if [[ "$#" -eq 1 ]] ; then - # deploy to given target - target=${1/--target=/} - else - # delete trailing space and 'device' after device ID - target=${device_list[0]/[^a-zA-Z0-9._]device/} - fi - echo "Installing ${apk_list[0]} onto device $target..." - adb -s $target install -r ${apk_list[0]}; - echo "Launching application..." - local launch_str=$(java -jar "$PROJECT_PATH"/cordova/appinfo.jar "$PROJECT_PATH"/AndroidManifest.xml) - adb -s $target shell am start -W -a android.intent.action.MAIN -n $launch_str - else - echo "Application package not found, could not install to device" - echo " make sure your application is built before deploying." - exit 2 - fi - else - echo "No devices found to deploy to. Please make sure your device is connected" - echo " and you can view it using the 'cordova/lib/list-devices' command." - exit 2 - fi -} - -function install_emulator { - IFS=$'\n' - # check that there is an emulator to deploy to - emulator_string=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'emulator'` - emulator_list=($emulator_string) - if [[ ${#emulator_list[@]} > 0 ]] ; then - apks=`find $PROJECT_PATH/bin -type f -maxdepth 1 | egrep '\.apk$'` - apk_list=($apks) - if [[ ${#apk_list[@]} > 0 ]] ; then - local target - # handle target emulator - if [[ "$#" -eq 1 ]] ; then - # deploy to given target - target=${1/--target=/} - else - # delete trailing space and 'device' after emulator ID - target=${emulator_list[0]/[^a-zA-Z0-9._]device/} - fi - echo "Installing ${apk_list[0]} onto $target..." - adb -s $target install -r ${apk_list[0]}; - echo "Launching application..." - local launch_str=$(java -jar "$PROJECT_PATH"/cordova/appinfo.jar "$PROJECT_PATH"/AndroidManifest.xml) - adb -s $target shell am start -W -a android.intent.action.MAIN -n $launch_str - - else - echo "Application package not found, could not install to device" - echo " make sure your application is built before deploying." - exit 2 - fi - else - echo "No emulators found to deploy to. Please make sure your emulator is started" - echo " and you can view it using the 'cordova/lib/list-started-emulators' command." - exit 2 - fi -} - -# cleans the project -function clean { - echo "Cleaning project..." - ant clean -} - -# has to be used independently and not in conjunction with other commands -function log { - # filter out nativeGetEnabledTags spam from latest sdk bug. - adb logcat | grep -v nativeGetEnabledTags -} - - -function build { - if [[ "$#" -eq 1 ]] ; then - if [[ $1 == "--debug" ]] ; then - clean - ant debug -f "$PROJECT_PATH"/build.xml - elif [[ $1 == "--release" ]] ; then - clean - ant release -f "$PROJECT_PATH"/build.xml - elif [[ $1 == "--nobuild" ]] ; then - echo "Skipping build..." - else - echo "Error : Build command '$1' not recognized." - exit 2 - fi - else - echo "Warning : [ --debug | --release | --nobuild ] not specified, defaulting to --debug" - clean - ant debug -f "$PROJECT_PATH"/build.xml - fi -} - - -function wait_for_emulator { - emulator_string=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep 'emulator'` - old_started=($emulator_string) - local new_started - local new_emulator_name - local i="0" - echo -n "Waiting for emulator..." - while [ $i -lt 300 ] - do - emulator_string=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep 'emulator'` - new_started=($emulator_string) - if [[ ${#new_started[@]} > ${#old_started[@]} && -z "$new_emulator_name" ]] ; then - # get the name of the started emulator - local count="0" - if [[ ${#old_started[@]} == 0 ]] ; then - new_emulator_name=${new_started[$count]/[^a-zA-Z0-9._]device/} - else - for count in {0...${#old_started[@]}} - do - if [[ ! ${new_started[$count]} == ${old_started[$count]} ]] ; then - new_emulator_name=${new_started[$count]/[^a-zA-Z0-9._]device/} - fi - done - if [[ -z "$new_emulator_name" ]] ; then - count=$[count+1] - new_emulator_name=${new_started[$count]/[^a-zA-Z0-9._]device/} - fi - fi - elif [[ "$new_emulator_name" ]] ; then - boot_anim=`adb -s $new_emulator_name shell getprop init.svc.bootanim` - if [[ $boot_anim =~ "stopped" ]] ; then - break - else - sleep 1 - i=$[i+1] - echo -n "." - fi - else - sleep 1 - i=$[i+1] - echo -n "." - fi - done - # Device timeout: emulator has not started in time - if [ $i -eq 300 ] - then - echo "emulator timeout!" - exit 69 - else - echo "connected!" - fi -} - -function run { - IFS=$'\n' - if [[ "$#" -eq 2 ]] ; then - build $2 - if [[ $1 == "--device" ]] ; then - install_device - elif [[ $1 == "--emulator" ]] ; then - install_emulator - elif [[ $1 =~ "--target=" ]]; then - install_device $1 - else - echo "Error : '$1' is not recognized as an install option" - fi - elif [[ "$#" -eq 1 ]] ; then - if [[ $1 == "--debug" || $1 == "--release" || $1 == "--nobuild" ]] ; then - build $1 - elif [[ $1 == "--device" ]] ; then - install_device - elif [[ $1 == "--emulator" ]] ; then - install_emulator - elif [[ $1 =~ "--target=" ]]; then - install_device $1 - else - echo "Error : '$1' is not recognized as an install option" - fi - else - echo "Warning : [ --device | --emulate | --target= ] not specified, using defaults." - build - devices=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep -v 'emulator'` - device_list=($devices) - emulator_string=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep 'emulator'` - emulator_list=($emulator_string) - if [[ ${#device_list[@]} > 0 ]] ; then - install_device - elif [[ ${#emulator_list[@]} > 0 ]] ; then - install_emulator - else - emulator_images=`android list avds | grep "Name:" | cut -f 2 -d ":"` - echo $emulator_images - emulator_image_list=($emulator_images) - if [[ ${#emulator_image_list[@]} > 0 ]] ; then - echo "Starting emulator : ${emulator_image_list[0]}" - emulator -avd ${emulator_image_list[0]/[^.\w]/} 1> /dev/null 2>&1 & - wait_for_emulator - install_emulator - else - # TODO : look for emulator images and start one if it's availible - echo "Error : there are no availible devices or emulators to deploy to." - echo " create an emulator or connect your device to run this command." - echo "If you would like to create an emulator follow the instructions" - echo " provided here : http://developer.android.com/tools/devices/index.html" - echo " Or run 'android create avd --name --target ' in on the command line." - exit 2 - fi - fi - fi -} - -# parse command line arguments - -if [[ $# > 3 ]] ; then - echo "Error : too many arguments." - exit 2 -elif [[ $# == 3 ]] ; then - if [[ $1 == "run" ]] ; then - run $2 $3 - else - echo "Error : too many arguments for '$1'" - exit 2 - fi -elif [[ $# == 2 ]] ; then - if [[ $1 == "run" ]] ; then - if [[ $2 == "--emulator" || $2 == "--device" || $2 =~ "--target=" ]] ; then - run $2 '' - elif [[ $2 == "--debug" || $2 == "--release" || $2 == "--nobuild" ]] ; then - run '' $2 - else - echo "Error : '$2' is not recognized as a run option." - exit 2 - fi - elif [[ $1 == "build" ]] ; then - build $2 - elif [[ $1 == "start-emulator" ]] ; then - start_emulator $2 - elif [[ $1 == "install-device" ]] ; then - if [[ $2 =~ "--target=" ]] ; then - install_device $2 - else - echo "Error : '$2' is not recognized as an install option" - exit 2 - fi - elif [[ $1 == "install-emulator" ]] ; then - if [[ $2 =~ "--target=" ]] ; then - install_emulator $2 - else - echo "Error : '$2' is not recognized as an install option" - exit 2 - fi - else - echo "Error : '$1' is not recognized as an option that takes arguments" - exit 2 - fi -elif [[ $# == 1 ]] ; then - if [[ $1 == "run" ]] ; then - run - elif [[ $1 == "build" ]]; then - build - elif [[ $1 == "clean" ]]; then - clean - elif [[ $1 == "log" ]]; then - log - elif [[ $1 == "list-devices" ]]; then - list_devices - elif [[ $1 == "list-emulator-images" ]]; then - list_emulator_images - elif [[ $1 == "list-started-emulators" ]]; then - list_started_emulators - elif [[ $1 == "install-device" ]]; then - install_device - elif [[ $1 == "install-emulator" ]]; then - install_emulator - elif [[ $1 == "start-emulator" ]]; then - start_emulator - else - echo "Error : '$1' is not recognized as a tooling command." - exit 2 - fi -else - echo "Error : No command recieved, exiting..." - exit 2 -fi \ No newline at end of file