Files
assistant-android/scripts/tinker_env.sh

50 lines
2.1 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# *****************************************************************************
# @author CsHeng
# @2017.9.14 init
#
# 简单禁用tinker标志位
#
#
# *****************************************************************************
# get current shell absolute dir
CWD=$(cd "$(dirname "$0")"; pwd)
# 根目录是脚本文件所在的上一级
PROJECT_BASE=${CWD}/../
GRADLE_FILE=${PROJECT_BASE}/gradle.properties
APK_CHANNEL_PATH=${CWD}/apk-channel
OS=`uname`
case ${OS} in
Darwin) VERSION_CODE=`grep -r versionCode ${PROJECT_BASE}/dependencies.gradle | awk '{print $4}'`;;
Linux) VERSION_CODE=`grep -r versionCode ${PROJECT_BASE}/dependencies.gradle | awk '{print $3}'`;;
esac
# 从根目录dependencies文件获取并使用版本来标识一个release
VERSION_NAME=`grep -r versionName ${PROJECT_BASE}/dependencies.gradle | awk -F '\"' '{print $2}'`
APP_RELEASE_ALL=${PROJECT_BASE}/release-app/
APP_RELEASE_BASE=${APP_RELEASE_ALL}/${VERSION_NAME}_${VERSION_CODE}
APP_CHANNEL_BASE=${APP_RELEASE_BASE}/channel/
APP_TINKER_BASE=${APP_RELEASE_BASE}/tinker/
TINKER_BAK_APK_BASE=${PROJECT_BASE}/app/build/bakApk/
PATCH_OUTPUT=${PROJECT_BASE}/app/build/outputs/patch/
CMD_GRADLE_SYNC="${PROJECT_BASE}/gradlew --recompile-scripts"
# 根据自己的需求是要以哪个flavor为基准打包我只需要flavor为publish的release
# CMD_GRADLE_RELEASE=${PROJECT_BASE}/gradlew assembleRelease
CMD_GRADLE_RELEASE="${PROJECT_BASE}/gradlew -b ${PROJECT_BASE}/build.gradle assemblePublishRelease --parallel"
# 找到自己的build命令
CMD_GRADLE_PATCH="${PROJECT_BASE}/gradlew -b ${PROJECT_BASE}/build.gradle buildTinkerPatchPublishRelease --parallel"
# 打channel release包的apk应该以tinker打基准包的那个apk为准找出文件名包含flavor publish 的apk
# APP_RELEASE_FILE=${PROJECT_BASE}/release-app/${versionName}_${versionCode}/patch/app-xxxxxx-gitsha/app-publish-release.apk
# [ -f ${APP_RELEASE_BASE} ] && APP_RELEASE_FILE=`find ${APP_RELEASE_BASE} -type f -name '*publish*.apk'`
APP_RELEASE_FILE=`find ${APP_RELEASE_BASE} -type f -name '*publish*.apk'`