VirtualAPK 插件打包脚本

最近项目使用了didi开源的插件包框架,多个模块打包很繁琐,索性自己写了一个小脚本,如果自己使用,需要根据实际情况修改下里面涉及到路径,代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import multiprocessing

#获取当前目录
root = os.getcwd()
disrs = os.listdir(root)

#list = [path for path in disrs if path.__contains__('ICQueryPlugin')]
list = ['ICQueryPlugin','NoSettleICPlugin']

def copyfile(s,t):
print('')
if not os.path.exists(t):
os.makedirs(t)

for file in os.listdir(s):
sfile = os.path.join(s,file)
tfile = os.path.join(t,file)
open(tfile,'wb').write(open(sfile,'rb').read())

print('working end!!!!!!!!')

def startwork(path):
os.chdir(path)
os.system('./gradlew clean assemblePlugin')

for path in list:
sub = os.path.join(root,path)
print(sub)
print("开始打包:"+path)
multiprocessing.Process(target=startwork(sub)).start()
apkpath = os.path.join(sub,'app/build/outputs/plugin/release')
copyfile(apkpath,'/Users/ghwang/Desktop/apk')

具体使用

  • cd 到插件包路径
  • python 脚本文件.py

Have a fun!