Create build rule for hilt_android_testing
hilt_android_testing is for test setup using @HiltAndroidTest.
hilt_generates_root_input_processor and hilt_define_component_processor
are two hilt processors needed for generating code for hilt_core.
hilt_generates_root_input_processor is the only hilt processor needed
for generating code for hilt_android_testing. Thus, this change has
hilt_generates_root_input_processor to contain the annotation processor
classes instead and removes the uncessary
hilt_android_entry_point_processor from hilt_core.
Bug: 173800389
Test: mma -j32
Change-Id: I299f4d45f10e76c0dd0a82c4cd3fd18178aa24b2
diff --git a/Android.bp b/Android.bp
index 69983fb..b4430b2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -178,7 +178,6 @@
],
sdk_version: "core_current",
plugins: [
- "hilt_android_entry_point_processor",
"hilt_define_component_processor",
"hilt_generates_root_input_processor",
],
@@ -235,16 +234,63 @@
],
}
+android_library {
+ name: "hilt_android_testing",
+ visibility: ["//visibility:public"],
+
+ srcs: [
+ "java/dagger/hilt/android/internal/testing/*.java",
+ "java/dagger/hilt/android/testing/*.java",
+ ],
+ manifest: "java/dagger/hilt/android/testing/AndroidManifest.xml",
+ static_libs: [
+ "auto_value_annotations",
+ "androidx.annotation_annotation",
+ "androidx.fragment_fragment",
+ "androidx.annotation_annotation",
+ "androidx.fragment_fragment",
+ "androidx.test.core",
+ "android-support-multidex",
+ "jsr305",
+ "dagger2",
+ "hilt_core",
+ "junit",
+ ],
+ sdk_version: "current",
+ min_sdk_version: "14",
+ plugins: [
+ "auto_value_plugin",
+ "dagger2-compiler",
+ "hilt_generates_root_input_processor",
+ ],
+ exported_plugins: [
+ "dagger2-compiler",
+ "hilt_android_entry_point_processor",
+ "hilt_aggregated_deps_processor",
+ "hilt_define_component_processor",
+ "hilt_generates_root_input_processor",
+ "hilt_originating_element_processor",
+ "hilt_root_processor",
+ "hilt_custom_test_application_processor",
+ "hilt_uninstall_modules_processor",
+ ],
+}
+
// Hilt has many annotation processors. To reduce compilation and runtime cost, they are all compiled
// into hilt_android_processors. A java_plugin can only expose a single processor class, so each has
// to be defined separately. Since they are not visible outside this package and will always be
// exported together, only the first actually contains the annotation processor classes.
+java_plugin {
+ name: "hilt_generates_root_input_processor",
+ generates_api: true,
+ processor_class: "dagger.hilt.processor.internal.generatesrootinput.GeneratesRootInputProcessor",
+ static_libs: ["hilt_android_processors"],
+}
java_plugin {
name: "hilt_android_entry_point_processor",
generates_api: true,
processor_class: "dagger.hilt.android.processor.internal.androidentrypoint.AndroidEntryPointProcessor",
- static_libs: ["hilt_android_processors"],
}
java_plugin {
@@ -266,12 +312,6 @@
}
java_plugin {
- name: "hilt_generates_root_input_processor",
- generates_api: true,
- processor_class: "dagger.hilt.processor.internal.generatesrootinput.GeneratesRootInputProcessor",
-}
-
-java_plugin {
name: "hilt_originating_element_processor",
generates_api: true,
processor_class: "dagger.hilt.processor.internal.originatingelement.OriginatingElementProcessor",
@@ -283,6 +323,19 @@
processor_class: "dagger.hilt.processor.internal.root.RootProcessor",
}
+// Hilt testing processors
+java_plugin {
+ name: "hilt_custom_test_application_processor",
+ generates_api: true,
+ processor_class: "dagger.hilt.android.processor.internal.customtestapplication.CustomTestApplicationProcessor",
+}
+
+java_plugin {
+ name: "hilt_uninstall_modules_processor",
+ generates_api: true,
+ processor_class: "dagger.hilt.android.processor.internal.uninstallmodules.UninstallModulesProcessor",
+}
+
java_library_host {
name: "hilt_android_processors",
use_tools_jar: true,