1、下载freeline.zip包到工程文件夹下,比如android_2下面。下载链接:https://cdrive.cloud.ctripcorp.com/s/XfX7TnXmt7jcTL4
2、cmd到工程文件夹下,执行初始化命令:gradle initFreeline -PfreelineVersion=0.8.3.1.1 -PfreelineLocal=freeline-v0.8.3.1.1.zip
3、编译执行的命令:
python freeline.py -f//全量编译
python freeline.py//增量编译
python freeline.py > log.txt//增量编译并存储编译日志到log.txt文件中
python freeline.py -d//增量编译输出日志并保存日志到log.txt中。
在工程中的配置如下:
在biuld.gradle 中的配置如下:
classpath 'com.antfortune.freeline:gradle:0.8.3.1.3'
在CtripMain/build.gradle 中的文件中添加
添加配置如下:
useMd5Paths=['build.gradle','settings.gradle','CtripMain\\build.gradle','CtripMain\\Androi
dManifest.xml']
在配置中遇到的问题
1
Traceback (most recent call last):
File "/Users/admin/bkhu/workspcae/android_2/freeline/freeline_core/android_tools.py", line 343, in execute
self._command.execute()
File "/Users/admin/bkhu/workspcae/android_2/freeline/freeline_core/gradle_inc_build.py", line 186, in execute
map(lambda command: command.execute(), self.command_list)
File "/Users/admin/bkhu/workspcae/android_2/freeline/freeline_core/gradle_inc_build.py", line 186, in <lambda>
map(lambda command: command.execute(), self.command_list)
File "/Users/admin/bkhu/workspcae/android_2/freeline/freeline_core/gradle_inc_build.py", line 240, in execute
self._invoker.run_dex_task()
File "/Users/admin/bkhu/workspcae/android_2/freeline/freeline_core/android_tools.py", line 627, in run_dex_task
output, err, code = cexec(dex_args, add_path=add_path)
File "/Users/admin/bkhu/workspcae/android_2/freeline/freeline_core/utils.py", line 28, in cexec
p = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env, cwd=cwd)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
解决办法:
在工程的主目录下,cd 到freeLine 文件夹release-tools下修改权限, 执行
chmod -R 777 release-tools/ 修改该文件的权限,
然后执行命令:
python freeline.py
[INFO] preparing for tasks...
[-][connect_device_task] finished. in 0.3s
[-][gradle_aapt_task] finished. in 0.0s
[-][CTBusiness] finished. in 0.0s
[-][CTPersonInfo] finished. in 0.0s
[-][CTReactNative] finished. in 0.0s
[-][CTLogin] finished. in 0.1s
[-][CTDebug] finished. in 0.1s
[-][CTPublicProduct] finished. in 0.1s
[-][CTPay] finished. in 0.1s
[-][CTMyCtrip] finished. in 0.0s
[-][CTChat] finished. in 0.0s
[-][CTHotel] finished. in 0.0s
[-][CTHotelPassenger] finished. in 0.0s
[-][CTHotelOrder] finished. in 2.0s
[-][CTHotelDetail] finished. in 0.0s
[-][CTHotelComment] finished. in 0.0s
[-][CTHotelTool] finished. in 0.0s
[-][CtripMain] finished. in 0.0s
[-][merge_dex_task] finished. in 0.0s
[-][gradle_sync_task] finished. in 0.1s
[-][clean_cache_task] finished. in 0.0s
[-][update_stat_task] finished. in 0.1s
[DEBUG] --------------------------------------------------------
[DEBUG] Prepare tasks time: 0.3s
[DEBUG] Task engine running time: 2.3s
[DEBUG] Total time: 2.6s
[DEBUG] -------------------
极大的提高了编译的速度。
2 在手动压缩包的时候,会压缩成 freeline-v0.8.3.1.1.zip,执行
gradle initFreeline -PfreelineVersion=0.8.3.1.1 -PfreelineLocal=freeline-v0.8.3.1.1.zip
解压的时候,会出现 freeline-v0.8.3.1.1 这个名称的文件夹 手动的修改成 freeline 这个文件夹,不然在编译的时候,会报找不到相应的文件夹的错误。
在开发中修改了androidMainfest.xml 或者 build.xml 需要触发增量