blob: 0d236d8558af5f9c16183b2c65188da45d958429 [file] [log] [blame]
apply plugin: 'java'
apply plugin: 'org.anarres.jarjar'
apply plugin: 'com.google.protobuf'
buildscript {
dependencies {
classpath 'org.anarres.jarjar:jarjar-gradle:1.0.0'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.7.7'
}
}
archivesBaseName = 'studio-profiler-grpc'
version = '1.0'// TODO: Pass in as an argument
ext {
protobufVersion = '3.0.0'
grpcVersion = '1.0.1'
}
configurations {
packaging
}
dependencies {
packaging("com.google.protobuf:protobuf-java:$protobufVersion") {
transitive false
}
packaging("io.grpc:grpc-auth:$grpcVersion") {
transitive false
}
packaging("io.grpc:grpc-context:$grpcVersion") {
transitive false
}
packaging("io.grpc:grpc-core:$grpcVersion") {
transitive false
}
packaging("io.grpc:grpc-netty:$grpcVersion") {
transitive false
}
packaging("io.grpc:grpc-okhttp:$grpcVersion") {
transitive false
}
packaging("io.grpc:grpc-protobuf:$grpcVersion") {
transitive false
}
packaging("io.grpc:grpc-protobuf-lite:$grpcVersion") {
transitive false
}
packaging("io.grpc:grpc-protobuf-nano:$grpcVersion") {
transitive false
}
packaging("io.grpc:grpc-stub:$grpcVersion") {
transitive false
}
compile "com.google.protobuf:protobuf-java:$protobufVersion"
compile "io.grpc:grpc-all:$grpcVersion"
}
sourceSets {
main {
proto {
srcDir '../proto'
}
}
}
protobuf {
protoc {
// The version of protoc must match protobuf-java. If you don't depend on
// protobuf-java directly, you will be transitively depending on the
// protobuf-java version that grpc depends on.
artifact = "com.google.protobuf:protoc:$protobufVersion"
}
plugins {
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:$grpcVersion"
}
}
generateProtoTasks {
// Iterate through all() configurations and run .plugins.
// *. is just a shorthand for "for each item run this".
all() *.plugins {
grpc {}
}
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
jarjar.repackage('jarjarLibs') {
destinationName = archivesBaseName + '-' + version + '-jarjar.jar'
from configurations.packaging
from files(sourceSets.main.output.classesDir)
dependsOn sourceSets.main.output
classRename 'com.google.protobuf.**', 'com.google.protobuf3jarjar.@1'
}
artifacts {
archives(jarjarLibs.destinationPath) {
name 'ProfilerServerApi'
type 'jar'
builtBy jarjarLibs
}
archives sourcesJar
}
def runtime = "$rootDir/../../../out/studio/runtime/"
task copy(type: Copy, dependsOn: jarjarLibs) {
from jarjarLibs.outputs
destinationDir file(runtime)
}
build.dependsOn copy