-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathpush.sh
More file actions
executable file
·44 lines (38 loc) · 1.56 KB
/
Copy pathpush.sh
File metadata and controls
executable file
·44 lines (38 loc) · 1.56 KB
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
36
37
38
39
40
41
42
43
44
#!/bin/sh
# Created by GitHub@SsageParuders
# ==---------------==作用==---------------==
# 将 outputs/libs 目录下的编译产物
# 输出到设备的 /sdcard/outputs 目录下
# ==---------------==作用==---------------==
echo "\n\033[44;37mStart push build ...\033[0m"
# 判断是否存在目标文件夹, 不存在则创建, 存在则清空上一次推送产物, 进行本次推送
FILENAME_RESULT=$(adb shell ls /sdcard/ | tr -d '\015'|grep 'outputs')
echo "\033[44;37mStart looking for outputs ...\033[0m"
if [ -z "$FILENAME_RESULT" ]; then # 没找到 /sdcard/outputs
echo "\033[44;37mNo outputs found\033[0m"
echo "\033[44;37mStart mkdir outputs ...\033[0m"
# 创建 /sdcard/outputs 目录
adb shell mkdir /sdcard/outputs
if [ $? -ne 0 ]; then
echo "\n\033[41;37mError !! Mkdir outputs failed !!\033[0m\n"
else
echo "\033[42;35mMkdir outputs SUCCEED !!\033[0m"
fi
else # 找到了 /sdcard/outputs
echo "\033[42;35mFind outputs SUCCEED !!\033[0m"
echo "\033[44;37mStart clean outputs On Android\033[0m"
# 清空上一次推送产物
adb shell find /data/local/tmp/libs -type f -delete
if [ $? -ne 0 ]; then
echo "\n\033[41;37mError !! Clean outputs On Android failed !!\033[0m\n"
else
echo "\033[42;35mClean outputs On Android SUCCEED !!\033[0m"
fi
fi
# 推送最终生成产物 到设备的 /sdcard/outputs 目录下
adb push outputs/libs /data/local/tmp/
if [ $? -ne 0 ]; then
echo "\033[41;37mError !! Push failed !!\033[0m\n"
else
echo "\033[42;35mFinish push SUCCEED !!\033[0m\n"
fi