-
Notifications
You must be signed in to change notification settings - Fork 3.5k
/
build_documentation.sh
executable file
·87 lines (75 loc) · 3.38 KB
/
build_documentation.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh
#
# Copyright 2010-present Facebook.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This script builds the API documentation from source-level comments.
# This script requires appledoc be installed: https://github.com/tomaz/appledoc
. ${FB_SDK_SCRIPT:-$(dirname $0)}/common.sh
test -x "$APPLEDOC" || die 'Could not find appledoc in $PATH - run git clone git://github.com/tomaz/appledoc.git && appledoc/install-appledoc.sh'
# -----------------------------------------------------------------------------
# Build pre-requisites
#
if is_outermost_build; then
. $FB_SDK_SCRIPT/build_framework.sh -n
fi
progress_message Building Documentation.
# -----------------------------------------------------------------------------
# Build docs
#
test -d $FB_SDK_BUILD \
|| mkdir -p $FB_SDK_BUILD \
|| die "Could not create directory $FB_SDK_BUILD"
cd $FB_SDK_SRC
DOCSET="$FB_SDK_BUILD"/"$FB_SDK_DOCSET_NAME"
rm -rf $DOCSET
hash $APPLEDOC &>/dev/null
if [ "$?" -eq "0" ]; then
APPLEDOC_DOCSET_NAME="Facebook SDK 3.5.1 for iOS"
$APPLEDOC --project-name "$APPLEDOC_DOCSET_NAME" \
--project-company "Facebook" \
--company-id "com.facebook" \
--output "$DOCSET" \
--preprocess-headerdoc \
--docset-bundle-name "$APPLEDOC_DOCSET_NAME" \
--docset-feed-name "$APPLEDOC_DOCSET_NAME" \
--exit-threshold 2 \
--no-install-docset \
--search-undocumented-doc \
--keep-undocumented-members \
--keep-undocumented-objects \
--explicit-crossref \
$FB_SDK_FRAMEWORK/Headers \
|| die 'appledoc execution failed'
else
die "appledoc not installed, unable to build documentation"
fi
# Temporary workaround to an appledoc bug that drops protocol names.
function replace_string() {
perl -pi -e "s/$1/$2/" $3
}
DOCSDIR="$DOCSET"/docset/Contents/Resources/Documents
replace_string 'id<> delegate' 'id<FBFriendPickerDelegate> delegate' "$DOCSDIR"/Classes/FBFriendPickerViewController.html
replace_string 'id<> delegate' 'id<FBPlacePickerDelegate> delegate' "$DOCSDIR"/Classes/FBPlacePickerViewController.html
replace_string 'id<> selection' 'id<FBGraphPlace> selection' "$DOCSDIR"/Classes/FBPlacePickerViewController.html
replace_string 'id<> graphObject' 'id<FBGraphObject> graphObject' "$DOCSDIR"/Classes/FBRequest.html
replace_string 'id<> application' 'id<FBGraphObject> application' "$DOCSDIR"/Protocols/FBOpenGraphAction.html
replace_string 'id<> from' 'id<FBGraphUser> from' "$DOCSDIR"/Protocols/FBOpenGraphAction.html
replace_string 'id<> place' 'id<FBGraphPlace> place' "$DOCSDIR"/Protocols/FBOpenGraphAction.html
replace_string 'id<> location' 'id<FBGraphLocation> location' "$DOCSDIR"/Protocols/FBGraphUser.html
replace_string 'id<> location' 'id<FBGraphLocation> location' "$DOCSDIR"/Protocols/FBGraphPlace.html
# -----------------------------------------------------------------------------
# Done
#
common_success