You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2012/06/13 01:11:23 UTC
[8/18] android commit: renaming create2
renaming create2
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/55b1e408
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/55b1e408
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/55b1e408
Branch: refs/heads/master
Commit: 55b1e408856a9a4b0bcdcd8569da32af3b6efa1b
Parents: 71972dc
Author: Anis Kadri <an...@gmail.com>
Authored: Fri Jun 8 10:36:10 2012 -0700
Committer: Anis Kadri <an...@gmail.com>
Committed: Fri Jun 8 10:36:10 2012 -0700
----------------------------------------------------------------------
bin/create | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
bin/create2 | 115 ------------------------------------------------------
2 files changed, 115 insertions(+), 115 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/55b1e408/bin/create
----------------------------------------------------------------------
diff --git a/bin/create b/bin/create
new file mode 100755
index 0000000..2b3fe05
--- /dev/null
+++ b/bin/create
@@ -0,0 +1,115 @@
+#! /bin/sh
+# 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 [ -n "$1" ] && [ "$1" == "-h" ]
+then
+ echo 'usage: create path package activity'
+ echo "Make sure the Android SDK tools folder is in your PATH!"
+ 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
+
+# cleanup after exit and/or on error
+function on_exit {
+ echo "Cleaning up ..."
+ [ -f $BUILD_PATH/framework/libs/commons-codec-1.6.jar ] && rm $BUILD_PATH/framework/libs/commons-codec-1.6.jar
+ [ -d $BUILD_PATH/framework/libs ] && rmdir $BUILD_PATH/framework/libs
+ [ -f $BUILD_PATH/framework/assets/www/cordova-$VERSION.js ] && rm $BUILD_PATH/framework/assets/www/cordova-$VERSION.js
+ [ -f $BUILD_PATH/framework/cordova-$VERSION.jar ] && rm $BUILD_PATH/framework/cordova-$VERSION.jar
+}
+
+function on_error {
+ echo "An error occured. Deleting project..."
+ [ -d $PROJECT_PATH ] && rm -rf $PROJECT_PATH
+}
+
+# we do not want the script to silently fail
+trap on_error ERR
+trap on_exit EXIT
+
+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 ' ' )
+
+# 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.6.jar ]; then
+ # Use curl to get the jar (TODO: Support Apache Mirrors)
+ echo "Downloading common-codecs-1.6 ..."
+ curl -OL http://mirror.symnds.com/software/Apache//commons/codec/binaries/commons-codec-1.6-bin.zip &> /dev/null
+ unzip commons-codec-1.6-bin.zip &> /dev/null
+ mkdir -p $BUILD_PATH/framework/libs
+ cp commons-codec-1.6/commons-codec-1.6.jar $BUILD_PATH/framework/libs
+ # cleanup yo
+ rm commons-codec-1.6-bin.zip && rm -rf commons-codec-1.6
+fi
+
+# compile cordova.js and cordova.jar
+echo "Building cordova-$VERSION.jar and cordova-$VERSION.js ..."
+(cd $BUILD_PATH/framework && ant jar &> /dev/null )
+
+# create new android project
+echo "Creating a new cordova android project ..."
+$ANDROID_BIN create project --target $TARGET --path $PROJECT_PATH --package $PACKAGE --activity $ACTIVITY &> /dev/null
+
+# copy project template
+echo "Copying assets and resources ..."
+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
+echo "Setting up config and plugins list ..."
+cp -r $BUILD_PATH/framework/res/xml $PROJECT_PATH/res
+
+echo "Adding cordova-$VERSION.js and cordova-$VERSION.jar ..."
+cp $BUILD_PATH/framework/assets/www/cordova-$VERSION.js $PROJECT_PATH/assets/www/cordova-$VERSION.js
+cp $BUILD_PATH/framework/cordova-$VERSION.jar $PROJECT_PATH/libs/cordova-$VERSION.jar
+
+# interpolate the activity name and package
+echo "Updating Activity and AndroidManifest ..."
+cp $BUILD_PATH/bin/templates/project/Activity.java $ACTIVITY_PATH
+sed -i '' -e "s/__ACTIVITY__/${ACTIVITY}/g" $ACTIVITY_PATH
+sed -i '' -e "s/__ID__/${PACKAGE}/g" $ACTIVITY_PATH
+
+cp $BUILD_PATH/bin/templates/project/AndroidManifest.xml $MANIFEST_PATH
+sed -i '' -e "s/__ACTIVITY__/${ACTIVITY}/g" $MANIFEST_PATH
+sed -i '' -e "s/__PACKAGE__/${PACKAGE}/g" $MANIFEST_PATH
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/55b1e408/bin/create2
----------------------------------------------------------------------
diff --git a/bin/create2 b/bin/create2
deleted file mode 100755
index 2b3fe05..0000000
--- a/bin/create2
+++ /dev/null
@@ -1,115 +0,0 @@
-#! /bin/sh
-# 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 [ -n "$1" ] && [ "$1" == "-h" ]
-then
- echo 'usage: create path package activity'
- echo "Make sure the Android SDK tools folder is in your PATH!"
- 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
-
-# cleanup after exit and/or on error
-function on_exit {
- echo "Cleaning up ..."
- [ -f $BUILD_PATH/framework/libs/commons-codec-1.6.jar ] && rm $BUILD_PATH/framework/libs/commons-codec-1.6.jar
- [ -d $BUILD_PATH/framework/libs ] && rmdir $BUILD_PATH/framework/libs
- [ -f $BUILD_PATH/framework/assets/www/cordova-$VERSION.js ] && rm $BUILD_PATH/framework/assets/www/cordova-$VERSION.js
- [ -f $BUILD_PATH/framework/cordova-$VERSION.jar ] && rm $BUILD_PATH/framework/cordova-$VERSION.jar
-}
-
-function on_error {
- echo "An error occured. Deleting project..."
- [ -d $PROJECT_PATH ] && rm -rf $PROJECT_PATH
-}
-
-# we do not want the script to silently fail
-trap on_error ERR
-trap on_exit EXIT
-
-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 ' ' )
-
-# 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.6.jar ]; then
- # Use curl to get the jar (TODO: Support Apache Mirrors)
- echo "Downloading common-codecs-1.6 ..."
- curl -OL http://mirror.symnds.com/software/Apache//commons/codec/binaries/commons-codec-1.6-bin.zip &> /dev/null
- unzip commons-codec-1.6-bin.zip &> /dev/null
- mkdir -p $BUILD_PATH/framework/libs
- cp commons-codec-1.6/commons-codec-1.6.jar $BUILD_PATH/framework/libs
- # cleanup yo
- rm commons-codec-1.6-bin.zip && rm -rf commons-codec-1.6
-fi
-
-# compile cordova.js and cordova.jar
-echo "Building cordova-$VERSION.jar and cordova-$VERSION.js ..."
-(cd $BUILD_PATH/framework && ant jar &> /dev/null )
-
-# create new android project
-echo "Creating a new cordova android project ..."
-$ANDROID_BIN create project --target $TARGET --path $PROJECT_PATH --package $PACKAGE --activity $ACTIVITY &> /dev/null
-
-# copy project template
-echo "Copying assets and resources ..."
-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
-echo "Setting up config and plugins list ..."
-cp -r $BUILD_PATH/framework/res/xml $PROJECT_PATH/res
-
-echo "Adding cordova-$VERSION.js and cordova-$VERSION.jar ..."
-cp $BUILD_PATH/framework/assets/www/cordova-$VERSION.js $PROJECT_PATH/assets/www/cordova-$VERSION.js
-cp $BUILD_PATH/framework/cordova-$VERSION.jar $PROJECT_PATH/libs/cordova-$VERSION.jar
-
-# interpolate the activity name and package
-echo "Updating Activity and AndroidManifest ..."
-cp $BUILD_PATH/bin/templates/project/Activity.java $ACTIVITY_PATH
-sed -i '' -e "s/__ACTIVITY__/${ACTIVITY}/g" $ACTIVITY_PATH
-sed -i '' -e "s/__ID__/${PACKAGE}/g" $ACTIVITY_PATH
-
-cp $BUILD_PATH/bin/templates/project/AndroidManifest.xml $MANIFEST_PATH
-sed -i '' -e "s/__ACTIVITY__/${ACTIVITY}/g" $MANIFEST_PATH
-sed -i '' -e "s/__PACKAGE__/${PACKAGE}/g" $MANIFEST_PATH