8000 Migrating to new protolite runtime (#1534) · firebase/firebase-android-sdk@037282f · GitHub
[go: up one dir, main page]

Skip to content

Commit 037282f

Browse files
ashwinraghavschmidt-sebastianrlazo
authored
Migrating to new protolite runtime (#1534)
* Upgrade Firestore's GRPC to 1.26 * Bump prolite GRPC version * fix other callers * remove javalite * Use the same Guava * Google truth * GRPC testing * Fix * ... * fix iam * fix firestore * More attempts that failed * WIP * grpc & protobuf-javalite * Fix components & installations gradle error in fiamui-app. * Moving back to proto * Removing grpc protos * 1 * Fixing smoke tests * Fixing smoke tests * Test * test2 * Cherry picking cloud protos * Descriptor * Cleanup * 1. No proto deps Failure https://android-ci.firebaseopensource.com/view/gcs/android-ci/pr-logs/pull/firebase_firebase-android-sdk/1534/smoke-tests/1258819568042774532/ google/firestore/v1/document.proto:20:1: Import "google/api/annotations.proto" was not found or had errors. google/firestore/v1/document.proto:23:1: Import "google/type/latlng.proto" was not found or had errors. google/firestore/v1/document.proto:123:5: "google.type.LatLng" is not defined. google/firebase/firestore/proto/maybe_document.proto:24:1: Import "google/firestore/v1/document.proto" was not found or had errors. google/firebase/firestore/proto/maybe_document.proto:57:5: "google.firestore.v1.Document" is not defined. * 2. Adding only cloud protos Smoke test failures https://android-ci.firebaseopensource.com/view/gcs/android-ci/pr-logs/pull/firebase_firebase-android-sdk/1534/smoke-tests/1258800815649329152/ * 3. Upgrading proto toolchain Since the cloud protos brings in the proto dep, the resulting well known types has conflicting classes Failures https://android-ci.firebaseopensource.com/view/gcs/android-ci/pr-logs/pull/firebase_firebase-android-sdk/1534/smoke-tests/1258860209397305345/ java.lang.RuntimeException: Duplicate class com.google.protobuf.Any found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.1-SNAPSHOT:20200508.204735-1) and protobuf-javalite-3.11.0.jar (com.google.protobuf:protobuf-javalite:3.11.0) Duplicate class com.google.protobuf.Any$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.1-SNAPSHOT:20200508.204735-1) and protobuf-javalite-3.11.0.jar (com.google.protobuf:protobuf-javalite:3.11.0) Duplicate class com.google.protobuf.Any$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.1-SNAPSHOT:20200508.204735-1) and protobuf-javalite-3.11.0.jar (com.google.protobuf:protobuf-javalite:3.11.0) Duplicate class com.google.protobuf.AnyOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.1-SNAPSHOT:20200508.204735-1) and protobuf-javalite-3.11.0.jar (com.google.protobuf:protobuf-javalite:3.11.0) * 4. Excluded proto dependencies Descriptor not found Smoke test failures https://android-ci.firebaseopensource.com/view/gcs/android-ci/pr-logs/pull/firebase_firebase-android-sdk/1534/smoke-tests/1258862867042537472/ * Added compile(only?) dep on proto Smoke test failures https://android-ci.firebaseopensource.com/view/gcs/android-ci/pr-logs/pull/firebase_firebase-android-sdk/1534/smoke-tests/1258867395951333376/ * Vendored descriptor proto Duplicate classes https://android-ci.firebaseopensource.com/view/gcs/android-ci/pr-logs/pull/firebase_firebase-android-sdk/1534/smoke-tests/1258872300619436032/ * Removed proto compile dep https://android-ci.firebaseopensource.com/view/gcs/android-ci/pr-logs/pull/firebase_firebase-android-sdk/1534/smoke-tests/1258873811042832387/ * Removed duration https://android-ci.firebaseopensource.com/view/gcs/android-ci/pr-logs/pull/firebase_firebase-android-sdk/1534/smoke-tests/1258877965266063361/ * Added duration as a `protobuf` config * Removing duration class files * Changing case * Bumped version of well known types * Use previous version of GRPC because of guava dep. * Changes to transport-backend-cct proto configuration. * remove fiamui-app * remove fiamu-app entry in subprojects.cfg * testapp fix * Use full proto runtime for tests. * Use same protoc version for all entries. * Don't upgrade version for crashlytics tests. * Proguard rule for inappmessaging. * Test using protobuf only * Rollback previous test. * Move proguard to well-known-types. * Use javalite fix referred in protobuf repo protocolbuffers/protobuf#7094 (comment) * Propagate proguart configuration from protolite-well-known-types * Nit, fixes, and clean ups. * Use double quotes for variable substitution. * Missing 'c' * Remove unwanted change. * Additional lints. * No javadoc for protolite-well-known-types. * Undo changes to protolite-well-known-types * Add empty api.txt * Don't publish javadoc for proto-well-known-types. * Address comments. Co-authored-by: Sebastian Schmidt <mrschmidt@google.com> Co-authored-by: Rodrigo Lazo Paz <rlazo@google.com>
1 parent cbc422e commit 037282f

File tree

17 files changed

+1052
-88
lines changed

17 files changed

+1052
-88
lines changed

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ ext {
4949
playServicesVersion = '16.0.1'
5050
supportAnnotationsVersion = '28.0.0'
5151
googleTruthVersion = '0.45'
52+
grpcVersion = '1.28.0'
5253
robolectricVersion = '4.3.1'
54+
protocVersion = '3.11.0'
55+
javaliteVersion = '3.11.0'
5356
}
5457

5558
apply plugin: com.google.firebase.gradle.plugins.publish.PublishingPlugin

firebase-abt/firebase-abt.gradle

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,12 @@ firebaseLibrary {
2525
// TODO(issue/568): Remove this once legacy logic is removed from Remote Config.
2626
protobuf {
2727
protoc {
28-
artifact = 'com.google.protobuf:protoc:3.4.0'
29-
}
30-
plugins {
31-
javalite {
32-
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
33-
}
28+
artifact = "com.google.protobuf:protoc:$protocVersion"
3429
}
3530
generateProtoTasks {
3631
all().each { task ->
3732
task.builtins {
38-
remove java
39-
}
40-
task.plugins {
41-
javalite {}
33+
java { option 'lite' }
4234
}
4335
}
4436
}
@@ -86,7 +78,7 @@ dependencies {
8678
exclude group: "com.google.firebase", module: "firebase-common"
8779
}
8880
implementation 'com.google.android.gms:play-services-basement:17.0.0'
89-
implementation 'com.google.protobuf:protobuf-lite:3.0.1'
81+
implementation "com.google.protobuf:protobuf-javalite:$javaliteVersion"
9082
testImplementation 'org.mockito:mockito-core:2.25.0'
9183
testImplementation 'com.google.truth:truth:0.44'
9284
testImplementation 'junit:junit:4.13-beta-2'

firebase-config/bandwagoner/bandwagoner.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ dependencies {
7373
implementation 'com.google.android.gms:play-services-tasks:17.0.0'
7474

7575
// Support Libraries
76-
implementation 'com.google.guava:guava:27.1-android'
76+
implementation 'com.google.guava:guava:28.1-android'
7777
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
7878

7979
implementation 'androidx.appcompat:appcompat:1.0.2'

firebase-config/firebase-config.gradle

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,12 @@ protobuf {
2828
// Configure the protoc executable
2929
protoc {
3030
// Download from repositories
31-
artifact = 'com.google.protobuf:protoc:3.4.0'
32-
}
33-
plugins {
34-
javalite {
35-
// The codegen for lite comes as a separate artifact
36-
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
37-
}
31+
artifact = "com.google.protobuf:protoc:$protocVersion"
3832
}
3933
generateProtoTasks {
4034
all().each { task ->
4135
task.builtins {
42-
// In most cases you don't need the full Java output
43-
// if you use the lite output.
44-
remove java
45-
}
46-
task.plugins {
47-
javalite {}
36+
java { option 'lite' }
4837
}
4938
}
5039
}
@@ -89,7 +78,7 @@ dependencies {
8978
runtimeOnly project(':firebase-installations')
9079

9180
implementation 'com.google.firebase:firebase-measurement-connector:18.0.0'
92-
implementation 'com.google.protobuf:protobuf-lite:3.0.1'
81+
implementation "com.google.protobuf:protobuf-javalite:$javaliteVersion"
9382
implementation 'com.google.android.gms:play-services-tasks:17.0.2'
9483

9584
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,5 @@ dependencies {
7171
androidTestImplementation 'org.mockito:mockito-core:2.25.0'
7272
androidTestImplementation 'com.linkedin.dexmaker:dexmaker:2.25.0'
7373
androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito:2.25.0'
74-
androidTestImplementation 'com.google.protobuf:protobuf-java:3.6.1'
74+
androidTestImplementation "com.google.protobuf:protobuf-javalite:$javaliteVersion"
7575
}

firebase-firestore/firebase-firestore.gradle

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,22 @@ protobuf {
2626
// Configure the protoc executable
2727
protoc {
2828
// Download from repositories
29-
artifact = 'com.google.protobuf:protoc:3.4.0'
29+
artifact = "com.google.protobuf:protoc:$protocVersion"
3030
}
3131
plugins {
3232
grpc {
33-
artifact = 'io.grpc:protoc-gen-grpc-java:1.21.0'
34-
}
35-
javalite {
36-
// The codegen for lite comes as a separate artifact
37-
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
33+
artifact = "io.grpc:protoc-gen-grpc-java:$grpcVersion"
3834
}
3935
}
4036
generateProtoTasks {
4137
all().each { task ->
4238
task.builtins {
43-
// In most cases you don't need the full Java output
44-
// if you use the lite output.
45-
remove java
39+
java { option 'lite' }
4640
}
4741
task.plugins {
4842
grpc {
4943
option 'lite'
5044
}
51-
javalite {}
5245
}
5346
}
5447
}
@@ -108,9 +101,10 @@ configurations.all {
108101
if(it.name.contains('AndroidTestRuntimeClasspath')) {
109102
it.resolutionStrategy {
110103
force 'org.checkerframework:checker-compat-qual:2.5.5'
111-
force 'com.google.guava:guava:27.0.1-android'
104+
force 'com.google.guava:guava:28.1-android'
112105
}
113106
}
107+
exclude group: "com.google.protobuf", module: "protobuf-java"
114108
}
115109

116110
dependencies {
@@ -124,10 +118,10 @@ dependencies {
124118
compileOnly 'javax.annotation:jsr250-api:1.0'
125119

126120
implementation 'androidx.annotation:annotation:1.1.0'
127-
implementation 'io.grpc:grpc-stub:1.21.0'
128-
implementation 'io.grpc:grpc-protobuf-lite:1.21.0'
129-
implementation 'io.grpc:grpc-okhttp:1.21.0'
130-
implementation 'io.grpc:grpc-android:1.21.0'
121+
implementation "io.grpc:grpc-stub:$grpcVersion"
122+
implementation "io.grpc:grpc-protobuf-lite:$grpcVersion"
123+
implementation "io.grpc:grpc-okhttp:$grpcVersion"
124+
implementation "io.grpc:grpc-android:$grpcVersion"
131125
implementation 'com.google.android.gms:play-services-basement:17.0.0'
132126
implementation 'com.google.android.gms:play-services-tasks:17.0.0'
133127
implementation 'com.google.android.gms:play-services-base:17.0.0'
@@ -148,7 +142,9 @@ dependencies {
148142
testImplementation 'com.google.guava:guava-testlib:12.0-rc2'
149143

150144
androidTestImplementation 'junit:junit:4.12'
151-
androidTestImplementation "com.google.truth:truth:$googleTruthVersion"
145+
androidTestImplementation("com.google.truth:truth:$googleTruthVersion"){
146+
exclude group: "org.codehaus.mojo", module: "animal-sniffer-annotations"
147+
}
152148
androidTestImplementation C74D 'org.mockito:mockito-core:2.25.0'
153149
androidTestImplementation 'org.mockito:mockito-android:2.25.0'
154150
androidTestImplementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8'

firebase-firestore/ktx/ktx.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ dependencies {
5555
testImplementation 'org.mockito:mockito-core:2.25.0'
5656
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
5757
testImplementation 'com.google.android.gms:play-services-tasks:16.0.1'
58-
testImplementation 'com.google.protobuf:protobuf-lite:3.0.1'
5958
testImplementation "org.robolectric:robolectric:$robolectricVersion"
6059
testImplementation 'junit:junit:4.12'
6160
testImplementation "com.google.truth:truth:$googleTruthVersion"

firebase-firestore/src/main/java/com/google/firebase/firestore/remote/GrpcCallProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private ManagedChannel initChannel(Context context, DatabaseInfo databaseInfo) {
125125
// Wrap the ManagedChannelBuilder in an AndroidChannelBuilder. This allows the channel to
126126
// respond more gracefully to network change events (such as switching from cell to wifi).
127127
AndroidChannelBuilder androidChannelBuilder =
128-
AndroidChannelBuilder.fromBuilder(channelBuilder).context(context);
128+
AndroidChannelBuilder.usingBuilder(channelBuilder).context(context);
129129

130130
return androidChannelBuilder.build();
131131
}

firebase-inappmessaging/firebase-inappmessaging.gradle

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,22 @@ protobuf {
2525
// Configure the protoc executable
2626
protoc {
2727
// Download from repositories
28-
artifact = 'com.google.protobuf:protoc:3.4.0'
28+
artifact = "com.google.protobuf:protoc:$protocVersion"
2929
}
3030
plugins {
3131
grpc {
32-
artifact = 'io.grpc:protoc-gen-grpc-java:1.21.0'
33-
}
34-
javalite {
35-
// The codegen for lite comes as a separate artifact
36-
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
32+
artifact = "io.grpc:protoc-gen-grpc-java:$grpcVersion"
3733
}
3834
}
3935
generateProtoTasks {
4036
all().each { task ->
4137
task.builtins {
42-
// In most cases you don't need the full Java output
43-
// if you use the lite output.
44-
remove java
38+
java { option 'lite' }
4539
}
4640
task.plugins {
4741
grpc {
4842
option 'lite'
4943
}
50-
javalite {}
5144
}
5245
}
5346
}
@@ -104,7 +97,7 @@ configurations.all {
10497
if(it.name.contains('AndroidTestRuntimeClasspath')) {
10598
it.resolutionStrategy {
10699
force 'org.checkerframework:checker-compat-qual:2.5.5'
107-
force 'com.google.guava:guava:27.0.1-android'
100+
force 'com.google.guava:guava:28.1-android'
108101
}
109102
}
110103
}
@@ -123,10 +116,10 @@ dependencies {
123116
compileOnly 'javax.annotation:jsr250-api:1.0'
124117

125118
implementation 'com.google.android.gms:play-services-tasks:17.0.2'
126-
implementation 'io.grpc:grpc-stub:1.21.0'
127-
implementation 'io.grpc:grpc-protobuf-lite:1.21.0'
128-
implementation 'io.grpc:grpc-okhttp:1.21.0'
129-
implementation 'com.google.dagger:dagger:2.27'
119+
implementation "io.grpc:grpc-stub:$grpcVersion"
120+
implementation "io.grpc:grpc-protobuf-lite:$grpcVersion"
121+
implementation "io.grpc:grpc-okhttp:$grpcVersion"
122+
implementation 'com.google.dagger:dagger:2.24'
130123
implementation 'io.reactivex.rxjava2:rxjava:2.1.14'
131124
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
132125
implementation 'com.google.auto.value:auto-value-annotations:1.6.6'
@@ -146,15 +139,15 @@ dependencies {
146139
testImplementation ("org.robolectric:robolectric:$robolectricVersion") {
147140
exclude group: 'com.google.protobuf', mod C74D ule: 'protobuf-java'
148141
}
149-
testImplementation 'io.grpc:grpc-testing:1.21.0'
142+
testImplementation "io.grpc:grpc-testing:$grpcVersion"
150143
testImplementation 'com.google.guava:guava:27.1-android'
151144

152145
androidTestImplementation 'junit:junit:4.12'
153146
androidTestImplementation 'androidx.test:runner:1.2.0'
154147
androidTestImplementation "com.google.truth:truth:$googleTruthVersion"
155148
androidTestImplementation 'org.mockito:mockito-core:2.25.0'
156149
androidTestImplementation 'org.awaitility:awaitility:3.1.0'
157-
androidTestImplementation 'io.grpc:grpc-testing:1.21.0'
150+
androidTestImplementation "io.grpc:grpc-testing:$grpcVersion"
158151
androidTestImplementation 'com.linkedin.dexmaker:dexmaker:2.25.0'
159152
androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito:2.25.0'
160153

protolite-well-known-types/README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,22 @@ A typical grpc and protobuf-lite configuration should look like
2929
```groovy
3030
protobuf {
3131
protoc {
32-
artifact = 'com.google.protobuf:protoc:3.4.0'
32+
artifact = "com.google.protobuf:protoc:$protocVersion"
3333
}
3434
plugins {
3535
grpc {
3636
artifact = "io.grpc:protoc-gen-grpc-java:$grpcVersion"
3737
}
38-
javalite {
39-
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
40-
}< 4473 /div>
4138
}
4239
generateProtoTasks {
4340
all().each { task ->
4441
task.builtins {
45-
remove java
42+
java { option 'lite' }
4643
}
4744
task.plugins {
4845
grpc {
4946
option 'lite'
5047
}
51-
javalite { }
5248
}
5349
}
5450
}

0 commit comments

Comments
 (0)
0