-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGetLatestIntoPlugin.sh
More file actions
executable file
·116 lines (95 loc) · 3 KB
/
GetLatestIntoPlugin.sh
File metadata and controls
executable file
·116 lines (95 loc) · 3 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/sh
# UpdateInfoPlist.sh
# SignatureProfiler
#
# Created by Scott Little on 9/11/12.
#
# Ignore if we are cleaning
if [[ -n $ACTION && "$ACTION" = "clean" ]]; then
echo "Ignoring during clean"
exit 0
fi
SRCROOT='.'
# if script is called with absolute path, take repo path from it
BASEDIR=$(dirname $0)
# Set the locations
export MY_UUID_REPO_NAME="MailMessageUUIDs"
if [[ -d "$BASEDIR" ]]; then
export MY_UUID_REPO="$BASEDIR"
else
export MY_UUID_REPO="$SRCROOT/../$MY_UUID_REPO_NAME"
fi
# Go into the MailMessagesUUIDs folder and ensure that it is up-to-date
if [ ! -d "$MY_UUID_REPO" ]; then
echo "UUID Script ERROR - The $MY_UUID_REPO_NAME submodule doesn't exist!!"
exit 1
fi
cd "$MY_UUID_REPO"
NEEDS_BUILD=1
IS_RELEASE=0
if [[ "$CONFIGURATION" == Release* ]]; then
IS_RELEASE=1
fi
#"SupportableUUIDList.txt"
FILE_NAME=SupportableUUIDList.plist
if [[ -f "$FILE_NAME" && ($IS_RELEASE == 0) ]]; then
# check if there are commits missing from the remote git repository
NUM_BEHIND=`git rev-list HEAD...origin/master --count`
if [ $NUM_BEHIND == 0 ]; then
# If the latest supported file is newer than any local commits, go ahead and indicate that a build isn't needed
DATE_FORMAT="%a %b %d %T %Y"
LAST_PLIST_COMMIT_DATE=`git log -1 --format=%cd PlistFolder/*`
SUPPORTABLE_FILE_DATE=`/usr/bin/python3 -c "import os,time; print(time.ctime(os.path.getmtime('$FILE_NAME')))"`
COMMIT_DATE=`date -j -f "%a %b %d %T %Y" "$LAST_PLIST_COMMIT_DATE" +%s`
FILE_DATE=`date -j -f "%a %b %d %T %Y" "$SUPPORTABLE_FILE_DATE" +%s`
if [[ $FILE_DATE > $COMMIT_DATE ]]; then
NEEDS_BUILD=0
fi
fi
fi
if [[ ! -d Archived ]]; then
mkdir Archived
fi
PREV_HASH=`git rev-parse HEAD`;
# If we actually do need to rebuild the files
if [[ $NEEDS_BUILD == 1 ]]; then
echo "Ensuring that the files are up-to-date."
git checkout -q master
BRANCH=`git rev-parse --abbrev-ref HEAD`
if [ "$BRANCH" != "master" ]; then
echo "UUID Script ERROR - $MY_UUID_REPO_NAME needs to be on the master branch - I can't seem to change to it"
exit 2
fi
if [ -n "$(git status --porcelain)" ]; then
echo "UUID Script ERROR - $MY_UUID_REPO_NAME needs have a clean status"
exit 3
fi
git pull origin master
fi # End of if we should rebuild
UPDATED_HASH=`git rev-parse HEAD`;
if [[ $PREV_HASH != $UPDATED_HASH ]]; then
# delete the contents of the Archive folder
rm Archived/*
fi
# Run the script there that generates the UUID list file
echo "Generating UUID list file"
./ProcessMailMessageInfo.pl plist "$@"
# Set the default info plist path
export PLIST_PATH="$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH"
if [[ -n "$UPDATE_INFO_PLIST_PATH" ]]; then
export PLIST_PATH="$UPDATE_INFO_PLIST_PATH"
fi
UUID_KEY=''
for i in {1..10}
do
if [[ "$1" == uu=* ]]; then
UUID_KEY=`echo $1 | cut -b 4-`
break
fi
shift
done
echo "The UUID KEY is: $UUID_KEY"
# Run the other script that will update my Info.plist file
echo "Updating Info.plist file"
echo "PList Path: $PLIST_PATH"
perl -w UpdateInfoPlist.pl "$MY_UUID_REPO/$FILE_NAME" "$PLIST_PATH" "$UUID_KEY"