Replace custom annotation processor handling

Use LOCAL_ANNOTATION_PROCESSORS instead of custom annotation
processor handling.

Test: m -j java
Change-Id: Ia01cc51ea8dbe0842145789ef22a278573c1ee6b
diff --git a/Android.mk b/Android.mk
index 21fa4c1..deb2fea 100644
--- a/Android.mk
+++ b/Android.mk
@@ -74,24 +74,19 @@
   dagger2-producers-host \
   guavalib
 
-# Disable the default discovery for annotation processors and explicitly specify
-# the path and classes needed. This is needed because otherwise it breaks a code
-# indexing tool that doesn't, as yet do automatic discovery.
-PROCESSOR_LIBRARIES := \
+LOCAL_ANNOTATION_PROCESSORS := \
   dagger2-auto-common-host \
   dagger2-auto-factory-host \
   dagger2-auto-service-host \
   dagger2-auto-value-host \
   guavalib
 
-PROCESSOR_CLASSES := \
+LOCAL_ANNOTATION_PROCESSOR_CLASSES := \
   com.google.auto.factory.processor.AutoFactoryProcessor \
   com.google.auto.service.processor.AutoServiceProcessor \
   com.google.auto.value.processor.AutoAnnotationProcessor \
   com.google.auto.value.processor.AutoValueProcessor
 
-include $(LOCAL_PATH)/java_annotation_processors.mk
-
 LOCAL_JAVA_LANGUAGE_VERSION := 1.7
 include $(BUILD_HOST_JAVA_LIBRARY)
 
diff --git a/dagger2_annotation_processor.mk b/dagger2_annotation_processor.mk
deleted file mode 100644
index f80b83c..0000000
--- a/dagger2_annotation_processor.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (C) 2015 The Android Open Source Project
-#
-# 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.
-
-DAGGER2_PROCESSOR_LIBRARIES := \
-  dagger2-compiler-host
-
-DAGGER2_PROCESSOR_CLASSES := \
-  dagger.internal.codegen.ComponentProcessor
diff --git a/java_annotation_processors.mk b/java_annotation_processors.mk
deleted file mode 100644
index d901083..0000000
--- a/java_annotation_processors.mk
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright (C) 2015 The Android Open Source Project
-#
-# 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.
-
-# Manages use of annotation processors.
-#
-# At the moment both the -processorpath and the -processor
-# flags must be specified in order to use annotation processors
-# as a code indexing tool that wraps javac doesn't as yet support
-# the same behaviour as standard javac with regard to use of
-# annotation processors. In particular it:
-# - doesn't default -processorpath to be the same as -classpath
-# - doesn't scan processorpath to automatically discover processors
-# - doesn't support a comma separated list of processor class names
-#   on a single -processor option so need on option per class name.
-#
-# Input variables:
-#
-#   PROCESSOR_LIBRARIES := <list of library names>
-#     Similar to names added to LOCAL_JAVA_LIBRARIES.
-#
-#   PROCESSOR_CLASSES := <list of processor class names>
-#
-# Upon exit various LOCAL_ variables have been updated and the
-# input variables have been cleared.
-
-# Map the library names to actual JARs.
-PROCESSOR_JARS := $(call java-lib-deps, $(PROCESSOR_LIBRARIES), true)
-
-# Add a javac -processorpath flag.
-LOCAL_JAVACFLAGS += -processorpath $(call normalize-path-list,$(PROCESSOR_JARS))
-
-# Specify only one processor class per -processor option as
-# the indexing tool does not parse the -processor value as a
-# comma separated list.
-LOCAL_JAVACFLAGS += $(foreach class,$(PROCESSOR_CLASSES),-processor $(class))
-
-# Create a source directory into which the code will be generated.
-GENERATED_SOURCE_DIR := $(local-generated-sources-dir)/annotation_processor_output/
-
-# Tell javac to generate source files in the source directory.
-LOCAL_JAVACFLAGS += -s $(GENERATED_SOURCE_DIR)
-
-# Add dependency between the jar being built and the processor jars so that
-# they are built before this one.
-LOCAL_ADDITIONAL_DEPENDENCIES += $(PROCESSOR_JARS) $(GENERATED_SOURCE_DIR)
-
-$(GENERATED_SOURCE_DIR):
-	mkdir -p $@
-
-# Clean up all the extra variables to make sure that they don't escape to
-# another module.
-PROCESSOR_LIBRARIES :=
-PROCESSOR_CLASSES :=
-PROCESSOR_JARS :=
-GENERATED_SOURCE_DIR :=