Add support for AutoValue in examples.

The @AutoValue annotation can _only_ be used in test/examples so that
we can write tests for this common pattern. This is not meant to
encourage general use of @AutoValue in the code base.

Bug:
Change-Id: Ie2f43cb4e49bfb2ed0f462c1d12f04c384fb1432
diff --git a/build.gradle b/build.gradle
index 35da63e..ef09f76 100644
--- a/build.gradle
+++ b/build.gradle
@@ -10,6 +10,7 @@
 apply plugin: 'com.google.protobuf'
 apply plugin: 'com.cookpad.android.licensetools'
 apply plugin: 'net.ltgt.errorprone-base'
+apply plugin: "net.ltgt.apt"
 
 def errorProneConfiguration = [
     '-XepDisableAllChecks',
@@ -51,6 +52,7 @@
         // classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1'
         classpath files("third_party/shadow/shadow-2.0.1.jar")
         classpath "net.ltgt.gradle:gradle-errorprone-plugin:0.0.13"
+        classpath "net.ltgt.gradle:gradle-apt-plugin:0.12"
     }
 }
 
@@ -169,12 +171,16 @@
     jctfTestsCompile sourceSets.jctfCommon.output
     examplesAndroidOCompile group: 'org.ow2.asm', name: 'asm', version: '6.0'
     examplesAndroidPCompile group: 'org.ow2.asm', name: 'asm', version: '6.0'
+    // Import Guava for @Nullable annotation
+    examplesCompile 'com.google.guava:guava:23.0'
     examplesCompile 'com.google.protobuf:protobuf-lite:3.0.0'
+    examplesCompileOnly "com.google.auto.value:auto-value:1.5"
     examplesRuntime 'com.google.protobuf:protobuf-lite:3.0.0'
     supportLibs 'com.android.support:support-v4:25.4.0'
     supportLibs 'junit:junit:4.12'
     supportLibs 'com.android.support.test.espresso:espresso-core:3.0.0'
     debugTestResourcesKotlinCompileOnly 'org.jetbrains.kotlin:kotlin-stdlib:1.1.4-3'
+    apt 'com.google.auto.value:auto-value:1.5'
 }
 
 licenseTools {
diff --git a/src/test/examples/autovalue/SimpleAutoValue.java b/src/test/examples/autovalue/SimpleAutoValue.java
new file mode 100644
index 0000000..2c0b2c6
--- /dev/null
+++ b/src/test/examples/autovalue/SimpleAutoValue.java
@@ -0,0 +1,54 @@
+// Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+package autovalue;
+
+import com.google.auto.value.AutoValue;
+import javax.annotation.Nullable;
+
+public class SimpleAutoValue {
+
+  @AutoValue
+  static abstract class Pair {
+
+    Pair() {
+      // Intentionally left empty.
+    }
+
+    abstract int getOne();
+
+    @Nullable
+    abstract String getOther();
+
+    abstract String getRequiredOther();
+
+    static Builder builder() {
+      return new AutoValue_SimpleAutoValue_Pair.Builder();
+    }
+
+    @AutoValue.Builder
+    abstract static class Builder {
+
+      abstract Builder setOne(int value);
+
+      abstract Builder setOther(String value);
+
+      abstract Builder setRequiredOther(String value);
+
+      abstract Pair build();
+    }
+  }
+
+  public static void main(String... args) {
+    Pair.Builder builder = Pair.builder();
+    builder.setOne(42);
+    builder.setRequiredOther("123");
+    System.out.println(builder.build());
+    builder = Pair.builder();
+    try {
+      builder.build();
+    } catch (Exception e) {
+      System.out.println(e.getMessage());
+    }
+  }
+}