diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build.sh | 7 | ||||
-rwxr-xr-x | scripts/check_test_inclusion.py | 106 | ||||
-rwxr-xr-x | scripts/if_changed.sh | 3 | ||||
-rwxr-xr-x | scripts/if_cron.sh | 25 | ||||
-rwxr-xr-x | scripts/install_prereqs.sh | 34 | ||||
-rwxr-xr-x | scripts/pod_install.sh | 54 | ||||
-rwxr-xr-x | scripts/push-pods.sh | 20 | ||||
-rwxr-xr-x | scripts/update-tags.sh | 48 |
8 files changed, 194 insertions, 103 deletions
diff --git a/scripts/build.sh b/scripts/build.sh index b024e9f..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' \ 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/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 - diff --git a/scripts/push-pods.sh b/scripts/push-pods.sh index 2fb8eaa..9f4c303 100755 --- a/scripts/push-pods.sh +++ b/scripts/push-pods.sh @@ -22,20 +22,20 @@ # investigation. pod cache clean FirebaseCore --all -pod cache clean FirebaseAuth --all -pod cache clean FirebaseDatabase --all +#pod cache clean FirebaseAuth --all +#pod cache clean FirebaseDatabase --all pod cache clean FirebaseFirestore --all -pod cache clean FirebaseFunctions --all -pod cache clean FirebaseMessaging --all -pod cache clean FirebaseStorage --all +#pod cache clean FirebaseFunctions --all +#pod cache clean FirebaseMessaging --all +#pod cache clean FirebaseStorage --all pod repo push cpdc-internal-spec FirebaseCore.podspec -pod repo push cpdc-internal-spec FirebaseAuth.podspec -pod repo push cpdc-internal-spec FirebaseDatabase.podspec +#pod repo push cpdc-internal-spec FirebaseAuth.podspec +#pod repo push cpdc-internal-spec FirebaseDatabase.podspec pod repo push cpdc-internal-spec FirebaseFirestore.podspec --allow-warnings -pod repo push cpdc-internal-spec FirebaseFunctions.podspec -pod repo push cpdc-internal-spec FirebaseMessaging.podspec -pod repo push cpdc-internal-spec FirebaseStorage.podspec +#pod repo push cpdc-internal-spec FirebaseFunctions.podspec +#pod repo push cpdc-internal-spec FirebaseMessaging.podspec +#pod repo push cpdc-internal-spec FirebaseStorage.podspec # FirebaseFirestore warning (no plan to fix) # https://github.com/firebase/firebase-ios-sdk/issues/1143 diff --git a/scripts/update-tags.sh b/scripts/update-tags.sh index 64cf1ce..0c018c3 100755 --- a/scripts/update-tags.sh +++ b/scripts/update-tags.sh @@ -27,35 +27,35 @@ # Delete any existing tags at origin -git push --delete origin '5.0.0' -git push --delete origin 'Core-5.0.0' -git push --delete origin 'Auth-5.0.0' -git push --delete origin 'Database-5.0.0' -git push --delete origin 'Firestore-0.12.0' -git push --delete origin 'Functions-2.0.0' -git push --delete origin 'Messaging-3.0.0' -git push --delete origin 'Storage-3.0.0' +git push --delete origin '5.0.1' +git push --delete origin 'Core-5.0.1' +#git push --delete origin 'Auth-5.0.0' +#git push --delete origin 'Database-5.0.0' +git push --delete origin 'Firestore-0.12.1' +#git push --delete origin 'Functions-2.0.0' +#git push --delete origin 'Messaging-3.0.0' +#git push --delete origin 'Storage-3.0.0' # Delete local tags -git tag --delete '5.0.0' -git tag --delete 'Core-5.0.0' -git tag --delete 'Auth-5.0.0' -git tag --delete 'Database-5.0.0' -git tag --delete 'Firestore-0.12.0' -git tag --delete 'Functions-2.0.0' -git tag --delete 'Messaging-3.0.0' -git tag --delete 'Storage-3.0.0' +git tag --delete '5.0.1' +git tag --delete 'Core-5.0.1' +#git tag --delete 'Auth-5.0.0' +#git tag --delete 'Database-5.0.0' +git tag --delete 'Firestore-0.12.1' +#git tag --delete 'Functions-2.0.0' +#git tag --delete 'Messaging-3.0.0' +#git tag --delete 'Storage-3.0.0' # Add and push the tags -git tag '5.0.0' -git tag 'Core-5.0.0' -git tag 'Auth-5.0.0' -git tag 'Database-5.0.0' -git tag 'Firestore-0.12.0' -git tag 'Functions-2.0.0' -git tag 'Messaging-3.0.0' -git tag 'Storage-3.0.0' +git tag '5.0.1' +git tag 'Core-5.0.1' +#git tag 'Auth-5.0.0' +#git tag 'Database-5.0.0' +git tag 'Firestore-0.12.1' +#git tag 'Functions-2.0.0' +#git tag 'Messaging-3.0.0' +#git tag 'Storage-3.0.0' git push origin --tags |