自动编译打包的bash脚本

最近在调试一个项目,频繁的在mming,snod,copy-img,挺不方便的,写一个脚本来的快。之前用的脚本倒挺多,自己写倒挺少挺短,这次来个稍微长点的,用习惯了C++,java,感觉脚本的语法不够直观,甚至还不如Python。

#!/bin/bash

#debug app framework jni hal,snod and copy to img folder

[html]

# function begin

printLog(){

if [ "$1" ];then

echo "Please input app,fw,jni,hal"
fi

}

usage(){

echo " Please input app,fw,jni,hal;"

exit 1

}

mmAPP(){

printLog "build app"

./mk mm packages/apps/apphello/

}

mmFramework(){

printLog "build framework"

./mk mm frameworks/base/core/java/android/hardware/

}

mmJNI(){

printLog "build jni"

./mk mm frameworks/base/services/jni/

}

mmHAL(){

printLog "build hal"

./mk mm hardware/libhardware/modules/smartcenter/

}

mmSNOD(){

printLog "snod"

./mk snod

}

mmRM(){

printLog "rm -rf img/"

rm -rf img/

}

mmCopy(){

printLog "copy-img"

./copy-img.sh

}

# main function

if [ "$1" ];then

case "$1" in

app) mmAPP ;;

fw) mmFramework ;;

jni) mmJNI ;;

hal) mmHAL ;;

help)  usage ;;

*) usage ;;

esac

if [ $? -eq 0 ];then

mmSNOD &&

mmRM &&

mmCopy

fi

else

mmAPP && mmFramework && mmJNI && mmHAL && mmSNOD && mmRM && mmCopy

fi
[/html]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.