在Android.mk產生git版本,編譯時間和builder名稱


Android.mk產生git版本,編譯時間和builder名稱

CUR_GIT_VERSION="$(shell cd $(LOCAL_PATH);git log | grep commit -m 1 | cut -d' ' -f 2)"
CUR_GIT_UNCOMMIT_FILE_NUM=$(shell cd $(LOCAL_PATH);git diff | grep +++ -c)
CUR_BUILD_TIME=" $(shell date)"
CUR_BUILD_NAME=" $(shell echo ${LOGNAME})"

LOCAL_CFLAGS+=-DCUR_GIT_VERSION=\"${CUR_GIT_VERSION}${CUR_GIT_UNCOMMIT_FILE_NUM}\"
LOCAL_CFLAGS+=-DCUR_BUILD_TIME=\"${CUR_BUILD_TIME}\"
LOCAL_CFLAGS+=-DCUR_BUILD_NAME=\"${CUR_BUILD_NAME}\"

留言