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*
|
2019-05-06 13:54:34 -07:00
|
|
|
check_changes '^(Firebase/Auth|Firebase/Database|Firebase/DynamicLinks|'\
|
2019-03-07 16:38:31 -08:00
|
|
|
'Firebase/Messaging|Firebase/Storage|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|'\
|
|
|
|
|
'FirebaseStorage.podspec|FirebaseStorage.podspec|Firebase/InAppMessagingDisplay|'\
|
|
|
|
|
'InAppMessagingDisplay|InAppMessaging|Firebase/InAppMessaging|'\
|
2019-04-10 15:07:12 -04:00
|
|
|
'FirebaseInAppMessaging.podspec|FirebaseInAppMessagingDisplay.podspec|'\
|
|
|
|
|
'Firebase/InstanceID|FirebaseInstanceID.podspec)'
|
2019-02-20 13:31:28 -08:00
|
|
|
;;
|
|
|
|
|
|
2018-03-10 14:08:20 -08:00
|
|
|
Firebase-*)
|
2018-10-16 11:57:25 -07:00
|
|
|
check_changes '^(Firebase/Auth|Firebase/Core|Firebase/Database|Firebase/DynamicLinks|'\
|
2019-03-07 16:38:31 -08:00
|
|
|
'Firebase/Messaging|Firebase/Storage|GoogleUtilities|Interop|Example|'\
|
2018-10-16 15:03:57 -07:00
|
|
|
'FirebaseAnalyticsIntop.podspec|FirebaseAuth.podspec|FirebaseAuthInterop.podspec|'\
|
2019-07-18 09:54:06 -07:00
|
|
|
'FirebaseCore.podspec|FirebaseCoreDiagnostics.podspec|FirebaseCoreDiagnosticsInterop.podspec|'\
|
|
|
|
|
'FirebaseDatabase.podspec|FirebaseDynamicLinks.podspec|FirebaseMessaging.podspec|'\
|
|
|
|
|
'FirebaseStorage.podspec|FirebaseStorage.podspec|Firebase/InstanceID|FirebaseInstanceID.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-*)
|
2019-10-24 06:36:55 -07:00
|
|
|
check_changes '^(Firebase/Core|Example/Core/Tests|GoogleUtilities|FirebaseCore.podspec'\
|
|
|
|
|
'FirebaseCoreDiagnostics.podspec|FirebaseCoreDiagnosticsInterop|FirebaseCoreDiagnosticsInterop.podspec)'
|
2019-05-06 13:54:34 -07:00
|
|
|
;;
|
|
|
|
|
|
2019-08-05 19:30:54 -07:00
|
|
|
ABTesting-*)
|
|
|
|
|
check_changes '^(Firebase/Core|FirebaseABTesting)'
|
|
|
|
|
;;
|
|
|
|
|
|
2019-06-05 20:33:21 -07:00
|
|
|
Auth-*)
|
|
|
|
|
check_changes '^(Firebase/Core|Firebase/Auth|Example/Auth|GoogleUtilities|FirebaseAuth.podspec)'
|
|
|
|
|
;;
|
|
|
|
|
|
2019-08-29 12:26:30 -07:00
|
|
|
CoreDiagnostics-*)
|
|
|
|
|
check_changes '^(Firebase/CoreDiagnostics|Example/CoreDiagnostics/Tests|FirebaseCoreDiagnostics.podspec|'\
|
|
|
|
|
'FirebaseCoreDiagnosticsInterop|FirebaseCoreDiagnosticsInterop.podspec)'
|
|
|
|
|
;;
|
|
|
|
|
|
2019-05-21 08:29:15 -07:00
|
|
|
Database-*)
|
|
|
|
|
check_changes '^(Firebase/Core|Firebase/Database|Example/Database|GoogleUtilities|FirebaseDatabase.podspec)'
|
|
|
|
|
;;
|
|
|
|
|
|
2019-05-31 15:43:49 -07:00
|
|
|
DynamicLinks-*)
|
|
|
|
|
check_changes '^(Firebase/Core|Firebase/DynamicLinks|Example/DynamicLinks|GoogleUtilities|FirebaseDynamicLinks.podspec)'
|
|
|
|
|
;;
|
|
|
|
|
|
2019-03-07 16:38:31 -08:00
|
|
|
Functions-*)
|
|
|
|
|
check_changes '^(Firebase/Core|Functions|GoogleUtilities|FirebaseFunctions.podspec)'
|
|
|
|
|
;;
|
|
|
|
|
|
2019-05-28 11:35:51 -07:00
|
|
|
GoogleUtilities-*)
|
|
|
|
|
check_changes '^(GoogleUtilities|GoogleUtilities.podspec)'
|
|
|
|
|
;;
|
|
|
|
|
|
2019-10-25 14:05:29 -04:00
|
|
|
GoogleUtilitiesComponents-*)
|
|
|
|
|
check_changes '^(GoogleUtilitiesComponents|GoogleUtilitiesComponents.podspec)'
|
|
|
|
|
;;
|
|
|
|
|
|
2019-02-20 13:31:28 -08:00
|
|
|
InAppMessaging-*)
|
2019-09-30 15:32:03 -07:00
|
|
|
check_changes '^(InAppMessaging|Firebase/InAppMessaging)'
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
InAppMessagingDisplay-*)
|
2019-02-20 13:31:28 -08:00
|
|
|
check_changes '^(Firebase/InAppMessagingDisplay|InAppMessagingDisplay|InAppMessaging|'\
|
|
|
|
|
'Firebase/InAppMessaging)'
|
2018-09-28 09:27:45 -07:00
|
|
|
;;
|
|
|
|
|
|
2019-05-21 11:22:43 -07:00
|
|
|
InstanceID-*)
|
|
|
|
|
check_changes '^(Firebase/InstanceID|Example/InstanceID|Firebase/Core|GoogleUtilities|'\
|
|
|
|
|
'FirebaseInstanceID.podspec)'
|
|
|
|
|
;;
|
|
|
|
|
|
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|'\
|
|
|
|
|
'GoogleUtilities)'
|
2018-03-10 14:08:20 -08:00
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
Firestore-cmake)
|
2019-02-22 20:07:47 -08:00
|
|
|
check_changes '^(Firestore/(core|third_party)|cmake|GoogleUtilities)'
|
2018-03-10 14:08:20 -08:00
|
|
|
;;
|
|
|
|
|
|
2019-04-12 19:27:00 -07:00
|
|
|
GoogleDataTransport-*)
|
|
|
|
|
check_changes '^(GoogleDataTransport|GoogleDataTransport.podspec)'
|
|
|
|
|
;;
|
|
|
|
|
|
2019-05-20 17:12:13 -07:00
|
|
|
GoogleDataTransportIntegrationTest-*)
|
|
|
|
|
check_changes '^(GoogleDataTransport|GoogleDataTransport.podspec)'
|
|
|
|
|
;;
|
|
|
|
|
|
2019-04-12 19:27:00 -07:00
|
|
|
GoogleDataTransportCCTSupport-*)
|
|
|
|
|
check_changes '^(GoogleDataTransportCCTSupport|GoogleDataTransportCCTSupport.podspec|GoogleDataTransport|GoogleDataTransport.podspec)'
|
|
|
|
|
;;
|
|
|
|
|
|
2019-05-28 11:36:31 -07:00
|
|
|
Messaging-*)
|
|
|
|
|
check_changes '^(Firebase/Core|Firebase/Messaging|Example/Messaging|GoogleUtilities|FirebaseMessaging.podspec|Firebase/InstanceID)'
|
|
|
|
|
;;
|
|
|
|
|
|
2019-08-22 13:37:44 -07:00
|
|
|
RemoteConfig-*)
|
|
|
|
|
check_changes '^(Firebase/Core|FirebaseRemoteConfig)'
|
|
|
|
|
;;
|
|
|
|
|
|
2019-05-21 06:56:48 -07:00
|
|
|
Storage-*)
|
|
|
|
|
check_changes '^(Firebase/Core|Firebase/Storage|Example/Storage|GoogleUtilities|FirebaseStorage.podspec)'
|
|
|
|
|
;;
|
|
|
|
|
|
2019-07-17 20:07:35 -04:00
|
|
|
Installations-*)
|
|
|
|
|
check_changes '^(Firebase/Core|GoogleUtilities|FirebaseInstallations|FirebaseInstallations.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)'
|
2018-04-16 21:54:51 -04:00
|
|
|
|
2018-03-10 14:08:20 -08:00
|
|
|
if [[ "$run" == true ]]; then
|
|
|
|
|
"$@"
|
|
|
|
|
else
|
|
|
|
|
echo "skipped $*"
|
|
|
|
|
fi
|
|
|
|
|
|