Skip to content
This repository was archived by the owner on Oct 14, 2021. It is now read-only.

Commit 2bd2ff5

Browse files
author
Jeff Verkoeyen
committed
Split apple into objc/swift harnesses.
Swift libraries require a different invocation of sourcekitten than objc.
1 parent 10778ad commit 2bd2ff5

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

src/apidiff

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ usage() {
1919
echo
2020
echo "Engine-specific invocations:"
2121
echo
22-
echo " apidiff <old git ref> <new git ref> apple <umbrella header>"
22+
echo " apidiff <old git ref> <new git ref> objc <umbrella header>"
23+
echo " apidiff <old git ref> <new git ref> swift <workspace path> <scheme name>"
2324
echo " apidiff <old git ref> <new git ref> android <library>"
2425
}
2526

@@ -79,7 +80,7 @@ echo_header() {
7980
echo
8081
}
8182

82-
apidiff_apple() {
83+
apidiff_objc() {
8384
umbrella_header="$1"
8485

8586
if [[ -z "$umbrella_header" ]]; then
@@ -103,6 +104,42 @@ apidiff_apple() {
103104
build/Build/Products/Release/diffreport.app/Contents/MacOS/diffreport "$TMP_PATH/old_apis" "$TMP_PATH/new_apis"
104105
}
105106

107+
apidiff_swift() {
108+
workspace_path="$1"
109+
scheme_name="$2"
110+
111+
if [[ -z "$workspace_path" || -z "$scheme_name" ]]; then
112+
usage
113+
exit 1
114+
fi
115+
116+
escaped_old_path=$(echo "$OLD_PATH" | sed "s:/:\\\\\\\\/:g")
117+
escaped_new_path=$(echo "$NEW_PATH" | sed "s:/:\\\\\\\\/:g")
118+
119+
cd "$ROOT"
120+
121+
xcodebuild build -workspace apple/diffreport.xcworkspace/ -scheme diffreport -configuration Release -derivedDataPath build >> /dev/null
122+
123+
make_clones
124+
125+
if [ -f "$OLD_PATH/Podfile" ]; then
126+
pushd "$OLD_PATH" >> /dev/null
127+
pod install >> /dev/null 2> /dev/null
128+
popd >> /dev/null
129+
fi
130+
sourcekitten doc -- -workspace "$OLD_PATH/$workspace_path" -scheme "$scheme_name" 2> /dev/null | sed "s:$escaped_old_path\\\\/::g" > "$TMP_PATH/old_apis"
131+
132+
if [ -f "$NEW_PATH/Podfile" ]; then
133+
pushd "$NEW_PATH" >> /dev/null
134+
pod install >> /dev/null 2> /dev/null
135+
popd >> /dev/null
136+
fi
137+
sourcekitten doc -- -workspace "$NEW_PATH/$workspace_path" -scheme "$scheme_name" 2> /dev/null | sed "s:$escaped_new_path\\\\/::g" > "$TMP_PATH/new_apis"
138+
139+
echo_header "$@"
140+
build/Build/Products/Release/diffreport.app/Contents/MacOS/diffreport "$TMP_PATH/old_apis" "$TMP_PATH/new_apis"
141+
}
142+
106143
apidiff_java() {
107144
library="$1"
108145

@@ -134,7 +171,8 @@ apidiff_java() {
134171
}
135172

136173
case "$ENGINE" in
137-
apple) apidiff_apple "${@:4}" ;;
174+
objc) apidiff_objc "${@:4}" ;;
175+
swift) apidiff_swift "${@:4}" ;;
138176
android|java) apidiff_java "${@:4}" ;;
139177
*) usage ;;
140178
esac

0 commit comments

Comments
 (0)