aboutsummaryrefslogtreecommitdiff
path: root/java/dagger/hilt
AgeCommit message (Collapse)Author
2021-02-10Move the handling of @Override annotations out of the switch so it applies ↵Eric Chang
to BroadcastReceivers as well. RELNOTES=n/a PiperOrigin-RevId: 356800754
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-09Replace usages of project.properties with gradleProperty()Daniel Santiago
Usages of project.properties is not allowed to support Gradle's configuration caching features. RELNOTES=Fix an issue where Hilt's Gradle plugin was incompatible with Configuration Caching when `enableExperimentalClasspathAggregation` was turned ON. PiperOrigin-RevId: 356553564
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-08Filter out the configuring project from the artifact view in the Hilt Gradle ↵Daniel Santiago
plugin during classpath aggregation to avoid interfering with kotlinc's classpath configuration to the modude's classes. This avoids a situation where `internal` members would seem to not be accessible from local host unit tests in an Android library. Fixes: https://github.com/google/dagger/issues/2306 RELNOTES=Fix an issue where internal Kotlin classes where not accessible with `enableExperimentalClasspathAggregation` turned ON. PiperOrigin-RevId: 356243936
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-05Uncomment precondition check enforcing that HiltAndroidRule#inject() is not ↵Grant Oakley
called multiple times. RELNOTES=HiltAndroidRule now enforces that inject() is only called at most once per test case. PiperOrigin-RevId: 355877394
2021-02-04Internal refactorBrad Corso
RELNOTES=N/A PiperOrigin-RevId: 355752966
2021-02-04Reset DelayComponentState between gradle test runs. Adds a new gradle test ↵Grant Oakley
that uses HiltAndroidRule#delayComponentReady(). RELNOTES=Fixes HiltAndroidRule#delayComponentState() for gradle tests PiperOrigin-RevId: 355744007
2021-02-02Internal refactorDagger Team
RELNOTES=n/a PiperOrigin-RevId: 355283763
2021-01-29Update Gradle to 6.7.1 in test projects, required by AGP 4.2.0-beta04.Daniel Santiago
RELNOTES=n/a PiperOrigin-RevId: 354631986
2021-01-29Update Hilt Plugin to AGP beta04 and use renamed APIs when configuring the ↵Daniel Santiago
ASM transform. Fixes https://github.com/google/dagger/issues/2337 RELNOTES=Fix an incompatibility issue between the Hilt Gradle Plugin and AGP 4.2.0-beta04. Note that this fix makes it so that earlier versions of AGP 4.2.0 are incompatible with Hilt's Plugin. PiperOrigin-RevId: 354610640
2021-01-29Allow deferring component initialization in tests when using @BindsValue.Grant Oakley
RELNOTES=A new deferBinds() method on HiltAndroidRule allows deferring component initialization in tests until after test execution has started. This allows modifying the @BindValue field values before they are used by an OnComponentReadyRunner. PiperOrigin-RevId: 354557513
2021-01-28Internal refactorEric Chang
RELNOTES=n/a PiperOrigin-RevId: 354348146
2021-01-27Request 'processed-jar' in the Hilt Gradle plugin during classpath ↵Daniel Santiago
aggregation so that kotlinc invocations use the processed jar in the '-friend-path' such that internal members are accessible. Fixes: https://github.com/google/dagger/issues/2306 RELNOTES=Fix an issue where internal Kotlin classes where not accessible with `enableExperimentalClasspathAggregation` turned ON. PiperOrigin-RevId: 354151797
2021-01-27Use SingletonComponent instead of ApplicationComponent in commentstakahirom
Closes https://github.com/google/dagger/pull/2128 RELNOTES=n/a PiperOrigin-RevId: 354147061
2021-01-27Internal changeDagger Team
RELNOTES=N/A PiperOrigin-RevId: 353987663
2021-01-21Revert Hilt internal entry point and modules back to public to avoid r8 ↵Brad Corso
optimization issues. This CL is a partial rollback of changes made in CL/351213437 when introducing TestInstallIn. Making these classes pkg-private was mostly just a precaution. Making these public again should be fine since AggeregatedDepsProcessor prevents using TestInstallIn from replacing dagger.hilt modules. See https://github.com/google/dagger/issues/2291 RELNOTES=Partially Fixes 2291: Reverts Hilt internal entry point and modules back to public to avoid r8 optimization issues. The full fix on our side (until r8 bug is fixed) will be to ship a proguard config that keeps the HiltWrapper_ classes. This will be done in a future release. PiperOrigin-RevId: 353064986
2021-01-21Rollback since this was an unintended effect on the deps of the release.Eric Chang
PiperOrigin-RevId: 353057330
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-19This feature may be a breaking change, so rolling it back for a Dagger patch ↵Brad Corso
release. I'll roll this forward before the next minor release. RELNOTES=N/A PiperOrigin-RevId: 352656750
2021-01-19Clears Fragment reference in FragmentContextWrapper after Fragment#onDestroy()Brad Corso
This CL uses the fragment Lifecycle to clear the fragment instance from the FragmentContextWrapper after onDestroy. Fixes: #2070 See https://github.com/google/dagger/issues/2070 RELNOTES=Fixes #2070: clears Fragment reference in FragmentContextWrapper after Fragment#onDestroy() PiperOrigin-RevId: 352579115
2021-01-15Rename some usages of ViewModelInject to HiltViewModelEric Chang
RELNOTES=n/a PiperOrigin-RevId: 352108269
2021-01-15Internal refactorEric Chang
RELNOTES=n/a PiperOrigin-RevId: 352100147
2021-01-11Protect against double injection in the case that user code manually calls ↵Eric Chang
the generated inject() method. RELNOTES=n/a PiperOrigin-RevId: 351255476
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
2021-01-07Use AGP given ASM Api version when creating the ClassVisitor.Dagger Team
RELNOTES=N/A PiperOrigin-RevId: 350666988
2021-01-05Use runtime classpath at root to workaround Dagger/Hilt API vs Impl issue.Dagger Team
This CL adds a new Hilt option called 'enableClasspathAggregation' that will configure the compile classpath of the project (for app modules and tests) to use the runtime classpath. This means that transitive dependencies will be available during compilation which in turn will allow Dagger to traverse the classes along the dependency tree and will allow for Hilt's aggregating classes to be discovered. The classpath configuration is done by resolving the runtime configuration with an artifact view and adding it to the 'CompileOnly' config. This solution is inefficient and will cause build performance impact, but it is a starting point that can be further optimized by using a smarter transform that can extract the necessary classes required by Dagger and Hilt. Fixes: https://github.com/google/dagger/issues/1991 RELNOTES=Use runtime classpath at root to workaround Dagger/Hilt API vs Impl issue. PiperOrigin-RevId: 350239023
2021-01-05Internal refactorDagger Team
RELNOTES=n/a PiperOrigin-RevId: 350193163
2020-12-30Rollback of ↵Dagger Team
https://github.com/google/dagger/commit/ce6cf6114c2301d174debcc93afc2a6bc01d6eb5 PiperOrigin-RevId: 349576136
2020-12-29Protect against double injection in the case that user code manually calls ↵Eric Chang
the generated inject() method. RELNOTES=n/a PiperOrigin-RevId: 349489978
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-23Migrate HiltGradlePlugin to use AGP's new ASM pipeline for bytecode ↵Dagger Team
transformation. Updates the HiltGradlePlugin to use AGP's new ASM pipeline if the developer is on AGP 4.2.0+, otherwise the plugin will use the older transform APIs. Using the new APIs allows for the plugin to not need a custom task to transform local tests as this is now supported with the new pipeline. If the developer is using AGP 4.2.0 then having 'enableTransformForLocalTests' is no longer needed and a warning will be shown with the hopes of migrating user away and once 4.2 is stable completely removing and deprecating the option. AGP's new transform pipeline is available in AGP 4.2.0 which is currently in beta. Fixes: https://github.com/google/dagger/issues/2118 RELNOTES=Use AGP's new transform pipeline when developer is on AGP 4.2.0+. PiperOrigin-RevId: 348818076
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-10Refactor view model support to avoid conflicts with the existing Hilt extension.Eric Chang
HiltViewModelFactory moved to internal as it isn't meant to be used directly as a public interface and it groups better with the internal helper methods, avoiding a circular dependency. RELNOTES=n/a PiperOrigin-RevId: 346827298
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-08Add a comment explaining why BindValue is restricted to the @HiltAndroidTest ↵Eric Chang
class. RELNOTES=n/a PiperOrigin-RevId: 346455327
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-12-01Add packing proguard.txt for AARs into gen_maven_artifact macro.Dagger Team
RELNOTES=N/A PiperOrigin-RevId: 345035431
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-30Migrate ApplicationComponent to SingletonComponent.Eric Chang
RELNOTES=n/a PiperOrigin-RevId: 344859215
2020-11-23Add a missing @Override on #injectTest.Dagger Team
RELNOTES=n/a PiperOrigin-RevId: 343809078
2020-11-19Remove erroneously added JSR250 deps from the Hilt runtime.Eric Chang
RELNOTES=Remove the erroneous JSR250 dep from the Hilt runtime. PiperOrigin-RevId: 343393037
2020-11-19Deprecate ApplicationComponent for SingletonComponent.Eric Chang
RELNOTES=Deprecate ApplicationComponent PiperOrigin-RevId: 343333212
2020-11-12Rollback of Migrating @ViewModelInject into Hilt's codebase.Dagger Team
Breaks users member injecting ViewModels without SavedStateHandle. PiperOrigin-RevId: 342057045