This commit is contained in:
giuseppenuc committed 2016-02-24 16:56:39 +01:00
1 parent d281d765ea
commit 5b074a5176
1261 files changed
+199158 -7303

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
#!/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 FacebookSDK.framework, all samples, and the distribution package.
. ${FB_SDK_SCRIPT:-$(dirname $0)}/common.sh
# -----------------------------------------------------------------------------
# Call out to build .framework
#
. $FB_SDK_SCRIPT/build_framework.sh
# -----------------------------------------------------------------------------
# Build docs
#
. $FB_SDK_SCRIPT/build_documentation.sh
# -----------------------------------------------------------------------------
# Call out to build samples (suppress building framework)
#
. $FB_SDK_SCRIPT/build_samples.sh Release
. $FB_SDK_SCRIPT/build_samples.sh Debug
# -----------------------------------------------------------------------------
# Call out to build distribution (suppress building framework)
#
. $FB_SDK_SCRIPT/build_distribution.sh
common_success
+110
View File
@@ -0,0 +1,110 @@
#!/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 FacebookSDK.framework that is distributed at
# https://github.com/facebook/facebook-ios-sdk/downloads/FacebookSDK.framework.zip
. ${FB_SDK_SCRIPT:-$(dirname $0)}/common.sh
test -x "$PACKAGEMAKER" || die 'Could not find PackageMaker in $PATH - install to Applications from https://developer.apple.com/downloads/index.action (Auxiliary Tools for XCode)'
test -x "$PRODUCTSIGN" || die 'Could not find productsign utility! Reinstall XCode?'
FB_SDK_PGK_VERSION=$(sed -n 's/.*FB_IOS_SDK_VERSION_STRING @\"\(.*\)\"/\1/p' ${FB_SDK_SRC}/FacebookSDK.h)
# In case the hotfix value is zero, we drop the .0
FB_SDK_NORMALIZED_PGK_VERSION=$(echo ${FB_SDK_PGK_VERSION} | sed 's/^\([0-9]*\.[0-9]*\)\.0/\1/')
FB_SDK_UNSIGNED_PKG=$FB_SDK_BUILD/FacebookSDK-${FB_SDK_NORMALIZED_PGK_VERSION}-unsigned.pkg
FB_SDK_PKG=$FB_SDK_BUILD/FacebookSDK-${FB_SDK_NORMALIZED_PGK_VERSION}.pkg
FB_SDK_BUILD_PACKAGE=$FB_SDK_BUILD/package
FB_SDK_BUILD_PACKAGE_FRAMEWORK_SUBDIR=Documents/FacebookSDK
FB_SDK_BUILD_PACKAGE_FRAMEWORK=$FB_SDK_BUILD_PACKAGE/$FB_SDK_BUILD_PACKAGE_FRAMEWORK_SUBDIR
FB_SDK_BUILD_PACKAGE_SAMPLES=$FB_SDK_BUILD_PACKAGE/Documents/FacebookSDK/Samples
FB_SDK_BUILD_PACKAGE_DOCS=$FB_SDK_BUILD_PACKAGE/Library/Developer/Shared/Documentation/DocSets/$FB_SDK_DOCSET_NAME
CODE_SIGN_IDENTITY='Developer ID Installer: Facebook, Inc. (V9WTTPBFK9)'
# -----------------------------------------------------------------------------
# Call out to build prerequisites.
#
if is_outermost_build; then
. $FB_SDK_SCRIPT/build_framework.sh -t -c Release
. $FB_SDK_SCRIPT/build_documentation.sh
fi
echo Building Distribution.
# -----------------------------------------------------------------------------
# Build package directory structure
#
progress_message "Building package directory structure."
\rm -rf $FB_SDK_BUILD_PACKAGE
mkdir $FB_SDK_BUILD_PACKAGE \
|| die "Could not create directory $FB_SDK_BUILD_PACKAGE"
mkdir -p $FB_SDK_BUILD_PACKAGE_FRAMEWORK
mkdir -p $FB_SDK_BUILD_PACKAGE_SAMPLES
mkdir -p $FB_SDK_BUILD_PACKAGE_DOCS
\cp -R $FB_SDK_FRAMEWORK $FB_SDK_BUILD_PACKAGE_FRAMEWORK \
|| die "Could not copy $FB_SDK_FRAMEWORK"
\cp -R $FB_SDK_SAMPLES/ $FB_SDK_BUILD_PACKAGE_SAMPLES \
|| die "Could not copy $FB_SDK_BUILD_PACKAGE_SAMPLES"
\cp -R $FB_SDK_FRAMEWORK_DOCS/docset/Contents $FB_SDK_BUILD_PACKAGE_DOCS \
|| die "Could not copy $$FB_SDK_FRAMEWORK_DOCS/docset/Contents"
\cp $FB_SDK_ROOT/README $FB_SDK_BUILD_PACKAGE/Documents/FacebookSDK \
|| die "Could not copy README"
\cp $FB_SDK_ROOT/LICENSE $FB_SDK_BUILD_PACKAGE/Documents/FacebookSDK \
|| die "Could not copy LICENSE"
# -----------------------------------------------------------------------------
# Fixup projects to point to the SDK framework
#
for fname in $(find $FB_SDK_BUILD_PACKAGE_SAMPLES -name "project.pbxproj" -print); do \
sed "s|../../build|../../../../${FB_SDK_BUILD_PACKAGE_FRAMEWORK_SUBDIR}|g" \
${fname} > ${fname}.tmpfile && mv ${fname}.tmpfile ${fname}; \
done
# -----------------------------------------------------------------------------
# Build .pkg from package directory
#
progress_message "Building .pkg from package directory."
\rm -rf $FB_SDK_UNSIGNED_PKG
$PACKAGEMAKER \
--doc $FB_SDK_SRC/Package/FacebookSDK.pmdoc \
--domain user \
--target 10.5 \
--version $FB_SDK_VERSION \
--out $FB_SDK_UNSIGNED_PKG \
--title 'Facebook SDK 3.8 for iOS' \
|| die "PackageMaker reported error"
progress_message "Signing package."
\rm -rf $FB_SDK_PKG
$PRODUCTSIGN -s "$CODE_SIGN_IDENTITY" $FB_SDK_UNSIGNED_PKG $FB_SDK_PKG \
|| FAILED_TO_SIGN=1
if [ "$FAILED_TO_SIGN" == "1" ] ; then
progress_message "Failed to sign the package. See https://our.intern.facebook.com/intern/wiki/index.php/Platform/Mobile/ContributingToMobileSDKs#Building_the_iOS_Distribution_with_PackageMaker"
fi
# -----------------------------------------------------------------------------
# Done
#
progress_message "Successfully built SDK distribution:"
if [ "$FAILED_TO_SIGN" != "1" ] ; then
progress_message " Signed : $FB_SDK_PKG"
fi
progress_message " Unsigned : $FB_SDK_UNSIGNED_PKG"
common_success
+87
View File
@@ -0,0 +1,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.8 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
+185
View File
@@ -0,0 +1,185 @@
#!/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 FacebookSDK.framework that is distributed at
# https://github.com/facebook/facebook-ios-sdk/downloads/FacebookSDK.framework.tgz
. ${FB_SDK_SCRIPT:-$(dirname $0)}/common.sh
# process options, valid arguments -c [Debug|Release] -n
BUILDCONFIGURATION=Debug
NOEXTRAS=1
while getopts ":ntc:" OPTNAME
do
case "$OPTNAME" in
"c")
BUILDCONFIGURATION=$OPTARG
;;
"n")
NOEXTRAS=1
;;
"t")
NOEXTRAS=0
;;
"?")
echo "$0 -c [Debug|Release] -n"
echo " -c sets configuration (default=Debug)"
echo " -n no test run (default)"
echo " -t test run"
die
;;
":")
echo "Missing argument value for option $OPTARG"
die
;;
*)
# Should not occur
echo "Unknown error while processing options"
die
;;
esac
done
test -x "$XCODEBUILD" || die 'Could not find xcodebuild in $PATH'
test -x "$LIPO" || die 'Could not find lipo in $PATH'
FB_SDK_UNIVERSAL_BINARY=$FB_SDK_BUILD/${BUILDCONFIGURATION}-universal/$FB_SDK_BINARY_NAME
# -----------------------------------------------------------------------------
progress_message Building Framework.
# -----------------------------------------------------------------------------
# Compile binaries
#
test -d $FB_SDK_BUILD \
|| mkdir -p $FB_SDK_BUILD \
|| die "Could not create directory $FB_SDK_BUILD"
cd $FB_SDK_SRC
function xcode_build_target() {
echo "Compiling for platform: ${1}."
$XCODEBUILD \
RUN_CLANG_STATIC_ANALYZER=NO \
-target "facebook-ios-sdk" \
-sdk $1 \
-configuration "${2}" \
SYMROOT=$FB_SDK_BUILD \
CURRENT_PROJECT_VERSION=$FB_SDK_VERSION_FULL \
clean build \
|| die "XCode build failed for platform: ${1}."
}
xcode_build_target "iphonesimulator" "${BUILDCONFIGURATION}"
xcode_build_target "iphoneos" "${BUILDCONFIGURATION}"
xcode_build_target "iphonesimulator" "${BUILDCONFIGURATION}64"
xcode_build_target "iphoneos" "${BUILDCONFIGURATION}64"
# -----------------------------------------------------------------------------
# Merge lib files for different platforms into universal binary
#
progress_message "Building $FB_SDK_BINARY_NAME library using lipo."
mkdir -p $(dirname $FB_SDK_UNIVERSAL_BINARY)
$LIPO \
-create \
$FB_SDK_BUILD/${BUILDCONFIGURATION}-iphonesimulator/libfacebook_ios_sdk.a \
$FB_SDK_BUILD/${BUILDCONFIGURATION}-iphoneos/libfacebook_ios_sdk.a \
$FB_SDK_BUILD/${BUILDCONFIGURATION}64-iphonesimulator/libfacebook_ios_sdk.a \
$FB_SDK_BUILD/${BUILDCONFIGURATION}64-iphoneos/libfacebook_ios_sdk.a \
-output $FB_SDK_UNIVERSAL_BINARY \
|| die "lipo failed - could not create universal static library"
# -----------------------------------------------------------------------------
# Build .framework out of binaries
#
progress_message "Building $FB_SDK_FRAMEWORK_NAME."
\rm -rf $FB_SDK_FRAMEWORK
mkdir $FB_SDK_FRAMEWORK \
|| die "Could not create directory $FB_SDK_FRAMEWORK"
mkdir $FB_SDK_FRAMEWORK/Versions
mkdir $FB_SDK_FRAMEWORK/Versions/A
mkdir $FB_SDK_FRAMEWORK/Versions/A/Headers
mkdir $FB_SDK_FRAMEWORK/Versions/A/DeprecatedHeaders
mkdir $FB_SDK_FRAMEWORK/Versions/A/Resources
\cp \
$FB_SDK_BUILD/${BUILDCONFIGURATION}-iphoneos/facebook-ios-sdk/*.h \
$FB_SDK_FRAMEWORK/Versions/A/Headers \
|| die "Error building framework while copying SDK headers"
\cp \
$FB_SDK_BUILD/${BUILDCONFIGURATION}-iphoneos/facebook-ios-sdk/*.h \
$FB_SDK_FRAMEWORK/Versions/A/DeprecatedHeaders \
|| die "Error building framework while copying SDK headers to deprecated folder"
for HEADER in FBConnect.h \
FBDialog.h \
FBFrictionlessRequestSettings.h \
FBLoginDialog.h \
Facebook.h \
FBRequest.h \
FBSessionManualTokenCachingStrategy.h
do
\cp \
$FB_SDK_SRC/$HEADER \
$FB_SDK_FRAMEWORK/Versions/A/DeprecatedHeaders \
|| die "Error building framework while copying deprecated SDK headers"
done
\cp \
$FB_SDK_SRC/Framework/Resources/* \
$FB_SDK_FRAMEWORK/Versions/A/Resources \
|| die "Error building framework while copying Resources"
\cp -r \
$FB_SDK_SRC/*.bundle \
$FB_SDK_FRAMEWORK/Versions/A/Resources \
|| die "Error building framework while copying bundle to Resources"
\cp -r \
$FB_SDK_SRC/*.bundle.README \
$FB_SDK_FRAMEWORK/Versions/A/Resources \
|| die "Error building framework while copying README to Resources"
\cp \
$FB_SDK_UNIVERSAL_BINARY \
$FB_SDK_FRAMEWORK/Versions/A/FacebookSDK \
|| die "Error building framework while copying FacebookSDK"
# Current directory matters to ln.
cd $FB_SDK_FRAMEWORK
ln -s ./Versions/A/Headers ./Headers
ln -s ./Versions/A/Resources ./Resources
ln -s ./Versions/A/FacebookSDK ./FacebookSDK
cd $FB_SDK_FRAMEWORK/Versions
ln -s ./A ./Current
# -----------------------------------------------------------------------------
# Run unit tests
#
if [ ${NOEXTRAS:-0} -eq 1 ];then
progress_message "Skipping unit tests."
else
progress_message "Running unit tests."
cd $FB_SDK_SRC
$FB_SDK_SCRIPT/run_tests.sh -c $BUILDCONFIGURATION facebook-ios-sdk-tests
fi
# -----------------------------------------------------------------------------
# Done
#
progress_message "Framework version info:" `perl -ne 'print "$1 " if (m/FB_IOS_SDK_MIGRATION_BUNDLE @(.+)$/ || m/FB_IOS_SDK_VERSION_STRING @(.+)$/);' $FB_SDK_SRC/FBSDKVersion.h $FB_SDK_SRC/FacebookSDK.h`
common_success
+75
View File
@@ -0,0 +1,75 @@
#!/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 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 -n -c Release
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
+144
View File
@@ -0,0 +1,144 @@
#!/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 sets up a consistent environment for the other scripts in this directory.
# Set up paths for a specific clone of the SDK source
if [ -z "$FB_SDK_SCRIPT" ]; then
# ---------------------------------------------------------------------------
# Versioning for the SDK
#
FB_SDK_VERSION_MAJOR=0
FB_SDK_VERSION_MINOR=1
test -n "$FB_SDK_VERSION_BUILD" || FB_SDK_VERSION_BUILD=$(date '+%Y%m%d')
FB_SDK_VERSION=${FB_SDK_VERSION_MAJOR}.${FB_SDK_VERSION_MINOR}
FB_SDK_VERSION_FULL=${FB_SDK_VERSION}.${FB_SDK_VERSION_BUILD}
# ---------------------------------------------------------------------------
# Set up paths
#
# The directory containing this script
# We need to go there and use pwd so these are all absolute paths
pushd $(dirname $BASH_SOURCE[0]) >/dev/null
FB_SDK_SCRIPT=$(pwd)
popd >/dev/null
# The root directory where the Facebook SDK for iOS is cloned
FB_SDK_ROOT=$(dirname $FB_SDK_SCRIPT)
# Path to source files for Facebook SDK
FB_SDK_SRC=$FB_SDK_ROOT/src
# Path to sample files for Facebook SDK
FB_SDK_SAMPLES=$FB_SDK_ROOT/samples
# The directory where the target is built
FB_SDK_BUILD=$FB_SDK_ROOT/build
FB_SDK_BUILD_LOG=$FB_SDK_BUILD/build.log
# The name of the Facebook SDK for iOS
FB_SDK_BINARY_NAME=FacebookSDK
# The name of the Facebook SDK for iOS framework
FB_SDK_FRAMEWORK_NAME=${FB_SDK_BINARY_NAME}.framework
# The path to the built Facebook SDK for iOS .framework
FB_SDK_FRAMEWORK=$FB_SDK_BUILD/$FB_SDK_FRAMEWORK_NAME
# The name of the docset
FB_SDK_DOCSET_NAME=com.facebook.Facebook-SDK-3_0-for-iOS.docset
# The path to the framework docs
FB_SDK_FRAMEWORK_DOCS=$FB_SDK_BUILD/$FB_SDK_DOCSET_NAME
fi
# Set up one-time variables
if [ -z $FB_SDK_ENV ]; then
FB_SDK_ENV=env1
FB_SDK_BUILD_DEPTH=0
# Explains where the log is if this is the outermost build or if
# we hit a fatal error.
function show_summary() {
test -r $FB_SDK_BUILD_LOG && echo "Build log is at $FB_SDK_BUILD_LOG"
}
# Determines whether this is out the outermost build.
function is_outermost_build() {
test 1 -eq $FB_SDK_BUILD_DEPTH
}
# Calls show_summary if this is the outermost build.
# Do not call outside common.sh.
function pop_common() {
FB_SDK_BUILD_DEPTH=$(($FB_SDK_BUILD_DEPTH - 1))
test 0 -eq $FB_SDK_BUILD_DEPTH && show_summary
}
# Deletes any previous build log if this is the outermost build.
# Do not call outside common.sh.
function push_common() {
test 0 -eq $FB_SDK_BUILD_DEPTH && \rm -f $FB_SDK_BUILD_LOG
FB_SDK_BUILD_DEPTH=$(($FB_SDK_BUILD_DEPTH + 1))
}
# Echoes a progress message to stderr
function progress_message() {
echo "$@" >&2
}
# Any script that includes common.sh must call this once if it finishes
# successfully.
function common_success() {
pop_common
return 0
}
# Call this when there is an error. This does not return.
function die() {
echo ""
echo "FATAL: $*" >&2
show_summary
exit 1
}
test -n "$XCODEBUILD" || XCODEBUILD=$(which xcodebuild)
test -n "$LIPO" || LIPO=$(which lipo)
test -n "$PACKAGEMAKER" || PACKAGEMAKER=$(which PackageMaker)
test -n "$PRODUCTSIGN" || PRODUCTSIGN=$(which productsign)
test -n "$APPLEDOC" || APPLEDOC=$(which appledoc)
# < XCode 4.3.1
if [ ! -x "$XCODEBUILD" ]; then
# XCode from app store
XCODEBUILD=/Applications/XCode.app/Contents/Developer/usr/bin/xcodebuild
fi
if [ ! -x "$PACKAGEMAKER" ]; then
PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
fi
if [ ! -x "$PACKAGEMAKER" ]; then
PACKAGEMAKER=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
fi
fi
# Increment depth every time we . this file. At the end of any script
# that .'s this file, there should be a call to common_finish to decrement.
push_common
+44
View File
@@ -0,0 +1,44 @@
#!/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 configures your iOS simulator for unit tests
# Note: On Mac OS X, an easy way to generate a MACHINE_UNIQUE_USER_TAG is with the following:
# system_profiler SPHardwareDataType | grep -i "Serial Number (system):" | awk '{print $4}'
. ${FB_SDK_SCRIPT:-$(dirname $0)}/common.sh
if [ "$#" -lt 2 ]; then
echo "Usage: $0 APP_ID APP_SECRET [MACHINE_UNIQUE_USER_KEY]"
echo " APP_ID your unit-testing Facebook application's App ID"
echo " APP_SECRET your unit-testing Facebook application's App Secret"
echo " MACHINE_UNIQUE_USER_TAG optional text used to ensure this machine will use its own set of test users rather than sharing"
die 'Arguments do not conform to usage'
fi
function write_xcconfig {
echo "IOS_SDK_TEST_APP_ID = $2" > $1
echo "IOS_SDK_TEST_APP_SECRET = $3" >> $1
echo "IOS_SDK_MACHINE_UNIQUE_USER_KEY = $4" >> $1
echo "Wrote test app configuration to: $1"
}
XCCONFIG_FILE="$FB_SDK_SRC"/tests/TestAppIdAndSecret.xcconfig
write_xcconfig "$XCCONFIG_FILE" "$1" "$2" "$3"
+142
View File
@@ -0,0 +1,142 @@
#!/usr/bin/python
import sys
import getopt
headerTemplate = """/*
* 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 is is a generated file during the SDK build process.
* Please do not hand edit this file.
* It can be rebuilt by running
*
* ./image_to_code.py %(args)s
*
*/
"""
def bytes_from_file(filename, chunksize=8192):
with open(filename, "rb") as f:
while True:
chunk = f.read(chunksize)
if chunk:
for b in chunk:
yield b
else:
break
def write_header_file(header, className, outputFile):
with open(outputFile, "w") as f:
f.write(header)
f.write("""
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
""")
f.write("@interface " + className + " : NSObject\n\n")
f.write("+ (UIImage *)image;\n\n")
f.write("@end")
def write_implementation_file(inputFile, header, className, outputFile):
formattedBytes = ["0x{0:02x}".format(ord(x)) for x in bytes_from_file(inputFile)]
with open(outputFile, "w") as f:
f.write(header)
f.write("\n")
f.write("#import \"" + className + ".h\"\n")
f.write("#import \"FBImageResourceLoader.h\"\n\n")
# Write standard bytes out
f.write("const Byte " + className + "_standard[] = {\n")
f.write(", ".join(formattedBytes))
f.write("\n")
f.write("};\n")
# Write retina if present
useRetina = True
try:
(name, ext) = inputFile.rsplit(".", 1)
name = name + "@2x"
formattedBytes = ["0x{0:02x}".format(ord(x)) for x in bytes_from_file(name + "." + ext)]
f.write("const Byte " + className + "_retina[] = {\n")
f.write(", ".join(formattedBytes))
f.write("\n")
f.write("};\n")
except IOError:
useRetina = False
# Enter the bundle path override
# strip of the PNG that was added for our class name for the resource name
bundlepath = "@\"" + "FacebookSDKImages/" + className[0:-3] + ".png\""
f.write("\n")
f.write("@implementation " + className + "\n\n")
f.write("+ (UIImage *)image {\n")
f.write(" return [FBImageResourceLoader imageNamed:")
f.write(bundlepath)
f.write("\n")
f.write(" fromBytes:" + className + "_standard\n")
f.write(" length:sizeof(" + className + "_standard)/sizeof(" + className + "_standard[0])\n")
if useRetina:
f.write(" fromRetinaBytes:" + className + "_retina\n")
f.write(" retinaLength:sizeof(" + className + "_retina)/sizeof(" + className + "_retina[0])];\n")
else:
f.write(" fromRetinaBytes:NULL\n")
f.write(" retinaLength:0];\n")
f.write("}\n")
f.write("@end\n")
def main(argv):
inputFile = ''
outputClass = ''
outputDir = ''
try:
opts, args = getopt.getopt(argv,"hi:c:o:")
except getopt.GetoptError:
print 'image_to_code.py -i <inputFile> -c <class> -o <outputDir>'
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print 'image_to_code.py -i <inputFile> -c <class> -o <outputDir>'
sys.exit()
elif opt == '-i':
inputFile = arg
elif opt == '-c':
outputClass = arg
elif opt in '-o':
outputDir = arg
# Build file headers
header = headerTemplate % {"args" : " ".join(argv)}
# outputClass needs to add PNG as part of it
outputClass = outputClass + "PNG"
# Build the output base filename
outputFileBase = outputDir + "/" + outputClass
# Build .h file
outputFile = outputFileBase + ".h"
write_header_file(header, outputClass, outputFile)
# Build .m file
outputFile = outputFileBase + ".m"
write_implementation_file(inputFile, header, outputClass, outputFile)
if __name__ == "__main__":
main(sys.argv[1:])
+49
View File
@@ -0,0 +1,49 @@
#!/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.
#
. ${FB_SDK_SCRIPT:-$(dirname $0)}/common.sh
if [ "$#" -lt 2 ]; then
echo "Usage: $0 MAJOR MINOR [HOTFIX [BETA]]"
echo " MAJOR major version number"
echo " MINOR minor version number"
echo " HOTFIX hotfix version number"
echo " BETA 'b' if this is a beta release"
die 'Arguments do not conform to usage'
fi
cd $FB_SDK_SRC
VERSION_STRING="$1"."$2"
if [ "$3" != "" ]; then
VERSION_STRING="$VERSION_STRING"."$3"
fi
if [ "$4" != "" ]; then
# We actually append 'b' regardless of what was passed.
VERSION_STRING="$VERSION_STRING".b
fi
TAG_NAME=sdk-version-"$VERSION_STRING"
git tag -a "$TAG_NAME" HEAD \
|| die 'Failed to tag HEAD. If this is a duplicate tag, please delete the old one first.'
progress_message "Tagged HEAD as $TAG_NAME"
progress_message "Be sure to use 'git push --tags' in order to push tags upstream."
common_success
+66
View File
@@ -0,0 +1,66 @@
#!/usr/bin/python
#
# 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.
#
import sys
import json
import httplib
from urlparse import urlparse
if len(sys.argv) == 3:
appId = sys.argv[1];
appSecret = sys.argv[2];
print("Deleting test users for app " + appId);
else:
print("Must specify appId and appSecret.");
exit(-1);
host = "graph.facebook.com";
fmtGet = "/{0}/accounts/test-users?access_token={0}|{1}";
fmtDel = "/{0}?method=delete&access_token={1}|{2}";
usersPath = fmtGet.format(appId, appSecret);
while usersPath:
print("Getting users via: " + usersPath);
conn = httplib.HTTPSConnection(host);
conn.request("GET", usersPath);
users = json.loads(conn.getresponse().read());
print "Got", len(users["data"]), "users.";
for user in users["data"]:
print("Deleting user {0}".format(user["id"]));
delPath = fmtDel.format(user["id"], appId, appSecret);
conn = httplib.HTTPSConnection(host);
conn.request("GET", delPath);
deleteResult = conn.getresponse().read();
if (deleteResult <> "true"):
print("delete failed, got " + deleteResult);
if not "paging" in users:
break;
paging = users["paging"];
if not "next" in users["paging"]:
break;
nextUrl = paging["next"];
prefix = "https://graph.facebook.com";
if not nextUrl.startswith(prefix):
print("Paging url does not start with "+prefix);
break;
usersPath = nextUrl[len(prefix):];
print("Continuing next page at: " + usersPath);
+70
View File
@@ -0,0 +1,70 @@
#!/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.
#
. ${FB_SDK_SCRIPT:-$(dirname $0)}/common.sh
# process options, valid arguments -c [Debug|Release] -n
BUILDCONFIGURATION=Debug
SCHEMES="facebook-ios-sdk-tests FacebookSDKIntegrationTests"
while getopts ":nc:" OPTNAME
do
case "$OPTNAME" in
"c")
BUILDCONFIGURATION=$OPTARG
;;
"?")
echo "$0 [-c [Debug|Release]] [-n] [SUITE ...]"
echo " -c sets configuration"
echo " -n clean before build"
echo "SUITE: one or more of the following (default is all):"
echo " facebook-ios-sdk-tests: unit tests"
echo " FacebookSDKIntegrationTests: integration tests"
die
;;
"n")
CLEAN=clean
;;
":")
echo "Missing argument value for option $OPTARG"
die
;;
*)
# Should not occur
echo "Unknown error while processing options"
die
;;
esac
done
shift $(( $OPTIND -1 ))
if [ -n "$*" ]; then
SCHEMES="$*"
fi
test -x "$XCODEBUILD" || die 'Could not find xcodebuild in $PATH'
cd $FB_SDK_SRC
for SCHEME in $SCHEMES; do
$XCODEBUILD \
-sdk iphonesimulator \
-configuration $BUILDCONFIGURATION \
-scheme $SCHEME \
$CLEAN test \
|| die "Error while running unit tests"
done