-
Notifications
You must be signed in to change notification settings - Fork 0
/
pollBuild.sh
67 lines (66 loc) · 2.42 KB
/
pollBuild.sh
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
function confound() {
cd $1
filelist=`ls`
for file in $filelist
do
if test -f $file
then
FILE=$file;
if [ "$FILE" == "Podfile" ] || [ "$FILE" == "podfile" ]
then
workspace=`find *.xcworkspace -depth 0`
searchspace=${workspace%.*}
exist=`echo $ALL_Open_XCWorkSpace|egrep -m 1 -o "DerivedData/$searchspace"`
if [[ -z "$exist" ]]; then
osascript -e 'display notification "begin pod update" with title "Warning:⚠️ pod update"'
#防止在编写代码时进行pod update
pod update > /dev/null
fi
#找出Scheme,临时方案,后面可以通过XcodeProj自动新建一个Scheme
schemelist=`xcodebuild -list`
schemeline=`echo $schemelist|xargs -n 1|egrep -n -i 'schemes'|awk -F ':' '{print $1}'`
echo $schemelist|xargs -n 1 > schemes.txt
schemeline=`expr $schemeline + 1`
schemeName=`sed -n "$schemeline p" schemes.txt`
rm -rf schemes.txt
xcodebuild clean
xcodebuild build -workspace $workspace -scheme $schemeName -destination 'platform=iOS Simulator,name=iPhone 7'
fi
fi
if test -d $file
then
FILE=$file;
if [ "${FILE#*.}" != "framework" ] && [ "${FILE#*.}" != "xcworkspace" ] && [ "${FILE#*.}" != "xcodeproj" ] && [ "$FILE" != "Pods" ]
then
# echo $file
confound $file
fi
fi
done
cd ..
}
function eachPull() {
cd $1
filelist=`ls`
for file in $filelist
do
if test -d $file
then
FILE=$file;
cd $file
if [ "${FILE#*.}" != "framework" ] && [ "${FILE#*.}" != "xcworkspace" ] && [ "${FILE#*.}" != "xcodeproj" ] && [ "$FILE" != "Pods" ]
then
currentBranch=`git branch|egrep -n '\*'|awk -F ':' '{print $1}'`
git pull origin $currentBranch > /dev/null
fi
cd ..
fi
done
cd ..
}
osascript -e 'display notification "Compiler Begin" with title "AwesomeXcodeComplierScript"'
ALL_Open_XCWorkSpace=`lsof -c com.apple`
eachPull $1
confound $1
osascript -e 'display notification "Compiler Done" with title "AwesomeXcodeComplierScript"'