forked from facebook/facebook-ios-sdk
/
build_samples.sh
executable file
·75 lines (63 loc) · 2.34 KB
/
build_samples.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
#!/bin/sh
#
# Copyright 2012 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 all of the samples in the samples subdirectory.
. ${FB_SDK_SCRIPT:-$(dirname $0)}/common.sh
# valid arguments are: no-value, "Debug" and "Release" (default)
BUILDCONFIGURATION=${1:-Release}
test -x "$XCODEBUILD" || die 'Could not find xcodebuild in $PATH'
# -----------------------------------------------------------------------------
progress_message Building samples.
# -----------------------------------------------------------------------------
# Call out to build .framework
#
if is_outermost_build; then
. $FB_SDK_SCRIPT/build_framework.sh
fi
# -----------------------------------------------------------------------------
# Determine which samples to build.
#
# Certain subdirs of samples are not samples to be built, exclude them from the find query
FB_SAMPLES_EXCLUDED=(FBConnect.bundle)
for excluded in "${FB_SAMPLES_EXCLUDED[@]}"; do
if [ -n "$FB_FIND_ARGS" ]; then
FB_FIND_ARGS="$FB_FIND_ARGS -o"
fi
FB_FIND_ARGS="$FB_FIND_ARGS -name $excluded"
done
FB_FIND_SAMPLES_CMD="find $FB_SDK_SAMPLES -type d -depth 1 ! ( $FB_FIND_ARGS )"
# -----------------------------------------------------------------------------
# Build each sample
#
function xcode_build_sample() {
cd $FB_SDK_SAMPLES/$1
progress_message "Compiling '${1}' for platform '${2}' using configuration '${3}'."
$XCODEBUILD \
-alltargets \
-sdk $2 \
-configuration "${3}" \
SYMROOT=$FB_SDK_BUILD \
CURRENT_PROJECT_VERSION=$FB_SDK_VERSION_FULL \
clean build \
|| die "XCode build failed for sample '${1}' on platform: ${2}."
}
for sampledir in `$FB_FIND_SAMPLES_CMD`; do
xcode_build_sample `basename $sampledir` "iphonesimulator" "$BUILDCONFIGURATION"
done
# -----------------------------------------------------------------------------
# Done
#
common_success