blob: 206c74f044b1ac57ce907ffcc4a694d6455ebff8 [file]
/*
* 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')
classpath('org.anarres.jarjar:jarjar-gradle:1.0.1')
}
}
apply plugin: 'java-library'
apply plugin: 'com.google.protobuf'
apply plugin: 'org.anarres.jarjar'
apply plugin: 'idea'
sourceSets {
main {
proto {
srcDir '../proto'
include '**/*.proto'
}
}
}
compileJava {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}
dependencies {
implementation('com.google.protobuf:protobuf-javalite:3.10.0')
}
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.10.0'
}
generateProtoTasks {
all().each { task ->
task.builtins {
java {
option 'lite'
}
}
}
}
}
jarjar.repackage('jarjarTask') {
destinationName "icing-java-jarjar.jar"
from 'com.google.protobuf:protobuf-javalite:3.10.0'
from files(sourceSets.main.output.classesDirs)
dependsOn sourceSets.main.output
classRename 'com.google.protobuf.**', 'com.google.android.icing.protobuf.@1'
}
configurations {
jarjarConf
}
artifacts {
jarjarConf(jarjarTask.destinationPath) {
name 'icing-java-jarjar'
type 'jar'
builtBy jarjarTask
}
}