diff options
author | Yiqun Wu <yiqunw@google.com> | 2021-01-07 15:53:37 -0800 |
---|---|---|
committer | Yiqun Wu <yiqunw@google.com> | 2021-01-12 07:33:48 -0800 |
commit | 6edcef5ff1219a4de815067fa89166ecae8efdac (patch) | |
tree | 2d4e236f0bf8639284496ff104608d7ee690e4e3 /Android.bp | |
parent | e68a5df4f7f6aa65f9cedf9e7fb252fef88f3916 (diff) | |
download | dagger2-6edcef5ff1219a4de815067fa89166ecae8efdac.tar.gz |
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
Diffstat (limited to 'Android.bp')
-rw-r--r-- | Android.bp | 69 |
1 files changed, 61 insertions, 8 deletions
diff --git a/Android.bp b/Android.bp index 69983fb1b..b4430b28f 100644 --- a/Android.bp +++ b/Android.bp @@ -178,7 +178,6 @@ java_library { ], 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 { ], } +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 { } 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 @@ java_plugin { 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, |