aboutsummaryrefslogtreecommitdiff
path: root/java/dagger/hilt/processor
AgeCommit message (Collapse)Author
2021-05-12Revert "Merge commit 'upstream/dagger-2.35.1^'"Aurimas Liutikas
This reverts commit 399f4f61132f363e9479e59c550a7bcf005922d8. Reason for revert: b/187908823 Change-Id: I81f7cd3672e65ce1f7e1fa846b6c3e2f87147a26
2021-04-26Add flag to disable cross-compilation root validation.Brad Corso
Fixes #2577 RELNOTES=Fixes #2577: Add flag to disable cross-compilation root validation. PiperOrigin-RevId: 370573954
2021-04-22Remove the references to beta in preparation for the upcoming stable release.Eric Chang
RELNOTES=n/a PiperOrigin-RevId: 369963385
2021-04-21Fix an issue where internal Kotlin objects were not properly being ↵Eric Chang
processed. Consolidate logic to figure out if a module requires an instance. RELNOTES=Fixes an issue where internal Kotlin object modules were incorrectly depended on directly by the component. PiperOrigin-RevId: 369743121
2021-04-20Remove defaultRootComponentName and pass in default root directly.Brad Corso
RELNOTES=N/A PiperOrigin-RevId: 369482450
2021-04-20Share aggregating metadata logic in a utility class.Brad Corso
RELNOTES=N/A PiperOrigin-RevId: 369466974
2021-04-19Add aggregating data for roots. Also add tests to verify illegal combinations.Brad Corso
This CL adds AggregatedRoot for each root found and AggregatedRootSentinel for each root processed. We can then use this information to determine if the roots from past and current compilation units are valid. RELNOTES=N/A PiperOrigin-RevId: 369316983
2021-04-19Allow ProcessorErrors.checkState without an associated elementBrad Corso
RELNOTES=N/A PiperOrigin-RevId: 369306095
2021-04-19Make aggregated deps public and prepend "_" to the name to obfuscate it from ↵Brad Corso
auto suggest tools. RELNOTES=N/A PiperOrigin-RevId: 369243374
2021-04-16Internal changeBrad Corso
RELNOTES=N/A PiperOrigin-RevId: 368922638
2021-04-16Internal changeBrad Corso
RELNOTES=N/A PiperOrigin-RevId: 368911475
2021-04-16Internal changeBrad Corso
RELNOTES=N/A PiperOrigin-RevId: 368872818
2021-04-13Add AggregatedEarlyEntryPointMetadata to aggregate information about ↵Brad Corso
@EarlyEntryPoints. Note: this is a breaking change in the rare case that an app that upgrades Hilt is relying on an @EarlyEntryPoint usage in a library that is not also updated. To fix, all usages of @EarlyEntryPoint must be using the upgraded version of Hilt or later. Otherwise, they may miss the @EarlyEntryPoint usage and fail at runtime during a test. RELNOTES=This is a breaking change in the rare case that an app that upgrades Hilt is relying on an @EarlyEntryPoint usage in a library that is not also updated. To fix, all usages of @EarlyEntryPoint must be using the upgraded version of Hilt or later. Otherwise, they may miss the @EarlyEntryPoint usage and fail at runtime during a test. PiperOrigin-RevId: 368322897
2021-04-09Generate a separate TestComponentDataSupplier for each root.Brad Corso
The name generated class will be based on the enclosed name of the root, e.g. `foo.FooTest` will generate `foo.FooTest_TestComponentDataSupplier`. RELNOTES=N/A PiperOrigin-RevId: 367637090
2021-04-08Sort root names before deduplicating them with numeric suffixes in order ↵Grant Oakley
guarantee determinism if this method is called from different processors. RELNOTES=N/A PiperOrigin-RevId: 367533712
2021-04-07Generate all test components in a common directory separate from the test ↵Grant Oakley
class root if shareTestComponents flag is enabled. Before this change, the test component would only be generated in the shared directory if it was able to use the shared test components. If only one root type exists in the compilation unit for a given simple name, that name is used to prefix the generated component name. If more than a one root shares a simple name (tests with the same name in separate packages), we have to disambiguate. RELNOTES=N/A PiperOrigin-RevId: 367252285
2021-04-05Pull AliasOfPropagatedDataMetadata into its own source file.Brad Corso
RELNOTES=N/A PiperOrigin-RevId: 366859328
2021-04-05Pull DefineComponentClassesMetadata into its own source file.Brad Corso
RELNOTES=N/A PiperOrigin-RevId: 366852409
2021-04-05Generate aggregated data for @UninstallModules.Brad Corso
RELNOTES=N/A PiperOrigin-RevId: 366804454
2021-04-02Fix an issue with KotlinMetadata where constructors were not getting added ↵Eric Chang
to the function map. RELNOTES=n/a PiperOrigin-RevId: 366532699
2021-04-02Pull AggregatedDepsMetadata into its own source file.Brad Corso
RELNOTES=N/A PiperOrigin-RevId: 366531336
2021-04-01Reuse the Default root generated components for test roots in the same ↵Grant Oakley
compilation unit that do not have test-specific bindings, rather than generating new components per-test. This can significantly reduce the amount of generated code for large projects with many test classes that do not provide test-specific bindings. This is currently off-by-default behind a compiler flag. This may be turned on by default in a future release. RELNOTES=Only generate and compile a single _HiltComponents class for test roots in the same compilation unit that do not have test-specific bindings, if flag enabled. PiperOrigin-RevId: 366281911
2021-03-30Also generate proxy module classes for Kotlin classes that are marked as ↵Grant Oakley
`internal`, which are analogous to package-private Java modules. RELNOTES=N/A PiperOrigin-RevId: 365865718
2021-03-18Remove unused TestApplicationInjector interface.Grant Oakley
RELNOTES=N/A PiperOrigin-RevId: 363740468
2021-03-12Remove throws declarations from methods that do not throwGrant Oakley
RELNOTES=N/A PiperOrigin-RevId: 362618454
2021-03-03Prevent KAPT from logging errors when compiling modules without entry points.Nicklas Ansman Giertz
When Hilt Android is run on a module that contains no entry points, KAPT will log an error about `disableAndroidSuperclassValidation` not being a support option. This is because the Hilt Gradle plugin will add this option when applied but if no entry points exists, no processor actually accepts that option. With this fix, all Hilt processors accept these options (though they are unused). This will prevent KAPT from logging these warnings in most cases. It is still possible for warnings to be logged, for example if the Hilt plugin is applied, but Hilt isn't used but for those cases the user can simply skip applying the plugin. Fixes #2040 Closes #2372 RELNOTES="Reduce the possibility of KAPT logging warnings due to no processor supporting `disableAndroidSuperclassValidation` when no Android entry points are in the source module." PiperOrigin-RevId: 360836064
2021-02-25Update all "alpha" references to "beta" in preparation for the upcoming beta ↵Brad Corso
release. RELNOTES=N/A PiperOrigin-RevId: 359575497
2021-02-24Follow-up changes to the EarlyEntryPoint APIBrad Corso
This CL changes the usage of @EarlyEntryPoint from being an addition to @EntryPoint to being a replacement for @EntryPoint. It also adds the @Beta annotation to the API. RELNOTES=N/A PiperOrigin-RevId: 359399064
2021-02-24Add EarlyTestEntryPoints to allow entry points to be called in tests before ↵Brad Corso
the test instance is instantiated. See https://github.com/google/dagger/issues/2016 RELNOTES=Add EarlyTestEntryPoints to allow entry points to be called in tests before the test instance is instantiated. PiperOrigin-RevId: 359350904
2021-02-17Internal refactorGrant Oakley
RELNOTES=N/A PiperOrigin-RevId: 358033242
2021-02-10Move ComponentTree into processor/internal/root since it's the only usage.Brad Corso
Actually, there was a usage in DefineComponents, but I removed it since it wasn't really necessary. RELNOTES=N/A PiperOrigin-RevId: 356736330
2021-02-09Move ComponentGenerator into processor/internal/root since it's the only usage.Brad Corso
RELNOTES=N/A PiperOrigin-RevId: 356504954
2021-02-08Fix an issue where two @DefineComponent classes with the same simple name ↵Eric Chang
can create build conflicts by appending a unique suffix. RELNOTES=Fix issue with @DefineComponent classes with same name PiperOrigin-RevId: 356363930
2021-02-05Remove the deprecated ApplicationComponent.Eric Chang
RELNOTES=Removes the deprecated ApplicationComponent. PiperOrigin-RevId: 355956593
2021-02-05Fix an issue where a module referencing a component without a builder would ↵Eric Chang
fail. This is done by moving where we filter builder-less components further to when we generate components as oppposed to immediately after finding all of the @DefineComponent classes. RELNOTES=Fix an issue where a module referencing a component without a builder would fail PiperOrigin-RevId: 355880849
2021-02-04Internal refactorBrad Corso
RELNOTES=N/A PiperOrigin-RevId: 355752966
2021-01-19Add back the deprecated ApplicationComponent since hilt-work latest release ↵Eric Chang
still uses it. RELNOTES=Add back the deprecated ApplicationComponent. PiperOrigin-RevId: 352671220
2021-01-11Add TestInstallIn to Hilt.Brad Corso
This feature allows users to replace @InstallIn modules with a @TestInstallIn module. For example, you can replace FooModule with FakeFooModule with the following: ``` @Module @TestInstallIn( components = SingletonComponent.class, replaces = FooModule.class) interface FakeFooModule { ... } ``` Note that @TestInstallIn only replaces @InstallIn when using @HiltAndroidTest, it does not apply in @HiltAndroidApp. RELNOTES=Adds @TestInstallIn feature to Hilt PiperOrigin-RevId: 351213437
2020-12-29Add a plugin to check for injections of @HiltViewModel types. Since ↵Eric Chang
@HiltViewModel has an @Inject constructor, it is possible to erroneously inject it instead of accessing it via the Android APIs. This check should prevent that from happening. RELNOTES=Injections of @HiltViewModel types now cause an error PiperOrigin-RevId: 349480648
2020-12-29Rename ClassNames.APPLICATION_COMPONENT to SINGLETON_COMPONENTBrad Corso
RELNOTES=N/A PiperOrigin-RevId: 349443733
2020-12-28Add a plugin to check for injections of @HiltViewModel types. Since ↵Dagger Team
@HiltViewModel has an @Inject constructor, it is possible to erroneously inject it instead of accessing it via the Android APIs. This check should prevent that from happening. RELNOTES=Injections of @HiltViewModel types now cause an error PiperOrigin-RevId: 349357974
2020-12-28Add a plugin to check for injections of @HiltViewModel types. Since ↵Eric Chang
@HiltViewModel has an @Inject constructor, it is possible to erroneously inject it instead of accessing it via the Android APIs. This check should prevent that from happening. RELNOTES=Injections of @HiltViewModel types now cause an error PiperOrigin-RevId: 349339906
2020-12-14Update Android SDK and build tools to 30 along with AGP to 4.1.1. AGP also ↵Dagger Team
requires newer Gradle version, so bumping the wrapper to 6.7. Robolectric also had tro be updates to 4.5-alpha which supports API 30. RELNOTES=N/A PiperOrigin-RevId: 347443545
2020-12-09Remove the deprecated ApplicationComponent.Eric Chang
RELNOTES=Remove the deprecated ApplicationComponent and handling for it. Users should migrate to SingletonComponent. PiperOrigin-RevId: 346656300
2020-12-07Update Hilt's ViewModel APIs to be a type annotation along with @Inject ↵Dagger Team
constructor annotation. This solidifies the relationship between Hilt/Dagger and ViewModels and will allow Dagger to generated the factories that will construction inject and member inject the ViewModels. RELNOTES=Update @ViewModelInject API to @HiltViewModel PiperOrigin-RevId: 346245747
2020-11-30Roll forward with fix of 'Migrating @ViewModelInject into Hilt's codebase'.Dagger Team
Additional changes compared to the original CL: * An additional Module per @ViewModelInject-annotated ViewModel class will be created to bind the class name to a Set<String>. * The Set<String> of injected view models class names will be used by the HiltViewModelFactory to determine whether the view model to create should come from the ViewModelComponent or not. By filtering out non-injected view models the factory can avoid eagerly creating a SavedStateHandle for a view model that will not be created via the ViewModelComponent. PiperOrigin-RevId: 344909991
2020-11-23Add a missing @Override on #injectTest.Dagger Team
RELNOTES=n/a PiperOrigin-RevId: 343809078
2020-11-12Rollback of Migrating @ViewModelInject into Hilt's codebase.Dagger Team
Breaks users member injecting ViewModels without SavedStateHandle. PiperOrigin-RevId: 342057045
2020-11-11Migrating @ViewModelInject into Hilt's codebase.Dagger Team
This CL brings the ViewModel extension from AndroidX into Hilt's codebase to provide first party support for ViewModels within Hilt. It does not update the mechanism for which the HiltViewModelFactory is provided into the @AndroidEntryPoint-annotated classes. RELNOTES=Migrating @ViewModelInject into Hilt's codebase. PiperOrigin-RevId: 341977365
2020-10-12Internal change.Eric Chang
RELNOTES=n/a PiperOrigin-RevId: 336792211