| description = 'OpenCensus Examples' | |
| buildscript { | |
| repositories { | |
| mavenCentral() | |
| mavenLocal() | |
| maven { | |
| url "https://plugins.gradle.org/m2/" | |
| } | |
| } | |
| dependencies { | |
| classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8' | |
| classpath 'com.github.ben-manes:gradle-versions-plugin:0.20.0' | |
| classpath "gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.8" | |
| } | |
| } | |
| apply plugin: "checkstyle" | |
| apply plugin: 'com.google.protobuf' | |
| apply plugin: 'com.github.sherter.google-java-format' | |
| apply plugin: 'idea' | |
| apply plugin: 'java' | |
| // Display the version report using: ./gradlew dependencyUpdates | |
| // Also see https://github.com/ben-manes/gradle-versions-plugin. | |
| apply plugin: 'com.github.ben-manes.versions' | |
| repositories { | |
| mavenCentral() | |
| mavenLocal() | |
| } | |
| group = "io.opencensus" | |
| version = "0.32.0-SNAPSHOT" // CURRENT_OPENCENSUS_VERSION | |
| def opencensusVersion = "0.30.0" // LATEST_OPENCENSUS_RELEASE_VERSION | |
| def grpcVersion = "1.32.2" // CURRENT_GRPC_VERSION | |
| def prometheusVersion = "0.6.0" | |
| def jettyVersion = "9.4.17.v20190418" | |
| def tcnativeVersion = "2.0.20.Final" | |
| tasks.withType(JavaCompile) { | |
| sourceCompatibility = '1.8' | |
| targetCompatibility = '1.8' | |
| } | |
| dependencies { | |
| compile "com.google.api.grpc:proto-google-common-protos:1.12.0", | |
| "io.opencensus:opencensus-api:${opencensusVersion}", | |
| "io.opencensus:opencensus-contrib-zpages:${opencensusVersion}", | |
| "io.opencensus:opencensus-contrib-grpc-metrics:${opencensusVersion}", | |
| "io.opencensus:opencensus-contrib-http-util:${opencensusVersion}", | |
| "io.opencensus:opencensus-contrib-http-servlet:${opencensusVersion}", | |
| "io.opencensus:opencensus-contrib-http-jetty-client:${opencensusVersion}", | |
| "io.opencensus:opencensus-exporter-metrics-ocagent:${opencensusVersion}", | |
| "io.opencensus:opencensus-exporter-stats-prometheus:${opencensusVersion}", | |
| "io.opencensus:opencensus-exporter-stats-stackdriver:${opencensusVersion}", | |
| "io.opencensus:opencensus-exporter-trace-jaeger:${opencensusVersion}", | |
| "io.opencensus:opencensus-exporter-trace-stackdriver:${opencensusVersion}", | |
| "io.opencensus:opencensus-exporter-trace-logging:${opencensusVersion}", | |
| "io.opencensus:opencensus-exporter-trace-ocagent:${opencensusVersion}", | |
| "io.grpc:grpc-protobuf:${grpcVersion}", | |
| "io.grpc:grpc-stub:${grpcVersion}", | |
| "io.grpc:grpc-netty-shaded:${grpcVersion}", | |
| "io.grpc:grpc-census:${grpcVersion}", | |
| "io.prometheus:simpleclient_httpserver:${prometheusVersion}", | |
| "javax.servlet:javax.servlet-api:3.1.0", | |
| "org.eclipse.jetty:jetty-server:${jettyVersion}", | |
| "org.eclipse.jetty:jetty-client:${jettyVersion}", | |
| "org.eclipse.jetty:jetty-servlet:${jettyVersion}", | |
| "org.slf4j:slf4j-log4j12:1.7.25" | |
| runtime "io.opencensus:opencensus-impl:${opencensusVersion}", | |
| "io.netty:netty-tcnative-boringssl-static:${tcnativeVersion}" | |
| } | |
| googleJavaFormat { | |
| toolVersion '1.7' | |
| source = 'src/main' | |
| include '**/*.java' | |
| } | |
| verifyGoogleJavaFormat { | |
| source = 'src/main' | |
| include '**/*.java' | |
| } | |
| protobuf { | |
| protoc { | |
| artifact = 'com.google.protobuf:protoc:3.6.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' | |
| } | |
| } | |
| } | |
| checkstyle { | |
| configFile = file("$rootDir/../buildscripts/checkstyle.xml") | |
| toolVersion = "8.12" | |
| ignoreFailures = false | |
| configProperties["rootDir"] = "$rootDir/.." | |
| } | |
| // Disable checkstyle if no java8. | |
| checkstyleMain.source = 'src/main' | |
| checkstyleTest.source = 'src/main' | |
| // 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 | |
| } | |
| task repl(type: CreateStartScripts) { | |
| mainClassName = 'io.opencensus.examples.quickstart.Repl' | |
| applicationName = 'Repl' | |
| outputDir = new File(project.buildDir, 'tmp') | |
| classpath = jar.outputs.files + project.configurations.runtime | |
| } | |
| task stackdriverStatsQuickstart(type: CreateStartScripts) { | |
| mainClassName = 'io.opencensus.examples.stats.StackdriverQuickstart' | |
| applicationName = 'StackdriverQuickstart' | |
| outputDir = new File(project.buildDir, 'tmp') | |
| classpath = jar.outputs.files + project.configurations.runtime | |
| } | |
| task derivedDoubleGaugeQuickstart(type: CreateStartScripts) { | |
| mainClassName = 'io.opencensus.examples.gauges.DerivedDoubleGaugeQuickstart' | |
| applicationName = 'DerivedDoubleGaugeQuickstart' | |
| outputDir = new File(project.buildDir, 'tmp') | |
| classpath = jar.outputs.files + project.configurations.runtime | |
| } | |
| task derivedLongGaugeQuickstart(type: CreateStartScripts) { | |
| mainClassName = 'io.opencensus.examples.gauges.DerivedLongGaugeQuickstart' | |
| applicationName = 'DerivedLongGaugeQuickstart' | |
| outputDir = new File(project.buildDir, 'tmp') | |
| classpath = jar.outputs.files + project.configurations.runtime | |
| } | |
| task doubleGaugeQuickstart(type: CreateStartScripts) { | |
| mainClassName = 'io.opencensus.examples.gauges.DoubleGaugeQuickstart' | |
| applicationName = 'DoubleGaugeQuickstart' | |
| outputDir = new File(project.buildDir, 'tmp') | |
| classpath = jar.outputs.files + project.configurations.runtime | |
| } | |
| task longGaugeQuickstart(type: CreateStartScripts) { | |
| mainClassName = 'io.opencensus.examples.gauges.LongGaugeQuickstart' | |
| applicationName = 'LongGaugeQuickstart' | |
| outputDir = new File(project.buildDir, 'tmp') | |
| classpath = jar.outputs.files + project.configurations.runtime | |
| } | |
| task httpJettyServer(type: CreateStartScripts) { | |
| mainClassName = 'io.opencensus.examples.http.jetty.server.HelloWorldServer' | |
| applicationName = 'HttpJettyServer' | |
| outputDir = new File(project.buildDir, 'tmp') | |
| classpath = jar.outputs.files + project.configurations.runtime | |
| } | |
| task httpJettyClient(type: CreateStartScripts) { | |
| mainClassName = 'io.opencensus.examples.http.jetty.client.HelloWorldClient' | |
| applicationName = 'HttpJettyClient' | |
| outputDir = new File(project.buildDir, 'tmp') | |
| classpath = jar.outputs.files + project.configurations.runtime | |
| } | |
| task ocAgentExportersQuickStart(type: CreateStartScripts) { | |
| mainClassName = 'io.opencensus.examples.ocagent.OcAgentExportersQuickStart' | |
| applicationName = 'OcAgentExportersQuickStart' | |
| 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) | |
| from(repl) | |
| from(stackdriverStatsQuickstart) | |
| from(derivedDoubleGaugeQuickstart) | |
| from(derivedLongGaugeQuickstart) | |
| from(doubleGaugeQuickstart) | |
| from(longGaugeQuickstart) | |
| from(httpJettyServer) | |
| from(httpJettyClient) | |
| from(ocAgentExportersQuickStart) | |
| fileMode = 0755 | |
| } |