Skip to content

Commit 48929c4

Browse files
authored
Upgrade to protobuf lite 3.10
This finally brings lite into version number sync with full proto. Well-known protos for javalite are now pre-generated.
1 parent b38134e commit 48929c4

File tree

9 files changed

+28
-55
lines changed

9 files changed

+28
-55
lines changed

android-interop-testing/app/build.gradle

+3-5
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,15 @@ android {
4141
protobuf {
4242
protoc { artifact = 'com.google.protobuf:protoc:3.10.0' }
4343
plugins {
44-
javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" }
4544
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.26.0-SNAPSHOT' // CURRENT_GRPC_VERSION
4645
}
4746
}
4847
generateProtoTasks {
4948
all().each { task ->
49+
task.builtins {
50+
java { option 'lite' }
51+
}
5052
task.plugins {
51-
javalite {}
5253
grpc {
5354
// Options added to --grpc_out
5455
option 'lite'
@@ -77,9 +78,6 @@ dependencies {
7778
implementation 'io.grpc:grpc-stub:1.26.0-SNAPSHOT' // CURRENT_GRPC_VERSION
7879
implementation 'io.grpc:grpc-testing:1.26.0-SNAPSHOT' // CURRENT_GRPC_VERSION
7980

80-
// workaround for https://github.com/google/protobuf/issues/1889
81-
protobuf 'com.google.protobuf:protobuf-java:3.0.2'
82-
8381
androidTestImplementation 'androidx.test:rules:1.1.0-alpha1'
8482
androidTestImplementation 'androidx.test:runner:1.1.0-alpha1'
8583
}

build.gradle

+1-7
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,6 @@ subprojects {
105105
}
106106

107107
tasks.withType(JavaCompile) {
108-
// Protobuf-generated code produces some warnings.
109-
// https://github.com/google/protobuf/issues/2718
110-
it.options.compilerArgs += [
111-
"-Xlint:-cast",
112-
]
113108
it.options.errorprone.excludedPaths = ".*/src/generated/[^/]+/java/.*" +
114109
"|.*/build/generated/source/proto/[^/]+/java/.*"
115110
}
@@ -137,8 +132,7 @@ subprojects {
137132
perfmark: 'io.perfmark:perfmark-api:0.19.0',
138133
pgv: 'io.envoyproxy.protoc-gen-validate:pgv-java-stub:0.2.0',
139134
protobuf: "com.google.protobuf:protobuf-java:${protobufVersion}",
140-
protobuf_lite: "com.google.protobuf:protobuf-lite:3.0.1",
141-
protoc_lite: "com.google.protobuf:protoc-gen-javalite:3.0.0",
135+
protobuf_lite: "com.google.protobuf:protobuf-javalite:${protobufVersion}",
142136
protobuf_util: "com.google.protobuf:protobuf-java-util:${protobufVersion}",
143137
lang: "org.apache.commons:commons-lang3:3.5",
144138

compiler/build.gradle

+4-16
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,13 @@ sourceSets {
142142
}
143143

144144
compileTestJava {
145-
options.compilerArgs += [
146-
"-Xlint:-cast"
147-
]
148145
options.errorprone.excludedPaths = ".*/build/generated/source/proto/.*"
149146
}
150147

151148
compileTestLiteJava {
152149
options.compilerArgs = compileTestJava.options.compilerArgs
153-
// Protobuf-generated Lite produces quite a few warnings.
154150
options.compilerArgs += [
155-
"-Xlint:-rawtypes",
156-
"-Xlint:-unchecked",
157-
"-Xlint:-fallthrough"
151+
"-Xlint:-cast"
158152
]
159153
options.errorprone.excludedPaths = ".*/build/generated/source/proto/.*"
160154
}
@@ -168,13 +162,6 @@ protobuf {
168162
}
169163
}
170164
plugins {
171-
javalite {
172-
if (project.hasProperty('protoc-gen-javalite')) {
173-
path = project['protoc-gen-javalite']
174-
} else {
175-
artifact = libraries.protoc_lite
176-
}
177-
}
178165
grpc { path = javaPluginPath }
179166
}
180167
generateProtoTasks {
@@ -184,9 +171,10 @@ protobuf {
184171
}
185172
ofSourceSet('test')*.plugins { grpc {} }
186173
ofSourceSet('testLite')*.each { task ->
187-
task.builtins { remove java }
174+
task.builtins {
175+
java { option 'lite' }
176+
}
188177
task.plugins {
189-
javalite {}
190178
grpc { option 'lite' }
191179
}
192180
}

examples/android/clientcache/app/build.gradle

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@ android {
2828
}
2929

3030
protobuf {
31-
protoc { artifact = 'com.google.protobuf:protoc:3.4.0' }
31+
protoc { artifact = 'com.google.protobuf:protoc:3.10.0' }
3232
plugins {
33-
javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" }
3433
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.26.0-SNAPSHOT' // CURRENT_GRPC_VERSION
3534
}
3635
}
3736
generateProtoTasks {
3837
all().each { task ->
38+
task.builtins {
39+
java { option 'lite' }
40+
}
3941
task.plugins {
40-
javalite {}
4142
grpc { // Options added to --grpc_out
4243
option 'lite' }
4344
}

examples/android/helloworld/app/build.gradle

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,15 @@ android {
2929
protobuf {
3030
protoc { artifact = 'com.google.protobuf:protoc:3.10.0' }
3131
plugins {
32-
javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" }
3332
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.26.0-SNAPSHOT' // CURRENT_GRPC_VERSION
3433
}
3534
}
3635
generateProtoTasks {
3736
all().each { task ->
37+
task.builtins {
38+
java { option 'lite' }
39+
}
3840
task.plugins {
39-
javalite {}
4041
grpc { // Options added to --grpc_out
4142
option 'lite' }
4243
}

examples/android/routeguide/app/build.gradle

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ android {
2828
protobuf {
2929
protoc { artifact = 'com.google.protobuf:protoc:3.10.0' }
3030
plugins {
31-
javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" }
3231
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.26.0-SNAPSHOT' // CURRENT_GRPC_VERSION
3332
}
3433
}
3534
generateProtoTasks {
3635
all().each { task ->
36+
task.builtins {
37+
java { option 'lite' }
38+
}
3739
task.plugins {
38-
javalite {}
3940
grpc { // Options added to --grpc_out
4041
option 'lite' }
4142
}

examples/android/strictmode/app/build.gradle

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,15 @@ android {
2929
protobuf {
3030
protoc { artifact = 'com.google.protobuf:protoc:3.10.0' }
3131
plugins {
32-
javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" }
3332
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.26.0-SNAPSHOT' // CURRENT_GRPC_VERSION
3433
}
3534
}
3635
generateProtoTasks {
3736
all().each { task ->
37+
task.builtins {
38+
java { option 'lite' }
39+
}
3840
task.plugins {
39-
javalite {}
4041
grpc { // Options added to --grpc_out
4142
option 'lite' }
4243
}

examples/example-kotlin/android/helloworld/app/build.gradle

+3-2
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,15 @@ android {
5151
protobuf {
5252
protoc { artifact = 'com.google.protobuf:protoc:3.10.0' }
5353
plugins {
54-
javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" }
5554
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.26.0-SNAPSHOT' // CURRENT_GRPC_VERSION
5655
}
5756
}
5857
generateProtoTasks {
5958
all().each { task ->
59+
task.builtins {
60+
java { option 'lite' }
61+
}
6062
task.plugins {
61-
javalite {}
6263
grpc { // Options added to --grpc_out
6364
option 'lite' }
6465
}

protobuf-lite/build.gradle

+4-16
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,14 @@ dependencies {
2222
}
2323

2424
testCompile project(':grpc-core')
25-
testProtobuf libraries.protobuf
2625

2726
signature "org.codehaus.mojo.signature:java17:1.0@signature"
2827
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
2928
}
3029

3130
compileTestJava {
32-
// Protobuf-generated Lite produces quite a few warnings.
3331
options.compilerArgs += [
34-
"-Xlint:-rawtypes",
35-
"-Xlint:-unchecked",
36-
"-Xlint:-fallthrough"
32+
"-Xlint:-cast"
3733
]
3834
options.errorprone.excludedPaths = ".*/build/generated/source/proto/.*"
3935
}
@@ -46,19 +42,11 @@ protobuf {
4642
artifact = "com.google.protobuf:protoc:${protocVersion}"
4743
}
4844
}
49-
plugins {
50-
javalite {
51-
if (project.hasProperty('protoc-gen-javalite')) {
52-
path = project['protoc-gen-javalite']
53-
} else {
54-
artifact = libraries.protoc_lite
55-
}
56-
}
57-
}
5845
generateProtoTasks {
5946
ofSourceSet('test')*.each { task ->
60-
task.builtins { remove java }
61-
task.plugins { javalite {} }
47+
task.builtins {
48+
java { option 'lite' }
49+
}
6250
}
6351
}
6452
}

0 commit comments

Comments
 (0)