欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

BAT批处理一键生成APK包脚本分享

程序员文章站 2022-06-17 13:36:13
bat批处理一键生成apk包脚本分享 将本bat放到cocos2dx目录下你的工程的project.android下(需修改变量)。 asmaker 用来将resour...

bat批处理一键生成apk包脚本分享

将本bat放到cocos2dx目录下你的工程的project.android下(需修改变量)。
asmaker 用来将resources文件夹下的lua文件批量加密 算法参考我之前的rc4算法实现。

每次打包apk前 svn 最新的工程代码 和 cocos2dx引擎代码。

@echo off
rem 工具路径
set java_home = "c:\program files\java\jdk1.8.0_05"
set ant_home = "d:\programsoftware\apache-ant-1.9.4"
set android_home = "d:\programsoftware\android sdk\sdk"
set ndk_home = "d:\programsoftware\android-ndk-r9d-windows-x86_64\android-ndk-r9d"
set svn_home = "c:\program files\tortoisesvn\bin\"
 
rem 目标路径
set work_dir = "d:\engine\projects\xxxxx\proj.android"
rem set pro_dir = "d:\engine\projects\xxxxx"
set resources_dir= %work_dir%\..\resources
set assets_dir = %work_dir%\assets
 
 
 
rem 先删除旧的assets
if exist d:\engine\projects\xxxxx\proj.android\assets (
  echo "deleting assets" 
  rd /q /s d:\engine\projects\xxxxx\proj.android\assets
)
 
rem 再删除旧有的resources
if exist d:\engine\projects\xxxxx\resources (
  echo "deleting resources"
  rd /q /s d:\engine\projects\xxxxx\resources
)
 
rem 删除旧的apk
if exist d:\engine\projects\xxxxx\proj.android\bin\xxxxx-release.apk (
  echo "deleting old apk"
  del /q /f d:\engine\projects\xxxxx\proj.android\bin\xxxxx-release.apk
)
 
rem call ant clean
 
rem svn
"c:/program files/tortoisesvn/bin/tortoiseproc.exe" /command:update /path:"d:\engine\projects\xxxxx" /closeonend:1
"c:/program files/tortoisesvn/bin/tortoiseproc.exe" /command:update /path:"d:\engine" /closeonend:1
 
pushd d:\engine\projects\xxxxx\proj.android
 
rem luajit resources
for /r d:\engine\projects\xxxxx\resources %%i in (*.lua) do ( 
  echo %%i  
  luajit.exe -b %%i %%i
)
 
rem asmaker assets
asmaker -i d:\engine\projects\xxxxx\resources -o d:\engine\projects\xxxxx\proj.android\assets
 
rem ndk
call "d:\programsoftware\android-ndk-r9d-windows-x86_64\android-ndk-r9d\ndk-build" -c "d:\engine\projects\xxxxx\proj.android" "ndk_module_path=d:\engine;d:\engine\cocos2dx\platform\third_party\android\prebuilt"
 
rem ant release
call "d:\programsoftware\android sdk\sdk\tools\android" update project -p "d:\engine\projects\xxxxx\proj.android"
call ant release 
 
popd
 
pause