mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-27 04:42:51 +08:00

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.
42 lines
1.3 KiB
Bash
Executable File
42 lines
1.3 KiB
Bash
Executable File
#! /bin/sh
|
|
#
|
|
# create a cordova/android project
|
|
#
|
|
# USAGE
|
|
# ./create [path package activity]
|
|
#
|
|
|
|
# load up the config
|
|
. ./.cordova/config
|
|
|
|
PACKAGE_AS_PATH=$(echo $PACKAGE | sed 's/\./\//g')
|
|
ACTIVITY_PATH=./src/$PACKAGE_AS_PATH/$ACTIVITY.java
|
|
MANIFEST_PATH=./AndroidManifest.xml
|
|
|
|
# create the project
|
|
android create project --target $TARGET --path . --package $PACKAGE --activity $ACTIVITY
|
|
|
|
# copy all the cordova scripts etc in there
|
|
cp -R ./cordova/templates/project/* .
|
|
|
|
# copy in cordova.js
|
|
cp ./.cordova/android/cordova-$VERSION.js ./assets/www
|
|
|
|
# copy in cordova.jar
|
|
cp ./.cordova/android/cordova-$VERSION.jar ./libs
|
|
|
|
# copy in res/xml
|
|
mkdir ./res/xml
|
|
cp ./.cordova/android/cordova.xml ./res/xml
|
|
cp ./.cordova/android/plugins.xml ./res/xml
|
|
|
|
# copy in default activity
|
|
cat ./cordova/templates/Activity.java > $ACTIVITY_PATH
|
|
|
|
# interpolate the acivity name and package
|
|
find "$ACTIVITY_PATH" | xargs grep '__ACTIVITY__' -sl | xargs -L1 sed -i -e "s/__ACTIVITY__/${ACTIVITY}/g"
|
|
find "$ACTIVITY_PATH" | xargs grep '__ID__' -sl | xargs -L1 sed -i -e "s/__ID__/${PACKAGE}/g"
|
|
|
|
find "$MANIFEST_PATH" | xargs grep '__ACTIVITY__' -sl | xargs -L1 sed -i -e "s/__ACTIVITY__/${ACTIVITY}/g"
|
|
find "$MANIFEST_PATH" | xargs grep '__PACKAGE__' -sl | xargs -L1 sed -i -e "s/__PACKAGE__/${PACKAGE}/g"
|