@echo off

echo 构建apk(正式)

echo 用法: %0   App主页链接地址   App名称   App图标   "App版权信息"   App厂商信息
echo 任意参数不传则使用App项目里gradle.properties的默认配置

set NUM_ARG=0
for %%x in (%*) do (
    set /a NUM_ARG+=1
)
 
echo 参数数量: %NUM_ARG%

if %NUM_ARG% GEQ 5 (
echo App主页链接地址: %1
echo App名称: %2
echo App图标: ic_launcher_%3; 圆角图标: ic_launcher_%3_round
echo App版权信息: %4
echo App厂商信息: %5
call gradlew assembleRelease -PappHomeUrl=%1 -PappName=%2 -PappIconKey=%3 -PappCopyright=%4 -PappVendor=%5
) else if %NUM_ARG% GEQ 4 (
echo App主页链接地址: %1
echo App名称: %2
echo App图标: ic_launcher_%3   圆角图标: ic_launcher_%3_round
echo App版权信息: %4
call gradlew assembleRelease -PappHomeUrl=%1 -PappName=%2 -PappIconKey=%3 -PappCopyright=%4
) else if %NUM_ARG% GEQ 3 (
echo App主页链接地址: %1
echo App名称: %2
echo App图标: ic_launcher_%3; 圆角图标: ic_launcher_%3_round
call gradlew assembleRelease -PappHomeUrl=%1 -PappName=%2 -PappIconKey=%3
) else if %NUM_ARG% GEQ 2 (
echo App主页链接地址: %1
echo App名称: %2
call gradlew assembleRelease -PappHomeUrl=%1 -PappName=%2
) else if %NUM_ARG% GEQ 1 (
echo App主页链接地址: %1
call gradlew assembleRelease -PappHomeUrl=%1
) else (
echo 使用gradle.properties默认配置
call gradlew assembleRelease
)

echo 打开app-release.apk所在目录......
start "" app\build\outputs\apk\release

pause;
