Android源码开发中单个模块的编译自动化

#!/bin/sh
. build/envsetup.sh
lunch 1

case $1 in
        "pc")
        mmm packages/apps/Contacts/
        find out -name Contacts.apk |xargs -t -i adb push {} system/app/
         ;;
        "pp")
        mmm packages/providers/ContactsProvider
        find out -name ContactsProvider.apk |xargs -t -i adb push {} system/app/
        ;;
        "ph")
        mmm packages/apps/Phone/
        find out -name Phone.apk |xargs -t -i adb push {} system/app/
        ;;
        "pf")
        mmm frameworks/base
        find out -name framework.jar |xargs -t -i adb push {} system/framework/
        ;;
        "pm")
        mmm packages/apps/Mms/
        find out -name Mms.apk |xargs -t -i adb push {} system/app/
        ;;
        "pcrm")
        find out -name Contacts.apk |xargs -t -i rm {}
        mmm packages/apps/Contacts/
        find out -name Contacts.apk |xargs -t -i adb push {} system/app/
         ;;
        "pprm")
        find out -name ContactsProvider.apk |xargs -t -i rm {}
        mmm packages/providers/ContactsProvider
        find out -name ContactsProvider.apk |xargs -t -i adb push {} system/app/
        ;;
        "phrm")
        find out -name Phone.apk |xargs -t -i rm {}
        mmm packages/apps/Phone/
        find out -name Phone.apk |xargs -t -i adb push {} system/app/
        ;;
        "pfrm")
        find out -name framework.jar |xargs -t -i rm {}
        mmm frameworks/base
        find out -name framework.jar |xargs -t -i adb push {} system/framework/
        ;;
        "pmrm")
        find out -name Mms.apk |xargs -t -i rm {}
        mmm packages/apps/Mms/
        find out -name Mms.apk |xargs -t -i adb push {} system/app/
        ;;
        "push")
        adb push contacts2.db data/data/com.android.providers.contacts/databases/contacts2.db
        ;;
        "pull")
        adb pull data/data/com.android.providers.contacts/databases/contacts2.db contacts2.db
        ;;
esac

       以上脚本文件保存为:op,赋予执行权限,使用实例:"./op pc"或者“,/op pcrm"即可完成Contacts模块的编译以及push到设备中。
find out -name Contacts.apk |xargs -t -i rm {}
是为了防止之前使用多个lunch模式生成过多个Contacts.apk
xargs -t -i rm {}

-i 选项告诉 xargs 用每项的名称替换 {}。

-t 选项指示 xargs 先打印命令,然后再执行。

"./op push"和"./op pull"分别完成contacts2.db数据库的push和pull。

       ps:Firefox有一个SQLite Manager插件可以用来查看或者修改sqlite数据库很方便。


你可能感兴趣的:(数据库,android,manager,sqlite,脚本,firefox)