--
#!/bin/bash
#sela.gao
#2016.10.
#History:
# .根据每行查找出来的结果push进去手机
#result:
# :没有编译生成文件
# :没有设置编译环境
echoMsg(){
echo "$1"
exit $
}
source build/envsetup.sh > /dev/null
if [ $# -lt ];then
echoMsg "参数不对,只能输入一个参数"
fi
if [ ! -e $ ];then
echoMsg "$1 不存在,无法编译"
fi
lsResult=`ls $ | grep "Android.mk"`
echo "lsResult $lsResult"
if [ -z $lsResult ];then
echoMsg "$1下面没有mk文件,没办法编译"
fi
param=$
processname=`echo ${param##*/}`
if [ -z $processname ];then
processname=`echo ${param%*/}`
processname=`echo ${processname##*/}`
fi
echo "final:$processname"
`mmm $> mm.log`
grepResult=`cat mm.log | grep Install | cut -d " " -f `
echo "grepResult:$grepResult"
if [ -z "$grepResult" ];then
echoMsg "本次编译没有生成文件!!!"
fi
if [ -z "$TARGET_PRODUCT" ];then
echoMsg "还没有设置编译项目"
fi
product=`echo ${TARGET_PRODUCT} | cut -d "_" -f `
if [ -z "$product" ];then
echoMsg "编译环境有问题"
fi
echo "TOP:${ANDROID_BUILD_TOP}"
echo "PRODUCT:${TARGET_PRODUCT}"
adb root
adb remount
for ONELINE in $grepResult
do
filename=`echo $ONELINE | sed 's/out\/target\/product\/[a-z][0-9][0-9][0-9][0-9]\///g'`
echo "filename:$filename"
echo "ONELINE:$ONELINE"
if [ ! -z "$ONELINE" -a ! -z "$filename" ];then
pushResult=`adb push "$ONELINE" "$filename"`
echo $pushResult
fi
done
processname=`echo $processname | tr '[A-Z]' '[a-z]'`
echo "::::::$processname"
containsPackage=`echo $ | grep "packages"`
echo $containsPackage
if [ -z `echo $ | grep "package"` ];then
echoMsg "这个可能编译的是库文件,不kill进程"
fi
killphoneprocess $processname
--