mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 23:25:11 +08:00
08d7a9c87a
We should only have these files in one place in the repo. Changes have been made to the scripts to pick up the xml files from their proper location.
51 lines
1.3 KiB
Bash
Executable File
51 lines
1.3 KiB
Bash
Executable File
#! /bin/sh
|
|
#
|
|
# create a cordova/android project
|
|
#
|
|
# USAGE
|
|
# ./create [path package activity]
|
|
#
|
|
set -e
|
|
|
|
PROJECT_PATH=${1:-"./example"}
|
|
PACKAGE=${2:-"org.apache.cordova.example"}
|
|
ACTIVITY=${3:-"cordovaExample"}
|
|
TARGET=$(android list targets | grep 'id: ' | sed 's/id: \([0-9]*\).*/\1/g' | tail -1)
|
|
VERSION=$(cat ./VERSION)
|
|
|
|
# clobber any existing example
|
|
if [ $# -eq 0 ]
|
|
then
|
|
rm -rf $PROJECT_PATH
|
|
fi
|
|
|
|
# update the cordova-android framework for the desired target
|
|
android update project --target $TARGET --path ./framework
|
|
|
|
# compile cordova.js and cordova.jar
|
|
cd ./framework && ant jar && cd ../
|
|
|
|
# copy all the bin scripts etc in there
|
|
cp -R ./bin/templates/project/ $PROJECT_PATH
|
|
|
|
# copy in cordova.js
|
|
cp ./framework/assets/www/cordova-$VERSION.js $PROJECT_PATH/.cordova/android/cordova-$VERSION.js
|
|
|
|
# copy in cordova.jar
|
|
cp ./framework/cordova-$VERSION.jar $PROJECT_PATH/.cordova/android/cordova-$VERSION.jar
|
|
|
|
# copy in res/xml
|
|
cp ./framework/res/xml/cordova.xml $PROJECT_PATH/.cordova/android/cordova.xml
|
|
cp ./framework/res/xml/plugins.xml $PROJECT_PATH/.cordova/android/plugins.xml
|
|
|
|
# app properties
|
|
cat > $PROJECT_PATH/.cordova/config <<eom
|
|
VERSION=$VERSION
|
|
PROJECT_PATH=$PROJECT_PATH
|
|
PACKAGE=$PACKAGE
|
|
ACTIVITY=$ACTIVITY
|
|
TARGET=$TARGET
|
|
eom
|
|
|
|
(cd $PROJECT_PATH && ./cordova/create)
|