Created
October 11, 2010 12:48
-
-
Save clairvy/620462 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
android_sdk_root=$ANDROID_SDK_ROOT | |
if [ x$android_sdk_root = x"" ]; then | |
echo '$ANDROID_SDK_ROOT is not set' | |
exit | |
fi | |
android_src=$1 | |
if [ x$android_src = x"" ]; then | |
android_src=$PWD | |
else | |
cd $android_src | |
fi | |
function src_dirs() { | |
find * -type d \( -name 'java' -o -name 'javax' -o -name 'src' \) | egrep -v tools | |
} | |
function show() { | |
echo "= $1" | |
ls -AF -1 $1 | |
} | |
function sync() { | |
dst_dir=$1 | |
shift | |
src_dirs=$* | |
# echo 'dst_dir : ' $dst_dir | |
# echo 'src_dirs : ' $src_dirs | |
for d in $src_dirs; do | |
( cd $d && \ | |
for dd in *; do \ | |
if [ -d $dd ]; then \ | |
find $dd -name '*.java' | cpio -pdmuv $dst_dir/.; \ | |
fi; \ | |
done ) | |
done | |
} | |
function main() { | |
src_dirs=`src_dirs` | |
for android_dst in $android_sdk_root/platforms/android*; do | |
# for android_dst in $android_sdk_root/platforms/android-1.6; do | |
if [ ! -d $android_dst/sources ]; then | |
mkdir $android_dst/sources | |
fi | |
sync $android_dst/sources $src_dirs | |
done | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment