-
Notifications
You must be signed in to change notification settings - Fork 16
/
carthage-verify
executable file
·73 lines (59 loc) · 2.02 KB
/
carthage-verify
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
#!/bin/bash
#
# This script verifies that the commitish values in the Cartfile.resolved are in
# sync with the commitish values in the Carthage/Build/*.version files.
#
# Usage:
# cd ProjectFolder && /path/to/carthage-verify [-m no_skip_missing] [-s no_strict]
no_skip_missing=0
no_strict=0
while [ "$1" != "" ]; do
case $1 in
-m | --no_skip_missing )
no_skip_missing=1
;;
-s | --no_strict )
no_strict=1
;;
esac
shift
done
sed -E 's/(github|git|binary) \"([^\"]+)\" \"([^\"]+)\"/\2 \3/g' Cartfile.resolved | while read line
do
read -a array <<< "$line"
# Handles:
# - ReactiveCocoa/ReactiveSwift > ReactiveSwift
# - Auth0/JWTDecode.swift > JWTDecode.swift
# - https://github.com/Carthage/Carthage.git > Carthage
# - https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json > Mapbox-iOS-SDK
dependency=`basename ${array[0]} | awk -F '.(git|json)' '{print $1}'`
resolved_commitish=${array[1]}
echo -e "Cartfile.resolved[$dependency] at $resolved_commitish"
version_file="Carthage/Build/.$dependency.version"
if [ ! -f "$version_file" ]
then
echo -e -n "No version file found for $dependency at $version_file, " >&2
if [ $no_skip_missing -eq 1 ]
then
echo "aborting." >&2
exit 2
else
echo "skipping." >&2
echo
continue
fi
fi
version_file_commitish=`grep -o '"commitish".*"' "$version_file" | awk -F'"' '{ print $4 }'`
echo -e "$version_file at $version_file_commitish"
if [ "$resolved_commitish" != "$version_file_commitish" ]
then
if [ $no_strict -eq 1 ]
then
echo -e "warning: $dependency commitish ($version_file_commitish) does not match resolved commitish ($resolved_commitish)" >&2
else
echo -e "error: $dependency commitish ($version_file_commitish) does not match resolved commitish ($resolved_commitish)" >&2
exit 1
fi
fi
echo
done