aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHailong Wen <hailongwen@google.com>2017-12-06 16:07:29 -0800
committerHailong Wen <hailongwen@google.com>2017-12-06 16:08:21 -0800
commitc0be5b44ec9d787e0834dc418381f0a5b87fca85 (patch)
tree59010ce7fc695ca7a93450901aeefffdb7be1049
parentd3a73c88eefedc6d6511e877858135d12df428ac (diff)
downloadopencensus-java-c0be5b44ec9d787e0834dc418381f0a5b87fca85.tar.gz
Make `examples` an independent gradle project.
-rw-r--r--examples/README.md4
-rw-r--r--examples/build.gradle187
-rw-r--r--examples/buildscripts/checkstyle.license15
-rw-r--r--examples/buildscripts/checkstyle.xml233
-rw-r--r--examples/gradle/errorprone/experimental_errors27
-rw-r--r--examples/gradle/errorprone/experimental_suggestions25
-rw-r--r--examples/gradle/errorprone/experimental_warnings23
-rw-r--r--examples/gradle/errorprone/warnings76
-rw-r--r--examples/gradle/wrapper/gradle-wrapper.jarbin0 -> 54708 bytes
-rw-r--r--examples/gradle/wrapper/gradle-wrapper.properties5
-rwxr-xr-xexamples/gradlew172
-rw-r--r--examples/gradlew.bat84
-rw-r--r--examples/settings.gradle1
-rw-r--r--settings.gradle1
14 files changed, 846 insertions, 7 deletions
diff --git a/examples/README.md b/examples/README.md
index 2b67780e..eb37cd17 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -5,6 +5,8 @@
```
$ ./gradlew installDist
```
+
+* Remember to change `opencensusVersion` in `build.gradle` to a released version you want to use.
## To run "StatsRunner" example use
```
@@ -21,4 +23,4 @@ Available pages:
* For tracing config page go to [localhost:8080/traceconfigz][ZPagesTraceConfigZLink].
[ZPagesTraceZLink]: http://localhost:8080/tracez
-[ZPagesTraceConfigZLink]: http://localhost:8080/traceconfigz \ No newline at end of file
+[ZPagesTraceConfigZLink]: http://localhost:8080/traceconfigz
diff --git a/examples/build.gradle b/examples/build.gradle
index b4bb6fa5..fa3eb587 100644
--- a/examples/build.gradle
+++ b/examples/build.gradle
@@ -1,16 +1,193 @@
description = 'OpenCensus Examples'
+buildscript {
+ repositories {
+ mavenCentral()
+ mavenLocal()
+ maven {
+ url "https://plugins.gradle.org/m2/"
+ }
+ }
+ dependencies {
+ classpath 'ru.vyarus:gradle-animalsniffer-plugin:1.4.2'
+ classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.13'
+ classpath "net.ltgt.gradle:gradle-apt-plugin:0.10"
+ classpath 'com.github.ben-manes:gradle-versions-plugin:0.15.0'
+ classpath "gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.6"
+ }
+}
+
+// Display the version report using: ./gradlew dependencyUpdates
+// Also see https://github.com/ben-manes/gradle-versions-plugin.
+apply plugin: 'com.github.ben-manes.versions'
+apply plugin: "checkstyle"
+apply plugin: 'maven'
+apply plugin: 'idea'
+apply plugin: 'java'
+apply plugin: "signing"
+apply plugin: "jacoco"
+// The plugin only has an effect if a signature is specified
+apply plugin: 'ru.vyarus.animalsniffer'
+apply plugin: 'findbugs'
+apply plugin: 'net.ltgt.apt'
+// Plugins that require java8
+if (JavaVersion.current().isJava8Compatible()) {
+ apply plugin: "net.ltgt.errorprone"
+ apply plugin: 'com.github.sherter.google-java-format'
+}
+
+repositories {
+ mavenCentral()
+ mavenLocal()
+}
+
+group = "io.opencensus"
+version = "0.11.0-SNAPSHOT"
+
+// change to the version you want to use.
+def opencensusVersion = "0.11.0-SNAPSHOT" // CURRENT_OPENCENSUS_VERSION
+
+[compileJava, compileTestJava].each() {
+ // We suppress the "processing" warning as suggested in
+ // https://groups.google.com/forum/#!topic/bazel-discuss/_R3A9TJSoPM
+ it.options.compilerArgs += ["-Xlint:all", "-Xlint:-try", "-Xlint:-processing"]
+ if (JavaVersion.current().isJava8Compatible()) {
+ it.options.compilerArgs += ["-XepDisableWarningsInGeneratedCode"]
+ // TODO(bdrutu): Read files directly instead of reading from properties.
+ if (rootProject.hasProperty("errorProneWarnings")) {
+ it.options.compilerArgs += rootProject.properties["errorProneWarnings"].split(',').collect {
+ it as String
+ }
+ }
+ if (rootProject.hasProperty("errorProneExperimentalErrors")) {
+ it.options.compilerArgs += rootProject.properties["errorProneExperimentalErrors"].split(',').collect {
+ it as String
+ }
+ }
+ if (rootProject.hasProperty("errorProneExperimentalWarnings")) {
+ it.options.compilerArgs += rootProject.properties["errorProneExperimentalWarnings"].split(',').collect {
+ it as String
+ }
+ }
+ if (rootProject.hasProperty("errorProneExperimentalSuggestions")) {
+ it.options.compilerArgs += rootProject.properties["errorProneExperimentalSuggestions"].split(',').collect {
+ it as String
+ }
+ }
+ }
+ it.options.encoding = "UTF-8"
+ // TODO(bdrutu): Enable when fix the issue with configuring bootstrap class.
+ // [options] bootstrap class path not set in conjunction with -source 1.6
+ if (JavaVersion.current().isJava8Compatible()) {
+ it.options.compilerArgs += ["-Werror"]
+ }
+}
+
+compileTestJava {
+ // serialVersionUID is basically guaranteed to be useless in tests
+ options.compilerArgs += ["-Xlint:-serial"]
+ // It undeprecates DoubleSubject.isEqualTo(Double).
+ options.compilerArgs += ["-Xlint:-deprecation"]
+}
+
+jar.manifest {
+ attributes('Implementation-Title': name,
+ 'Implementation-Version': version,
+ 'Built-By': System.getProperty('user.name'),
+ 'Built-JDK': System.getProperty('java.version'),
+ 'Source-Compatibility': sourceCompatibility,
+ 'Target-Compatibility': targetCompatibility)
+}
+
+javadoc.options {
+ encoding = 'UTF-8'
+ links 'https://docs.oracle.com/javase/8/docs/api/'
+}
+
+ext {
+ findBugsVersion = '3.0.1'
+}
+
+findbugs {
+ toolVersion = findBugsVersion
+ ignoreFailures = false // bug free or it doesn't ship!
+ effort = 'max'
+ reportLevel = 'low' // low = sensitive to even minor mistakes
+ omitVisitors = [] // bugs that we want to ignore
+}
+// Generate html report for findbugs.
+findbugsMain {
+ reports {
+ xml.enabled = false
+ html.enabled = true
+ }
+}
+// Disable findbugs for tests.
+findbugsTest.enabled = false
+
+checkstyle {
+ configFile = file("$rootDir/buildscripts/checkstyle.xml")
+ toolVersion = "8.0"
+ ignoreFailures = false
+ if (rootProject.hasProperty("checkstyle.ignoreFailures")) {
+ ignoreFailures = rootProject.properties["checkstyle.ignoreFailures"].toBoolean()
+ }
+ configProperties["rootDir"] = rootDir
+}
+
+// Disable checkstyle if no java8.
+checkstyleMain.enabled = JavaVersion.current().isJava8Compatible()
+checkstyleTest.enabled = JavaVersion.current().isJava8Compatible()
+
+// Google formatter works only on java8.
+if (JavaVersion.current().isJava8Compatible()) {
+ googleJavaFormat {
+ toolVersion '1.5'
+ }
+}
+
+signing {
+ required false
+ sign configurations.archives
+}
+
+task javadocJar(type: Jar) {
+ classifier = 'javadoc'
+ from javadoc
+}
+
+task sourcesJar(type: Jar) {
+ classifier = 'sources'
+ from sourceSets.main.allSource
+}
+
+artifacts {
+ archives javadocJar, sourcesJar
+}
+
+// At a test failure, log the stack trace to the console so that we don't
+// have to open the HTML in a browser.
+test {
+ testLogging {
+ exceptionFormat = 'full'
+ showExceptions true
+ showCauses true
+ showStackTraces true
+ }
+ maxHeapSize = '1500m'
+}
+
tasks.withType(JavaCompile) {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
dependencies {
- compile project(':opencensus-api'),
- project(':opencensus-contrib-zpages'),
- project(':opencensus-exporter-trace-logging')
+ compile "io.opencensus:opencensus-api:${opencensusVersion}",
+ "io.opencensus:opencensus-contrib-zpages:${opencensusVersion}",
+ "io.opencensus:opencensus-exporter-trace-logging:${opencensusVersion}"
- runtime project(':opencensus-impl')
+ runtime "io.opencensus:opencensus-impl:${opencensusVersion}"
}
// Provide convenience executables for trying out the examples.
@@ -60,4 +237,4 @@ applicationDistribution.into('bin') {
from(statsRunner)
from(zPagesTester)
fileMode = 0755
-} \ No newline at end of file
+}
diff --git a/examples/buildscripts/checkstyle.license b/examples/buildscripts/checkstyle.license
new file mode 100644
index 00000000..27bac1a2
--- /dev/null
+++ b/examples/buildscripts/checkstyle.license
@@ -0,0 +1,15 @@
+^/\*$
+^ \* Copyright \d\d\d\d(-\d\d)?, OpenCensus Authors$
+^ \*$
+^ \* 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\.$
+^ \*/$ \ No newline at end of file
diff --git a/examples/buildscripts/checkstyle.xml b/examples/buildscripts/checkstyle.xml
new file mode 100644
index 00000000..fdea0c5e
--- /dev/null
+++ b/examples/buildscripts/checkstyle.xml
@@ -0,0 +1,233 @@
+<?xml version="1.0"?>
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+
+<!--
+ Checkstyle configuration that checks the Google coding conventions from Google Java Style
+ that can be found at https://google.github.io/styleguide/javaguide.html.
+
+ Checkstyle is very configurable. Be sure to read the documentation at
+ http://checkstyle.sf.net (or in your downloaded distribution).
+
+ To completely disable a check, just comment it out or delete it from the file.
+
+ Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov.
+ -->
+
+<module name = "Checker">
+ <property name="charset" value="UTF-8"/>
+
+ <property name="severity" value="error"/>
+
+
+ <module name="RegexpHeader">
+ <property name="headerFile" value="${rootDir}/buildscripts/checkstyle.license"/>
+ <property name="fileExtensions" value="java"/>
+ </module>
+
+ <property name="fileExtensions" value="java, properties, xml"/>
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="FileTabCharacter">
+ <property name="eachLine" value="true"/>
+ </module>
+
+ <module name="TreeWalker">
+ <module name="OuterTypeFilename"/>
+ <module name="IllegalTokenText">
+ <property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
+ <property name="format" value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
+ <property name="message" value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
+ </module>
+ <module name="AvoidEscapedUnicodeCharacters">
+ <property name="allowEscapesForControlCharacters" value="true"/>
+ <property name="allowByTailComment" value="true"/>
+ <property name="allowNonPrintableEscapes" value="true"/>
+ </module>
+ <module name="LineLength">
+ <property name="max" value="100"/>
+ <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
+ </module>
+ <module name="AvoidStarImport"/>
+ <module name="RedundantImport"/>
+ <module name="OneTopLevelClass"/>
+ <module name="NoLineWrap"/>
+ <module name="EmptyBlock">
+ <property name="option" value="TEXT"/>
+ <property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
+ </module>
+ <module name="NeedBraces"/>
+ <module name="LeftCurly">
+ <property name="maxLineLength" value="100"/>
+ </module>
+ <module name="RightCurly">
+ <property name="id" value="RightCurlySame"/>
+ <property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_DO"/>
+ </module>
+ <module name="RightCurly">
+ <property name="id" value="RightCurlyAlone"/>
+ <property name="option" value="alone"/>
+ <property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, INSTANCE_INIT"/>
+ </module>
+ <module name="WhitespaceAround">
+ <property name="allowEmptyConstructors" value="true"/>
+ <property name="allowEmptyMethods" value="true"/>
+ <property name="allowEmptyTypes" value="true"/>
+ <property name="allowEmptyLoops" value="true"/>
+ <message key="ws.notFollowed"
+ value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
+ <message key="ws.notPreceded"
+ value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
+ </module>
+ <module name="OneStatementPerLine"/>
+ <module name="MultipleVariableDeclarations"/>
+ <module name="ArrayTypeStyle"/>
+ <!-- This rule conflicts with Error Prone's exhaustiveness checking. -->
+ <!-- <module name="MissingSwitchDefault"/> -->
+ <module name="FallThrough"/>
+ <module name="UpperEll"/>
+ <module name="ModifierOrder"/>
+ <module name="EmptyLineSeparator">
+ <property name="allowNoEmptyLineBetweenFields" value="true"/>
+ </module>
+ <module name="SeparatorWrap">
+ <property name="id" value="SeparatorWrapDot"/>
+ <property name="tokens" value="DOT"/>
+ <property name="option" value="nl"/>
+ </module>
+ <module name="SeparatorWrap">
+ <property name="id" value="SeparatorWrapComma"/>
+ <property name="tokens" value="COMMA"/>
+ <property name="option" value="EOL"/>
+ </module>
+ <module name="PackageName">
+ <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
+ <message key="name.invalidPattern"
+ value="Package name ''{0}'' must match pattern ''{1}''."/>
+ </module>
+ <module name="TypeName">
+ <message key="name.invalidPattern"
+ value="Type name ''{0}'' must match pattern ''{1}''."/>
+ </module>
+ <module name="MemberName">
+ <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
+ <message key="name.invalidPattern"
+ value="Member name ''{0}'' must match pattern ''{1}''."/>
+ </module>
+ <module name="ParameterName">
+ <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
+ <message key="name.invalidPattern"
+ value="Parameter name ''{0}'' must match pattern ''{1}''."/>
+ </module>
+ <module name="CatchParameterName">
+ <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
+ <message key="name.invalidPattern"
+ value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
+ </module>
+ <module name="LocalVariableName">
+ <property name="tokens" value="VARIABLE_DEF"/>
+ <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
+ <message key="name.invalidPattern"
+ value="Local variable name ''{0}'' must match pattern ''{1}''."/>
+ </module>
+ <module name="ClassTypeParameterName">
+ <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
+ <message key="name.invalidPattern"
+ value="Class type name ''{0}'' must match pattern ''{1}''."/>
+ </module>
+ <module name="MethodTypeParameterName">
+ <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
+ <message key="name.invalidPattern"
+ value="Method type name ''{0}'' must match pattern ''{1}''."/>
+ </module>
+ <module name="InterfaceTypeParameterName">
+ <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
+ <message key="name.invalidPattern"
+ value="Interface type name ''{0}'' must match pattern ''{1}''."/>
+ </module>
+ <module name="NoFinalizer"/>
+ <module name="GenericWhitespace">
+ <message key="ws.followed"
+ value="GenericWhitespace ''{0}'' is followed by whitespace."/>
+ <message key="ws.preceded"
+ value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
+ <message key="ws.illegalFollow"
+ value="GenericWhitespace ''{0}'' should followed by whitespace."/>
+ <message key="ws.notPreceded"
+ value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
+ </module>
+ <module name="Indentation">
+ <property name="basicOffset" value="2"/>
+ <property name="braceAdjustment" value="0"/>
+ <property name="caseIndent" value="2"/>
+ <property name="throwsIndent" value="4"/>
+ <property name="lineWrappingIndentation" value="4"/>
+ <property name="arrayInitIndent" value="2"/>
+ </module>
+ <module name="AbbreviationAsWordInName">
+ <property name="ignoreFinal" value="false"/>
+ <property name="allowedAbbreviationLength" value="1"/>
+ </module>
+ <module name="OverloadMethodsDeclarationOrder"/>
+ <module name="VariableDeclarationUsageDistance"/>
+ <module name="CustomImportOrder">
+ <property name="sortImportsInGroupAlphabetically" value="true"/>
+ <property name="separateLineBetweenGroups" value="true"/>
+ <property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/>
+ </module>
+ <module name="MethodParamPad"/>
+ <module name="ParenPad"/>
+ <module name="OperatorWrap">
+ <property name="option" value="NL"/>
+ <property name="tokens" value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/>
+ </module>
+ <module name="AnnotationLocation">
+ <property name="id" value="AnnotationLocationMostCases"/>
+ <property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
+ </module>
+ <module name="AnnotationLocation">
+ <property name="id" value="AnnotationLocationVariables"/>
+ <property name="tokens" value="VARIABLE_DEF"/>
+ <property name="allowSamelineMultipleAnnotations" value="true"/>
+ </module>
+ <module name="NonEmptyAtclauseDescription"/>
+ <module name="JavadocTagContinuationIndentation"/>
+ <module name="SummaryJavadoc">
+ <property name="forbiddenSummaryFragments" value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
+ </module>
+ <module name="JavadocParagraph"/>
+ <module name="AtclauseOrder">
+ <property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
+ <property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
+ </module>
+ <module name="JavadocMethod">
+ <property name="scope" value="public"/>
+ <property name="allowMissingParamTags" value="true"/>
+ <property name="allowMissingThrowsTags" value="true"/>
+ <property name="allowMissingReturnTag" value="true"/>
+ <property name="minLineCount" value="2"/>
+ <!-- Too restrictive for tests -->
+ <!-- <property name="allowedAnnotations" value="Override, Test"/-->
+ <property name="allowedAnnotations" value="Override, Test, Before, After, BeforeClass, AfterClass, Setup, TearDown"/>
+ <property name="allowThrowsTagsForSubclasses" value="true"/>
+ </module>
+ <module name="MethodName">
+ <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
+ <message key="name.invalidPattern"
+ value="Method name ''{0}'' must match pattern ''{1}''."/>
+ </module>
+ <module name="SingleLineJavadoc">
+ <!-- Wrong interpretation of the style guide; -->
+ <!-- <property name="ignoreInlineTags" value="false"/-->
+ </module>
+ <module name="EmptyCatchBlock">
+ <property name="exceptionVariableName" value="expected"/>
+ </module>
+ <module name="CommentsIndentation"/>
+ <module name="FileContentsHolder"/>
+ <module name="SuppressWarningsHolder"/>
+ </module>
+ <module name="SuppressionCommentFilter"/>
+ <module name="SuppressWarningsFilter"/>
+</module>
diff --git a/examples/gradle/errorprone/experimental_errors b/examples/gradle/errorprone/experimental_errors
new file mode 100644
index 00000000..5ce6e181
--- /dev/null
+++ b/examples/gradle/errorprone/experimental_errors
@@ -0,0 +1,27 @@
+errorProneExperimentalErrors = \
+-Xep:AssistedInjectAndInjectOnSameConstructor:ERROR,\
+-Xep:AutoFactoryAtInject:ERROR,\
+-Xep:ClassName:ERROR,\
+-Xep:ComparisonContractViolated:ERROR,\
+-Xep:DepAnn:ERROR,\
+-Xep:DivZero:ERROR,\
+-Xep:EmptyIf:ERROR,\
+-Xep:FuzzyEqualsShouldNotBeUsedInEqualsMethod:ERROR,\
+-Xep:InjectInvalidTargetingOnScopingAnnotation:ERROR,\
+-Xep:InjectMoreThanOneQualifier:ERROR,\
+-Xep:InjectScopeAnnotationOnInterfaceOrAbstractClass:ERROR,\
+-Xep:InjectScopeOrQualifierAnnotationRetention:ERROR,\
+-Xep:InjectedConstructorAnnotations:ERROR,\
+-Xep:InsecureCryptoUsage:ERROR,\
+-Xep:IterablePathParameter:ERROR,\
+-Xep:JMockTestWithoutRunWithOrRuleAnnotation:ERROR,\
+-Xep:JavaxInjectOnFinalField:ERROR,\
+-Xep:LockMethodChecker:ERROR,\
+-Xep:LongLiteralLowerCaseSuffix:ERROR,\
+-Xep:NoAllocation:ERROR,\
+-Xep:NumericEquality:ERROR,\
+-Xep:ParameterPackage:ERROR,\
+-Xep:ProtoStringFieldReferenceEquality:ERROR,\
+-Xep:QualifierOrScopeOnInjectMethod:ERROR,\
+-Xep:StaticOrDefaultInterfaceMethod:ERROR,\
+-Xep:UnlockMethod:ERROR
diff --git a/examples/gradle/errorprone/experimental_suggestions b/examples/gradle/errorprone/experimental_suggestions
new file mode 100644
index 00000000..1330b843
--- /dev/null
+++ b/examples/gradle/errorprone/experimental_suggestions
@@ -0,0 +1,25 @@
+# FieldMissingNullable is turned off due to
+# https://github.com/google/error-prone/issues/823.
+
+errorProneExperimentalSuggestions = \
+-Xep:ConstantField:ERROR,\
+-Xep:EmptySetMultibindingContributions:ERROR,\
+-Xep:FieldMissingNullable:OFF,\
+-Xep:MethodCanBeStatic:ERROR,\
+-Xep:MixedArrayDimensions:ERROR,\
+-Xep:MultiVariableDeclaration:ERROR,\
+-Xep:MultipleTopLevelClasses:ERROR,\
+-Xep:MultipleUnaryOperatorsInMethodCall:ERROR,\
+-Xep:PackageLocation:ERROR,\
+-Xep:ParameterComment:ERROR,\
+-Xep:ParameterNotNullable:ERROR,\
+-Xep:PrivateConstructorForNoninstantiableModuleTest:ERROR,\
+-Xep:PrivateConstructorForUtilityClass:ERROR,\
+-Xep:RemoveUnusedImports:ERROR,\
+-Xep:ReturnMissingNullable:ERROR,\
+-Xep:ThrowsUncheckedException:ERROR,\
+-Xep:UngroupedOverloads:ERROR,\
+-Xep:UnnecessarySetDefault:ERROR,\
+-Xep:UnnecessaryStaticImport:ERROR,\
+-Xep:UseBinds:ERROR,\
+-Xep:WildcardImport:ERROR
diff --git a/examples/gradle/errorprone/experimental_warnings b/examples/gradle/errorprone/experimental_warnings
new file mode 100644
index 00000000..b5a7df2b
--- /dev/null
+++ b/examples/gradle/errorprone/experimental_warnings
@@ -0,0 +1,23 @@
+errorProneExperimentalWarnings = \
+-Xep:AssertFalse:ERROR,\
+-Xep:AssistedInjectAndInjectOnConstructors:ERROR,\
+-Xep:BigDecimalLiteralDouble:ERROR,\
+-Xep:BindingToUnqualifiedCommonType:ERROR,\
+-Xep:ConstructorInvokesOverridable:ERROR,\
+-Xep:ConstructorLeaksThis:ERROR,\
+-Xep:EmptyTopLevelDeclaration:ERROR,\
+-Xep:ExpectedExceptionChecker:ERROR,\
+-Xep:HardCodedSdCardPath:ERROR,\
+-Xep:InconsistentOverloads:ERROR,\
+-Xep:MissingDefault:ERROR,\
+-Xep:MutableMethodReturnType:ERROR,\
+-Xep:NonCanonicalStaticMemberImport:ERROR,\
+-Xep:PrimitiveArrayPassedToVarargsMethod:ERROR,\
+-Xep:ProvidesFix:ERROR,\
+-Xep:QualifierWithTypeUse:ERROR,\
+-Xep:RedundantThrows:ERROR,\
+-Xep:StaticQualifiedUsingExpression:ERROR,\
+-Xep:StringEquality:ERROR,\
+-Xep:TestExceptionChecker:ERROR,\
+-Xep:UnnecessaryDefaultInEnumSwitch:ERROR,\
+-Xep:Var:OFF
diff --git a/examples/gradle/errorprone/warnings b/examples/gradle/errorprone/warnings
new file mode 100644
index 00000000..da7302dd
--- /dev/null
+++ b/examples/gradle/errorprone/warnings
@@ -0,0 +1,76 @@
+errorProneWarnings = \
+-Xep:AmbiguousMethodReference:ERROR,\
+-Xep:ArgumentSelectionDefectChecker:ERROR,\
+-Xep:AssertEqualsArgumentOrderChecker:ERROR,\
+-Xep:AssertionFailureIgnored:ERROR,\
+-Xep:BadAnnotationImplementation:ERROR,\
+-Xep:BadComparable:ERROR,\
+-Xep:BoxedPrimitiveConstructor:ERROR,\
+-Xep:CannotMockFinalClass:ERROR,\
+-Xep:CanonicalDuration:ERROR,\
+-Xep:ClassCanBeStatic:ERROR,\
+-Xep:ClassNewInstance:ERROR,\
+-Xep:CollectionToArraySafeParameter:ERROR,\
+-Xep:CollectorShouldNotUseState:ERROR,\
+-Xep:ComparableAndComparator:ERROR,\
+-Xep:DefaultCharset:ERROR,\
+-Xep:DoubleCheckedLocking:ERROR,\
+-Xep:EqualsHashCode:ERROR,\
+-Xep:EqualsIncompatibleType:ERROR,\
+-Xep:Finally:ERROR,\
+-Xep:FloatingPointLiteralPrecision:ERROR,\
+-Xep:FragmentInjection:ERROR,\
+-Xep:FragmentNotInstantiable:ERROR,\
+-Xep:FunctionalInterfaceClash:ERROR,\
+-Xep:FutureReturnValueIgnored:ERROR,\
+-Xep:GetClassOnEnum:ERROR,\
+-Xep:ImmutableAnnotationChecker:ERROR,\
+-Xep:ImmutableEnumChecker:ERROR,\
+-Xep:IncompatibleModifiers:ERROR,\
+-Xep:IncrementInForLoopAndHeader:ERROR,\
+-Xep:InjectOnConstructorOfAbstractClass:ERROR,\
+-Xep:InputStreamSlowMultibyteRead:ERROR,\
+-Xep:InstanceOfAndCastMatchWrongType:ERROR,\
+-Xep:IntLongMath:ERROR,\
+-Xep:IterableAndIterator:ERROR,\
+-Xep:JUnit3FloatingPointComparisonWithoutDelta:ERROR,\
+-Xep:JUnit4ClassUsedInJUnit3:ERROR,\
+-Xep:JUnitAmbiguousTestClass:ERROR,\
+-Xep:JavaLangClash:ERROR,\
+-Xep:JdkObsolete:ERROR,\
+-Xep:LogicalAssignment:ERROR,\
+-Xep:MissingFail:ERROR,\
+-Xep:MissingOverride:ERROR,\
+-Xep:MultipleParallelOrSequentialCalls:ERROR,\
+-Xep:MutableConstantField:ERROR,\
+-Xep:NamedParameters:ERROR,\
+-Xep:NarrowingCompoundAssignment:WARN,\
+-Xep:NestedInstanceOfConditions:ERROR,\
+-Xep:NonAtomicVolatileUpdate:ERROR,\
+-Xep:NonOverridingEquals:ERROR,\
+-Xep:NullableConstructor:ERROR,\
+-Xep:NullablePrimitive:ERROR,\
+-Xep:NullableVoid:ERROR,\
+-Xep:OperatorPrecedence:ERROR,\
+-Xep:OptionalNotPresent:ERROR,\
+-Xep:OverrideThrowableToString:ERROR,\
+-Xep:Overrides:ERROR,\
+-Xep:OverridesGuiceInjectableMethod:ERROR,\
+-Xep:ParameterName:ERROR,\
+-Xep:PreconditionsInvalidPlaceholder:ERROR,\
+-Xep:ProtoFieldPreconditionsCheckNotNull:ERROR,\
+-Xep:ReferenceEquality:ERROR,\
+-Xep:RequiredModifiers:ERROR,\
+-Xep:ShortCircuitBoolean:ERROR,\
+-Xep:SimpleDateFormatConstant:ERROR,\
+-Xep:StaticGuardedByInstance:ERROR,\
+-Xep:SynchronizeOnNonFinalField:ERROR,\
+-Xep:ThreadJoinLoop:ERROR,\
+-Xep:TruthConstantAsserts:ERROR,\
+-Xep:TypeParameterShadowing:ERROR,\
+-Xep:TypeParameterUnusedInFormals:ERROR,\
+-Xep:URLEqualsHashCode:ERROR,\
+-Xep:UnsynchronizedOverridesSynchronized:ERROR,\
+-Xep:UseCorrectAssertInTests:ERROR,\
+-Xep:WaitNotInLoop:ERROR,\
+-Xep:WakelockReleasedDangerously:ERROR
diff --git a/examples/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 00000000..7a3265ee
--- /dev/null
+++ b/examples/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/examples/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..92165eed
--- /dev/null
+++ b/examples/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-bin.zip
diff --git a/examples/gradlew b/examples/gradlew
new file mode 100755
index 00000000..cccdd3d5
--- /dev/null
+++ b/examples/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/examples/gradlew.bat b/examples/gradlew.bat
new file mode 100644
index 00000000..e95643d6
--- /dev/null
+++ b/examples/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/examples/settings.gradle b/examples/settings.gradle
new file mode 100644
index 00000000..310e652f
--- /dev/null
+++ b/examples/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'opencensus-examples'
diff --git a/settings.gradle b/settings.gradle
index e917496a..e94fb8f7 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -31,7 +31,6 @@ project(':opencensus-exporter-stats-stackdriver').projectDir = "$rootDir/exporte
// Java8 projects only
if (JavaVersion.current().isJava8Compatible()) {
include ":opencensus-all"
- include ":examples"
include ":benchmarks"
include ":opencensus-contrib-zpages"