From 28dfc3e16f7dabfffa09afd53ece832544c06210 Mon Sep 17 00:00:00 2001 From: Cody Winton Date: Fri, 15 Feb 2019 16:35:28 -0800 Subject: [PATCH] Conversion to Continuous Release (#949) Summary: Thanks for proposing a pull request. To help us review the request, please complete the following: - [X] sign [contributor license agreement](https://developers.facebook.com/opensource/cla) - [X] describe the change (for example, what happens before the change, and after the change) Converted project to structure that best supports continuous release process: - Updated scripts accordingly - Added `RELEASING.md` file for documentation Pull Request resolved: https://github.com/facebook/facebook-objc-sdk/pull/949 Reviewed By: jingping2015 Differential Revision: D14112836 Pulled By: codytwinton fbshipit-source-id: 740ce8956f2af5a45f7a8ad32e4496cce5046606 --- .editorconfig | 8 + .gitignore | 5 +- .jazzy.yaml | 1 + .prettierrc.yml | 9 + .travis.yml | 142 ++++--- CHANGELOG.md | 27 +- CONTRIBUTING.md | 2 +- .../FBSDKCoreKit.xcodeproj/project.pbxproj | 4 +- .../FBSDKLoginKit.xcodeproj/project.pbxproj | 4 +- .../FBSDKPlacesKit.xcodeproj/project.pbxproj | 2 +- .../FBSDKShareKit.xcodeproj/project.pbxproj | 4 +- .../FBSDKTVOSKit.xcodeproj/project.pbxproj | 2 +- RELEASING.md | 76 ++++ scripts/build_distribution.sh | 351 ----------------- scripts/build_distribution_tv.sh | 116 ------ scripts/build_documentation.sh | 61 --- scripts/build_framework.sh | 103 ----- scripts/common.sh | 117 ------ scripts/configure_simulator_for_unit_tests.sh | 49 --- scripts/package/preinstall | 4 - scripts/package/productbuild_distribution.xml | 27 -- scripts/run.sh | 354 ++++++++++++++++++ scripts/run_tests.sh | 115 ------ scripts/test_scripts.sh | 282 ++++++++++++++ .../before_install.sh} | 21 +- scripts/travis/install.sh | 25 ++ scripts/travis/script.sh | 25 ++ .../{ => xcode}/build-universal-framework.sh | 22 +- .../build-universal-tvos-framework.sh | 22 +- 29 files changed, 899 insertions(+), 1081 deletions(-) create mode 100644 .editorconfig create mode 100644 .prettierrc.yml create mode 100644 RELEASING.md delete mode 100755 scripts/build_distribution.sh delete mode 100755 scripts/build_distribution_tv.sh delete mode 100755 scripts/build_documentation.sh delete mode 100755 scripts/build_framework.sh delete mode 100755 scripts/common.sh delete mode 100755 scripts/configure_simulator_for_unit_tests.sh delete mode 100755 scripts/package/preinstall delete mode 100644 scripts/package/productbuild_distribution.xml create mode 100644 scripts/run.sh delete mode 100755 scripts/run_tests.sh create mode 100755 scripts/test_scripts.sh rename scripts/{install_docsets.sh => travis/before_install.sh} (68%) mode change 100755 => 100644 create mode 100644 scripts/travis/install.sh create mode 100644 scripts/travis/script.sh rename scripts/{ => xcode}/build-universal-framework.sh (69%) rename scripts/{ => xcode}/build-universal-tvos-framework.sh (68%) diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..1923d4101 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/.gitignore b/.gitignore index acc653f36..b8808ca71 100644 --- a/.gitignore +++ b/.gitignore @@ -39,14 +39,11 @@ xcuserdata/ Pods/ - # Carthage # # Add this line if you want to avoid checking in source code from Carthage dependencies. -Carthage/Checkouts -Carthage/Build - +Carthage/ # fastlane # diff --git a/.jazzy.yaml b/.jazzy.yaml index 7ea3aa73d..50bae63e3 100644 --- a/.jazzy.yaml +++ b/.jazzy.yaml @@ -3,3 +3,4 @@ author: Facebook objc: true clean: true sdk: iphonesimulator +readme: /dev/null diff --git a/.prettierrc.yml b/.prettierrc.yml new file mode 100644 index 000000000..5ace9d578 --- /dev/null +++ b/.prettierrc.yml @@ -0,0 +1,9 @@ +--- +printWidth: 120 +tabWidth: 2 +useTabs: false +semi: false +singleQuote: true +jsxSingleQuote: true +proseWrap: always +endOfLine: lf diff --git a/.travis.yml b/.travis.yml index dbe19c064..966b868f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,87 +1,75 @@ language: objective-c os: osx -osx_image: xcode10 env: global: - - SCRIPT_ENV=TRAVISCI - - XCODE_WORKSPACE=FacebookSDK.xcworkspace + - XCODE_WORKSPACE=FacebookSDK.xcworkspace + - secure: vjVOdxnuHnkDiPXoddLycTQ2WwbYudHU53xbaz86Su0J+xTSNDmxmd2GFn45EMn5BixwVzTnLWhDg7EvNvQhHWDAuHUaK7X/KXoR41s3PzlucWtxczxxt3eIRtk7U4y22tSwr/r1cl6Q2QM5IK8ICZshhSyiHHEz/EAaodcJkUE= + - secure: mpObzf4FG+JHEN6Gm/Jp96pLONe4nYpgtXxkRLlULlD23c6aHAwMJhT/pjYKINmBmxd0/Vnw5LVvBcU0rCrjANFn4nfotP4KoexIO4As+wjRGAmd9IUvosio9zdv1DasUZlHliyPElfsbKqK3aZjBDw1Cx99t6dog0H6aIKUOQA= -matrix: +stages: + - name: test + if: '! tag =~ /^v([0-9]{1}|[1-9][0-9]+)\.([0-9]{1}|[1-9][0-9]+)\.([0-9]{1}|[1-9][0-9]+)($|[-+][0-9A-Za-z+.-]+$)/' + # - name: tag + # if: '! tag =~ /^v([0-9]{1}|[1-9][0-9]+)\.([0-9]{1}|[1-9][0-9]+)\.([0-9]{1}|[1-9][0-9]+)($|[-+][0-9A-Za-z+.-]+$)/' + - name: release + if: tag =~ /^v([0-9]{1}|[1-9][0-9]+)\.([0-9]{1}|[1-9][0-9]+)\.([0-9]{1}|[1-9][0-9]+)($|[-+][0-9A-Za-z+.-]+$)/ + +jobs: include: - - name: "iOS 12.0" - env: - - MATRIX_TYPE=Xcode - - XCODE_SDK=iphonesimulator12.0 - - XCODE_SCHEME=BuildAllKits - - name: "tvOS 12.0" - env: - - MATRIX_TYPE=Xcode - - XCODE_SDK=appletvsimulator12.0 - - XCODE_SCHEME=BuildAllKits_TV - - name: "iOS 11.0" - osx_image: xcode9.4 - env: - - MATRIX_TYPE=Xcode - - XCODE_SDK=iphonesimulator11.4 - - XCODE_SCHEME=BuildAllKits - - name: "Carthage Xcode 10" - env: - - MATRIX_TYPE=Carthage + - stage: test + name: Xcode - iOS 12.0 + osx_image: xcode10.1 + env: + - XCODE_SDK=iphonesimulator12.1 + - XCODE_SCHEME=BuildAllKits + - stage: test + name: Xcode - tvOS 12.0 + osx_image: xcode10.1 + env: + - XCODE_SDK=appletvsimulator12.1 + - XCODE_SCHEME=BuildAllKits_TV + - stage: test + name: Xcode - iOS 11.4 + osx_image: xcode9.4 + env: + - XCODE_SDK=iphonesimulator11.4 + - XCODE_SCHEME=BuildAllKits + - stage: test + name: Carthage - Xcode 10.1 + osx_image: xcode10.1 + - stage: test + name: Pod Lint - Xcode 10.1 + osx_image: xcode10.1 + script: sh scripts/run.sh lint cocoapods + # - stage: tag + # name: Tag Version + # osx_image: xcode10.1 + # script: sh scripts/run.sh tag-current-version --push + - stage: release + name: GitHub + osx_image: xcode10.1 + script: sh scripts/run.sh build carthage --archive + deploy: + - provider: releases + skip_cleanup: true + api_key: $api_key + file: Carthage/Release/* + file_glob: true + name: Facebook SDK $TRAVIS_TAG + body: Consult Changelog $CURRENT_VERSION + on: + all_branches: true + tags: true + - provider: script + script: sh scripts/run.sh release cocoapods --allow-warnings + on: + all_branches: true + tags: true -branches: - only: - - master - -before_install: -- echo "Will update Brew" -- brew update - -install: -- echo "Will Bundle Brew" -- bundle install -- brew bundle - -before_script: -- echo "Will start scripts" - -script: -- echo "Did start scripts" -- echo "Env $SCRIPT_ENV $TEST_GLOBAL $MATRIX_TYPE $XCODE_SDK $XCODE_SCHEME $XCODE_DESTINATION" -- | - if [ "$MATRIX_TYPE" = Carthage ]; then - carthage build --no-skip-current - elif [ "$MATRIX_TYPE" = Xcode ]; then - xcodebuild build \ - -workspace $XCODE_WORKSPACE \ - -sdk $XCODE_SDK \ - -scheme $XCODE_SCHEME \ - -configuration Debug | \ - xcpretty - fi - -after_success: -- echo "Did succeed" - -after_failure: -- echo "Did fail" - -after_script: -- echo "Did complete scripts" - -before_deploy: -- echo "Will deploy" -- test $TRAVIS_TEST_RESULT = 0 - -deploy: -- provider: script - script: echo "Should deploy" - on: - tags: true - branch: master - -after_deploy: -- echo "Did deploy" +before_install: sh scripts/travis/before_install.sh +install: sh scripts/travis/install.sh +script: sh scripts/travis/script.sh notifications: # set notification options email: @@ -91,4 +79,4 @@ notifications: # set notification options - codytwinton@fb.com # Enable webhooks later # webhooks: - # on_failure: always + # on_failure: always diff --git a/CHANGELOG.md b/CHANGELOG.md index 79ed84915..4107ae17b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,12 @@ All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to +[Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## Unreleased -Expected 5.X release +[Full Changelog](https://github.com/facebook/facebook-objc-sdk/compare/v4.40.0...HEAD) ### Added @@ -42,20 +42,17 @@ Expected 5.X release - Various bug fixes -## [4.40.0] - 2019-01-17 +## 4.40.0 + +[2019-01-17](https://github.com/facebook/facebook-objc-sdk/releases/tag/v4.40.0) | +[Full Changelog](https://github.com/facebook/facebook-objc-sdk/compare/v4.39.1...v4.40.0) ### Fixed - Various bug fixes -## [4.39.1] - 2019-01-08 +## 4.39.1 -### Other - -- Facebook Developer Docs: [Changelog v4.x](https://developers.facebook.com/docs/ios/change-log-4x) - - - -[Unreleased]: https://github.com/facebook/facebook-objc-sdk/compare/v4.40.0...HEAD -[4.40.0]: https://github.com/facebook/facebook-objc-sdk/compare/v4.39.1...v4.40.0 -[4.39.1]: https://github.com/facebook/facebook-objc-sdk/compare/sdk-version-4.0.0...v4.39.1 +[2019-01-08](https://github.com/facebook/facebook-objc-sdk/releases/tag/v4.39.1) | +[Full Changelog](https://github.com/facebook/facebook-objc-sdk/compare/sdk-version-4.0.0...v4.39.1) | +[Facebook Developer Docs Changelog](https://developers.facebook.com/docs/ios/change-log-4x) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 13bd93626..75a21f164 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,7 @@ To contribute on behalf of yourself, sign the individual CLA All contributions: -1. MUST be be licensed using the Apache License, Version 2.0 +1. MUST be be licensed using the Apache License, Version 2.0 2. authors MAY retain copyright by adding their copyright notice to the appropriate flies More information on the Apache License can be found [here](http://www.apache.org/foundation/license-faq.html) diff --git a/FBSDKCoreKit/FBSDKCoreKit.xcodeproj/project.pbxproj b/FBSDKCoreKit/FBSDKCoreKit.xcodeproj/project.pbxproj index 93f7ad3db..c5c5abc00 100644 --- a/FBSDKCoreKit/FBSDKCoreKit.xcodeproj/project.pbxproj +++ b/FBSDKCoreKit/FBSDKCoreKit.xcodeproj/project.pbxproj @@ -2416,7 +2416,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "../scripts/build-universal-framework.sh\n"; + shellScript = "../scripts/xcode/build-universal-framework.sh\n"; }; 9D6DEEFD1BC2E546001A94ED /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -2429,7 +2429,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "../scripts/build-universal-tvos-framework.sh\n"; + shellScript = "../scripts/xcode/build-universal-tvos-framework.sh\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/FBSDKLoginKit/FBSDKLoginKit.xcodeproj/project.pbxproj b/FBSDKLoginKit/FBSDKLoginKit.xcodeproj/project.pbxproj index 34809f30a..9fbdbf5f9 100644 --- a/FBSDKLoginKit/FBSDKLoginKit.xcodeproj/project.pbxproj +++ b/FBSDKLoginKit/FBSDKLoginKit.xcodeproj/project.pbxproj @@ -880,7 +880,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "../scripts/build-universal-tvos-framework.sh\n"; + shellScript = "../scripts/xcode/build-universal-tvos-framework.sh\n"; }; 9D9DB9651A116AB50086167B /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -893,7 +893,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "../scripts/build-universal-framework.sh\n"; + shellScript = "../scripts/xcode/build-universal-framework.sh\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/FBSDKPlacesKit/FBSDKPlacesKit.xcodeproj/project.pbxproj b/FBSDKPlacesKit/FBSDKPlacesKit.xcodeproj/project.pbxproj index a1dc6c500..1e427e2a4 100644 --- a/FBSDKPlacesKit/FBSDKPlacesKit.xcodeproj/project.pbxproj +++ b/FBSDKPlacesKit/FBSDKPlacesKit.xcodeproj/project.pbxproj @@ -602,7 +602,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "../scripts/build-universal-framework.sh\n"; + shellScript = "../scripts/xcode/build-universal-framework.sh\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/FBSDKShareKit/FBSDKShareKit.xcodeproj/project.pbxproj b/FBSDKShareKit/FBSDKShareKit.xcodeproj/project.pbxproj index d262417d5..6b181e7a0 100644 --- a/FBSDKShareKit/FBSDKShareKit.xcodeproj/project.pbxproj +++ b/FBSDKShareKit/FBSDKShareKit.xcodeproj/project.pbxproj @@ -1476,7 +1476,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "../scripts/build-universal-tvos-framework.sh\n"; + shellScript = "../scripts/xcode/build-universal-tvos-framework.sh\n"; }; 9D46C6141A11E6E600A0DDB6 /* Run Script */ = { isa = PBXShellScriptBuildPhase; @@ -1490,7 +1490,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "../scripts/build-universal-framework.sh\n"; + shellScript = "../scripts/xcode/build-universal-framework.sh\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/FBSDKTVOSKit/FBSDKTVOSKit.xcodeproj/project.pbxproj b/FBSDKTVOSKit/FBSDKTVOSKit.xcodeproj/project.pbxproj index e933472eb..aed5bd9f8 100644 --- a/FBSDKTVOSKit/FBSDKTVOSKit.xcodeproj/project.pbxproj +++ b/FBSDKTVOSKit/FBSDKTVOSKit.xcodeproj/project.pbxproj @@ -859,7 +859,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "../scripts/build-universal-tvos-framework.sh"; + shellScript = "../scripts/xcode/build-universal-tvos-framework.sh"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 000000000..f13b54572 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,76 @@ +# Releasing Facebook ObjC SDK + +This document will guide you through the process of issuing a new version of the Facebook SDK. + +## Table of Contents + +- [Table of Contents](#table-of-contents) +- [Release Steps](#release-steps) + - [Bump Version](#bump-version) + - [Tag Version](#tag-version) + - [Release Version](#release-version) +- [Advanced Steps](#advanced-steps) + - [Upload Frameworks for Carthage](#upload-frameworks-for-carthage) + - [Release to Cocoapods](#release-to-cocoapods) + +## Release Steps + +### Bump Version + +Run the bump version script: + +```sh +# Call `bump-version` and pass in the desired semantic version, e.g. 4.40.0 +sh scripts/run.sh bump-version 4.40.0 +``` + +This script will modify the relevant version references and will edit the Changelog. + +Ensure that the version changes and Changelog updates are correct, then commit these changes with the title: "Bump +Version: 4.40.0" and submit a Pull Request. + +### Tag Version + +Once the bump version diff has successfully landed on the branch you wish to release, and all CI builds have passed, run +the tag current version script: + +```sh +# Ensure you're on the correct commit, e.g. latest master +git checkout master && git pull + +# Tag the currently set version and, optionally, push to origin +sh scripts/run.sh tag-current-version --push +``` + +### Release Version + +Head over to the [GitHub Releases](https://github.com/facebook/facebook-objc-sdk/releases), select the pushed tag, and +add the copy for the new release from the Changelog to the release body. Give it the title of "Facebook SDK: X.Y.Z" and +click "Publish Release". + +**Note:** Automation of this step is a WIP. + +## Advanced Steps + +All the steps below will normally be handled by Travis CI. In case Travis CI automation fails, here are the remaining +steps necessary for a release. + +### Upload Frameworks for Carthage + +On your machine, run: + +```sh +sh scripts/run.sh build carthage --archive +``` + +This will place all the SDK kits into the `Carthage/Release/` directory. Upload all the zip files to the GitHub Release. + +### Release to Cocoapods + +On your machine, run: + +```sh +sh scripts/run.sh release cocoapods --allow-warnings +``` + +This will publish all the podspecs. diff --git a/scripts/build_distribution.sh b/scripts/build_distribution.sh deleted file mode 100755 index 4d568c6fe..000000000 --- a/scripts/build_distribution.sh +++ /dev/null @@ -1,351 +0,0 @@ -#!/bin/sh -# Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -# -# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, -# copy, modify, and distribute this software in source code or binary form for use -# in connection with the web services and APIs provided by Facebook. -# -# As with any software that integrates with the Facebook platform, your use of -# this software is subject to the Facebook Developer Principles and Policies -# [http://developers.facebook.com/policy/]. This copyright notice shall be -# included in all copies or substantial portions of the software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -. "${FB_SDK_SCRIPT:-$(dirname $0)}/common.sh" -. "$FB_AD_SDK_SCRIPT/common.sh" - -COMMON_ARCHS="arm64 armv7 i386 x86_64" - -check_binary_has_architectures() { - local BINARY=$1 - local VALID_ARCHS=$2 - local SORTED_ARCHS - SORTED_ARCHS=$(lipo -info "$BINARY" | cut -d: -f3 | xargs -n1 | sort | xargs) - - if [ "$SORTED_ARCHS" != "$VALID_ARCHS" ] ; then - echo "ERROR: Invalid Architectures for $1. Expected $VALID_ARCHS Received: $SORTED_ARCHS"; - exit 1 - fi -} - -check_binary_has_bitcode() { - # static lib only - local BINARY=$1 - local BITCODE_SCRIPT="${FB_AD_SDK_ROOT}"/scripts/bitcodesize.rb - - local ISSUES=$("$BITCODE_SCRIPT" "$BINARY") - - if [ ! -z "$ISSUES" ] ; then - echo "$ISSUES" - echo "ERROR: Bitcode not found or weirdly small for $1. Check logs above."; - exit 1 - fi -} - -# valid arguments -s -p [AudienceNetwork|FacebookSDK] -# option s to skip build -SKIPBUILD="" -while getopts "sp:" OPTNAME -do - case "$OPTNAME" in - s) - SKIPBUILD="YES" - ;; - p) - PACKAGE=$OPTARG - ;; - esac -done - -if [ -z $PACKAGE ]; then - PACKAGE=$PACAKAGE_FACEBOOK -fi - -# ----------------------------------------------------------------------------- -# Install required dependencies -# -(gem list naturally -i > /dev/null) || die "Run 'gem install naturally' first" -(gem list xcpretty -i > /dev/null) || die "Run 'gem install xcpretty' first" -(gem list rake -i > /dev/null) || die "Run 'gem install rake' first" - -# ----------------------------------------------------------------------------- -# Build FBAudienceNetwork framework -# -if [ "$PACKAGE" == "$PACAKAGE_AN" ]; then - - # refuse to build with unclean state - repository_unclean=$(hg status -i ios-sdk/ | grep -v .DS_Store) - if [ "$repository_unclean" ]; then - echo "Detected unclean repository state:" - echo "$repository_unclean" - die "Please run 'hg purge --all' before building" - fi - - AN_ZIP=$FB_AD_SDK_BUILD/$FB_AD_SDK_BINARY_NAME-$FB_AD_SDK_VERSION.zip - AN_BUILD_PACKAGE=$FB_AD_SDK_BUILD/package - AN_SAMPLES=$AN_BUILD_PACKAGE/Samples/FBAudienceNetwork - AN_STATIC_REPORT="${FB_SDK_ROOT}"/FBAudienceNetworkFramework.out - AN_DYNAMIC_REPORT="${FB_SDK_ROOT}"/FBAudienceNetworkDynamicFramework.out - AN_BIDDING_STATIC_REPORT="${FB_SDK_ROOT}"/FBAudienceNetworkBiddingKitFramework.out - AN_BIDDING_DYNAMIC_REPORT="${FB_SDK_ROOT}"/FBAudienceNetworkBiddingKitDynamicFramework.out - - if [ -z $SKIPBUILD ]; then - buck build //ios-sdk/ads/src/FBAudienceNetwork:FBAudienceNetworkFramework --build-report "$AN_STATIC_REPORT" || die "Failed to build FBAudienceNetwork" - buck build //ios-sdk/ads/src/FBAudienceNetwork:FBAudienceNetworkDynamicFramework --build-report "$AN_DYNAMIC_REPORT" || die "Failed to build FBAudienceNetworkDynamicFramework" - - AN_BUCK_STATIC_OUTPUT="${FB_SDK_ROOT}/../"$(cat "$AN_STATIC_REPORT" | grep -E -m 1 '"output"' | awk -F '"' '{ print $4 }') - AN_BUCK_DYNAMIC_OUTPUT="${FB_SDK_ROOT}/../"$(cat "$AN_DYNAMIC_REPORT" | grep -E -m 1 '"output"' | awk -F '"' '{ print $4 }') - - rsync -avmc "$AN_BUCK_STATIC_OUTPUT" "$FB_AD_SDK_BUILD" \ - || die "Could not copy FBAudienceNetwork.framework" - rsync -avmc "$AN_BUCK_DYNAMIC_OUTPUT" "$FB_AD_SDK_BUILD" \ - || die "Could not copy FBAudienceNetworkDynamicFramework.framework" - - rm "$AN_STATIC_REPORT" - rm "$AN_DYNAMIC_REPORT" - fi - - rsync -avmc "$FB_AD_SDK_BUILD"/FBAudienceNetwork.framework "$AN_BUILD_PACKAGE" \ - || die "Could not copy FBAudienceNetwork.framework" - rsync -avmc "$FB_AD_SDK_BUILD"/FBAudienceNetworkDynamicFramework.framework "$AN_BUILD_PACKAGE" \ - || die "Could not copy FBAudienceNetworkDynamicFramework.framework" - mkdir -p "$AN_BUILD_PACKAGE/Samples/FBAudienceNetwork" - rsync -avmc "$FB_SDK_ROOT"/ads/samples/AdUnitsSample "$AN_SAMPLES" \ - || die "Could not copy FBAudienceNetwork samples" - # Fix up samples - for fname in $(find "$AN_SAMPLES" -name "project.pbxproj" -print); do \ - sed 's|"\\"\$(SRCROOT)/\.\./\.\./\.\./build\\"",||g;s|\.\./\.\./\.\./build||g;' \ - ${fname} > ${fname}.tmpfile && mv ${fname}.tmpfile ${fname}; \ - done - - check_binary_has_architectures "$FB_AD_SDK_BUILD"/FBAudienceNetwork.framework/FBAudienceNetwork "$COMMON_ARCHS"; - check_binary_has_architectures "$FB_AD_SDK_BUILD"/FBAudienceNetworkDynamicFramework.framework/FBAudienceNetworkDynamicFramework "$COMMON_ARCHS"; - - check_binary_has_bitcode "$FB_AD_SDK_BUILD"/FBAudienceNetwork.framework/FBAudienceNetwork - - # Fix up samples - for fname in $(find "$AN_SAMPLES" -name "project.pbxproj" -print); do \ - sed "s|../../build|../../../|g;" \ - ${fname} > ${fname}.tmpfile && mv ${fname}.tmpfile ${fname}; \ - done - for fname in $(find "$AN_SAMPLES" -name "*-PUBLIC.xcodeproj" -print); do \ - newfname="$(echo ${fname} | sed -e 's/-PUBLIC//')" ; \ - rm -rf "${newfname}"; \ - mv "${fname}" "${newfname}" ; \ - done - - LANG=C - - # Remove all BUCK related files from AN samples - find "$AN_SAMPLES" -name "BUCK" -delete - find "$AN_SAMPLES" -name "build-buck.sh" -delete - find "$AN_SAMPLES" -name "Buck-Info.plist" -delete - find "$AN_SAMPLES" -name "Entitlements" -type d -exec rm -r "{}" \; - - find "$AN_SAMPLES" -name "entitlements.plist" -delete - - find "$AN_SAMPLES" -name "Info.plist" -exec perl -p -i -0777 -e 's/\s*CFBundleURLTypes<\/key>\s*\s*\s*CFBundleURLSchemes<\/key>\s*\s*fb\d*<\/string>\s*<\/array>\s*<\/dict>\s*<\/array>\s*FacebookAppID<\/key>\s*\d*<\/string>\s*FacebookDisplayName<\/key>\s*.*<\/string>\s*LSApplicationQueriesSchemes<\/key>\s*\s*fbapi<\/string>\s*fb-messenger-api<\/string>\s*fbauth2<\/string>\s*fbshareextension<\/string>\s*<\/array>\n//g' {} \; - find "$AN_SAMPLES" -name "project.pbxproj" -exec perl -p -i -0777 -e 's/\n\s*com\.apple\.Keychain = {\s*enabled = 1;\s*};//gms' {} \; - find "$AN_SAMPLES" -name "project.pbxproj" -exec perl -p -i -0777 -e '/NativeAdSample.entitlements/d' {} \; - find "$AN_SAMPLES" -name "project.pbxproj" -exec perl -p -i -0777 -e '/AdBiddingSample.entitlements/d' {} \; - find "$AN_SAMPLES" -name "project.pbxproj" -exec perl -p -i -0777 -e 's/^\s*\n\s*<\/FileRef>\n//gms' {} \; - find "$AN_SAMPLES" -type f -exec sed -i '' -E -e "/fbLoginButton/d" {} \; - find "$AN_SAMPLES" -type f -exec sed -i '' -E -e "/FBSDKCoreKit/d" {} \; - find "$AN_SAMPLES" -type f -exec sed -i '' -E -e "/FBSDKLogin/d" {} \; - find "$AN_SAMPLES" -type f -exec sed -i '' -E -e "/FBSDKApplicationDelegate/d" {} \; - find "$AN_SAMPLES" -type f -exec perl -p -i -0777 -e 's/\n\/\/ START REMOVED AT DISTRIBUTION BUILD TIME.*?\/\/ END REMOVED AT DISTRIBUTION BUILD TIME\n//gms' {} \; - - # Build .zip from package directory - progress_message "Building .zip from package directory." - ( - cd $FB_AD_SDK_BUILD - ditto -ck --sequesterRsrc $AN_BUILD_PACKAGE $AN_ZIP - ) - -elif [ "$PACKAGE" = "$PACKAGE_BIDDING_KIT" ]; then - # refuse to build with unclean state - repository_unclean=$(hg status -i ios-sdk/ | grep -v .DS_Store) - if [ "$repository_unclean" ]; then - echo "Detected unclean repository state:" - echo "$repository_unclean" - die "Please run 'hg purge --all' before building" - fi - - AN_BIDDING_ZIP=$FB_AD_SDK_BUILD/$FB_BIDDING_KIT_BINARY_NAME-$FB_BIDDING_KIT_VERSION.zip - AN_BIDDING_BUILD_PACKAGE=$FB_AD_SDK_BUILD/package - AN_BIDDING_SAMPLES=$AN_BIDDING_BUILD_PACKAGE/Samples/FBAudienceNetworkBiddingKit - AN_BIDDING_STATIC_REPORT="${FB_SDK_ROOT}"/FBAudienceNetworkBiddingKitFramework.out - #AN_BIDDING_DYNAMIC_REPORT="${FB_SDK_ROOT}"/FBAudienceNetworkBiddingKitDynamicFramework.out - - if [ -z $SKIPBUILD ]; then - buck build //ios-sdk/ads/src/FBAudienceNetwork:FBAudienceNetworkBiddingKitFramework --build-report "$AN_BIDDING_STATIC_REPORT" || die "Failed to build FBAudienceNetworkBiddingKit" - # dynamic not supported yet - buck build //ios-sdk/ads/src/FBAudienceNetwork:FBAudienceNetworkBiddingKitDynamicFramework --build-report "$AN_BIDDING_DYNAMIC_REPORT" || die "Failed to build FBAudienceNetworkBiddingKitDynamicFramework" - - AN_BIDDING_BUCK_STATIC_OUTPUT="${FB_SDK_ROOT}/../"$(grep -E -m 1 '"output"' "$AN_BIDDING_STATIC_REPORT" | awk -F '"' '{ print $4 }') - AN_BIDDING_BUCK_DYNAMIC_OUTPUT="${FB_SDK_ROOT}/../"$(grep -E -m 1 '"output"' "$AN_BIDDING_DYNAMIC_REPORT" | awk -F '"' '{ print $4 }') - - rsync -avmc "$AN_BIDDING_BUCK_STATIC_OUTPUT" "$FB_AD_SDK_BUILD" \ - || die "Could not copy FBAudienceNetworkBiddingKit.framework" - rsync -avmc "$AN_BIDDING_BUCK_DYNAMIC_OUTPUT" "$FB_AD_SDK_BUILD" \ - || die "Could not copy FBAudienceNetworkBiddingKitDynamicFramework.framework" - - rm "$AN_BIDDING_STATIC_REPORT" - rm "$AN_BIDDING_DYNAMIC_REPORT" - fi - - - rsync -avmc "$FB_AD_SDK_BUILD"/FBAudienceNetworkBiddingKit.framework "$AN_BIDDING_BUILD_PACKAGE" \ - || die "Could not copy FBAudienceNetworkBiddingKit.framework" - rsync -avmc "$FB_AD_SDK_BUILD"/FBAudienceNetworkBiddingKitDynamicFramework.framework "$AN_BIDDING_BUILD_PACKAGE" \ - || die "Could not copy FBAudienceNetworkBiddingKitDynamicFramework.framework" - mkdir -p "$AN_BIDDING_BUILD_PACKAGE/Samples/FBAudienceNetworkBiddingKit" - rsync -avmc "$FB_SDK_ROOT"/ads/samples/AdBiddingSample "$AN_BIDDING_SAMPLES" \ - || die "Could not copy FBAudienceNetworkBiddingKit samples" - # Fix up samples - for fname in $(find "$AN_BIDDING_SAMPLES" -name "project.pbxproj" -print); do \ - sed 's|"\\"\$(SRCROOT)/\.\./\.\./\.\./build\\"",||g;s|\.\./\.\./\.\./build||g;' \ - "${fname}" > "${fname}".tmpfile && mv "${fname}".tmpfile "${fname}"; \ - done - - check_binary_has_architectures "$FB_AD_SDK_BUILD"/FBAudienceNetworkBiddingKit.framework/FBAudienceNetworkBiddingKit "$COMMON_ARCHS"; - check_binary_has_architectures "$FB_AD_SDK_BUILD"/FBAudienceNetworkBiddingKitDynamicFramework.framework/FBAudienceNetworkBiddingKitDynamicFramework "$COMMON_ARCHS"; - - check_binary_has_bitcode "$FB_AD_SDK_BUILD"/FBAudienceNetworkBiddingKit.framework/FBAudienceNetworkBiddingKit - - # Fix up samples - for fname in $(find "$AN_BIDDING_SAMPLES" -name "project.pbxproj" -print); do \ - sed "s|../../build|../../../|g;" \ - "${fname}" > "${fname}".tmpfile && mv "${fname}".tmpfile "${fname}"; \ - done - for fname in $(find "$AN_BIDDING_SAMPLES" -name "*-PUBLIC.xcodeproj" -print); do \ - newfname="$(echo "${fname}" | sed -e 's/-PUBLIC//')" ; \ - rm -rf "${newfname}"; \ - mv "${fname}" "${newfname}" ; \ - done - - LANG=C - - # Remove all BUCK related files from AN samples - find "$AN_BIDDING_SAMPLES" -name "BUCK" -delete - find "$AN_BIDDING_SAMPLES" -name "build-buck.sh" -delete - find "$AN_BIDDING_SAMPLES" -name "Buck-Info.plist" -delete - find "$AN_BIDDING_SAMPLES" -name "Entitlements" -type d -exec rm -r "{}" \; - - find "$AN_BIDDING_SAMPLES" -name "entitlements.plist" -delete - - find "$AN_BIDDING_SAMPLES" -name "Info.plist" -exec perl -p -i -0777 -e 's/\s*CFBundleURLTypes<\/key>\s*\s*\s*CFBundleURLSchemes<\/key>\s*\s*fb\d*<\/string>\s*<\/array>\s*<\/dict>\s*<\/array>\s*FacebookAppID<\/key>\s*\d*<\/string>\s*FacebookDisplayName<\/key>\s*.*<\/string>\s*LSApplicationQueriesSchemes<\/key>\s*\s*fbapi<\/string>\s*fb-messenger-api<\/string>\s*fbauth2<\/string>\s*fbshareextension<\/string>\s*<\/array>\n//g' {} \; - find "$AN_BIDDING_SAMPLES" -name "project.pbxproj" -exec perl -p -i -0777 -e 's/\n\s*com\.apple\.Keychain = {\s*enabled = 1;\s*};//gms' {} \; - find "$AN_BIDDING_SAMPLES" -name "project.pbxproj" -exec perl -p -i -0777 -e '/NativeAdSample.entitlements/d' {} \; - find "$AN_BIDDING_SAMPLES" -name "project.pbxproj" -exec perl -p -i -0777 -e '/AdBiddingSample.entitlements/d' {} \; - find "$AN_BIDDING_SAMPLES" -name "project.pbxproj" -exec perl -p -i -0777 -e 's/^\s*\n\s*<\/FileRef>\n//gms' {} \; - find "$AN_BIDDING_SAMPLES" -type f -exec sed -i '' -E -e "/fbLoginButton/d" {} \; - find "$AN_BIDDING_SAMPLES" -type f -exec sed -i '' -E -e "/FBSDKCoreKit/d" {} \; - find "$AN_BIDDING_SAMPLES" -type f -exec sed -i '' -E -e "/FBSDKLogin/d" {} \; - find "$AN_BIDDING_SAMPLES" -type f -exec sed -i '' -E -e "/FBSDKApplicationDelegate/d" {} \; - find "$AN_BIDDING_SAMPLES" -type f -exec perl -p -i -0777 -e 's/\n\/\/ START REMOVED AT DISTRIBUTION BUILD TIME.*?\/\/ END REMOVED AT DISTRIBUTION BUILD TIME\n//gms' {} \; - - # Build .zip from package directory - progress_message "Building .zip from package directory." - ( - cd "$FB_AD_SDK_BUILD" || die "Failed to change directory to package directory to build the zip" - ditto -ck --sequesterRsrc "$AN_BIDDING_BUILD_PACKAGE" "$AN_BIDDING_ZIP" - ) -else - # ----------------------------------------------------------------------------- - # Build FacebookSDK framework - # - if [ "$PACKAGE" == "$PACAKAGE_FACEBOOK" ]; then - FB_SDK_ZIP=$FB_SDK_BUILD/FacebookSDKs-${FB_SDK_VERSION_SHORT}.zip - - FB_SDK_BUILD_PACKAGE=$FB_SDK_BUILD/package - FB_SDK_BUILD_PACKAGE_SAMPLES=$FB_SDK_BUILD_PACKAGE/Samples - FB_SDK_BUILD_PACKAGE_SCRIPTS=$FB_SDK_BUILD/Scripts - FB_SDK_BUILD_PACKAGE_DOCSETS_FOLDER=$FB_SDK_BUILD_PACKAGE/DocSets/ - - # Build package directory structure - progress_message "Building package directory structure." - rm -rf "$FB_SDK_BUILD_PACKAGE" "$FB_SDK_BUILD_PACKAGE_SCRIPTS" - mkdir -p "$FB_SDK_BUILD_PACKAGE" \ - || die "Could not create directory $FB_SDK_BUILD_PACKAGE" - mkdir -p "$FB_SDK_BUILD_PACKAGE_SAMPLES" - mkdir -p "$FB_SDK_BUILD_PACKAGE_SCRIPTS" - mkdir -p "$FB_SDK_BUILD_PACKAGE_DOCSETS_FOLDER" - - # Call out to build prerequisites. - if is_outermost_build; then - if [ -z $SKIPBUILD ]; then - . "$FB_SDK_SCRIPT/build_framework.sh" -c Release - fi - fi - echo Building Distribution. - - # Copy over stuff - \cp -R "$FB_SDK_BUILD"/FBSDKCoreKit.framework "$FB_SDK_BUILD_PACKAGE" \ - || die "Could not copy FBSDKCoreKit.framework" - \cp -R "$FB_SDK_BUILD"/FBSDKLoginKit.framework "$FB_SDK_BUILD_PACKAGE" \ - || die "Could not copy FBSDKLoginKit.framework" - \cp -R "$FB_SDK_BUILD"/FBSDKShareKit.framework "$FB_SDK_BUILD_PACKAGE" \ - || die "Could not copy FBSDKShareKit.framework" - \cp -R "$FB_SDK_BUILD"/FBSDKPlacesKit.framework "$FB_SDK_BUILD_PACKAGE" \ - || die "Could not copy FBSDKPlacesKit.framework" - \cp -R $"$FB_SDK_ROOT"/FacebookSDKStrings.bundle "$FB_SDK_BUILD_PACKAGE" \ - || die "Could not copy FacebookSDKStrings.bundle" - for SAMPLE in Configurations Iconicus RPSSample Scrumptious ShareIt SwitchUserSample FBSDKPlacesSample; do - \rsync -avmc --exclude "${SAMPLE}.xcworkspace" "$FB_SDK_SAMPLES/$SAMPLE" "$FB_SDK_BUILD_PACKAGE_SAMPLES" \ - || die "Could not copy $SAMPLE" - done - \cp "$FB_SDK_ROOT/README.txt" "$FB_SDK_BUILD_PACKAGE" \ - || die "Could not copy README" - \cp "$FB_SDK_ROOT/LICENSE" "$FB_SDK_BUILD_PACKAGE"/LICENSE.txt \ - || die "Could not copy LICENSE" - - # Fixup projects to point to the SDK framework - for fname in $(find "$FB_SDK_BUILD_PACKAGE_SAMPLES" -name "Project.xcconfig" -print); do \ - sed 's|\(\.\.\(/\.\.\)*\)/build|\1|g;s|\.\.\(/\.\.\)*/Carthage/Checkouts/build/ios||g' \ - ${fname} > ${fname}.tmpfile && mv ${fname}.tmpfile ${fname}; \ - done - for fname in $(find "$FB_SDK_BUILD_PACKAGE_SAMPLES" -name "project.pbxproj" -print); do \ - sed 's|\(path[[:space:]]*=[[:space:]]*\.\.\(/\.\.\)*\)/build|\1|g' \ - ${fname} > ${fname}.tmpfile && mv ${fname}.tmpfile ${fname}; \ - done - - # Build AKFAccountKit framework - if [ -z $SKIPBUILD ]; then - (xcodebuild -project "${FB_SDK_ROOT}"/AccountKit/AccountKit.xcodeproj -scheme "AccountKit-Universal" -configuration Release clean build) || die "Failed to build account kit" - fi - check_binary_has_architectures "$FB_SDK_BUILD"/AccountKit.framework/AccountKit "$COMMON_ARCHS"; - \cp -R "$FB_SDK_BUILD"/AccountKit.framework "$FB_SDK_BUILD_PACKAGE" \ - || die "Could not copy AccountKit.framework" - \cp -R "$FB_SDK_BUILD"/AccountKitStrings.bundle "$FB_SDK_BUILD_PACKAGE" \ - || die "Could not copy AccountKitStrings.bundle" - - # Build docs - if [ -z $SKIPBUILD ]; then - . "$FB_SDK_SCRIPT/build_documentation.sh" - fi - \ls -d "$FB_SDK_BUILD"/*.docset | xargs -I {} cp -R {} $FB_SDK_BUILD_PACKAGE_DOCSETS_FOLDER \ - || die "Could not copy docsets" - \cp "$FB_SDK_SCRIPT/install_docsets.sh" $FB_SDK_BUILD_PACKAGE_DOCSETS_FOLDER \ - || die "Could not copy install_docset" - - # Build .zip from package directory - progress_message "Building .zip from package directory." - ( - cd $FB_SDK_BUILD - ditto -ck --sequesterRsrc $FB_SDK_BUILD_PACKAGE $FB_SDK_ZIP - ) - - # Done - progress_message "Successfully built SDK zip: $FB_SDK_ZIP" - common_success - else - progress_message "Invalid parameter: the package should be AudienceNetwork or FacebookSDK." - fi -fi diff --git a/scripts/build_distribution_tv.sh b/scripts/build_distribution_tv.sh deleted file mode 100755 index a8ad9fa05..000000000 --- a/scripts/build_distribution_tv.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/sh -# Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -# -# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, -# copy, modify, and distribute this software in source code or binary form for use -# in connection with the web services and APIs provided by Facebook. -# -# As with any software that integrates with the Facebook platform, your use of -# this software is subject to the Facebook Developer Principles and Policies -# [http://developers.facebook.com/policy/]. This copyright notice shall be -# included in all copies or substantial portions of the software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -. "${FB_SDK_SCRIPT:-$(dirname $0)}/common.sh" - -# option s to skip build -SKIPBUILD="" -while getopts "s" OPTNAME -do - case "$OPTNAME" in - s) - SKIPBUILD="YES" - ;; - esac -done - -FB_SDK_ZIP=$FB_SDK_BUILD/FacebookSDKs_TV-${FB_SDK_VERSION_SHORT}.zip - - -FB_SDK_BUILD_PACKAGE=$FB_SDK_BUILD/package -FB_SDK_BUILD_PACKAGE_SAMPLES=$FB_SDK_BUILD_PACKAGE/Samples -FB_SDK_BUILD_PACKAGE_SCRIPTS=$FB_SDK_BUILD/Scripts - -# -----------------------------------------------------------------------------gi -# Build package directory structure -# -progress_message "Building package directory structure." -\rm -rf "$FB_SDK_BUILD_PACKAGE" "$FB_SDK_BUILD_PACKAGE_SCRIPTS" -mkdir -p "$FB_SDK_BUILD_PACKAGE" \ - || die "Could not create directory $FB_SDK_BUILD_PACKAGE" -mkdir -p "$FB_SDK_BUILD_PACKAGE_SCRIPTS" -mkdir -p "$FB_SDK_BUILD_PACKAGE_SAMPLES" - -# ----------------------------------------------------------------------------- -# Call out to build prerequisites. -# -if is_outermost_build; then - if [ -z $SKIPBUILD ]; then - . "$FB_SDK_SCRIPT/build_framework.sh" -c Release -s BuildAllKits_TV - fi -fi -echo Building Distribution. - -# ----------------------------------------------------------------------------- -# Copy over stuff -# -\cp -R "$FB_SDK_BUILD"/tv/FBSDKCoreKit.framework "$FB_SDK_BUILD_PACKAGE" \ - || die "Could not copy FBSDKCoreKit.framework" -\cp -R "$FB_SDK_BUILD"/tv/FBSDKShareKit.framework "$FB_SDK_BUILD_PACKAGE" \ - || die "Could not copy FBSDKShareKit.framework" -\cp -R "$FB_SDK_BUILD"/tv/FBSDKLoginKit.framework "$FB_SDK_BUILD_PACKAGE" \ - || die "Could not copy FBSDKLoginKit.framework" -\cp -R "$FB_SDK_BUILD"/tv/FBSDKTVOSKit.framework "$FB_SDK_BUILD_PACKAGE" \ - || die "Could not copy FBSDKTVOSKit.framework" -\cp -R $"$FB_SDK_ROOT"/FacebookSDKStrings.bundle "$FB_SDK_BUILD_PACKAGE" \ - || die "Could not copy FacebookSDKStrings.bundle" -for SAMPLE in Configurations HelloTV; do - \cp -R "$FB_SDK_SAMPLES/$SAMPLE" "$FB_SDK_BUILD_PACKAGE_SAMPLES" \ - || die "Could not copy $SAMPLE" - # Workspace doesn't work with Sample project because the framework projects are not present, so we'll delete it - find "$FB_SDK_BUILD_PACKAGE_SAMPLES/$SAMPLE" -name "$SAMPLE.xcworkspace" -type d -exec rm -r "{}" \; -done -\cp "$FB_SDK_ROOT/README_TV.txt" "$FB_SDK_BUILD_PACKAGE" \ - || die "Could not copy README" -\cp "$FB_SDK_ROOT/LICENSE" "$FB_SDK_BUILD_PACKAGE"/LICENSE.txt \ - || die "Could not copy LICENSE" - - -# ----------------------------------------------------------------------------- -# Fixup projects to point to the SDK framework -# -for fname in $(find "$FB_SDK_BUILD_PACKAGE_SAMPLES" -name "Project-TVOS.xcconfig" -print); do \ - sed "s|../../build\(/tv\)\{0,1\}|../../|g" \ - ${fname} > ${fname}.tmpfile && mv ${fname}.tmpfile ${fname}; \ -done - -for fname in $(find "$FB_SDK_BUILD_PACKAGE_SAMPLES" -name "Project.xcconfig" -print); do \ -sed "s|../../build\(/tv\)\{0,1\}|../../|g" \ -${fname} > ${fname}.tmpfile && mv ${fname}.tmpfile ${fname}; \ -done - -for fname in $(find "$FB_SDK_BUILD_PACKAGE_SAMPLES" -name "project.pbxproj" -print); do \ -sed 's|\(path[[:space:]]*=[[:space:]]*\.\.\(/\.\.\)*\)/build\(/tv\)\{0,1\}|\1|g' \ -${fname} > ${fname}.tmpfile && mv ${fname}.tmpfile ${fname}; \ -done - -# ----------------------------------------------------------------------------- -# Build .zip from package directory -# -progress_message "Building .zip from package directory." -( - cd $FB_SDK_BUILD - ditto -ck --sequesterRsrc $FB_SDK_BUILD_PACKAGE $FB_SDK_ZIP -) - -# ----------------------------------------------------------------------------- -# Done -# -progress_message "Successfully built SDK zip: $FB_SDK_ZIP" -common_success diff --git a/scripts/build_documentation.sh b/scripts/build_documentation.sh deleted file mode 100755 index 70e17a72a..000000000 --- a/scripts/build_documentation.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh -# Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -# -# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, -# copy, modify, and distribute this software in source code or binary form for use -# in connection with the web services and APIs provided by Facebook. -# -# As with any software that integrates with the Facebook platform, your use of -# this software is subject to the Facebook Developer Principles and Policies -# [http://developers.facebook.com/policy/]. This copyright notice shall be -# included in all copies or substantial portions of the software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -# shellcheck disable=SC2039 -# shellcheck disable=SC2140 - -# This script builds the API documentation from source-level comments. -# This script requires jazzy be installed: https://github.com/realm/jazzy - -. "${FB_SDK_SCRIPT:-$(dirname "$0")}/common.sh" - -# Make sure jazzy is installed -hash jazzy >/dev/null || die 'Jazzy is not installed! Run `sudo gem install jazzy`' - -# Then iterate over the kits -KITS=("FBSDKCoreKit" - "FBSDKShareKit" - "FBSDKLoginKit" - "FBSDKPlacesKit" - "AccountKit" - "FBSDKMarketingKit") - -CNT=${#KITS[@]} - -for (( i = 0; i < CNT; i++ )) -do - KITREFDOCS=${KITS[$i]}; - - if [ "$KITREFDOCS" == "FBSDKMarketingKit" ]; then PREFIX="internal/"; else PREFIX=""; fi - - # Actually generate the documentation - jazzy \ - --config "$FB_SDK_ROOT"/.jazzy.yaml \ - --framework-root "$FB_SDK_ROOT"/"$PREFIX$KITREFDOCS" \ - --umbrella-header "$FB_SDK_ROOT"/"$PREFIX$KITREFDOCS"/"$KITREFDOCS"/"$KITREFDOCS".h \ - --output "$FB_SDK_ROOT"/docs/"$KITREFDOCS" \ - --readme /dev/null - - # Zip the result so it can be uploaded easily - pushd $FB_SDK_ROOT/docs/ - zip -r $KITREFDOCS.zip $KITREFDOCS - popd -done - -common_success diff --git a/scripts/build_framework.sh b/scripts/build_framework.sh deleted file mode 100755 index e63b1a908..000000000 --- a/scripts/build_framework.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/sh -# shellcheck disable=SC2038 -# Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -# -# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, -# copy, modify, and distribute this software in source code or binary form for use -# in connection with the web services and APIs provided by Facebook. -# -# As with any software that integrates with the Facebook platform, your use of -# this software is subject to the Facebook Developer Principles and Policies -# [http://developers.facebook.com/policy/]. This copyright notice shall be -# included in all copies or substantial portions of the software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -. "${FB_SDK_SCRIPT:-$(dirname "$0")}/common.sh" - -# process options, valid arguments -c [Debug|Release] -n -s [scheme] -BUILDCONFIGURATION=Debug -NOEXTRAS=1 -SCHEME=BuildAllKits -while getopts ":ntc:s:" OPTNAME -do - case "$OPTNAME" in - "s") - SCHEME=$OPTARG - ;; - "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" - echo " -s scheme (default=BuildAllKits)" - die - ;; - ":") - echo "Missing argument value for option $OPTARG" - die - ;; - *) - # Should not occur - echo "Unknown error while processing options" - die - ;; - esac -done - - -# ----------------------------------------------------------------------------- - -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_ROOT" -(xcodebuild -workspace "${FB_SDK_ROOT}"/FacebookSDK.xcworkspace -scheme "${SCHEME}" -configuration "${BUILDCONFIGURATION}") || die "Failed to build" - -# ----------------------------------------------------------------------------- -# Run unit tests -# - -if [ ${NOEXTRAS:-0} -eq 1 ];then - progress_message "Skipping unit tests." -else - progress_message "Running unit tests." - cd "$FB_SDK_ROOT" - "$FB_SDK_SCRIPT/run_tests.sh" -c $BUILDCONFIGURATION -fi - -# ----------------------------------------------------------------------------- -# Generate strings -# -progress_message "Generating strings" -( - cd "$FB_SDK_ROOT" - find FBSDKCoreKit/ FBSDKShareKit/ FBSDKLoginKit/ FBSDKTVOSKit/ -name "*.m" | xargs genstrings -o FacebookSDKStrings.bundle/Resources/en.lproj/ -) - -# ----------------------------------------------------------------------------- -# Done -# - -progress_message "Framework version info: ${FB_SDK_VERSION_RAW}" -common_success diff --git a/scripts/common.sh b/scripts/common.sh deleted file mode 100755 index e6a7fb9b5..000000000 --- a/scripts/common.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/sh -# Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -# -# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, -# copy, modify, and distribute this software in source code or binary form for use -# in connection with the web services and APIs provided by Facebook. -# -# As with any software that integrates with the Facebook platform, your use of -# this software is subject to the Facebook Developer Principles and Policies -# [http://developers.facebook.com/policy/]. This copyright notice shall be -# included in all copies or substantial portions of the software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -# 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 - # --------------------------------------------------------------------------- - # 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 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 - - # BUILD TARGET - PACAKAGE_FACEBOOK="FacebookSDK" - PACAKAGE_AN="AudienceNetwork" - PACKAGE_BIDDING_KIT="AudienceNetworkBiddingKit" - - # Extract the SDK version from FacebookSDK.h - FB_SDK_VERSION_RAW=$(sed -n 's/.*FBSDK_VERSION_STRING @\"\(.*\)\"/\1/p' "${FB_SDK_ROOT}"/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit.h) - FB_SDK_VERSION_MAJOR=$(echo $FB_SDK_VERSION_RAW | awk -F'.' '{print $1}') - FB_SDK_VERSION_MINOR=$(echo $FB_SDK_VERSION_RAW | awk -F'.' '{print $2}') - FB_SDK_VERSION_REVISION=$(echo $FB_SDK_VERSION_RAW | awk -F'.' '{print $3}') - FB_SDK_VERSION_MAJOR=${FB_SDK_VERSION_MAJOR:-0} - FB_SDK_VERSION_MINOR=${FB_SDK_VERSION_MINOR:-0} - FB_SDK_VERSION_REVISION=${FB_SDK_VERSION_REVISION:-0} - FB_SDK_VERSION=$FB_SDK_VERSION_MAJOR.$FB_SDK_VERSION_MINOR.$FB_SDK_VERSION_REVISION - FB_SDK_VERSION_SHORT=$(echo $FB_SDK_VERSION | sed 's/\.0$//') - - # The path to AudienceNetwork directory - FB_AD_SDK_SCRIPT=$FB_SDK_ROOT/ads/scripts -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 - } -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 diff --git a/scripts/configure_simulator_for_unit_tests.sh b/scripts/configure_simulator_for_unit_tests.sh deleted file mode 100755 index 03c0e7ea2..000000000 --- a/scripts/configure_simulator_for_unit_tests.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -# -# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, -# copy, modify, and distribute this software in source code or binary form for use -# in connection with the web services and APIs provided by Facebook. -# -# As with any software that integrates with the Facebook platform, your use of -# this software is subject to the Facebook Developer Principles and Policies -# [http://developers.facebook.com/policy/]. This copyright notice shall be -# included in all copies or substantial portions of the software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -# 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 3 ]; then - echo "Usage: $0 APP_ID APP_SECRET CLIENT_TOKEN [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 " CLIENT_TOKEN your unit-testing Facebook application's client token" - 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_TEST_CLIENT_TOKEN = $4" >> $1 - echo "IOS_SDK_MACHINE_UNIQUE_USER_KEY = $5" >> $1 - - echo "Wrote test app configuration to: $1" -} - -XCCONFIG_FILE="$FB_SDK_ROOT"/Configurations/TestAppIdAndSecret.xcconfig - -write_xcconfig "$XCCONFIG_FILE" "$1" "$2" "$3" "$4" - - diff --git a/scripts/package/preinstall b/scripts/package/preinstall deleted file mode 100755 index 09b0076a5..000000000 --- a/scripts/package/preinstall +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -# Remove the FBAudienceNetwork beta directory -rm -rf $DSTROOT/Documents/FacebookSDK/FBAudienceNetwork/ diff --git a/scripts/package/productbuild_distribution.xml b/scripts/package/productbuild_distribution.xml deleted file mode 100644 index cf41495e8..000000000 --- a/scripts/package/productbuild_distribution.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - Facebook SDK SDK_VERSION_TO_RELEASE for iOS - - - - - - - - - - FacebookSDK.pkg - - diff --git a/scripts/run.sh b/scripts/run.sh new file mode 100644 index 000000000..78d5147d5 --- /dev/null +++ b/scripts/run.sh @@ -0,0 +1,354 @@ +#!/bin/sh +# Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +# +# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +# copy, modify, and distribute this software in source code or binary form for use +# in connection with the web services and APIs provided by Facebook. +# +# As with any software that integrates with the Facebook platform, your use of +# this software is subject to the Facebook Developer Principles and Policies +# [http://developers.facebook.com/policy/]. This copyright notice shall be +# included in all copies or substantial portions of the software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# shellcheck disable=SC2039 + +# -------------- +# Functions +# -------------- + +# Main +main() { + if [ -z "$SCRIPTS_DIR" ]; then + # Set global variables + + SCRIPTS_DIR=$(realpath "$(dirname "${BASH_SOURCE[0]}")") + SDK_DIR="$(dirname "$SCRIPTS_DIR")" + + SDK_KITS=( + "FBSDKCoreKit" + "FBSDKLoginKit" + "FBSDKShareKit" + "FBSDKPlacesKit" + "FBSDKMarketingKit" + "FBSDKTVOSKit" + "AccountKit" + ) + + VERSION_FILES=( + "Configurations/Version.xcconfig" + "FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit.h" + "AccountKit/AccountKit/Internal/AKFConstants.m" + ) + + MAIN_VERSION_FILE="Configurations/Version.xcconfig" + + FRAMEWORK_NAME="FacebookSDK" + + POD_SPECS=("${SDK_KITS[@]}" "$FRAMEWORK_NAME") + POD_SPECS=("${POD_SPECS[@]/%/.podspec}") + POD_SPECS[6]="AccountKit/${POD_SPECS[6]}" + + CURRENT_VERSION=$(grep -Eo 'FBSDK_PROJECT_VERSION=.*' "$SDK_DIR/$MAIN_VERSION_FILE" | awk -F'=' '{print $2}') + + GIT_REMOTE="https://github.com/facebook/facebook-objc-sdk" + fi + + local command_type="$1" + shift + + case "$command_type" in + "build") build_sdk "$@" ;; + "bump-version") bump_version "$@" ;; + "bump-changelog") bump_changelog "$@" ;; + "check-release-status") check_release_status "$@" ;; + "is-valid-semver") is_valid_semver "$@" ;; + "does-version-exist") does_version_exist "$@" ;; + "release") release_sdk "$@" ;; + "tag-current-version") tag_current_version "$@" ;; + "lint") lint_sdk "$@" ;; + "test-file-upload") + mkdir -p Carthage/Release + echo "This is a test" >>Carthage/Release/file.txt + ;; + "--help" | "help" | *) echo "Check main() for supported commands" ;; + esac +} + +# Bump Version +bump_version() { + local new_version="$1" + + if [ "$new_version" == "$CURRENT_VERSION" ]; then + echo "This version is the same as the current version" + false + return + fi + + if ! is_valid_semver "$new_version"; then + echo "This version isn't a valid semantic versioning" + false + return + fi + + echo "Changing from: $CURRENT_VERSION to: $new_version" + + local version_change_files=( + "${VERSION_FILES[@]}" + "${POD_SPECS[@]}" + ) + + # Replace the previous version to the new version in relative files + for file_path in "${version_change_files[@]}"; do + local full_file_path="$SDK_DIR/$file_path" + + if [ ! -f "$full_file_path" ]; then + echo "*** NOTE: unable to find $full_file_path." + continue + fi + + local temp_file="$full_file_path.tmp" + sed -e "s/$CURRENT_VERSION/$new_version/g" "$full_file_path" >"$temp_file" + if diff "$full_file_path" "$temp_file" >/dev/null; then + echo "*** ERROR: unable to update $full_file_path" + rm "$temp_file" + continue + fi + + mv "$temp_file" "$full_file_path" + done + + bump_changelog "$new_version" +} + +bump_changelog() { + local new_version="$1" + + # Edit Changelog + local updated_changelog="" + + while IFS= read -r line; do + local updated_line + + case "$line" in + "[Full Changelog]("*"$CURRENT_VERSION...HEAD)") + local current_date + current_date=$(date +%Y-%m-%d) + + updated_line="\n""${line/$CURRENT_VERSION/$new_version}""\n\n" + updated_line=$updated_line"## $new_version\n\n" + updated_line=$updated_line"[$current_date]" + updated_line=$updated_line"($GIT_REMOTE/releases/tag/v$new_version) |\n" + updated_line=$updated_line"[Full Changelog]($GIT_REMOTE/compare/v$CURRENT_VERSION...v$new_version)" + ;; + "# Changelog") updated_line=$line ;; + *) updated_line="\n"$line ;; + esac + + updated_changelog=$updated_changelog$updated_line + done <"CHANGELOG.md" + + echo "$updated_changelog" >CHANGELOG.md +} + +# Tag push current version +tag_current_version() { + if ! is_valid_semver "$CURRENT_VERSION"; then + exit 1 + fi + + if does_version_exist "$CURRENT_VERSION"; then + echo "Version $CURRENT_VERSION already exists" + false + return + fi + + git tag -a "v$CURRENT_VERSION" -m "Version $CURRENT_VERSION" + + if [ "$1" == "--push" ]; then + git push origin "v$CURRENT_VERSION" + fi +} + +# Build +build_sdk() { + build_xcode_workspace() { + xcodebuild build \ + -workspace "$1" \ + -sdk "$2" \ + -scheme "$3" \ + -configuration Debug | + xcpretty + } + + build_carthage() { + carthage build --no-skip-current + + if [ "$1" == "--archive" ]; then + for kit in "${SDK_KITS[@]}"; do + if [ -d "$SDK_DIR"/Carthage/Build/iOS/"$kit".framework ] || + [ -d "$SDK_DIR"/Carthage/Build/tvOS/"$kit".framework ]; then + carthage archive "$kit" --output Carthage/Release/ + fi + done + fi + } + + build_docs() { + for kit in "${SDK_KITS[@]}"; do + local prefix + if [ "$kit" == "FBSDKMarketingKit" ]; then prefix="internal/"; else prefix=""; fi + + local header_file="$SDK_DIR/$prefix$kit/$kit/$kit".h + + if [ ! -f "$header_file" ]; then + echo "*** ERROR: unable to document $kit" + continue + fi + + jazzy \ + --config "$SDK_DIR"/.jazzy.yaml \ + --framework-root "$SDK_DIR/$prefix$kit" \ + --umbrella-header "$header_file" \ + --output "$SDK_DIR"/docs/"$kit" + + # Zip the result so it can be uploaded easily + pushd "$SDK_DIR"/docs/ || continue + zip -r "$kit.zip" "$kit" + popd || continue + done + } + + local build_type="$1" + shift + + case "$build_type" in + "carthage") build_carthage "$@" ;; + "docs" | "documentation") build_docs "$@" ;; + "xcode") build_xcode_workspace "$@" ;; + *) echo "Unsupported Build: $build_type" ;; + esac +} + +# Lint +lint_sdk() { + # Lint Podspecs + lint_cocoapods() { + for spec in "${POD_SPECS[@]}"; do + if [ ! -f "$spec" ]; then + echo "*** ERROR: unable to lint $spec" + continue + fi + + pod lib lint "$spec" "$@" + done + } + + local lint_type="$1" + shift + + case "$lint_type" in + "cocoapods") lint_cocoapods "$@" ;; + *) echo "Unsupported Lint: $lint_type" ;; + esac +} + +# Release +release_sdk() { + + # Release Cocoapods + release_cocoapods() { + for spec in "${POD_SPECS[@]}"; do + if [ ! -f "$spec" ]; then + echo "*** ERROR: unable to release $spec" + continue + fi + + pod trunk push "$spec" "$@" + done + } + + local release_type="$1" + shift + + case "$release_type" in + "cocoapods") release_cocoapods "$@" ;; + *) echo "Unsupported Release: $release_type" ;; + esac +} + +# Check Release Status +check_release_status() { + local version_to_check="$1" + local release_success=0 + + if ! is_valid_semver "$version_to_check"; then + echo "$version_to_check isn't a valid semantic versioning" + ((release_success += 1)) + fi + + if ! does_version_exist "$version_to_check"; then + echo "$version_to_check isn't tagged in GitHub" + ((release_success += 1)) + fi + + local pod_info + + for spec in "${POD_SPECS[@]}"; do + if [ ! -f "$spec" ]; then + echo "*** ERROR: unable to release $spec" + continue + fi + + pod_info=$(pod trunk info "${spec/.podspec/}") + + if [[ $pod_info != *"$version_to_check"* ]]; then + echo "$spec hasn't been released yet" + ((release_success += 1)) + fi + done + + case $release_success in + 0) return ;; + *) false ;; + esac +} + +# Proper Semantic Version +is_valid_semver() { + if ! [[ "$1" =~ ^([0-9]{1}|[1-9][0-9]+)\.([0-9]{1}|[1-9][0-9]+)\.([0-9]{1}|[1-9][0-9]+)($|[-+][0-9A-Za-z+.-]+$) ]]; then + false + return + fi +} + +# Check Version Tag Exists +does_version_exist() { + local version_to_check="$1" + + if [ "$version_to_check" == "" ]; then + version_to_check=$CURRENT_VERSION + fi + + if git rev-parse "v$version_to_check" >/dev/null 2>&1; then + return + fi + + if git rev-parse "sdk-version-$version_to_check" >/dev/null 2>&1; then + return + fi + + false +} + +# -------------- +# Main Script +# -------------- + +main "$@" diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh deleted file mode 100755 index a0ea8bb1a..000000000 --- a/scripts/run_tests.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2014-present, Facebook, Inc. All rights reserved. -# -# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, -# copy, modify, and distribute this software in source code or binary form for use -# in connection with the web services and APIs provided by Facebook. -# -# As with any software that integrates with the Facebook platform, your use of -# this software is subject to the Facebook Developer Principles and Policies -# [http://developers.facebook.com/policy/]. This copyright notice shall be -# included in all copies or substantial portions of the software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -. "${FB_SDK_SCRIPT:-$(dirname "$0")}/common.sh" - -# process options, valid arguments -c [Debug|Release] -n -BUILDCONFIGURATION=Debug -SCHEMES="BuildAllKits FBSDKIntegrationTests samples" - -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 " BuildAllKits: unit tests" - echo " FBSDKIntegrationTests: integration tests" - echo " samples: build sample apps" - 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 -# re-map v3 schemes -SCHEMES=${SCHEMES/FacebookSDKTests/BuildAllKits} -SCHEMES=${SCHEMES/FacebookSDKIntegrationTests/FBSDKIntegrationTests} -SCHEMES=${SCHEMES/FacebookSDKApplicationTests/samples} - -cd "$FB_SDK_ROOT" - -for SCHEME in $SCHEMES; do - if [[ $SCHEME == "BuildAllKits" ]]; then - # Build iOS frameworks and run unit tests - ( xcodebuild -workspace FacebookSDK.xcworkspace \ - -scheme "BuildAllKits" \ - -configuration $BUILDCONFIGURATION \ - -sdk iphonesimulator \ - -destination 'platform=iOS Simulator,name=iPhone 6' \ - test - ) || exit $? - - # Build tvOS frameworks - ( xcodebuild -workspace FacebookSDK.xcworkspace \ - -scheme "BuildAllKits_TV" \ - -configuration $BUILDCONFIGURATION \ - -sdk appletvsimulator \ - build - ) || exit $? - elif [[ $SCHEME == "samples" ]]; then - ( cd "$FB_SDK_ROOT/samples/HelloTV" - xcodebuild -project "HelloTV.xcodeproj" -scheme "HelloTV" -sdk appletvsimulator build - ) || exit $? - - FAILED_SAMPLES="" - for SAMPLE in Iconicus RPSSample Scrumptious ShareIt SwitchUserSample; do - ( - cd "$FB_SDK_ROOT/samples/$SAMPLE" - xcodebuild -project "$SAMPLE.xcodeproj" -scheme "$SAMPLE" -sdk iphonesimulator build - ) - if [[ $? -ne 0 ]]; then - FAILED_SAMPLES="$FAILED_SAMPLES $SAMPLE" - fi - done - if [[ -n $FAILED_SAMPLES ]]; then - die "Failed to build $FAILED_SAMPLES" - fi - else - COMMAND="xcodebuild - -workspace FacebookSDK.xcworkspace \ - -scheme $SCHEME \ - -configuration $BUILDCONFIGURATION \ - -sdk iphonesimulator \ - -destination 'platform=iOS Simulator,name=iPhone 6' \ - test" - eval $COMMAND || die "Error while running tests ($COMMAND)" - fi -done diff --git a/scripts/test_scripts.sh b/scripts/test_scripts.sh new file mode 100755 index 000000000..d975d141b --- /dev/null +++ b/scripts/test_scripts.sh @@ -0,0 +1,282 @@ +#!/bin/sh +# Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +# +# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +# copy, modify, and distribute this software in source code or binary form for use +# in connection with the web services and APIs provided by Facebook. +# +# As with any software that integrates with the Facebook platform, your use of +# this software is subject to the Facebook Developer Principles and Policies +# [http://developers.facebook.com/policy/]. This copyright notice shall be +# included in all copies or substantial portions of the software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# shellcheck disable=SC2039 +# shellcheck disable=SC1090 + +# -------------- +# Functions +# -------------- + +# Main +main() { + TEST_FAILURES=$((0)) + + test_shared_setup + test_run_routing + test_is_valid_semver + test_does_version_exist + test_check_release_status + + case $TEST_FAILURES in + 0) test_success "test_scripts tests" ;; + *) test_failure "$TEST_FAILURES test_scripts tests" ;; + esac +} + +# Test Success +test_success() { + local green='\033[0;32m' + local none='\033[0m' + echo "${green}* Passed:${none} $*" +} + +# Test Failure +test_failure() { + local red='\033[0;31m' + local none='\033[0m' + echo "${red}* Failed:${none} $*" +} + +# Test Shared Setup +test_shared_setup() { + + # Arrange + local test_sdk_kits=( + "FBSDKCoreKit" + "FBSDKLoginKit" + "FBSDKShareKit" + "FBSDKPlacesKit" + "FBSDKMarketingKit" + "FBSDKTVOSKit" + "AccountKit" + ) + + local test_pod_specs=( + "FBSDKCoreKit.podspec" + "FBSDKLoginKit.podspec" + "FBSDKShareKit.podspec" + "FBSDKPlacesKit.podspec" + "FBSDKMarketingKit.podspec" + "FBSDKTVOSKit.podspec" + "AccountKit/AccountKit.podspec" + "FacebookSDK.podspec" + ) + + local test_version_change_files=( + "Configurations/Version.xcconfig" + "FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit.h" + "AccountKit/AccountKit/Internal/AKFConstants.m" + ) + + local test_main_version_file="Configurations/Version.xcconfig" + + local test_current_version + test_current_version=$(grep -Eo 'FBSDK_PROJECT_VERSION=.*' "$PWD/$test_main_version_file" | awk -F'=' '{print $2}') + + if [ ! -f "$PWD/scripts/run.sh" ]; then + test_failure "You're not in the correct working directory. Please change to the scripts/ parent directory" + fi + + # Act + . "$PWD/scripts/run.sh" + + # Assert + if [ -z "$SCRIPTS_DIR" ]; then + test_failure "SCRIPTS_DIR" + ((TEST_FAILURES += 1)) + fi + + if [ "$SCRIPTS_DIR" != "$SDK_DIR"/scripts ]; then + test_failure "SCRIPTS_DIR not correct" + ((TEST_FAILURES += 1)) + fi + + if [ "${SDK_KITS[*]}" != "${test_sdk_kits[*]}" ]; then + test_failure "SDK_KITS not correct" + ((TEST_FAILURES += 1)) + fi + + if [ "${POD_SPECS[*]}" != "${test_pod_specs[*]}" ]; then + test_failure "POD_SPECS not correct" + ((TEST_FAILURES += 1)) + fi + + if [ "${VERSION_FILES[*]}" != "${test_version_change_files[*]}" ]; then + test_failure "VERSION_FILES not correct" + ((TEST_FAILURES += 1)) + fi + + if [ "$MAIN_VERSION_FILE" != "$test_main_version_file" ]; then + test_failure "MAIN_VERSION_FILE not correct" + ((TEST_FAILURES += 1)) + fi + + if [ "$FRAMEWORK_NAME" != "FacebookSDK" ]; then + test_failure "FRAMEWORK_NAME not correct" + ((TEST_FAILURES += 1)) + fi + + if [ "$CURRENT_VERSION" != "$test_current_version" ]; then + test_failure "CURRENT_VERSION not correct" + ((TEST_FAILURES += 1)) + fi + + if [ "$GIT_REMOTE" != "https://github.com/facebook/facebook-objc-sdk" ]; then + test_failure "GIT_REMOTE not correct" + ((TEST_FAILURES += 1)) + fi +} + +test_is_valid_semver() { + # Arrange + local proper_versions=( + "0.0.0" + "1.0.0" + "0.1.0" + "0.0.1" + "0.1.1" + "10.1.0" + "100.1.0" + "10.10.10" + "1.9.0" + "1.10.0" + "1.11.0" + "1.0.0-alpha" + "1.0.0-alpha.1" + "1.0.0-0.3.7" + "1.0.0-x.7.z.92" + "1.0.0-alpha+001" + "1.0.0+alpha-001" + "1.0.0+20130313144700" + "1.0.0-beta+exp.sha.5114f85" + "1.0.0-alpha" + "1.0.0-alpha.1" + "1.0.0-alpha.beta" + "1.0.0-beta" + "1.0.0-beta.2" + "1.0.0-beta.11" + "1.0.0-rc.1" + ) + + # Act + for version in "${proper_versions[@]}"; do + # Assert + if ! sh "$PWD"/scripts/run.sh is-valid-semver "$version"; then + test_failure "$version is valid, but returns false" + ((TEST_FAILURES += 1)) + fi + done + + # Arrange + local improper_versions=( + "1.0." + "0.1" + "10.1.0.1" + "a.b.c" + "1.0.0-" + "01.0.0" + "00.0.0" + "1.01.0" + "0.00.0" + "1.0.00" + "0.0.01" + ) + + # Act + for version in "${improper_versions[@]}"; do + # Assert + if sh "$PWD"/scripts/run.sh is-valid-semver "$version"; then + test_failure "$version is invalid, but returns true" + fi + done +} + +# Test Build SDK +test_run_routing() { + # Arrange + local inputs=( + "build unsupported" + "lint unsupported" + "release unsupported" + "help" + "--help" + "" + "unsupported" + ) + + local expected=( + "Unsupported Build: unsupported" + "Unsupported Lint: unsupported" + "Unsupported Release: unsupported" + "Check main() for supported commands" + "Check main() for supported commands" + "Check main() for supported commands" + "Check main() for supported commands" + ) + + # Act + for i in "${!inputs[@]}"; do + local input_string="${inputs[$i]}" + IFS=" " read -r -a input_params <<<"$input_string" + + local actual + actual=$(sh "$PWD"/scripts/run.sh "${input_params[@]}") + + # Assert + if [ "$actual" != "${expected[$i]}" ]; then + test_failure "expected: ${expected[$i]} but got: $actual" + ((TEST_FAILURES += 1)) + fi + done +} + +test_does_version_exist() { + # Arrange, Act, & Assert + + if ! sh "$PWD"/scripts/run.sh does-version-exist; then + test_failure "Current version is valid, but returns false" + ((TEST_FAILURES += 1)) + fi + + if ! sh "$PWD"/scripts/run.sh does-version-exist 4.40.0; then + test_failure "4.40.0 is valid, but returns false" + ((TEST_FAILURES += 1)) + fi + + if sh "$PWD"/scripts/run.sh does-version-exist 0.0.0; then + test_failure "0.0.0 is valid, but returns true" + ((TEST_FAILURES += 1)) + fi +} + +test_check_release_status() { + # Arrange, Act, & Assert + + if ! sh "$PWD"/scripts/run.sh check-release-status 4.38.0; then + test_failure "Version 4.40.0 is valid, but returns false" + ((TEST_FAILURES += 1)) + fi +} + +# -------------- +# Main Script +# -------------- + +main "$@" diff --git a/scripts/install_docsets.sh b/scripts/travis/before_install.sh old mode 100755 new mode 100644 similarity index 68% rename from scripts/install_docsets.sh rename to scripts/travis/before_install.sh index 68dffb29f..cefa80a41 --- a/scripts/install_docsets.sh +++ b/scripts/travis/before_install.sh @@ -1,5 +1,4 @@ #!/bin/sh -# # Copyright (c) 2014-present, Facebook, Inc. All rights reserved. # # You are hereby granted a non-exclusive, worldwide, royalty-free license to use, @@ -18,18 +17,8 @@ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# This script installs the docsets in the current folder into the user's ~/Library -( -cd "$(dirname "$0")" -DESTINATION="$HOME/Library/Developer/Shared/Documentation/DocSets/" -echo "This script will install the docsets in the current folder into $DESTINATION" -select yn in "Yes" "No"; do - case $yn in - Yes ) - \ls -d *.docset | xargs -I {} cp -R {} $DESTINATION - echo "Installation complete. Please restart Xcode." - break;; - No ) exit;; - esac -done -) \ No newline at end of file +# -------------- +# Main Script +# -------------- + +brew update diff --git a/scripts/travis/install.sh b/scripts/travis/install.sh new file mode 100644 index 000000000..166bda44f --- /dev/null +++ b/scripts/travis/install.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +# +# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +# copy, modify, and distribute this software in source code or binary form for use +# in connection with the web services and APIs provided by Facebook. +# +# As with any software that integrates with the Facebook platform, your use of +# this software is subject to the Facebook Developer Principles and Policies +# [http://developers.facebook.com/policy/]. This copyright notice shall be +# included in all copies or substantial portions of the software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# -------------- +# Main Script +# -------------- + +bundle install +brew bundle diff --git a/scripts/travis/script.sh b/scripts/travis/script.sh new file mode 100644 index 000000000..85b47b32d --- /dev/null +++ b/scripts/travis/script.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +# +# You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +# copy, modify, and distribute this software in source code or binary form for use +# in connection with the web services and APIs provided by Facebook. +# +# As with any software that integrates with the Facebook platform, your use of +# this software is subject to the Facebook Developer Principles and Policies +# [http://developers.facebook.com/policy/]. This copyright notice shall be +# included in all copies or substantial portions of the software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# -------------- +# Main Script +# -------------- + +BUILD_TYPE=$(echo "$TRAVIS_JOB_NAME" | awk '{print $1}' | tr '[:upper:]' '[:lower:]') +sh scripts/run.sh build "$BUILD_TYPE" "$XCODE_WORKSPACE" "$XCODE_SDK" "$XCODE_SCHEME" diff --git a/scripts/build-universal-framework.sh b/scripts/xcode/build-universal-framework.sh similarity index 69% rename from scripts/build-universal-framework.sh rename to scripts/xcode/build-universal-framework.sh index 4cb13ab59..b00f77784 100755 --- a/scripts/build-universal-framework.sh +++ b/scripts/xcode/build-universal-framework.sh @@ -17,26 +17,32 @@ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -UNIVERSAL_OUTPUT_FOLDER=../build/ +# -------------- +# Main Script +# -------------- + +UNIVERSAL_BUILD_FOLDER=../build/ + +echo "ECHO: $UNIVERSAL_BUILD_FOLDER" # make the output directory and delete the framework directory -mkdir -p "${UNIVERSAL_OUTPUT_FOLDER}" -rm -rf "${UNIVERSAL_OUTPUT_FOLDER}/${PROJECT_NAME}.framework" +mkdir -p "${UNIVERSAL_BUILD_FOLDER}" +rm -rf "${UNIVERSAL_BUILD_FOLDER}/${PROJECT_NAME}.framework" # Step 1. Build Device and Simulator versions -xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" -xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphonesimulator BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" +xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration "${CONFIGURATION}" -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" +xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration "${CONFIGURATION}" -sdk iphonesimulator BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" # Step 2. Copy the framework structure to the universal folder -cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUT_FOLDER}/" +cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework" "${UNIVERSAL_BUILD_FOLDER}/" # Step 3. Create universal binary file using lipo and place the combined executable in the copied framework directory -lipo -create -output "${UNIVERSAL_OUTPUT_FOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}" +lipo -create -output "${UNIVERSAL_BUILD_FOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}" # Step 4. Copy strings bundle if exists STRINGS_INPUT_FOLDER="${PROJECT_NAME}Strings.bundle" if [ -d "${STRINGS_INPUT_FOLDER}" ]; then - STRINGS_OUTPUT_FOLDER="${UNIVERSAL_OUTPUT_FOLDER}/${PROJECT_NAME}Strings.bundle" + STRINGS_OUTPUT_FOLDER="${UNIVERSAL_BUILD_FOLDER}/${PROJECT_NAME}Strings.bundle" rm -rf "${STRINGS_OUTPUT_FOLDER}" cp -R "${STRINGS_INPUT_FOLDER}" "${STRINGS_OUTPUT_FOLDER}" fi diff --git a/scripts/build-universal-tvos-framework.sh b/scripts/xcode/build-universal-tvos-framework.sh similarity index 68% rename from scripts/build-universal-tvos-framework.sh rename to scripts/xcode/build-universal-tvos-framework.sh index 6f9b1d6fa..8386e9fb3 100755 --- a/scripts/build-universal-tvos-framework.sh +++ b/scripts/xcode/build-universal-tvos-framework.sh @@ -17,20 +17,24 @@ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -UNIVERSAL_OUTPUTFOLDER=../build/tv/ +# -------------- +# Main Script +# -------------- + +UNIVERSAL_TV_BUILD_FOLDER=../build/tv/ # make the output directory and delete the framework directory -mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" -rm -rf "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework" +mkdir -p "${UNIVERSAL_TV_BUILD_FOLDER}" +rm -rf "${UNIVERSAL_TV_BUILD_FOLDER}/${PROJECT_NAME}.framework" # Step 1. Build Device and Simulator versions -xcodebuild -target "${PROJECT_NAME}_TV" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk appletvos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build -xcodebuild -target "${PROJECT_NAME}_TV" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk appletvsimulator BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build +xcodebuild -target "${PROJECT_NAME}_TV" ONLY_ACTIVE_ARCH=NO -configuration "${CONFIGURATION}" -sdk appletvos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build +xcodebuild -target "${PROJECT_NAME}_TV" ONLY_ACTIVE_ARCH=NO -configuration "${CONFIGURATION}" -sdk appletvsimulator BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build # Step 2. Copy the framework structure to the universal folder -cp -R "${BUILD_DIR}/${CONFIGURATION}-appletvos/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/" +cp -R "${BUILD_DIR}/${CONFIGURATION}-appletvos/${PROJECT_NAME}.framework" "${UNIVERSAL_TV_BUILD_FOLDER}/" # Step 3. Create universal binary file using lipo and place the combined executable in the copied framework directory -lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}" \ -"${BUILD_DIR}/${CONFIGURATION}-appletvsimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}" \ -"${BUILD_DIR}/${CONFIGURATION}-appletvos/${PROJECT_NAME}.framework/${PROJECT_NAME}" +lipo -create -output "${UNIVERSAL_TV_BUILD_FOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}" \ + "${BUILD_DIR}/${CONFIGURATION}-appletvsimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}" \ + "${BUILD_DIR}/${CONFIGURATION}-appletvos/${PROJECT_NAME}.framework/${PROJECT_NAME}"