Skip to content

Commit 3539251

Browse files
authored
Merge branch 'master' into mila/fix-mutation-on-emptyMap
2 parents adedf8f + ac19e5d commit 3539251

File tree

75 files changed

+356
-164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+356
-164
lines changed

.github/workflows/ci_tests.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,50 @@ jobs:
199199
run: |
200200
./gradlew firebase-firestore:deviceCheck withErrorProne -PtargetBackend="prod" -PtargetDatabaseId="test-db"
201201
202+
203+
firestore_nightly_integ_tests:
204+
name: "Firestore Instrumentation Tests Against Nightly Environment"
205+
runs-on: ubuntu-22.04
206+
needs:
207+
- determine_changed
208+
# only run on post submit or PRs not originating from forks.
209+
if: ((github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)) && contains(fromJSON(needs.determine_changed.outputs.modules), ':firebase-firestore')
210+
strategy:
211+
fail-fast: false
212+
213+
steps:
214+
- uses: actions/[email protected]
215+
with:
216+
fetch-depth: 2
217+
submodules: true
218+
219+
- name: Set up JDK 11
220+
uses: actions/setup-java@v3
221+
with:
222+
java-version: 11
223+
distribution: temurin
224+
cache: gradle
225+
226+
- name: Add google-services.json
227+
env:
228+
INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.NIGHTLY_INTEG_TESTS_GOOGLE_SERVICES }}
229+
run: |
230+
echo $INTEG_TESTS_GOOGLE_SERVICES > google-services.json
231+
- uses: google-github-actions/auth@v0
232+
with:
233+
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }}
234+
- uses: google-github-actions/setup-gcloud@v0
235+
236+
- name: Firestore Nightly Integ Tests
237+
env:
238+
FIREBASE_CI: 1
239+
FTL_RESULTS_BUCKET: android-ci
240+
FTL_RESULTS_DIR: ${{ github.event_name == 'pull_request' && format('pr-logs/pull/{0}/{1}/{2}/{3}_{4}/artifacts/', github.repository, github.event.pull_request.number, github.job, github.run_id, github.run_attempt) || format('logs/{0}/{1}_{2}/artifacts/', github.workflow, github.run_id, github.run_attempt)}}
241+
FIREBASE_APP_CHECK_DEBUG_SECRET: ${{ secrets.FIREBASE_APP_CHECK_DEBUG_SECRET }}
242+
run: |
243+
./gradlew firebase-firestore:deviceCheck withErrorProne -PtargetBackend="nightly"
244+
245+
202246
publish-test-results:
203247
name: "Publish Tests Results"
204248
needs:

firebase-config-interop/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# Unreleased
2+
3+
# 16.0.0
24
* [feature] Initial release.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
version=16.0.0
1+
version=16.0.1
2+
latestReleasedVersion=16.0.0

firebase-config/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Unreleased
2+
3+
# 21.6.0
24
* [changed] Added support for other Firebase products to integrate with [remote_config].
35

46
# 21.5.0

firebase-config/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616

17-
version=21.6.0
18-
latestReleasedVersion=21.5.0
17+
version=21.6.1
18+
latestReleasedVersion=21.6.0
1919
android.enableUnitTestBinaryResources=true
2020

firebase-crashlytics-ndk/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Unreleased
22

33

4+
# 18.6.0
5+
* [changed] Updated `firebase-crashlytics` dependency to v18.6.0
6+
47
# 18.5.0
5-
* [changed] Updated `firebase-crashlytics` dependency to v18.4.3
8+
* [changed] Updated `firebase-crashlytics` dependency to v18.5.0
69

710
# 18.4.3
811
* [changed] Updated `firebase-crashlytics` dependency to v18.4.3
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version=18.5.2
2-
latestReleasedVersion=18.5.1
1+
version=18.6.1
2+
latestReleasedVersion=18.6.0

firebase-crashlytics/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Unreleased
2+
3+
# 18.6.0
24
* [changed] Include more details about app processes in reports.
35
* [feature] Updated `firebase-sessions` dependency for more accurate sessions on multi-process apps.
46
* [changed] Added support for [crashlytics] to report information from [remote_config].
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version=18.6.0
2-
latestReleasedVersion=18.5.1
1+
version=18.6.1
2+
latestReleasedVersion=18.6.0

firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common/Utils.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.google.android.gms.tasks.Task;
2121
import com.google.android.gms.tasks.TaskCompletionSource;
2222
import com.google.errorprone.annotations.CanIgnoreReturnValue;
23-
2423
import java.util.concurrent.Callable;
2524
import java.util.concurrent.CancellationException;
2625
import java.util.concurrent.CountDownLatch;

firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/metadata/UserMetadata.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import androidx.annotation.Nullable;
1818
import androidx.annotation.VisibleForTesting;
19-
2019
import com.google.errorprone.annotations.CanIgnoreReturnValue;
2120
import com.google.firebase.crashlytics.internal.common.CommonUtils;
2221
import com.google.firebase.crashlytics.internal.common.CrashlyticsBackgroundWorker;

firebase-firestore/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
* [fixed] Fixed an issue caused by calling mutation on immutable map object. [#5573](//github.com/firebase/firebase-android-sdk/pull/5573)
33

44
* [fixed] Fixed an issue in the local cache synchronization logic where all locally-cached documents that matched a resumed query would be unnecessarily re-downloaded; with the fix it now only downloads the documents that are known to be out-of-sync. [#5506](//github.com/firebase/firebase-android-sdk/pull/5506)
5+
* [fixed] Fixed an issue where GC runs into a infinite loop in a certain case. [#5417](https://github.com/firebase/firebase-android-sdk/issues/5417)
56

7+
# 24.10.0
8+
* [fixed] Fixed the `DocumentSnapshot` equals method to not consider internal state when comparing snapshots.
69

710
# 24.9.1
811
* [feature] Expose Sum/Average aggregate query support in API. [#5217](//github.com/firebase/firebase-android-sdk/pull/5217)

firebase-firestore/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version=24.9.2
2-
latestReleasedVersion=24.9.1
1+
version=24.10.1
2+
latestReleasedVersion=24.10.0
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Copyright 2018 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package com.google.firebase.firestore;
16+
17+
import static com.google.firebase.firestore.testutil.IntegrationTestUtil.testCollection;
18+
import static com.google.firebase.firestore.testutil.IntegrationTestUtil.waitFor;
19+
import static com.google.firebase.firestore.testutil.TestUtil.map;
20+
import static org.junit.Assert.assertEquals;
21+
22+
import androidx.test.ext.junit.runners.AndroidJUnit4;
23+
import com.google.firebase.firestore.testutil.IntegrationTestUtil;
24+
import java.util.Map;
25+
import org.junit.After;
26+
import org.junit.Test;
27+
import org.junit.runner.RunWith;
28+
29+
@RunWith(AndroidJUnit4.class)
30+
public class DocumentSnapshotTest {
31+
@After
32+
public void tearDown() {
33+
IntegrationTestUtil.tearDown();
34+
}
35+
36+
@Test
37+
public void testCanUpdateAnExistingDocument() {
38+
DocumentReference documentReference = testCollection("rooms").document("eros");
39+
Map<String, Object> initialValue =
40+
map("desc", "Description", "owner", map("name", "Jonny", "email", "[email protected]"));
41+
waitFor(documentReference.set(initialValue));
42+
43+
DocumentSnapshot snapshot1 = waitFor(documentReference.get());
44+
DocumentSnapshot snapshot2 = waitFor(documentReference.get());
45+
DocumentSnapshot snapshot3 = waitFor(documentReference.get());
46+
assertEquals(snapshot1.getMetadata(), snapshot2.getMetadata());
47+
assertEquals(snapshot2.getMetadata(), snapshot3.getMetadata());
48+
49+
assertEquals(snapshot1.getId(), snapshot2.getId());
50+
assertEquals(snapshot2.getId(), snapshot3.getId());
51+
52+
assertEquals(snapshot1.exists(), snapshot2.exists());
53+
assertEquals(snapshot2.exists(), snapshot3.exists());
54+
55+
assertEquals(snapshot1.getReference(), snapshot2.getReference());
56+
assertEquals(snapshot2.getReference(), snapshot3.getReference());
57+
58+
assertEquals(snapshot1.getData(), snapshot2.getData());
59+
assertEquals(snapshot2.getData(), snapshot3.getData());
60+
61+
assertEquals(snapshot1.getData(), snapshot2.getData());
62+
assertEquals(snapshot2.getData(), snapshot3.getData());
63+
64+
assertEquals(snapshot1, snapshot2);
65+
assertEquals(snapshot2, snapshot3);
66+
}
67+
}

firebase-firestore/src/androidTest/java/com/google/firebase/firestore/QueryTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,8 +1341,8 @@ public void bloomFilterShouldCorrectlyEncodeComplexUnicodeCharacters() throws Ex
13411341
isRunningAgainstEmulator());
13421342

13431343
// Firestore does not do any Unicode normalization on the document IDs. Therefore, two document
1344-
// IDs that are canonically-equivalent (i.e. they visually appear identical) but are represented
1345-
// by a different sequence of Unicode code points are treated as distinct document IDs.
1344+
// IDs that are canonically-equivalent (they visually appear identical) but are represented by a
1345+
// different sequence of Unicode code points are treated as distinct document IDs.
13461346
ArrayList<String> testDocIds = new ArrayList<>();
13471347
testDocIds.add("DocumentToDelete");
13481348
// The next two strings both end with "e" with an accent: the first uses the dedicated Unicode

firebase-firestore/src/main/java/com/google/firebase/Timestamp.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
* A Timestamp represents a point in time independent of any time zone or calendar, represented as
2626
* seconds and fractions of seconds at nanosecond resolution in UTC Epoch time. It is encoded using
2727
* the Proleptic Gregorian Calendar which extends the Gregorian calendar backwards to year one. It
28-
* is encoded assuming all minutes are 60 seconds long, i.e. leap seconds are "smeared" so that no
29-
* leap second table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to
28+
* is encoded assuming all minutes are 60 seconds long, specifically leap seconds are "smeared" so
29+
* that no leap second table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to
3030
* 9999-12-31T23:59:59.999999999Z. By restricting to that range, we ensure that we can convert to
3131
* and from RFC 3339 date strings.
3232
*

firebase-firestore/src/main/java/com/google/firebase/firestore/AggregateField.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private AggregateField(@Nullable FieldPath fieldPath, @NonNull String operator)
3939

4040
/**
4141
* Returns the field on which the aggregation takes place. Returns an empty string if there's no
42-
* field (e.g. for count).
42+
* field (specifically, for count).
4343
*/
4444
@RestrictTo(RestrictTo.Scope.LIBRARY)
4545
@NonNull

firebase-firestore/src/main/java/com/google/firebase/firestore/CollectionReference.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public DocumentReference document(@NonNull String documentPath) {
109109
* Adds a new document to this collection with the specified data, assigning it a document ID
110110
* automatically.
111111
*
112-
* @param data The data to write to the document (e.g. a Map or a POJO containing the desired
112+
* @param data The data to write to the document (like a Map or a POJO containing the desired
113113
* document contents).
114114
* @return A Task that will be resolved with the {@code DocumentReference} of the newly created
115115
* document.

firebase-firestore/src/main/java/com/google/firebase/firestore/DocumentReference.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public CollectionReference collection(@NonNull String collectionPath) {
138138
* Overwrites the document referred to by this {@code DocumentReference}. If the document does not
139139
* yet exist, it will be created. If a document already exists, it will be overwritten.
140140
*
141-
* @param data The data to write to the document (e.g. a Map or a POJO containing the desired
141+
* @param data The data to write to the document (like a Map or a POJO containing the desired
142142
* document contents).
143143
* @return A Task that will be resolved when the write finishes.
144144
*/
@@ -152,7 +152,7 @@ public Task<Void> set(@NonNull Object data) {
152152
* yet exist, it will be created. If you pass {@code SetOptions}, the provided data can be merged
153153
* into an existing document.
154154
*
155-
* @param data The data to write to the document (e.g. a Map or a POJO containing the desired
155+
* @param data The data to write to the document (like a Map or a POJO containing the desired
156156
* document contents).
157157
* @param options An object to configure the set behavior.
158158
* @return A Task that will be resolved when the write finishes.
@@ -402,7 +402,7 @@ public ListenerRegistration addSnapshotListener(
402402
* Starts listening to the document referenced by this {@code DocumentReference} with the given
403403
* options.
404404
*
405-
* @param metadataChanges Indicates whether metadata-only changes (i.e. only {@code
405+
* @param metadataChanges Indicates whether metadata-only changes (specifically, only {@code
406406
* DocumentSnapshot.getMetadata()} changed) should trigger snapshot events.
407407
* @param listener The event listener that will be called with the snapshots.
408408
* @return A registration object that can be used to remove the listener.
@@ -418,7 +418,7 @@ public ListenerRegistration addSnapshotListener(
418418
* options.
419419
*
420420
* @param executor The executor to use to call the listener.
421-
* @param metadataChanges Indicates whether metadata-only changes (i.e. only {@code
421+
* @param metadataChanges Indicates whether metadata-only changes (specifically, only {@code
422422
* DocumentSnapshot.getMetadata()} changed) should trigger snapshot events.
423423
* @param listener The event listener that will be called with the snapshots.
424424
* @return A registration object that can be used to remove the listener.
@@ -441,7 +441,7 @@ public ListenerRegistration addSnapshotListener(
441441
* <p>The listener will be automatically removed during {@link Activity#onStop}.
442442
*
443443
* @param activity The activity to scope the listener to.
444-
* @param metadataChanges Indicates whether metadata-only changes (i.e. only {@code
444+
* @param metadataChanges Indicates whether metadata-only changes (specifically, only {@code
445445
* DocumentSnapshot.getMetadata()} changed) should trigger snapshot events.
446446
* @param listener The event listener that will be called with the snapshots.
447447
* @return A registration object that can be used to remove the listener.

firebase-firestore/src/main/java/com/google/firebase/firestore/DocumentSnapshot.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,10 @@ public boolean equals(@Nullable Object obj) {
526526
DocumentSnapshot other = (DocumentSnapshot) obj;
527527
return firestore.equals(other.firestore)
528528
&& key.equals(other.key)
529-
&& (doc == null ? other.doc == null : doc.equals(other.doc))
530-
&& metadata.equals(other.metadata);
529+
&& metadata.equals(other.metadata)
530+
&& (doc == null
531+
? other.doc == null
532+
: other.doc != null && doc.getData().equals(other.doc.getData()));
531533
}
532534

533535
@Override

firebase-firestore/src/main/java/com/google/firebase/firestore/FirebaseFirestore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ void validateReference(DocumentReference docRef) {
886886

887887
/**
888888
* Sets the language of the public API in the format of "gl-<language>/<version>" where version
889-
* might be blank, e.g. `gl-cpp/`. The provided string is used as is.
889+
* might be blank, for example `gl-cpp/`. The provided string is used as is.
890890
*
891891
* <p>Note: this method is package-private because it is expected to only be called via JNI (which
892892
* ignores access modifiers).

firebase-firestore/src/main/java/com/google/firebase/firestore/FirebaseFirestoreException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public enum Code {
4444
/**
4545
* Client specified an invalid argument. Note that this differs from {@link
4646
* #FAILED_PRECONDITION}. {@code INVALID_ARGUMENT} indicates arguments that are problematic
47-
* regardless of the state of the system (e.g., an invalid field name).
47+
* regardless of the state of the system (like an invalid field name).
4848
*/
4949
INVALID_ARGUMENT(3),
5050

firebase-firestore/src/main/java/com/google/firebase/firestore/LoadBundleTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class LoadBundleTask extends Task<LoadBundleTaskProgress> {
4848
private LoadBundleTaskProgress snapshot;
4949

5050
/**
51-
* A TaskCompletionSource that is used to deliver all standard Task API events (e.g.
51+
* A TaskCompletionSource that is used to deliver all standard Task API events (such as,
5252
* `onComplete`).
5353
*/
5454
private final TaskCompletionSource<LoadBundleTaskProgress> completionSource;

firebase-firestore/src/main/java/com/google/firebase/firestore/Query.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ public Query whereNotIn(@NonNull FieldPath fieldPath, @NonNull List<? extends Ob
399399
public Query where(@NonNull Filter filter) {
400400
com.google.firebase.firestore.core.Filter parsedFilter = parseFilter(filter);
401401
if (parsedFilter.getFilters().isEmpty()) {
402-
// Return the existing query if not adding any more filters (e.g. an empty composite filter).
402+
// Return the existing query if not adding any more filters (because composite filter is
403+
// empty).
403404
return this;
404405
}
405406
validateNewFilter(parsedFilter);
@@ -1070,7 +1071,7 @@ public ListenerRegistration addSnapshotListener(
10701071
/**
10711072
* Starts listening to this query with the given options.
10721073
*
1073-
* @param metadataChanges Indicates whether metadata-only changes (i.e. only {@code
1074+
* @param metadataChanges Indicates whether metadata-only changes (specifically, only {@code
10741075
* QuerySnapshot.getMetadata()} changed) should trigger snapshot events.
10751076
* @param listener The event listener that will be called with the snapshots.
10761077
* @return A registration object that can be used to remove the listener.
@@ -1085,7 +1086,7 @@ public ListenerRegistration addSnapshotListener(
10851086
* Starts listening to this query with the given options.
10861087
*
10871088
* @param executor The executor to use to call the listener.
1088-
* @param metadataChanges Indicates whether metadata-only changes (i.e. only {@code
1089+
* @param metadataChanges Indicates whether metadata-only changes (specifically, only {@code
10891090
* QuerySnapshot.getMetadata()} changed) should trigger snapshot events.
10901091
* @param listener The event listener that will be called with the snapshots.
10911092
* @return A registration object that can be used to remove the listener.
@@ -1107,7 +1108,7 @@ public ListenerRegistration addSnapshotListener(
11071108
* <p>The listener will be automatically removed during {@link Activity#onStop}.
11081109
*
11091110
* @param activity The activity to scope the listener to.
1110-
* @param metadataChanges Indicates whether metadata-only changes (i.e. only {@code
1111+
* @param metadataChanges Indicates whether metadata-only changes (specifically, only {@code
11111112
* QuerySnapshot.getMetadata()} changed) should trigger snapshot events.
11121113
* @param listener The event listener that will be called with the snapshots.
11131114
* @return A registration object that can be used to remove the listener.
@@ -1181,7 +1182,7 @@ private void validateHasExplicitOrderByForLimitToLast() {
11811182
*
11821183
* <p>Using the returned query to count the documents is efficient because only the final count,
11831184
* not the documents' data, is downloaded. The returned query can even count the documents if the
1184-
* result set would be prohibitively large to download entirely (e.g. thousands of documents).
1185+
* result set would be prohibitively large to download entirely (like thousands of documents).
11851186
*
11861187
* @return The {@code AggregateQuery} that counts the documents in the result set of this query.
11871188
*/
@@ -1196,7 +1197,7 @@ public AggregateQuery count() {
11961197
*
11971198
* <p>Using this function to perform aggregations is efficient because only the final aggregation
11981199
* values, not the documents' data, is downloaded. This function can even perform aggregations of
1199-
* the documents if the result set would be prohibitively large to download entirely (e.g.
1200+
* the documents if the result set would be prohibitively large to download entirely (like
12001201
* thousands of documents).
12011202
*
12021203
* @return The {@code AggregateQuery} that performs aggregations on the documents in the result

firebase-firestore/src/main/java/com/google/firebase/firestore/QuerySnapshot.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public List<DocumentChange> getDocumentChanges() {
105105
* Returns the list of documents that changed since the last snapshot. If it's the first snapshot
106106
* all documents will be in the list as added changes.
107107
*
108-
* @param metadataChanges Indicates whether metadata-only changes (i.e. only {@code
108+
* @param metadataChanges Indicates whether metadata-only changes (specifically, only {@code
109109
* DocumentSnapshot.getMetadata()} changed) should be included.
110110
* @return The list of document changes since the last snapshot.
111111
*/

0 commit comments

Comments
 (0)