123 lines
3.4 KiB
Groovy
123 lines
3.4 KiB
Groovy
description = 'Ad Service'
|
|
|
|
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
mavenLocal()
|
|
maven {
|
|
url "https://plugins.gradle.org/m2/"
|
|
}
|
|
}
|
|
dependencies {
|
|
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.3'
|
|
}
|
|
}
|
|
|
|
apply plugin: 'idea'
|
|
apply plugin: 'java'
|
|
apply plugin: 'com.google.protobuf'
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
mavenLocal()
|
|
}
|
|
|
|
group = "adservice"
|
|
version = "0.1.0-SNAPSHOT" // CURRENT_OPENCENSUS_VERSION
|
|
|
|
def opencensusVersion = "0.15.0" // LATEST_OPENCENSUS_RELEASE_VERSION
|
|
def grpcVersion = "1.10.1" // CURRENT_GRPC_VERSION
|
|
def prometheusVersion = "0.3.0"
|
|
|
|
tasks.withType(JavaCompile) {
|
|
sourceCompatibility = '1.8'
|
|
targetCompatibility = '1.8'
|
|
}
|
|
|
|
ext {
|
|
speed = project.hasProperty('speed') ? project.getProperty('speed') : false
|
|
offlineCompile = new File("$buildDir/output/lib")
|
|
}
|
|
|
|
dependencies {
|
|
if (speed) {
|
|
compile fileTree(dir: offlineCompile, include: '*.jar')
|
|
} else {
|
|
compile "com.google.api.grpc:proto-google-common-protos:1.11.0",
|
|
"io.opencensus:opencensus-exporter-stats-prometheus:${opencensusVersion}",
|
|
"io.opencensus:opencensus-exporter-stats-stackdriver:${opencensusVersion}",
|
|
"io.opencensus:opencensus-exporter-trace-stackdriver:${opencensusVersion}",
|
|
"io.opencensus:opencensus-exporter-trace-logging:${opencensusVersion}",
|
|
"io.grpc:grpc-protobuf:${grpcVersion}",
|
|
"io.grpc:grpc-stub:${grpcVersion}",
|
|
"io.grpc:grpc-netty:${grpcVersion}",
|
|
"io.grpc:grpc-services:${grpcVersion}",
|
|
"io.prometheus:simpleclient_httpserver:${prometheusVersion}"
|
|
|
|
runtime "io.opencensus:opencensus-impl:${opencensusVersion}",
|
|
"io.netty:netty-tcnative-boringssl-static:2.0.8.Final"
|
|
}
|
|
}
|
|
|
|
protobuf {
|
|
protoc {
|
|
artifact = 'com.google.protobuf:protoc:3.5.1-1'
|
|
}
|
|
plugins {
|
|
grpc {
|
|
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
|
|
}
|
|
}
|
|
generateProtoTasks {
|
|
all()*.plugins {
|
|
grpc {}
|
|
}
|
|
ofSourceSet('main')
|
|
}
|
|
}
|
|
|
|
// Inform IDEs like IntelliJ IDEA, Eclipse or NetBeans about the generated code.
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
srcDirs 'hipstershop'
|
|
srcDirs 'build/generated/source/proto/main/java/hipstershop'
|
|
srcDirs 'build/generated/source/proto/main/grpc/hipstershop'
|
|
}
|
|
}
|
|
}
|
|
|
|
// Provide convenience executables for trying out the examples.
|
|
apply plugin: 'application'
|
|
|
|
startScripts.enabled = false
|
|
|
|
// This to cache dependencies during Docker image building. First build will take time.
|
|
// Subsequent build will be incremental.
|
|
task downloadRepos(type: Copy) {
|
|
from configurations.compile
|
|
into offlineCompile
|
|
from configurations.runtime
|
|
into offlineCompile
|
|
}
|
|
|
|
task adService(type: CreateStartScripts) {
|
|
mainClassName = 'hipstershop.AdService'
|
|
applicationName = 'AdService'
|
|
outputDir = new File(project.buildDir, 'tmp')
|
|
classpath = jar.outputs.files + project.configurations.runtime
|
|
}
|
|
|
|
task adServiceClient(type: CreateStartScripts) {
|
|
mainClassName = 'hipstershop.AdServiceClient'
|
|
applicationName = 'AdServiceClient'
|
|
outputDir = new File(project.buildDir, 'tmp')
|
|
classpath = jar.outputs.files + project.configurations.runtime
|
|
}
|
|
|
|
applicationDistribution.into('bin') {
|
|
from(adService)
|
|
from(adServiceClient)
|
|
fileMode = 0755
|
|
}
|