1plugins {
2    id 'com.google.protobuf'
3}
4
5ext {
6    // http://cs/h/android/platform/superproject/main/+/main:external/protobuf/version.json
7    // TODO: protobuf_version should be "3.21.7", but upgrading causes a lot of build failures,
8    // and the fix is non-trivial because of our usage of javanano
9    protobuf_version = "3.0.0"
10}
11
12dependencies {
13    api "com.google.protobuf:protobuf-lite:${protobuf_version}"
14}
15
16protobuf {
17    // Configure the protoc executable
18    protoc {
19        artifact = "com.google.protobuf:protoc:${protobuf_version}${PROTO_ARCH_SUFFIX}"
20    }
21    generateProtoTasks {
22        all().each { task ->
23            task.builtins {
24                remove java
25            }
26            task.plugins {
27                javalite {}
28            }
29        }
30    }
31    plugins {
32        javalite {
33            // The codegen for lite comes as a separate artifact
34            artifact = "com.google.protobuf:protoc-gen-javalite:${protobuf_version}${PROTO_ARCH_SUFFIX}"
35        }
36    }
37}
38