Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ jobs:
id: cache_ndk
uses: actions/cache@v2
with:
path: /tmp/android-ndk-r16b
key: android-ndk-${{ matrix.os }}-r16b
path: /tmp/android-ndk-r21e
key: android-ndk-${{ matrix.os }}-r21e

- name: Check cached NDK
shell: bash
if: steps.cache_ndk.outputs.cache-hit != 'true'
run: |
# If the NDK failed to download from the cache, but there is a
# /tmp/android-ndk-r16b directory, it's incomplete, so remove it.
if [[ -d "/tmp/android-ndk-r16b" ]]; then
# /tmp/android-ndk-r21e directory, it's incomplete, so remove it.
if [[ -d "/tmp/android-ndk-r21e" ]]; then
echo "Removing incomplete download of NDK"
rm -rf /tmp/android-ndk-r16b
rm -rf /tmp/android-ndk-r21e
fi

- name: Update homebrew (avoid bintray errors)
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/cpp-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,11 @@ jobs:
path: firebase-cpp-sdk-ios-tvos-package.tgz

build_and_package_android:
name: build-and-package-android-${{matrix.stl}}
name: build-and-package-android
runs-on: ubuntu-latest
if: ${{ github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == '' }}
strategy:
fail-fast: false
matrix:
stl: ["c++", "gnustl"]
steps:
- name: fetch SDK
uses: actions/checkout@v2.3.1
Expand All @@ -261,18 +259,18 @@ jobs:
id: cache_ndk
uses: actions/cache@v2
with:
path: /tmp/android-ndk-r16b
key: android-ndk-${{ matrix.os }}-r16b
path: /tmp/android-ndk-r21e
key: android-ndk-${{ runner.os }}-r21e

- name: install prerequisites
run: sdk-src/build_scripts/android/install_prereqs.sh

- name: build sdk
run: |
sdk-src/build_scripts/android/build.sh firebase-cpp-sdk-android-${{ matrix.stl }}-build sdk-src ${{ matrix.stl }}
sdk-src/build_scripts/android/package.sh firebase-cpp-sdk-android-${{ matrix.stl }}-build firebase-cpp-sdk-android-${{ matrix.stl }}-package ${{ matrix.stl }}
cd firebase-cpp-sdk-android-${{ matrix.stl }}-package
tar -czhf ../firebase-cpp-sdk-android-${{ matrix.stl}}-package.tgz .
sdk-src/build_scripts/android/build.sh firebase-cpp-sdk-android-build sdk-src
sdk-src/build_scripts/android/package.sh firebase-cpp-sdk-android-build firebase-cpp-sdk-android-package
cd firebase-cpp-sdk-android-package
tar -czhf ../firebase-cpp-sdk-android-package.tgz .

- name: Print built libraries
shell: bash
Expand All @@ -292,8 +290,8 @@ jobs:
- name: upload artifacts
uses: actions/upload-artifact@v2.2.2
with:
name: firebase-cpp-sdk-android-${{ matrix.stl }}-package
path: firebase-cpp-sdk-android-${{ matrix.stl }}-package.tgz
name: firebase-cpp-sdk-android-package
path: firebase-cpp-sdk-android-package.tgz

build_desktop:
name: build-${{ matrix.sdk_platform }}-${{ matrix.architecture }}-${{ matrix.build_type }}-${{ matrix.msvc_runtime }}-${{ matrix.linux_abi }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,8 @@ jobs:
id: cache_ndk
uses: actions/cache@v2
with:
path: /tmp/android-ndk-r16b
key: android-ndk-${{ matrix.os }}-r16b
path: /tmp/android-ndk-r21e
key: android-ndk-${{ matrix.os }}-r21e
- name: Setup python
uses: actions/setup-python@v2
with:
Expand Down
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ option(FIREBASE_GITHUB_ACTION_BUILD
option(FIREBASE_QUICK_TEST
"Enable quick tests will skip tests which requires access to the SECRET" OFF)

set(FIREBASE_ANDROID_STL "" CACHE STRING "STL implementation to use.")
if (NOT FIREBASE_ANDROID_STL STREQUAL "")
set(ANDROID_STL ${FIREBASE_ANDROID_STL})
endif()

set(FIREBASE_PYTHON_EXECUTABLE "python" CACHE FILEPATH
"The Python interpreter to use, such as one from a venv")

Expand Down
8 changes: 1 addition & 7 deletions admob/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ allprojects {

apply plugin: 'com.android.library'

ext {
firebaseAndroidStl = System.getenv('FIREBASE_ANDROID_STL')
firebaseAndroidStl = firebaseAndroidStl != null ? firebaseAndroidStl : ''
}

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
Expand Down Expand Up @@ -71,8 +66,7 @@ android {
// Only include needed project.
arguments '-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON',
'-DFIREBASE_INCLUDE_LIBRARY_DEFAULT=OFF',
'-DFIREBASE_INCLUDE_ADMOB=ON',
"-DFIREBASE_ANDROID_STL=${firebaseAndroidStl}"
'-DFIREBASE_INCLUDE_ADMOB=ON'
}
}
}
Expand Down
8 changes: 1 addition & 7 deletions analytics/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ allprojects {

apply plugin: 'com.android.library'

ext {
firebaseAndroidStl = System.getenv('FIREBASE_ANDROID_STL')
firebaseAndroidStl = firebaseAndroidStl != null ? firebaseAndroidStl : ''
}

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
Expand Down Expand Up @@ -71,8 +66,7 @@ android {
// Only include needed project.
arguments '-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON',
'-DFIREBASE_INCLUDE_LIBRARY_DEFAULT=OFF',
'-DFIREBASE_INCLUDE_ANALYTICS=ON',
"-DFIREBASE_ANDROID_STL=${firebaseAndroidStl}"
'-DFIREBASE_INCLUDE_ANALYTICS=ON'
}
}
}
Expand Down
8 changes: 1 addition & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ allprojects {

apply plugin: 'com.android.library'

ext {
firebaseAndroidStl = System.getenv('FIREBASE_ANDROID_STL')
firebaseAndroidStl = firebaseAndroidStl != null ? firebaseAndroidStl : ''
}

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
Expand Down Expand Up @@ -67,8 +62,7 @@ android {
cmake {
targets 'firebase_app'
// Don't configure all the cmake subprojects.
arguments '-DFIREBASE_INCLUDE_LIBRARY_DEFAULT=OFF',
"-DFIREBASE_ANDROID_STL=${firebaseAndroidStl}"
arguments '-DFIREBASE_INCLUDE_LIBRARY_DEFAULT=OFF'
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions app/src/include/firebase/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ namespace internal {
class AppInternal;
} // namespace internal

#if FIREBASE_PLATFORM_ANDROID && defined(__GLIBCXX__)
#warning \
"Firebase support for gnustl is deprecated and will be removed in the next major release. Please use libc++ instead."
#endif

/// @brief Reports whether a Firebase module initialized successfully.
enum InitResult {
/// The given library was successfully initialized.
Expand Down
8 changes: 1 addition & 7 deletions auth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ allprojects {

apply plugin: 'com.android.library'

ext {
firebaseAndroidStl = System.getenv('FIREBASE_ANDROID_STL')
firebaseAndroidStl = firebaseAndroidStl != null ? firebaseAndroidStl : ''
}

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
Expand Down Expand Up @@ -71,8 +66,7 @@ android {
// Only include needed project.
arguments '-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON',
'-DFIREBASE_INCLUDE_LIBRARY_DEFAULT=OFF',
'-DFIREBASE_INCLUDE_AUTH=ON',
"-DFIREBASE_ANDROID_STL=${firebaseAndroidStl}"
'-DFIREBASE_INCLUDE_AUTH=ON'
}
}
}
Expand Down
41 changes: 13 additions & 28 deletions build_scripts/android/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

buildpath=$1
sourcepath=$2
stl=$3

if [[ -z "${buildpath}" || -z "${sourcepath}" ]]; then
echo "Usage: $0 <build path> <source path> [c++|gnustl]"
echo "Usage: $0 <build path> <source path> [c++]"
exit 1
fi

Expand All @@ -16,14 +15,6 @@ if [[ ! -d "${sourcepath}" ]]; then
exit 2
fi

if [[ "${stl}" == "c++" || "${stl}" == "gnustl" ]]; then
export FIREBASE_ANDROID_STL="${stl}"_static
elif [[ ! -z "${stl}" ]]; then
echo "Invalid STL specified."
echo "Valid STLs are: 'c++' (default) or 'gnustl'"
exit 2
fi

origpath=$( pwd -P )

mkdir -p "${buildpath}"
Expand All @@ -36,21 +27,15 @@ absbuildpath=$( pwd -P )
cd "${origpath}"

# If NDK_ROOT is not set or is the wrong version, use to the version in /tmp.
if [[ -z "${NDK_ROOT}" || ! $(grep -q "Pkg\.Revision = 16\." "${NDK_ROOT}/source.properties") ]]; then
if [[ ! -d /tmp/android-ndk-r16b ]]; then
echo "Recommended NDK version r16b not present in /tmp."
if [[ ! -z "${stl}" ]]; then
echo "STL may only be specified if using the recommended NDK version."
echo "Please run install_prereqs.sh script and try again."
exit 2
else
echo "Please run install_prereqs.sh if you wish to use the recommended NDK version."
echo "Continuing with default NDK..."
sleep 2
fi
if [[ -z "${NDK_ROOT}" || ! $(grep -q "Pkg\.Revision = 21\." "${NDK_ROOT}/source.properties") ]]; then
if [[ ! -d /tmp/android-ndk-r21e ]]; then
echo "Recommended NDK version r21e not present in /tmp."
echo "Please run install_prereqs.sh if you wish to use the recommended NDK version."
echo "Continuing with default NDK..."
sleep 2
fi
export NDK_ROOT=/tmp/android-ndk-r16b
export ANDROID_NDK_HOME=/tmp/android-ndk-r16b
export NDK_ROOT=/tmp/android-ndk-r21e
export ANDROID_NDK_HOME=/tmp/android-ndk-r21e
fi
cd "${sourcepath}"
set +e
Expand All @@ -72,16 +57,16 @@ set -e
declare -a paths
for lib in *; do
if [[ -d "${lib}/build" ]]; then
paths+=("${lib}/build")
paths+=("${lib}/build")
fi
if [[ -d "${lib}/.externalNativeBuild" ]]; then
paths+=("${lib}/.externalNativeBuild")
paths+=("${lib}/.externalNativeBuild")
fi
if [[ -d "${lib}/${lib}_resources/build" ]]; then
paths+=("${lib}/${lib}_resources/build")
paths+=("${lib}/${lib}_resources/build")
fi
if [[ -d "${lib}/${lib}_java/build" ]]; then
paths+=("${lib}/${lib}_java/build")
paths+=("${lib}/${lib}_java/build")
fi
done
set -x
Expand Down
50 changes: 25 additions & 25 deletions build_scripts/android/install_prereqs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ else
# Retry up to 10 times because Curl has a tendency to timeout on
# Github runners.
for retry in {1..10} error; do
if [[ $retry == "error" ]]; then exit 5; fi
curl -LSs \
if [[ $retry == "error" ]]; then exit 5; fi
curl -LSs \
"https://download.sysinternals.com/files/Strings.zip" \
--output Strings.zip && break
sleep 300
sleep 300
done
set -e
unzip -q Strings.zip && rm -f Strings.zip
Expand Down Expand Up @@ -60,29 +60,29 @@ if [[ -z "${ANDROID_HOME}" ]]; then
exit 1
fi

if [[ -z "${NDK_ROOT}" || -z $(grep "Pkg\.Revision = 16\." "${NDK_ROOT}/source.properties") ]]; then
if [[ -d /tmp/android-ndk-r16b && \
-n $(grep "Pkg\.Revision = 16\." "/tmp/android-ndk-r16b/source.properties") ]]; then
echo "Using NDK r16b in /tmp/android-ndk-r16b".
if [[ -z "${NDK_ROOT}" || -z $(grep "Pkg\.Revision = 21\." "${NDK_ROOT}/source.properties") ]]; then
if [[ -d /tmp/android-ndk-r21e && \
-n $(grep "Pkg\.Revision = 21\." "/tmp/android-ndk-r21e/source.properties") ]]; then
echo "Using NDK r21e in /tmp/android-ndk-r21e".
else
echo "NDK_ROOT environment variable is not set, or NDK version is incorrect."
echo "This build requires NDK r16b for STLPort compatibility, downloading..."
if [[ -z $(which curl) ]]; then
echo "Error, could not run 'curl' to download NDK. Is it in your PATH?"
exit 1
fi
set +e
# Retry up to 10 times because Curl has a tendency to timeout on
# Github runners.
for retry in {1..10} error; do
if [[ $retry == "error" ]]; then exit 5; fi
curl --http1.1 -LSs \
"https://dl.google.com/android/repository/android-ndk-r16b-${platform}-x86_64.zip" \
--output /tmp/android-ndk-r16b.zip && break
sleep 300
done
set -e
(cd /tmp && unzip -oq android-ndk-r16b.zip && rm -f android-ndk-r16b.zip)
echo "NDK r16b has been downloaded into /tmp/android-ndk-r16b"
echo "This build recommends NDK r21e, downloading..."
if [[ -z $(which curl) ]]; then
echo "Error, could not run 'curl' to download NDK. Is it in your PATH?"
exit 1
fi
set +e
# Retry up to 10 times because Curl has a tendency to timeout on
# Github runners.
for retry in {1..10} error; do
if [[ $retry == "error" ]]; then exit 5; fi
curl --http1.1 -LSs \
"https://dl.google.com/android/repository/android-ndk-r21e-${platform}-x86_64.zip" \
--output /tmp/android-ndk-r21e.zip && break
sleep 300
done
set -e
(cd /tmp && unzip -oq android-ndk-r21e.zip && rm -f android-ndk-r21e.zip)
echo "NDK r21e has been downloaded into /tmp/android-ndk-r21e"
fi
fi
16 changes: 4 additions & 12 deletions build_scripts/android/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,14 @@

# Copyright 2020 Google LLC

readonly -a allowed_stl_variants=("c++" "gnustl")
builtpath=$1
packagepath=$2
stl=$3

if [[ -z "${builtpath}" || -z "${packagepath}" || -z "${stl}" ]]; then
echo "Usage: $0 <built Android SDK path> <path to put packaged files into> <STL variant>"
echo "STL variant is one of: ${allowed_stl_variants[*]}"
if [[ -z "${builtpath}" || -z "${packagepath}" ]]; then
echo "Usage: $0 <built Android SDK path> <path to put packaged files into>"
exit 1
fi

if [[ ! " ${allowed_stl_variants[@]} " =~ " ${stl} " ]]; then
echo "Invalid STL variant '${stl}'. Allowed STL variants: ${allowed_stl_variants[*]}"
exit 2
fi

if [[ ! -d "${builtpath}/app/build" ]]; then
echo "Built Android SDK not found at path '${builtpath}'."
exit 2
Expand All @@ -38,7 +30,7 @@ cd "${origpath}"

mkdir -p "${destpath}/libs/android"

# Copy each platform's libraries to the destination directory for this STL variant.
# Copy each platform's libraries to the destination directory.
cd "${sourcepath}"
# Make sure we only copy the libraries in product_list (specified in packaging.conf)
for product in ${product_list[*]}; do
Expand All @@ -49,7 +41,7 @@ for product in ${product_list[*]}; do
for cpudir in "${dir}"/*; do
cpu=$(basename ${cpudir})
libsrc="${sourcepath}/${cpudir}/libfirebase_${product}.a"
libdest="${destpath}/libs/android/${cpu}/${stl}"
libdest="${destpath}/libs/android/${cpu}"
mkdir -p "${libdest}"
cp -f "${libsrc}" "${libdest}/"
done
Expand Down
Loading