#!/usr/bin/env bash
# *****************************************************************************
# @author CsHeng
# @2017.9.3 init
# @2017.9.15 支持tinker打基准包和多渠道打包
#
# 处理打包事务
#
#
# *****************************************************************************

CWD=$(cd "$(dirname "$0")"; pwd)

# release tinker base package
${CWD}/tinker_release_base.sh

source ${CWD}/tinker_env.sh

if [ ! -f "${APP_RELEASE_FILE}" ]; then
    echo "release apk file not found, please make sure that ${APP_RELEASE_FILE} exists"
    exit 0
fi

# copy release file
mkdir -p ${APP_CHANNEL_BASE}
cp ${APP_RELEASE_FILE} ${CHANNEL_FILES}/

# generate channel files
java -jar ${CWD}/ApkChannelPackage.jar put -mtc ${PROJECT_BASE}/channel.txt ${APP_RELEASE_FILE} ${APP_CHANNEL_BASE}
