Skip to content

Add Analytics header update to iOS SDK update. #775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Dec 1, 2021
Prev Previous commit
Next Next commit
Remove explicit list of filenames
  • Loading branch information
jonsimantov committed Dec 1, 2021
commit 7b2f93bef9ad96f86d14ebc3c19d417bc4f723b4
42 changes: 27 additions & 15 deletions .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,33 @@ jobs:
sed -i~ "s/^set(version [^)]*)/set(version CocoaPods-${firestore_version})/i" cmake/external/firestore.cmake
# iOS: Update Analytics header files, used for generating constants.
analytics_version=$(grep "pod 'Firebase/Analytics'" ios_pod/Podfile | sed "s/.*'\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)'.*/\1/")
# Download the Firebase Analytics cocoapod.
podtmp="$(mktemp -d)"
cd "${podtmp}"
echo "platform :ios, '14.0'" > Podfile
echo "pod 'Firebase/Analytics', '${analytics_version}'" >> Podfile
pod repo update
pod install || true # ignore error since there is no Xcode project
declare -a header_dirs
header_dirs=(Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.xcframework/*/FirebaseAnalytics.framework/Headers)
header_dir="${header_dirs[0]}" # headers should all be the same
cd -
for ios_header in FIREventNames.h FIRParameterNames.h FIRUserPropertyNames.h; do
cp -vf ${podtmp}/${header_dir}/${ios_header} analytics/ios_headers/${ios_header}
done
rm -rf ${podtmp}
if [[ "$(uname)" == "Darwin"* ]]; then
# Unfortunately we can't just download these headers from GitHub, as
# Analytics is closed-source. If it becomes open-source, we could just
# download the header files from the iOS SDK's release branch. So instead,
# download the Firebase Analytics cocoapod (via a stub project) and get the
# header from there.
podtmp="$(mktemp -d)"
cd "${podtmp}"
echo "platform :ios, '14.0'" > Podfile
echo "pod 'Firebase/Analytics', '${analytics_version}'" >> Podfile
pod repo update
pod install || true # ignore error since there is no Xcode project
declare -a header_dirs
# Get all of the framework header directories from the xcframework.
header_dirs=(Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.xcframework/*/FirebaseAnalytics.framework/Headers)
# Just use the first directory found, the headers should be the same across
# all of the frameworks.
header_dir="${header_dirs[0]}"
cd -
cd analytics/ios_headers
for ios_header in *.h; do
# Each file in this directory matches a file in the Analytics iOS SDK.
cp -vf "${podtmp}/${header_dir}/${ios_header}" .
done
cd -
rm -rf "${podtmp}"
fi
elif [[ ${{ github.event.inputs.updateAndroid }} -eq 1 ]]; then
# Update Android only
echo "Updating Android dependencies only"
Expand Down