Skip to content

Commit 3b20dad

Browse files
committed
Merge branch 'master' into mila/multiple-inequality-support
2 parents de360e2 + f2a0fa3 commit 3b20dad

File tree

29 files changed

+263
-80
lines changed

29 files changed

+263
-80
lines changed

README.md

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -225,30 +225,21 @@ strategy](https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.Resolutio
225225

226226
### Commands
227227

228-
The simplest way to publish a project and all its associated dependencies is to
229-
just publish all projects. The following command builds SNAPSHOT dependencies of
230-
all projects. All pom level dependencies within the published artifacts will
231-
also point to SNAPSHOT versions that are co-published.
228+
For more advanced use cases where developers wish to make changes to a project,
229+
but have transitive dependencies point to publicly released versions, individual
230+
projects may be published as follows.
232231

233232
```bash
234-
./gradlew publishAllToLocal
233+
# e.g. to publish Firestore and Functions
234+
./gradlew -PprojectsToPublish="firebase-firestore,firebase-functions" \
235+
publishReleasingLibrariesToMavenLocal
235236
```
236237

237238
Developers may take a dependency on these locally published versions by adding
238239
the `mavenLocal()` repository to your [repositories
239240
block](https://docs.gradle.org/current/userguide/declaring_repositories.html) in
240241
your app module's build.gradle.
241242

242-
For more advanced use cases where developers wish to make changes to a project,
243-
but have transitive dependencies point to publicly released versions, individual
244-
projects may be published as follows.
245-
246-
```bash
247-
# e.g. to publish Firestore and Functions
248-
./gradlew -PprojectsToPublish=":firebase-firestore,:firebase-functions" \
249-
publishProjectsToMavenLocal
250-
```
251-
252243
### Code Formatting
253244

254245
#### Java

buildSrc/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## Build Source
22

3+
> [!NOTE]
4+
> Eventually, this will be merged with our [contributor documentation](https://firebase.github.io/firebase-android-sdk/).
5+
36
This file will be more organized as time progresses. Because a lot of our
47
plugins and systems require a moderate amount of cognitive overhead to understand,
58
I thought it best to provide documentation for such systems. You can find the

buildSrc/src/main/java/com/google/firebase/gradle/bomgenerator/RecipeVersionWriter.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -173,18 +173,6 @@ public String generateVersionUpdate() {
173173
"Firebase Functions KTX",
174174
"functions-ktx-dependency",
175175
"com.google.firebase:firebase-functions-ktx"));
176-
outputBuilder.append(
177-
generateVersionVariable(
178-
depsByArtifactId,
179-
"Firebase Dynamic Links",
180-
"fdl-dependency",
181-
"com.google.firebase:firebase-dynamic-links"));
182-
outputBuilder.append(
183-
generateVersionVariable(
184-
depsByArtifactId,
185-
"Firebase Dynamic Links KTX",
186-
"fdl-ktx-dependency",
187-
"com.google.firebase:firebase-dynamic-links-ktx"));
188176
outputBuilder.append(
189177
generateVersionVariable(
190178
depsByArtifactId,

buildSrc/src/main/java/com/google/firebase/gradle/plugins/FirebaseLibraryPlugin.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class FirebaseLibraryPlugin : BaseFirebaseLibraryPlugin() {
9191

9292
private fun getSemverTaskAar(project: Project, firebaseLibrary: FirebaseLibraryExtension) {
9393
project.mkdir("semver")
94+
project.mkdir("semver/previous-version")
9495
project.tasks.register<GmavenCopier>("copyPreviousArtifacts") {
9596
dependsOn("bundleReleaseAar")
9697
project.file("semver/previous.aar").delete()
@@ -111,7 +112,10 @@ class FirebaseLibraryPlugin : BaseFirebaseLibraryPlugin() {
111112

112113
project.tasks.register<Copy>("extractPreviousClasses") {
113114
dependsOn("copyPreviousArtifacts")
114-
if (project.file("semver/previous.aar").exists()) {
115+
if (
116+
GmavenHelper(firebaseLibrary.groupId.get(), firebaseLibrary.artifactId.get())
117+
.isPresentInGmaven()
118+
) {
115119
from(project.zipTree("semver/previous.aar"))
116120
into(project.file("semver/previous-version"))
117121
}
@@ -121,15 +125,15 @@ class FirebaseLibraryPlugin : BaseFirebaseLibraryPlugin() {
121125

122126
val previousJarFile = project.file("semver/previous-version/classes.jar").absolutePath
123127
project.tasks.register<ApiDiffer>("semverCheck") {
128+
dependsOn("extractCurrentClasses")
129+
dependsOn("extractPreviousClasses")
124130
currentJar.value(currentJarFile)
125131
previousJar.value(previousJarFile)
126132
version.value(firebaseLibrary.version)
127133
previousVersionString.value(
128134
GmavenHelper(firebaseLibrary.groupId.get(), firebaseLibrary.artifactId.get())
129135
.getLatestReleasedVersion()
130136
)
131-
dependsOn("extractCurrentClasses")
132-
dependsOn("extractPreviousClasses")
133137
}
134138
}
135139

buildSrc/src/main/java/com/google/firebase/gradle/plugins/GmavenHelper.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package com.google.firebase.gradle.plugins
1616

1717
import java.io.FileNotFoundException
18+
import java.net.HttpURLConnection
1819
import java.net.URL
1920
import javax.xml.parsers.DocumentBuilder
2021
import javax.xml.parsers.DocumentBuilderFactory
@@ -30,6 +31,16 @@ class GmavenHelper(val groupId: String, val artifactId: String) {
3031
return "${GMAVEN_ROOT}/${groupIdAsPath}/${artifactId}/${version}/${pomFileName}"
3132
}
3233

34+
fun isPresentInGmaven(): Boolean {
35+
val groupIdAsPath = groupId.replace(".", "/")
36+
val u = URL("${GMAVEN_ROOT}/${groupIdAsPath}/${artifactId}/maven-metadata.xml")
37+
val huc: HttpURLConnection = u.openConnection() as HttpURLConnection
38+
huc.setRequestMethod("GET") // OR huc.setRequestMethod ("HEAD");
39+
huc.connect()
40+
val code: Int = huc.getResponseCode()
41+
return code == HttpURLConnection.HTTP_OK
42+
}
43+
3344
fun getArtifactForVersion(version: String, isJar: Boolean): String {
3445
val fileName =
3546
if (isJar == true) "${artifactId}-${version}.jar" else "${artifactId}-${version}.aar"

buildSrc/src/main/java/com/google/firebase/gradle/plugins/PublishingPlugin.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ abstract class PublishingPlugin : Plugin<Project> {
191191
allFirebaseLibraries: List<FirebaseLibraryExtension>
192192
): ReleaseMetadata? {
193193
val projectsToPublish = project.provideProperty<String>("projectsToPublish").orNull
194-
val releaseName = project.provideProperty<String>("releaseName").orNull
194+
val releaseName = project.provideProperty<String>("releaseName").orNull ?: "NO_NAME"
195195

196-
if (projectsToPublish == null || releaseName == null) return null
196+
if (projectsToPublish == null) return null
197197

198198
val projectNames = projectsToPublish.split(",")
199199
val librariesToRelease =
@@ -450,7 +450,6 @@ abstract class PublishingPlugin : Plugin<Project> {
450450
project.tasks.register(SEMVER_CHECK_TASK) {
451451
for (releasingProject in releasingProjects) {
452452
val semverCheckTask = releasingProject.tasks.named("semverCheck")
453-
454453
dependsOn(semverCheckTask)
455454
}
456455
}

buildSrc/src/main/java/com/google/firebase/gradle/plugins/semver/GmavenCopier.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,14 @@ abstract class GmavenCopier : DefaultTask() {
3636
@TaskAction
3737
fun run() {
3838
val mavenHelper = GmavenHelper(groupId.get(), artifactId.get())
39+
if (!mavenHelper.isPresentInGmaven()) {
40+
return
41+
}
3942
val gMavenPath =
4043
mavenHelper.getArtifactForVersion(
4144
mavenHelper.getLatestReleasedVersion(),
4245
!aarAndroidFile.get()
4346
)
44-
try {
45-
URL(gMavenPath).openStream().use { Files.copy(it, Paths.get(filePath.get())) }
46-
} catch (_: java.io.FileNotFoundException) {
47-
// Gmaven Artifact doesn't exist.
48-
return
49-
}
47+
URL(gMavenPath).openStream().use { Files.copy(it, Paths.get(filePath.get())) }
5048
}
5149
}

firebase-crashlytics/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Unreleased
2+
* [changed] Updated `firebase-sessions` dependency to v1.0.2
23

34
# 18.4.0
45
* [feature] Integrated with Firebase sessions library to enable upcoming features related to
@@ -477,4 +478,3 @@ The following release notes describe changes in the new SDK.
477478
from your `AndroidManifest.xml` file.
478479
* [removed] The `fabric.properties` and `crashlytics.properties` files are no
479480
longer supported. Remove them from your app.
480-

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,24 @@ public synchronized boolean isAutomaticDataCollectionEnabled() {
7575
final boolean dataCollectionEnabled =
7676
crashlyticsDataCollectionEnabled != null
7777
? crashlyticsDataCollectionEnabled
78-
: firebaseApp.isDataCollectionDefaultEnabled();
78+
: isFirebaseDataCollectionDefaultEnabled();
7979
logDataCollectionState(dataCollectionEnabled);
8080
return dataCollectionEnabled;
8181
}
8282

83+
/**
84+
* Determine whether automatic data collection is enabled or disabled by default in all SDKs.
85+
*
86+
* <p>If the FirebaseApp has been deleted, returns false.
87+
*/
88+
private boolean isFirebaseDataCollectionDefaultEnabled() {
89+
try {
90+
return firebaseApp.isDataCollectionDefaultEnabled();
91+
} catch (IllegalStateException ignored) {
92+
return false;
93+
}
94+
}
95+
8396
public synchronized void setCrashlyticsDataCollectionEnabled(@Nullable Boolean enabled) {
8497
if (enabled != null) {
8598
setInManifest = false;

firebase-datatransport/CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
# Unreleased
2-
3-
2+
* [feature] Expose the transport factory as a qualified dependency based on the endpoint connected.

firebase-datatransport/firebase-datatransport.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ android {
4646
}
4747

4848
dependencies {
49-
implementation 'com.google.firebase:firebase-common:20.3.1'
49+
implementation 'com.google.firebase:firebase-common:20.3.3'
5050
implementation 'com.google.firebase:firebase-components:17.1.0'
5151
implementation 'com.google.android.datatransport:transport-api:3.0.0'
52-
implementation 'com.google.android.datatransport:transport-runtime:3.1.8'
53-
implementation 'com.google.android.datatransport:transport-backend-cct:3.1.8'
52+
implementation 'com.google.android.datatransport:transport-runtime:3.1.9'
53+
implementation 'com.google.android.datatransport:transport-backend-cct:3.1.9'
5454
implementation 'androidx.annotation:annotation:1.1.0'
5555

5656
testImplementation 'androidx.test:runner:1.2.0'
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version=18.1.9
1+
version=18.2.0
22
latestReleasedVersion=18.1.8
33
android.enableUnitTestBinaryResources=true
4-
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2023 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.datatransport;
16+
17+
import java.lang.annotation.ElementType;
18+
import java.lang.annotation.Target;
19+
import javax.inject.Qualifier;
20+
21+
@Qualifier
22+
@Target({ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD})
23+
public @interface LegacyTransportBackend {}

firebase-datatransport/src/main/java/com/google/firebase/datatransport/package-info.java renamed to firebase-datatransport/src/main/java/com/google/firebase/datatransport/TransportBackend.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC
1+
// Copyright 2023 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -12,5 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
/** @hide */
1615
package com.google.firebase.datatransport;
16+
17+
import java.lang.annotation.ElementType;
18+
import java.lang.annotation.Target;
19+
import javax.inject.Qualifier;
20+
21+
@Qualifier
22+
@Target({ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD})
23+
public @interface TransportBackend {}

firebase-datatransport/src/main/java/com/google/firebase/datatransport/TransportRegistrar.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616

1717
import android.content.Context;
1818
import androidx.annotation.Keep;
19+
import androidx.annotation.NonNull;
1920
import com.google.android.datatransport.TransportFactory;
2021
import com.google.android.datatransport.cct.CCTDestination;
2122
import com.google.android.datatransport.runtime.TransportRuntime;
2223
import com.google.firebase.components.Component;
2324
import com.google.firebase.components.ComponentRegistrar;
2425
import com.google.firebase.components.Dependency;
26+
import com.google.firebase.components.Qualified;
2527
import com.google.firebase.platforminfo.LibraryVersionComponent;
2628
import java.util.Arrays;
2729
import java.util.List;
@@ -31,6 +33,7 @@ public class TransportRegistrar implements ComponentRegistrar {
3133
private static final String LIBRARY_NAME = "fire-transport";
3234

3335
@Override
36+
@NonNull
3437
public List<Component<?>> getComponents() {
3538
return Arrays.asList(
3639
Component.builder(TransportFactory.class)
@@ -42,6 +45,22 @@ public List<Component<?>> getComponents() {
4245
return TransportRuntime.getInstance().newFactory(CCTDestination.LEGACY_INSTANCE);
4346
})
4447
.build(),
48+
Component.builder(Qualified.qualified(LegacyTransportBackend.class, TransportFactory.class))
49+
.add(Dependency.required(Context.class))
50+
.factory(
51+
c -> {
52+
TransportRuntime.initialize(c.get(Context.class));
53+
return TransportRuntime.getInstance().newFactory(CCTDestination.LEGACY_INSTANCE);
54+
})
55+
.build(),
56+
Component.builder(Qualified.qualified(TransportBackend.class, TransportFactory.class))
57+
.add(Dependency.required(Context.class))
58+
.factory(
59+
c -> {
60+
TransportRuntime.initialize(c.get(Context.class));
61+
return TransportRuntime.getInstance().newFactory(CCTDestination.INSTANCE);
62+
})
63+
.build(),
4564
LibraryVersionComponent.create(LIBRARY_NAME, BuildConfig.VERSION_NAME));
4665
}
4766
}

firebase-firestore/README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,10 @@ from within Android Studio.
9999

100100
## Build Local Jar of Firestore SDK
101101

102-
Run:
103102
```bash
104-
./gradlew publishAllToLocal
103+
./gradlew -PprojectsToPublish="firebase-firestore" publishReleasingLibrariesToMavenLocal
105104
```
106105

107-
This will publish firebase SDK at SNAPSHOT versions. All pom level dependencies
108-
within the published artifacts will also point to SNAPSHOT versions that are
109-
co-published. The results will be built into your local maven repo.
110-
111106
Developers may then take a dependency on these locally published versions by adding
112107
the `mavenLocal()` repository to your [repositories
113108
block](https://docs.gradle.org/current/userguide/declaring_repositories.html) in

firebase-inappmessaging-display/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Unreleased
2+
* [changed] Firelog to clearcut migration.
23

34
# 20.3.3
45
* [unchanged] Updated internal Dagger dependency.

firebase-inappmessaging/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Unreleased
2+
* [changed] Firelog to clearcut migration.
23

34
# 20.3.3
45
* [unchanged] Updated internal Dagger dependency.

firebase-inappmessaging/firebase-inappmessaging.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ dependencies {
106106
implementation 'com.google.firebase:firebase-components:17.1.0'
107107
implementation project(':protolite-well-known-types')
108108
implementation 'com.google.android.datatransport:transport-api:3.0.0'
109-
implementation 'com.google.firebase:firebase-datatransport:18.1.7'
109+
implementation project(':firebase-datatransport')
110110
implementation 'com.google.firebase:firebase-installations-interop:17.1.0'
111111
runtimeOnly project(':firebase-installations')
112112
implementation 'javax.inject:javax.inject:1'

firebase-inappmessaging/src/main/java/com/google/firebase/inappmessaging/FirebaseInAppMessagingRegistrar.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import com.google.firebase.components.ComponentRegistrar;
3131
import com.google.firebase.components.Dependency;
3232
import com.google.firebase.components.Qualified;
33+
import com.google.firebase.datatransport.LegacyTransportBackend;
3334
import com.google.firebase.events.Subscriber;
3435
import com.google.firebase.inappmessaging.internal.AbtIntegrationHelper;
3536
import com.google.firebase.inappmessaging.internal.ProgramaticContextualTriggers;
@@ -66,6 +67,9 @@ public class FirebaseInAppMessagingRegistrar implements ComponentRegistrar {
6667
private Qualified<Executor> lightWeightExecutor =
6768
Qualified.qualified(Lightweight.class, Executor.class);
6869

70+
private Qualified<TransportFactory> legacyTransportFactory =
71+
Qualified.qualified(LegacyTransportBackend.class, TransportFactory.class);
72+
6973
@Override
7074
@Keep
7175
public List<Component<?>> getComponents() {
@@ -77,7 +81,7 @@ public List<Component<?>> getComponents() {
7781
.add(Dependency.required(FirebaseApp.class))
7882
.add(Dependency.required(AbtComponent.class))
7983
.add(Dependency.deferred(AnalyticsConnector.class))
80-
.add(Dependency.required(TransportFactory.class))
84+
.add(Dependency.required(legacyTransportFactory))
8185
.add(Dependency.required(Subscriber.class))
8286
.add(Dependency.required(backgroundExecutor))
8387
.add(Dependency.required(blockingExecutor))
@@ -125,7 +129,7 @@ private FirebaseInAppMessaging providesFirebaseInAppMessaging(ComponentContainer
125129
new ApiClientModule(firebaseApp, firebaseInstallations, universalComponent.clock()))
126130
.grpcClientModule(new GrpcClientModule(firebaseApp))
127131
.universalComponent(universalComponent)
128-
.transportFactory(container.get(TransportFactory.class))
132+
.transportFactory(container.get(legacyTransportFactory))
129133
.build();
130134

131135
return instance.providesFirebaseInAppMessaging();

0 commit comments

Comments
 (0)