Skip to content

Commit 1edae57

Browse files
committed
Merge branch 'refs/heads/main' into perf-trace-before-init
# Conflicts: # firebase-perf/CHANGELOG.md
2 parents b448fd4 + 60a5e4c commit 1edae57

File tree

81 files changed

+2193
-1166
lines changed

Some content is hidden

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

81 files changed

+2193
-1166
lines changed

.github/workflows/ci_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ jobs:
167167

168168
steps:
169169
- name: Download Artifacts
170-
uses: actions/[email protected].5
170+
uses: actions/[email protected].7
171171
with:
172172
path: artifacts
173173

build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ ext {
5454
robolectricVersion = libs.versions.robolectric.get()
5555
androidxTestCoreVersion = libs.versions.androidx.test.core.get()
5656
androidxTestJUnitVersion = libs.versions.androidx.test.junit.get()
57-
protocVersion = libs.versions.protoc.get()
58-
javaliteVersion = libs.versions.javalite.get()
59-
protobufJavaUtilVersion = libs.versions.protobufjavautil.get()
6057
}
6158

6259
apply plugin: com.google.firebase.gradle.plugins.PublishingPlugin
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Unreleased
2-
2+
* [changed] Updated protobuf dependency to `3.25.5` to fix
3+
[CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8).
34

encoders/firebase-encoders-proto/firebase-encoders-proto.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ java {
3232

3333
protobuf {
3434
protoc {
35-
artifact = "com.google.protobuf:protoc:$protocVersion"
35+
artifact = libs.protoc.get().toString()
3636
}
3737
}
3838

@@ -47,7 +47,7 @@ dependencies {
4747
testAnnotationProcessor project(':encoders:firebase-encoders-processor')
4848

4949
testImplementation 'com.google.guava:guava:31.0-jre'
50-
testImplementation "com.google.protobuf:protobuf-java-util:$protobufJavaUtilVersion"
50+
testImplementation libs.protobuf.java.util
5151
testImplementation "com.google.truth:truth:$googleTruthVersion"
5252
testImplementation 'com.google.truth.extensions:truth-proto-extension:1.0'
5353
testImplementation 'junit:junit:4.13.1'

encoders/protoc-gen-firebase-encoders/protoc-gen-firebase-encoders.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ plugins {
2222

2323
protobuf {
2424
protoc {
25-
artifact = "com.google.protobuf:protoc:$protocVersion"
25+
artifact = libs.protoc.get().toString()
2626
}
2727
}
2828

encoders/protoc-gen-firebase-encoders/tests/tests.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dependencies {
2626

2727
protobuf {
2828
protoc {
29-
artifact = "com.google.protobuf:protoc:$protocVersion"
29+
artifact = libs.protoc.get().toString()
3030
}
3131
plugins {
3232
firebaseEncoders {
@@ -51,7 +51,7 @@ dependencies {
5151

5252
testImplementation project(":encoders:firebase-encoders")
5353
testImplementation project(":encoders:firebase-encoders-proto")
54-
testImplementation "com.google.protobuf:protobuf-java:3.21.9"
54+
testImplementation libs.protobuf.java
5555
testImplementation "com.google.truth:truth:1.0.1"
5656
testImplementation 'junit:junit:4.13.1'
5757
}

firebase-config/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Unreleased
2-
2+
* [changed] Updated protobuf dependency to `3.25.5` to fix
3+
[CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8).
34

45
# 22.0.0
56
* [changed] Bump internal dependencies

firebase-crashlytics-ndk/firebase-crashlytics-ndk.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ dependencies {
124124

125125
androidTestImplementation "androidx.test:core:$androidxTestCoreVersion"
126126
androidTestImplementation 'androidx.test:runner:1.4.0'
127-
androidTestImplementation "com.google.protobuf:protobuf-javalite:$javaliteVersion"
127+
androidTestImplementation libs.protobuf.java.lite
128128
androidTestImplementation 'com.linkedin.dexmaker:dexmaker:2.28.1'
129129
androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito:2.28.1'
130130
androidTestImplementation 'org.mockito:mockito-core:3.4.3'

firebase-crashlytics/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Unreleased
2+
* [changed] Updated protobuf dependency to `3.25.5` to fix
3+
[CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8).
4+
25

36
# 19.2.0
47
* [fixed] Improved data consistency for rapid user actions.

firebase-crashlytics/firebase-crashlytics.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ dependencies {
104104
androidTestImplementation(libs.androidx.test.runner)
105105
androidTestImplementation(libs.androidx.test.junit)
106106
androidTestImplementation("com.google.firebase:firebase-encoders-json:18.0.1")
107-
androidTestImplementation("com.google.protobuf:protobuf-java:3.21.11")
107+
androidTestImplementation(libs.protobuf.java)
108108
androidTestImplementation(libs.truth)
109109
androidTestImplementation("com.linkedin.dexmaker:dexmaker:2.28.3")
110110
androidTestImplementation(libs.mockito.dexmaker)

firebase-dataconnect/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Unreleased
2+
* [changed] Updated protobuf dependency to `3.25.5` to fix
3+
[CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8).
24

35
# 16.0.0-beta01
46
* [feature] Initial release of the Data Connect SDK (public preview). Learn how to
@@ -19,3 +21,4 @@
1921
([#6299](https://github.com/firebase/firebase-android-sdk/pull/6299))
2022
* [changed] Added `equals` and `hashCode` methods to `GeneratedConnector`.
2123
([#6177](https://github.com/firebase/firebase-android-sdk/pull/6177))
24+

firebase-dataconnect/androidTestutil/androidTestutil.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ dependencies {
5858
implementation(libs.androidx.test.core)
5959
implementation(libs.androidx.test.junit)
6060
implementation(libs.auth0.jwt)
61+
implementation(libs.kotest.assertions)
6162
implementation(libs.kotest.property)
6263
implementation(libs.kotlinx.coroutines.core)
6364
implementation(libs.kotlinx.serialization.core)

firebase-dataconnect/androidTestutil/src/main/kotlin/com/google/firebase/dataconnect/testutil/DataConnectIntegrationTestBase.kt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ package com.google.firebase.dataconnect.testutil
1919
import androidx.test.ext.junit.runners.AndroidJUnit4
2020
import com.google.firebase.dataconnect.ConnectorConfig
2121
import com.google.firebase.util.nextAlphanumericString
22+
import io.kotest.property.Arb
2223
import io.kotest.property.RandomSource
24+
import io.kotest.property.arbitrary.Codepoint
25+
import io.kotest.property.arbitrary.alphanumeric
26+
import io.kotest.property.arbitrary.arbitrary
27+
import io.kotest.property.arbitrary.string
2328
import kotlin.random.Random
2429
import org.junit.Rule
2530
import org.junit.rules.TestName
@@ -40,6 +45,31 @@ abstract class DataConnectIntegrationTestBase {
4045

4146
val rs: RandomSource by randomSeedTestRule.rs
4247

48+
/**
49+
* Generates and returns a string containing random alphanumeric characters, including the name of
50+
* the currently-running test as returned from [testName].
51+
*
52+
* @param string The [Arb] to use to generate the random string; if not specified, then an [Arb]
53+
* that generates strings of 20 alphanumeric characters is used.
54+
* @param prefix A prefix to include in the returned string; if null (the default) then no prefix
55+
* will be included.
56+
* @return a string containing random characters and incorporating the other information
57+
* identified above.
58+
*/
59+
fun Arb.Companion.alphanumericString(
60+
string: Arb<String> = Arb.string(20, Codepoint.alphanumeric()),
61+
prefix: String? = null,
62+
): Arb<String> = arbitrary {
63+
buildString {
64+
if (prefix != null) {
65+
append(prefix)
66+
}
67+
append(testName)
68+
append("_")
69+
append(string.bind())
70+
}
71+
}
72+
4373
companion object {
4474
val testConnectorConfig: ConnectorConfig
4575
get() =

firebase-dataconnect/androidTestutil/src/test/kotlin/com/google/firebase/dataconnect/testutil/DataConnectBackendUnitTest.kt

Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -16,118 +16,123 @@
1616

1717
package com.google.firebase.dataconnect.testutil
1818

19-
import com.google.common.truth.Truth.assertThat
2019
import com.google.firebase.dataconnect.testutil.DataConnectBackend.Companion.fromInstrumentationArgument
20+
import io.kotest.assertions.assertSoftly
21+
import io.kotest.assertions.throwables.shouldThrow
22+
import io.kotest.matchers.nulls.shouldBeNull
23+
import io.kotest.matchers.shouldBe
24+
import io.kotest.matchers.types.shouldBeSameInstanceAs
2125
import java.net.URI
2226
import java.net.URL
2327
import org.junit.Test
2428

2529
class DataConnectBackendUnitTest {
2630

2731
@Test
28-
fun `fromInstrumentationArgument(null) should return Production`() {
29-
assertThat(fromInstrumentationArgument(null)).isNull()
32+
fun `fromInstrumentationArgument(null) should return null`() {
33+
fromInstrumentationArgument(null).shouldBeNull()
3034
}
3135

3236
@Test
3337
fun `fromInstrumentationArgument('prod') should return Production`() {
34-
assertThat(fromInstrumentationArgument("prod")).isSameInstanceAs(DataConnectBackend.Production)
38+
fromInstrumentationArgument("prod") shouldBeSameInstanceAs DataConnectBackend.Production
3539
}
3640

3741
@Test
3842
fun `fromInstrumentationArgument('staging') should return Staging`() {
39-
assertThat(fromInstrumentationArgument("staging")).isSameInstanceAs(DataConnectBackend.Staging)
43+
fromInstrumentationArgument("staging") shouldBeSameInstanceAs DataConnectBackend.Staging
4044
}
4145

4246
@Test
4347
fun `fromInstrumentationArgument('autopush') should return Autopush`() {
44-
assertThat(fromInstrumentationArgument("autopush"))
45-
.isSameInstanceAs(DataConnectBackend.Autopush)
48+
fromInstrumentationArgument("autopush") shouldBeSameInstanceAs DataConnectBackend.Autopush
4649
}
4750

4851
@Test
4952
fun `fromInstrumentationArgument('emulator') should return Emulator()`() {
50-
assertThat(fromInstrumentationArgument("emulator")).isEqualTo(DataConnectBackend.Emulator())
53+
fromInstrumentationArgument("emulator") shouldBe DataConnectBackend.Emulator()
5154
}
5255

5356
@Test
5457
fun `fromInstrumentationArgument(emulator with host) should return Emulator() with the host`() {
55-
assertThat(fromInstrumentationArgument("emulator:a.b.c"))
56-
.isEqualTo(DataConnectBackend.Emulator(host = "a.b.c"))
58+
fromInstrumentationArgument("emulator:a.b.c") shouldBe
59+
DataConnectBackend.Emulator(host = "a.b.c")
5760
}
5861

5962
@Test
6063
fun `fromInstrumentationArgument(emulator with port) should return Emulator() with the port`() {
61-
assertThat(fromInstrumentationArgument("emulator::9987"))
62-
.isEqualTo(DataConnectBackend.Emulator(port = 9987))
64+
fromInstrumentationArgument("emulator::9987") shouldBe DataConnectBackend.Emulator(port = 9987)
6365
}
6466

6567
@Test
6668
fun `fromInstrumentationArgument(emulator with host and port) should return Emulator() with the host and port`() {
67-
assertThat(fromInstrumentationArgument("emulator:a.b.c:9987"))
68-
.isEqualTo(DataConnectBackend.Emulator(host = "a.b.c", port = 9987))
69+
fromInstrumentationArgument("emulator:a.b.c:9987") shouldBe
70+
DataConnectBackend.Emulator(host = "a.b.c", port = 9987)
6971
}
7072

7173
@Test
7274
fun `fromInstrumentationArgument(http url with host) should return Custom()`() {
73-
assertThat(fromInstrumentationArgument("http://a.b.c"))
74-
.isEqualTo(DataConnectBackend.Custom("a.b.c", false))
75+
fromInstrumentationArgument("http://a.b.c") shouldBe DataConnectBackend.Custom("a.b.c", false)
7576
}
7677

7778
@Test
7879
fun `fromInstrumentationArgument(http url with host and port) should return Custom()`() {
79-
assertThat(fromInstrumentationArgument("http://a.b.c:9987"))
80-
.isEqualTo(DataConnectBackend.Custom("a.b.c:9987", false))
80+
fromInstrumentationArgument("http://a.b.c:9987") shouldBe
81+
DataConnectBackend.Custom("a.b.c:9987", false)
8182
}
8283

8384
@Test
8485
fun `fromInstrumentationArgument(https url with host) should return Custom()`() {
85-
assertThat(fromInstrumentationArgument("https://a.b.c"))
86-
.isEqualTo(DataConnectBackend.Custom("a.b.c", true))
86+
fromInstrumentationArgument("https://a.b.c") shouldBe DataConnectBackend.Custom("a.b.c", true)
8787
}
8888

8989
@Test
9090
fun `fromInstrumentationArgument(https url with host and port) should return Custom()`() {
91-
assertThat(fromInstrumentationArgument("https://a.b.c:9987"))
92-
.isEqualTo(DataConnectBackend.Custom("a.b.c:9987", true))
91+
fromInstrumentationArgument("https://a.b.c:9987") shouldBe
92+
DataConnectBackend.Custom("a.b.c:9987", true)
9393
}
9494

9595
@Test
9696
fun `fromInstrumentationArgument('foo') should throw an exception`() {
9797
val exception =
98-
assertThrows(InvalidInstrumentationArgumentException::class) {
99-
fromInstrumentationArgument("foo")
100-
}
98+
shouldThrow<InvalidInstrumentationArgumentException> { fromInstrumentationArgument("foo") }
99+
101100
val urlParseErrorMessage = runCatching { URL("foo") }.exceptionOrNull()!!.message!!
102-
assertThat(exception).hasMessageThat().containsWithNonAdjacentText("foo")
103-
assertThat(exception).hasMessageThat().containsWithNonAdjacentText("invalid", ignoreCase = true)
104-
assertThat(exception).hasMessageThat().containsWithNonAdjacentText("DATA_CONNECT_BACKEND")
105-
assertThat(exception).hasMessageThat().containsWithNonAdjacentText(urlParseErrorMessage)
101+
assertSoftly {
102+
exception.message shouldContainWithNonAbuttingText "foo"
103+
exception.message shouldContainWithNonAbuttingTextIgnoringCase "invalid"
104+
exception.message shouldContainWithNonAbuttingText "DATA_CONNECT_BACKEND"
105+
exception.message shouldContainWithNonAbuttingText urlParseErrorMessage
106+
}
106107
}
107108

108109
@Test
109110
fun `fromInstrumentationArgument(invalid URI) should throw an exception`() {
110111
val exception =
111-
assertThrows(InvalidInstrumentationArgumentException::class) {
112-
fromInstrumentationArgument("..:")
113-
}
112+
shouldThrow<InvalidInstrumentationArgumentException> { fromInstrumentationArgument("..:") }
113+
114114
val uriParseErrorMessage = runCatching { URI("..:") }.exceptionOrNull()!!.message!!
115-
assertThat(exception).hasMessageThat().containsWithNonAdjacentText("..:")
116-
assertThat(exception).hasMessageThat().containsWithNonAdjacentText("invalid", ignoreCase = true)
117-
assertThat(exception).hasMessageThat().containsWithNonAdjacentText("DATA_CONNECT_BACKEND")
118-
assertThat(exception).hasMessageThat().containsWithNonAdjacentText(uriParseErrorMessage)
115+
assertSoftly {
116+
exception.message shouldContainWithNonAbuttingText "..:"
117+
exception.message shouldContainWithNonAbuttingTextIgnoringCase "invalid"
118+
exception.message shouldContainWithNonAbuttingText "DATA_CONNECT_BACKEND"
119+
exception.message shouldContainWithNonAbuttingText uriParseErrorMessage
120+
}
119121
}
120122

121123
@Test
122124
fun `fromInstrumentationArgument(invalid emulator URI) should throw an exception`() {
123125
val exception =
124-
assertThrows(InvalidInstrumentationArgumentException::class) {
126+
shouldThrow<InvalidInstrumentationArgumentException> {
125127
fromInstrumentationArgument("emulator:::::")
126128
}
129+
127130
val urlParseErrorMessage = runCatching { URL("https://::::") }.exceptionOrNull()!!.message!!
128-
assertThat(exception).hasMessageThat().containsWithNonAdjacentText("emulator:::::")
129-
assertThat(exception).hasMessageThat().containsWithNonAdjacentText("invalid", ignoreCase = true)
130-
assertThat(exception).hasMessageThat().containsWithNonAdjacentText("DATA_CONNECT_BACKEND")
131-
assertThat(exception).hasMessageThat().containsWithNonAdjacentText(urlParseErrorMessage)
131+
assertSoftly {
132+
exception.message shouldContainWithNonAbuttingText "emulator:::::"
133+
exception.message shouldContainWithNonAbuttingTextIgnoringCase "invalid"
134+
exception.message shouldContainWithNonAbuttingText "DATA_CONNECT_BACKEND"
135+
exception.message shouldContainWithNonAbuttingText urlParseErrorMessage
136+
}
132137
}
133138
}

firebase-dataconnect/connectors/connectors.gradle.kts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
18+
import com.google.firebase.dataconnect.gradle.plugin.UpdateDataConnectExecutableVersionsTask
1819

1920
plugins {
2021
id("com.android.library")
@@ -109,3 +110,41 @@ tasks.withType<KotlinCompile>().all {
109110
}
110111
}
111112
}
113+
114+
// Adds a Gradle task that updates the JSON file that stores the list of Data Connect
115+
// executable versions.
116+
//
117+
// Example 1: Add versions 1.4.3 and 1.4.4 to the JSON file, and set 1.4.4 as the default:
118+
// ../../gradlew -Pversions=1.4.3,1.4.4 -PdefaultVersion=1.4.4 updateJson --info
119+
//
120+
// Example 2: Add version 1.2.3 to the JSON file, but do not change the default version:
121+
// ../../gradlew -Pversion=1.2.3 updateJson --info
122+
//
123+
// The `--info` argument can be omitted; it merely controls the level of log output.
124+
tasks.register<UpdateDataConnectExecutableVersionsTask>("updateJson") {
125+
outputs.upToDateWhen { false }
126+
jsonFile.set(project.layout.projectDirectory.file(
127+
"../gradleplugin/plugin/src/main/resources/com/google/firebase/dataconnect/gradle/" +
128+
"plugin/DataConnectExecutableVersions.json"))
129+
workDirectory.set(project.layout.buildDirectory.dir("updateJson"))
130+
131+
val singleVersion: String? = project.providers.gradleProperty("version").orNull
132+
val multipleVersions: List<String>? = project.providers.gradleProperty("versions").orNull?.split(',')
133+
versions.set(buildList {
134+
singleVersion?.let{add(it)}
135+
multipleVersions?.let{addAll(it)}
136+
if (isEmpty()) {
137+
throw Exception("bm6d5ezxzd 'version' or 'versions' property must be specified")
138+
}
139+
})
140+
141+
updateMode.set(project.providers.gradleProperty("updateMode").map {
142+
when (it) {
143+
"overwrite" -> UpdateDataConnectExecutableVersionsTask.UpdateMode.Overwrite
144+
"update" -> UpdateDataConnectExecutableVersionsTask.UpdateMode.Update
145+
else -> throw Exception("ahe4zadcjs 'updateMode' must be 'overwrite' or 'update', but got: $it")
146+
}
147+
})
148+
149+
defaultVersion.set(project.providers.gradleProperty("defaultVersion"))
150+
}

0 commit comments

Comments
 (0)