aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build.sh13
-rwxr-xr-xscripts/check_test_inclusion.py106
-rwxr-xr-xscripts/if_changed.sh3
-rwxr-xr-xscripts/if_cron.sh25
-rwxr-xr-xscripts/install_prereqs.sh34
-rwxr-xr-xscripts/lint.sh2
-rwxr-xr-xscripts/pod_install.sh54
7 files changed, 167 insertions, 70 deletions
diff --git a/scripts/build.sh b/scripts/build.sh
index ef10059..4d6c230 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -84,7 +84,7 @@ case "$platform" in
iOS)
xcb_flags=(
-sdk 'iphonesimulator'
- -destination 'platform=iOS Simulator,name=iPhone 7'
+ -destination 'platform=iOS Simulator,name=iPhone 8 Plus'
)
;;
@@ -111,6 +111,7 @@ esac
xcb_flags+=(
ONLY_ACTIVE_ARCH=YES
CODE_SIGNING_REQUIRED=NO
+ CODE_SIGNING_ALLOWED=YES
)
# TODO(varconst): --warn-unused-vars - right now, it makes the log overflow on
@@ -179,10 +180,6 @@ case "$product-$method-$platform" in
cd Example
sed -i -e 's/use_frameworks/\#use_frameworks/' Podfile
pod update --no-repo-update
- # Workarounds for https://github.com/CocoaPods/CocoaPods/issues/7592.
- # Remove when updating to CocoaPods 1.5.1
- sed -i -e 's/-l"FirebaseMessaging"//' "Pods/Target Support Files/Pods-Messaging_Tests_iOS/Pods-Messaging_Tests_iOS.debug.xcconfig"
- sed -i -e 's/-l"FirebaseAuth-iOS" -l"FirebaseCore-iOS"//' "Pods/Target Support Files/Pods-Auth_Tests_iOS/Pods-Auth_Tests_iOS.debug.xcconfig"
cd ..
RunXcodebuild \
-workspace 'Example/Firebase.xcworkspace' \
@@ -214,6 +211,12 @@ case "$product-$method-$platform" in
RunXcodebuild \
-workspace 'Firestore/Example/Firestore.xcworkspace' \
+ -scheme "Firestore_IntegrationTests_$platform" \
+ "${xcb_flags[@]}" \
+ build
+
+ RunXcodebuild \
+ -workspace 'Firestore/Example/Firestore.xcworkspace' \
-scheme 'SwiftBuildTest' \
"${xcb_flags[@]}" \
build
diff --git a/scripts/check_test_inclusion.py b/scripts/check_test_inclusion.py
new file mode 100755
index 0000000..7f5f354
--- /dev/null
+++ b/scripts/check_test_inclusion.py
@@ -0,0 +1,106 @@
+#!/usr/bin/env python
+
+# Copyright 2018 Google
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Verifies that all tests are a part of the project file.
+"""
+
+from __future__ import print_function
+import os
+import os.path
+import re
+import sys
+
+
+# Tests that are known not to compile in Xcode and can't be added there.
+EXCLUDED = frozenset([
+ # b/79496027
+ "Firestore/core/test/firebase/firestore/remote/serializer_test.cc",
+])
+
+
+def Main():
+ """Runs the style check."""
+
+ tests = FindTestFiles("Firestore/Example/Tests", "Firestore/core/test")
+ problems = CheckProject(
+ "Firestore/Example/Firestore.xcodeproj/project.pbxproj", tests)
+
+ if problems:
+ Error("Test files exist that are unreferenced in Xcode project files:")
+ for problem in problems:
+ Error(problem)
+ sys.exit(1)
+
+ sys.exit(0)
+
+
+def FindTestFiles(*test_dirs):
+ """Searches the given source roots for test files.
+
+ Args:
+ *test_dirs: A list of directories containing test sources.
+
+ Returns:
+ A list of test source filenames.
+ """
+
+ test_file_pattern = re.compile(r"(?:Tests?\.mm?|_test\.(?:cc|mm))$")
+
+ result = []
+ for test_dir in test_dirs:
+ for root, dirs, files in os.walk(test_dir):
+ del dirs # unused
+ for basename in files:
+ filename = os.path.join(root, basename)
+ if filename not in EXCLUDED and test_file_pattern.search(basename):
+ result.append(filename)
+ return result
+
+
+def CheckProject(project_file, test_files):
+ """Checks the given project file for tests in the given test_dirs.
+
+ Args:
+ project_file: The path to an Xcode pbxproj file.
+ test_files: A list of all tests source files in the project.
+
+ Returns:
+ A sorted list of filenames that aren't referenced in the project_file.
+ """
+
+ # An dict of basename to filename
+ basenames = {os.path.basename(f) : f for f in test_files}
+
+ file_list_pattern = re.compile(r"/\* (\S+) in Sources \*/")
+ with open(project_file, "r") as fd:
+ for line in fd:
+ line = line.rstrip()
+ m = file_list_pattern.search(line)
+ if m:
+ basename = m.group(1)
+ if basename in basenames:
+ del basenames[basename]
+
+ return sorted(basenames.values())
+
+
+def Error(message, *args):
+ message %= args
+ print(message, file=sys.stderr)
+
+
+if __name__ == "__main__":
+ Main()
diff --git a/scripts/if_changed.sh b/scripts/if_changed.sh
index 697cad2..51217d6 100755
--- a/scripts/if_changed.sh
+++ b/scripts/if_changed.sh
@@ -49,7 +49,7 @@ else
check_changes '^(Firebase|Functions|Example)'
;;
- Firestore-xcodebuild)
+ Firestore-xcodebuild|Firestore-pod-lib-lint)
check_changes '^Firestore'
;;
@@ -68,6 +68,7 @@ fi
# Always rebuild if Travis configuration and/or build scripts changed.
check_changes '^.travis.yml'
+check_changes '^Gemfile.lock'
check_changes '^scripts/(build|if_changed).sh'
if [[ "$run" == true ]]; then
diff --git a/scripts/if_cron.sh b/scripts/if_cron.sh
new file mode 100755
index 0000000..c13a374
--- /dev/null
+++ b/scripts/if_cron.sh
@@ -0,0 +1,25 @@
+# Copyright 2018 Google
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Within Travis, check if running in a cron job.
+#
+# Examines the following Travis-supplied environment variables:
+# - TRAVIS_EVENT_TYPE - to check if this is a cron job
+#
+
+if [[ "$TRAVIS_EVENT_TYPE" == "cron" ]]; then
+ "$@"
+else
+ echo "skipped $*"
+fi
diff --git a/scripts/install_prereqs.sh b/scripts/install_prereqs.sh
index c86663f..c943369 100755
--- a/scripts/install_prereqs.sh
+++ b/scripts/install_prereqs.sh
@@ -19,28 +19,44 @@
# - PROJECT - Firebase or Firestore
# - METHOD - xcodebuild or cmake; default is xcodebuild
-if [[ -z "$METHOD" ]]; then
- METHOD="xcodebuild"
-fi
+bundle install
-case "$PROJECT-$METHOD" in
- *-xcodebuild)
- bundle install
+case "$PROJECT-$PLATFORM-$METHOD" in
+ Firebase-iOS-xcodebuild)
gem install xcpretty
+ bundle exec pod install --project-directory=Example --repo-update
+ bundle exec pod install --project-directory=Functions/Example
;;
- Firestore-cmake)
- bundle install
+ Firebase-*-xcodebuild)
+ gem install xcpretty
+ bundle exec pod install --project-directory=Example --repo-update
+ ;;
+
+ Firestore-*-xcodebuild)
+ gem install xcpretty
+ bundle exec pod install --project-directory=Firestore/Example --repo-update
+ ;;
+
+ *-pod-lib-lint)
+ bundle exec pod repo update
+ ;;
+
+ Firestore-*-cmake)
# xcpretty is helpful for the intermediate step which builds FirebaseCore
# using xcodebuild.
gem install xcpretty
brew outdated cmake || brew upgrade cmake
brew outdated go || brew upgrade go # Somehow the build for Abseil requires this.
+ bundle exec pod install --project-directory=Example --repo-update
+ bundle exec pod install --project-directory=Firestore/Example \
+ --no-repo-update
;;
*)
- echo "Unknown project-method combo" 1>&2
+ echo "Unknown project-platform-method combo" 1>&2
echo " PROJECT=$PROJECT" 1>&2
+ echo " PLATFORM=$PLATFORM" 1>&2
echo " METHOD=$METHOD" 1>&2
exit 1
;;
diff --git a/scripts/lint.sh b/scripts/lint.sh
index 9e33c87..d474129 100755
--- a/scripts/lint.sh
+++ b/scripts/lint.sh
@@ -60,7 +60,7 @@ objc_lint_options=(
if [[ $# -gt 0 ]]; then
# Interpret any command-line argument as a revision range
- command=(git diff --name-only)
+ command=(git diff --name-only --diff-filter=ACMR)
git_options+=("$@")
else
diff --git a/scripts/pod_install.sh b/scripts/pod_install.sh
deleted file mode 100755
index ff5ec96..0000000
--- a/scripts/pod_install.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-# Copyright 2018 Google
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Within Travis, installs prerequisites for a build.
-
-# Examines the following configured environment variables that should be
-# specified in an env: block
-# - PROJECT - Firebase or Firestore
-# - METHOD - xcodebuild or cmake; default is xcodebuild
-# - PLATFORM - iOS, macOS, or tvOS
-
-if [[ -z "$METHOD" ]]; then
- METHOD="xcodebuild"
-fi
-
-case "$PROJECT-$METHOD-$PLATFORM" in
- Firebase-xcodebuild-iOS)
- bundle exec pod install --project-directory=Example --repo-update
- bundle exec pod install --project-directory=Functions/Example
- ;;
-
- Firebase-xcodebuild-*)
- bundle exec pod install --project-directory=Example --repo-update
- ;;
-
- Firestore-xcodebuild-*)
- bundle exec pod install --project-directory=Firestore/Example --repo-update
- ;;
-
- Firestore-cmake-*)
- bundle exec pod install --project-directory=Example --repo-update
- bundle exec pod install --project-directory=Firestore/Example \
- --no-repo-update
- ;;
-
- *)
- echo "Unknown project-method combo" 1>&2
- echo " PROJECT=$PROJECT" 1>&2
- echo " METHOD=$METHOD" 1>&2
- exit 1
- ;;
-esac
-