2018-03-10 14:08:20 -08:00
|
|
|
# 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, runs the given command if the current project has changes
|
|
|
|
|
# worth building.
|
|
|
|
|
#
|
|
|
|
|
# Examines the following Travis-supplied environment variables:
|
|
|
|
|
# - TRAVIS_PULL_REQUEST - the PR number or false for full build
|
|
|
|
|
# - TRAVIS_COMMIT_RANGE - the range of commits under test; empty on a new
|
|
|
|
|
# branch
|
|
|
|
|
#
|
|
|
|
|
# Also examines the following configured environment variables that should be
|
|
|
|
|
# specified in an env: block
|
|
|
|
|
# - PROJECT - Firebase or Firestore
|
|
|
|
|
# - METHOD - xcodebuild or cmake
|
|
|
|
|
|
|
|
|
|
function check_changes() {
|
|
|
|
|
if git diff --name-only "$TRAVIS_COMMIT_RANGE" | grep -Eq "$1"; then
|
|
|
|
|
run=true
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
run=false
|
|
|
|
|
|
|
|
|
|
# To force Travis to do a full run, change the "false" to "{PR number}" like
|
|
|
|
|
# if [[ "$TRAVIS_PULL_REQUEST" == "904" ]]; then
|
|
|
|
|
if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then
|
|
|
|
|
# Full builds should run everything
|
|
|
|
|
run=true
|
|
|
|
|
|
|
|
|
|
elif [[ -z "$TRAVIS_COMMIT_RANGE" ]]; then
|
|
|
|
|
# First builds on a branch should also run everything
|
|
|
|
|
run=true
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
case "$PROJECT-$METHOD" in
|
2019-02-20 13:31:28 -08:00
|
|
|
Firebase-pod-lib-lint) # Combines Firebase-* and InAppMessaging*
|
2020-06-22 07:26:07 -07:00
|
|
|
check_changes '^(FirebaseAuth|FirebaseDatabase|Firebase/DynamicLinks|'\
|
2020-04-23 14:43:47 -07:00
|
|
|
'FirebaseMessaging|FirebaseStorage|GoogleUtilities|Interop|Example|'\
|
2019-10-24 06:36:55 -07:00
|
|
|
'FirebaseAnalyticsInterop.podspec|FirebaseAuth.podspec|FirebaseAuthInterop.podspec|'\
|
2019-07-18 09:54:06 -07:00
|
|
|
'FirebaseCoreDiagnostics.podspec|FirebaseCoreDiagnosticsInterop.podspec|'\
|
|
|
|
|
'FirebaseDatabase.podspec|FirebaseDynamicLinks.podspec|FirebaseMessaging.podspec|'\
|
2020-02-13 08:59:43 -08:00
|
|
|
'FirebaseStorage.podspec|'\
|
|
|
|
|
'InAppMessaging|Firebase/InAppMessaging|'\
|
|
|
|
|
'FirebaseInAppMessaging.podspec|'\
|
2019-12-20 10:54:11 -05:00
|
|
|
'Firebase/InstanceID|FirebaseInstanceID.podspec|'\
|
2020-10-01 15:10:32 -07:00
|
|
|
'FirebaseInstallations|'\
|
|
|
|
|
'FirebaseCrashlytics.podspec|'\
|
|
|
|
|
'FirebaseSegmentation.podspec)'\
|
2018-03-10 14:08:20 -08:00
|
|
|
;;
|
|
|
|
|
|
2019-10-08 14:57:07 -07:00
|
|
|
FirebasePod-*)
|
2019-10-17 09:45:04 -07:00
|
|
|
check_changes '^(CoreOnly|Firebase.podspec)'
|
2019-10-08 14:57:07 -07:00
|
|
|
;;
|
|
|
|
|
|
2019-05-06 13:54:34 -07:00
|
|
|
Core-*)
|
2020-01-06 07:11:40 -08:00
|
|
|
check_changes '^(FirebaseCore|Example/Core/Tests|GoogleUtilities|FirebaseCore.podspec'\
|
2019-11-22 16:57:08 -08:00
|
|
|
'Firebase/CoreDiagnostics|Example/CoreDiagnostics/Tests|FirebaseCoreDiagnostics.podspec|'\
|
|
|
|
|
'FirebaseCoreDiagnosticsInterop|FirebaseCoreDiagnosticsInterop.podspec)'
|
2019-05-06 13:54:34 -07:00
|
|
|
;;
|
|
|
|
|
|
2019-08-05 19:30:54 -07:00
|
|
|
ABTesting-*)
|
2020-01-06 07:11:40 -08:00
|
|
|
check_changes '^(FirebaseCore|FirebaseABTesting)'
|
2019-08-05 19:30:54 -07:00
|
|
|
;;
|
|
|
|
|
|
2019-06-05 20:33:21 -07:00
|
|
|
Auth-*)
|
2020-04-08 17:52:56 -07:00
|
|
|
check_changes '^(FirebaseCore|FirebaseAuth|GoogleUtilities|FirebaseAuth.podspec)'
|
2019-06-05 20:33:21 -07:00
|
|
|
;;
|
|
|
|
|
|
2020-01-08 16:54:11 -05:00
|
|
|
Crashlytics-*)
|
2020-01-15 11:33:57 -05:00
|
|
|
check_changes '^(FirebaseCore|GoogleUtilities|Crashlytics|FirebaseCrashlytics.podspec|Firebase/InstanceID|FirebaseInstanceID.podspec|'\
|
2020-06-24 14:09:46 -07:00
|
|
|
'FirebaseInstallations|GoogleDataTransport|GoogleDataTransport.podspec)'
|
2020-01-08 16:54:11 -05:00
|
|
|
;;
|
|
|
|
|
|
2019-05-21 08:29:15 -07:00
|
|
|
Database-*)
|
2020-06-22 07:26:07 -07:00
|
|
|
check_changes '^(FirebaseCore|FirebaseDatabase|GoogleUtilities|FirebaseDatabase.podspec|'\
|
2020-05-20 23:12:10 -07:00
|
|
|
'scripts/run_database_emulator.sh)'
|
2019-05-21 08:29:15 -07:00
|
|
|
;;
|
|
|
|
|
|
2019-05-31 15:43:49 -07:00
|
|
|
DynamicLinks-*)
|
2020-01-06 07:11:40 -08:00
|
|
|
check_changes '^(FirebaseCore|Firebase/DynamicLinks|Example/DynamicLinks|GoogleUtilities|FirebaseDynamicLinks.podspec)'
|
2019-05-31 15:43:49 -07:00
|
|
|
;;
|
|
|
|
|
|
2019-03-07 16:38:31 -08:00
|
|
|
Functions-*)
|
2020-01-06 07:11:40 -08:00
|
|
|
check_changes '^(FirebaseCore|Functions|GoogleUtilities|FirebaseFunctions.podspec)'
|
2019-03-07 16:38:31 -08:00
|
|
|
;;
|
|
|
|
|
|
2019-05-28 11:35:51 -07:00
|
|
|
GoogleUtilities-*)
|
|
|
|
|
check_changes '^(GoogleUtilities|GoogleUtilities.podspec)'
|
|
|
|
|
;;
|
|
|
|
|
|
2019-10-25 14:05:29 -04:00
|
|
|
GoogleUtilitiesComponents-*)
|
2020-06-16 09:05:29 -07:00
|
|
|
check_changes '^(GoogleUtilities|GoogleUtilitiesComponents|GoogleUtilitiesComponents.podspec)'
|
2019-10-25 14:05:29 -04:00
|
|
|
;;
|
|
|
|
|
|
2019-02-20 13:31:28 -08:00
|
|
|
InAppMessaging-*)
|
2020-02-13 08:59:43 -08:00
|
|
|
check_changes '^(FirebaseInAppMessaging|'\
|
|
|
|
|
'FirebaseInAppMessaging.podspec|Firebase/InstanceID|FirebaseInstanceID.podspec|'\
|
2020-01-15 11:33:57 -05:00
|
|
|
'FirebaseInstallations)'
|
2018-09-28 09:27:45 -07:00
|
|
|
;;
|
|
|
|
|
|
2019-05-21 11:22:43 -07:00
|
|
|
InstanceID-*)
|
2020-01-06 07:11:40 -08:00
|
|
|
check_changes '^(Firebase/InstanceID|Example/InstanceID|FirebaseCore|GoogleUtilities|'\
|
2020-01-15 11:33:57 -05:00
|
|
|
'FirebaseInstanceID.podspec|FirebaseInstallations)'
|
2019-05-21 11:22:43 -07:00
|
|
|
;;
|
|
|
|
|
|
2018-05-09 19:23:38 -07:00
|
|
|
Firestore-xcodebuild|Firestore-pod-lib-lint)
|
2019-02-22 20:07:47 -08:00
|
|
|
check_changes '^(Firestore|FirebaseFirestore.podspec|FirebaseFirestoreSwift.podspec|'\
|
2020-02-06 17:30:20 -08:00
|
|
|
'GoogleUtilities|scripts/run_firestore_emulator.sh)'
|
2018-03-10 14:08:20 -08:00
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
Firestore-cmake)
|
2020-02-06 17:30:20 -08:00
|
|
|
check_changes '^(Firestore/(core|third_party)|cmake|FirebaseCore|GoogleUtilities|)'\
|
|
|
|
|
'scripts/run_firestore_emulator.sh)'
|
2018-03-10 14:08:20 -08:00
|
|
|
;;
|
|
|
|
|
|
2019-04-12 19:27:00 -07:00
|
|
|
GoogleDataTransport-*)
|
2020-06-24 14:09:46 -07:00
|
|
|
check_changes '^(GoogleDataTransport|GoogleDataTransport.podspec)'
|
2019-04-12 19:27:00 -07:00
|
|
|
;;
|
|
|
|
|
|
2019-05-28 11:36:31 -07:00
|
|
|
Messaging-*)
|
2020-04-27 16:31:17 -07:00
|
|
|
check_changes '^(FirebaseCore|FirebaseMessaging|GoogleUtilities|FirebaseMessaging.podspec|Firebase/InstanceID|'\
|
2020-01-15 11:33:57 -05:00
|
|
|
'FirebaseInstanceID.podspec|FirebaseInstallations)'
|
2019-05-28 11:36:31 -07:00
|
|
|
;;
|
|
|
|
|
|
2019-08-22 13:37:44 -07:00
|
|
|
RemoteConfig-*)
|
2020-01-15 11:33:57 -05:00
|
|
|
check_changes '^(FirebaseCore|FirebaseRemoteConfig|FirebaseRemoteConfig.podspec|Firebase/InstanceID|FirebaseInstanceID.podspec|'\
|
|
|
|
|
'FirebaseInstallations)'
|
2019-08-22 13:37:44 -07:00
|
|
|
;;
|
|
|
|
|
|
2019-05-21 06:56:48 -07:00
|
|
|
Storage-*)
|
2020-01-06 07:11:40 -08:00
|
|
|
check_changes '^(FirebaseCore|FirebaseStorage|GoogleUtilities|FirebaseStorage.podspec)'
|
2019-05-21 06:56:48 -07:00
|
|
|
;;
|
|
|
|
|
|
2019-07-17 20:07:35 -04:00
|
|
|
Installations-*)
|
2020-01-15 11:33:57 -05:00
|
|
|
check_changes '^(FirebaseCore|GoogleUtilities|FirebaseInstallations)'
|
2019-07-17 20:07:35 -04:00
|
|
|
;;
|
|
|
|
|
|
2020-10-01 15:10:32 -07:00
|
|
|
Segmentation-*)
|
|
|
|
|
check_changes '^(Firebase/Core|FirebaseSegmentation|FirebaseSegmentation.podspec)'
|
|
|
|
|
;;
|
|
|
|
|
|
2018-03-10 14:08:20 -08:00
|
|
|
*)
|
|
|
|
|
echo "Unknown project-method combo" 1>&2
|
|
|
|
|
echo " PROJECT=$PROJECT" 1>&2
|
|
|
|
|
echo " METHOD=$METHOD" 1>&2
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
fi
|
|
|
|
|
|
2018-04-16 21:54:51 -04:00
|
|
|
# Always rebuild if Travis configuration and/or build scripts changed.
|
|
|
|
|
check_changes '^.travis.yml'
|
2018-05-13 19:10:35 -07:00
|
|
|
check_changes '^Gemfile.lock'
|
2019-10-24 06:36:55 -07:00
|
|
|
check_changes '^scripts/(build|install_prereqs|pod_lib_lint).(rb|sh)'
|
2020-02-12 15:42:08 -08:00
|
|
|
check_changes '^scripts/xcresult_logs.py'
|
2018-04-16 21:54:51 -04:00
|
|
|
|
2018-03-10 14:08:20 -08:00
|
|
|
if [[ "$run" == true ]]; then
|
|
|
|
|
"$@"
|
|
|
|
|
else
|
|
|
|
|
echo "skipped $*"
|
|
|
|
|
fi
|
|
|
|
|
|