blob: 30265cd60459d600e3c16ac57fa7c676e1f6c696 [file] [log] [blame]
Alexander Dorokhine0b4a3152021-03-03 16:01:42 -08001/*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17buildscript {
18 boolean unbundleBuild = (new File('unbundled-build')).exists()
19 repositories {
20 maven { url '../../prebuilts/androidx/external' }
21 if (unbundleBuild) {
22 jcenter()
23 }
24 }
25 dependencies {
26 classpath('gradle.plugin.com.google.protobuf:protobuf-gradle-plugin:0.8.8')
27 }
28}
29
30apply plugin: 'AndroidXPlugin'
31apply plugin: 'com.android.library'
32apply plugin: 'com.google.protobuf'
33apply plugin: 'idea'
34
35def protoGeneratedFilesBaseDir = "${project.buildDir}/generated/source/proto"
36
37android {
38 defaultConfig {
39 externalNativeBuild {
40 cmake {
41 arguments "-DPROTO_GENERATED_FILES_BASE_DIR=${protoGeneratedFilesBaseDir}"
42 cppFlags "-std=c++17"
43 arguments "-DCMAKE_VERBOSE_MAKEFILE=ON"
44 targets "icing"
45 }
46 }
47 }
48
49 sourceSets {
50 main {
51 manifest.srcFile 'AndroidManifest.xml'
52 proto {
53 srcDir '.'
54 include '**/*.proto'
55 }
56 }
57 }
58
59 externalNativeBuild {
60 cmake {
61 version '3.10.2'
62 // TODO(b/149853706): Uncomment this line once the lib fully compiles under cmake
63 //path 'CMakeLists.txt'
64 }
65 }
66}
67
68dependencies {
69 api('com.google.protobuf:protobuf-javalite:3.10.0')
70}
71
72protobuf {
73 generatedFilesBaseDir = protoGeneratedFilesBaseDir
74 protoc {
75 artifact = 'com.google.protobuf:protoc:3.10.0'
76 }
77
78 generateProtoTasks {
79 all().each { task ->
80 task.builtins {
81 java {
82 option 'lite'
83 }
84 }
85 }
86 }
87}