| description = 'OpenCensus Examples' | |
| 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 = "io.opencensus" | |
| version = "0.17.0-SNAPSHOT" // CURRENT_OPENCENSUS_VERSION | |
| def opencensusVersion = "0.16.1" // LATEST_OPENCENSUS_RELEASE_VERSION | |
| def grpcVersion = "1.13.1" // CURRENT_GRPC_VERSION | |
| def prometheusVersion = "0.3.0" | |
| tasks.withType(JavaCompile) { | |
| sourceCompatibility = '1.8' | |
| targetCompatibility = '1.8' | |
| } | |
| dependencies { | |
| compile "com.google.api.grpc:proto-google-common-protos:1.11.0", | |
| "io.opencensus:opencensus-api:${opencensusVersion}", | |
| "io.opencensus:opencensus-contrib-zpages:${opencensusVersion}", | |
| "io.opencensus:opencensus-contrib-grpc-metrics:${opencensusVersion}", | |
| "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.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 { | |
| srcDir 'src' | |
| srcDirs 'build/generated/source/proto/main/grpc' | |
| srcDirs 'build/generated/source/proto/main/java' | |
| } | |
| } | |
| } | |
| // Provide convenience executables for trying out the examples. | |
| apply plugin: 'application' | |
| startScripts.enabled = false | |
| task tagContextExample(type: CreateStartScripts) { | |
| mainClassName = 'io.opencensus.examples.tags.TagContextExample' | |
| applicationName = 'TagContextExample' | |
| outputDir = new File(project.buildDir, 'tmp') | |
| classpath = jar.outputs.files + project.configurations.runtime | |
| } | |
| task multiSpansTracing(type: CreateStartScripts) { | |
| mainClassName = 'io.opencensus.examples.trace.MultiSpansTracing' | |
| applicationName = 'MultiSpansTracing' | |
| outputDir = new File(project.buildDir, 'tmp') | |
| classpath = jar.outputs.files + project.configurations.runtime | |
| } | |
| task multiSpansScopedTracing(type: CreateStartScripts) { | |
| mainClassName = 'io.opencensus.examples.trace.MultiSpansScopedTracing' | |
| applicationName = 'MultiSpansScopedTracing' | |
| outputDir = new File(project.buildDir, 'tmp') | |
| classpath = jar.outputs.files + project.configurations.runtime | |
| } | |
| task multiSpansContextTracing(type: CreateStartScripts) { | |
| mainClassName = 'io.opencensus.examples.trace.MultiSpansContextTracing' | |
| applicationName = 'MultiSpansContextTracing' | |
| outputDir = new File(project.buildDir, 'tmp') | |
| classpath = jar.outputs.files + project.configurations.runtime | |
| } | |
| task zPagesTester(type: CreateStartScripts) { | |
| mainClassName = 'io.opencensus.examples.zpages.ZPagesTester' | |
| applicationName = 'ZPagesTester' | |
| outputDir = new File(project.buildDir, 'tmp') | |
| classpath = jar.outputs.files + project.configurations.runtime | |
| } | |
| task quickStart(type: CreateStartScripts) { | |
| mainClassName = 'io.opencensus.examples.helloworld.QuickStart' | |
| applicationName = 'QuickStart' | |
| outputDir = new File(project.buildDir, 'tmp') | |
| classpath = jar.outputs.files + project.configurations.runtime | |
| } | |
| task helloWorldServer(type: CreateStartScripts) { | |
| mainClassName = 'io.opencensus.examples.grpc.helloworld.HelloWorldServer' | |
| applicationName = 'HelloWorldServer' | |
| outputDir = new File(project.buildDir, 'tmp') | |
| classpath = jar.outputs.files + project.configurations.runtime | |
| } | |
| task helloWorldClient(type: CreateStartScripts) { | |
| mainClassName = 'io.opencensus.examples.grpc.helloworld.HelloWorldClient' | |
| applicationName = 'HelloWorldClient' | |
| outputDir = new File(project.buildDir, 'tmp') | |
| classpath = jar.outputs.files + project.configurations.runtime | |
| } | |
| applicationDistribution.into('bin') { | |
| from(multiSpansTracing) | |
| from(multiSpansScopedTracing) | |
| from(multiSpansContextTracing) | |
| from(tagContextExample) | |
| from(zPagesTester) | |
| from(quickStart) | |
| from(helloWorldServer) | |
| from(helloWorldClient) | |
| fileMode = 0755 | |
| } |