blob: 30265cd60459d600e3c16ac57fa7c676e1f6c696 [file] [log] [blame]
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
buildscript {
boolean unbundleBuild = (new File('unbundled-build')).exists()
repositories {
maven { url '../../prebuilts/androidx/external' }
if (unbundleBuild) {
jcenter()
}
}
dependencies {
classpath('gradle.plugin.com.google.protobuf:protobuf-gradle-plugin:0.8.8')
}
}
apply plugin: 'AndroidXPlugin'
apply plugin: 'com.android.library'
apply plugin: 'com.google.protobuf'
apply plugin: 'idea'
def protoGeneratedFilesBaseDir = "${project.buildDir}/generated/source/proto"
android {
defaultConfig {
externalNativeBuild {
cmake {
arguments "-DPROTO_GENERATED_FILES_BASE_DIR=${protoGeneratedFilesBaseDir}"
cppFlags "-std=c++17"
arguments "-DCMAKE_VERBOSE_MAKEFILE=ON"
targets "icing"
}
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
proto {
srcDir '.'
include '**/*.proto'
}
}
}
externalNativeBuild {
cmake {
version '3.10.2'
// TODO(b/149853706): Uncomment this line once the lib fully compiles under cmake
//path 'CMakeLists.txt'
}
}
}
dependencies {
api('com.google.protobuf:protobuf-javalite:3.10.0')
}
protobuf {
generatedFilesBaseDir = protoGeneratedFilesBaseDir
protoc {
artifact = 'com.google.protobuf:protoc:3.10.0'
}
generateProtoTasks {
all().each { task ->
task.builtins {
java {
option 'lite'
}
}
}
}
}