Skip to content

Releases: google/dagger

Dagger 2.40.3

29 Nov 18:30
Compare
Choose a tag to compare

Dagger bug fixes

  • Fixes #3065: Fixes an issue caused by our XProcessing migration (to support KSP). For now, we’ve replaced all problematic usages of XElement#getName() with XElements#getSimpleName(XElement) which ensures we use the old javac simple name.

Dagger 2.40.2

24 Nov 00:55
Compare
Choose a tag to compare

Dagger Bug Fixes

  • Fix #2997, #3032: Fixed issue with @BindsInstance parameters when bound types are from compiled dependencies. (ec1a98c).

Hilt New features

  • Add convenient overloads for Kotlin users of EntryPointAccessors (6e1f0ea)
  • @AliasOf now accepts multiple scope annotations. (aa92b9e)

Hilt Bug Fixes

  • Fix #3006:Sort dependencies in ComponentTreeDeps manually to give consistent output when doing incremental processing. (93f04ae)

Dagger 2.40.1

11 Nov 17:04
Compare
Choose a tag to compare

Bug Fixes

  • Fix an AGP 7.2 incompatibility issue in the Hilt Gradle Plugin due to AGP breaking their API when cleaning up a deprecated type. (ed677ba)
  • Fix #2986 - An issue in the Dagger processor where it would crash due to a bad initialization. (608bcba)

Dagger 2.40

27 Oct 23:03
Compare
Choose a tag to compare

What’s New in Hilt

New Changes

  • Flip the runtime flag default so that the fix is off and remove the compiler option for the Fragment.getContext() fix to make it easier to roll out the fix. This does not change the current default behavior of having the fix be off. (1c24b97, e61ff72)
  • Turn ON enableAggregatingTask by default in Hilt (90ea6a6)

Bug fixes

  • EarlyEntryPoints#get() will now throw if there are no @EarlyEntryPoint annotated interfaces. (b5ef01c)
  • Avoid using UAST implementation classes in Lint checkers. (44e1f05)
  • Fix an issue where @OptionalInject activity/fragment classes could not be used with non-Hilt ViewModels. (8ef08fa)

Dagger 2.39.1

01 Oct 16:39
Compare
Choose a tag to compare

Hilt bug fixes

  • Fix #2834: Hilt processor now checks the correct "names" property when getting values from Kotlin @Suppress annotations. (db21d3f)
  • Fix #2904: Change toImmutableSet to use DaggerStreams rather than Guava. (43a7fe1)

Dagger 2.39

30 Sep 01:06
Compare
Choose a tag to compare

What’s new in Hilt

New breaking changes

  • The compiler flag shareTestComponents now defaults to true. This may significantly improve test compilation time for large projects, but is a breaking change for some tests due to changed visibility requirements. See Hilt’s flags documentation for details. (7e09cee)
  • Hilt compiler flags are now strictly verified. Invalid flags will no longer compile. (742ba95)

Bug fixes

  • Fix #2779: Dagger no longer requires the additional google repository mentioned in the Dagger 2.28 release notes. (01cf47b)
  • There is now a runtime flag to control the Fragment.getContext() fix submitted in #2620. This allows enabling or disabling the fix without a compiler flag in order to permit a staged rollout. (c3f613f)
  • Fix #2789: Fixes issue with using EarlyEntryPoints being dropped when using enableAggregatingTask (38db196)
  • Fix a remote cache miss due to @Input parameter in ASM transform. (2f50035)

Dagger 2.38.1

27 Jul 20:07
Compare
Choose a tag to compare

Hilt bug fixes

  • Fix #2784. Fix an issue with AGP 7.0+ where the Gradle plugin bytecode transform was not applied to non-test code. This affected all @AndroidEntryPoint and @HiltAndroidApp classes that did not directly themselves extend from the Hilt-generated base class and meant that Hilt was not actually applied to those classes. (666df50)
  • Fix #2762. Fix an incompatibility with AGP 7.0.0-beta05 and 7.0.0-rc01 (09087db)

Dagger bug fixes

  • Fix #2765. Properly handle Kotlin metadata when shading dependencies. (ef7e7a1)

Dagger 2.38

20 Jul 01:02
Compare
Choose a tag to compare

What’s New in Dagger

New breaking changes

Add the Google Maven repository for KSP artifacts

As part of necessary changes in order to eventually support running Dagger as a KSP processor, Dagger now has a dependency on the KSP artifacts. These artifacts are available from the Google Maven repository, so this may break users who currently do not use this repository for other dependencies. The Google Maven repository is available at https://maven.google.com.

Adding the repository in Gradle

In your build.gradle file, add google() in repositories.

repositories {
  google()
}

Example: https://github.com/google/dagger/blob/ff62b195c1a00727192154a409aa4ab0b796ff07/javatests/artifacts/dagger/simple/build.gradle#L23

Adding the repository in Bazel

If using the repository list from our workspace_defs.bzl, then no change is needed.

Otherwise, pass "https://maven.google.com" to your usage of maven_install.

maven_install(
    repositories = [
      "https://maven.google.com",
      ...
    ],
    ...
)

Adding the repository in Maven

Add the repository in your pom.xml file like the following:

  <repositories>
    <repository>
      <id>google-maven</id>
      <name>Google Maven Repo</name>
      <url>https://maven.google.com</url>
    </repository>
  </repositories>

Example:
https://github.com/google/dagger/blob/ff62b195c1a00727192154a409aa4ab0b796ff07/examples/maven/pom.xml#L20

Bug Fixes

  • Fix #2576. Check and give a better error message when a user added method has a name that is a java reserved keyword. (436ac2e)
  • Fix #2575. Check and give a better error message when a user added method has the same method signature as generated factory methods. (6971d00)
  • Fix #2570. De-dupe assisted parameter names and field names to avoid a case where generated code may have naming conflicts. #2570 (3d93625)
  • Fix #2710. Allow Dagger-defined map keys (like ClassKey and StringKey) to be placed on fields in order to support Hilt's @BindValueIntoMap. (7af40df)
  • Errors for requesting bindings from the wrong component now include the component name for each binding along the dependency path for easier debugging. (2335e0f)

What’s New in Hilt

This release fixes an incompatibility in the Hilt Gradle Plugin with AGP 7.0-beta04 and 7.1-alpha03. However, with this fix the HiltGradlePlugin will not work with alpha/beta versions of AGP 7.0 and 7.1 older than the versions previously mentioned. This fixes #2700. (be2f89a)

Bug Fixes

  • Fix #2710. Allow Dagger-defined map keys (like ClassKey and StringKey) to be placed on fields in order to support Hilt's @BindValueIntoMap. (7af40df)
  • Fix #2695. Fix an issue where enableAggregatingTask would not correctly generate Hilt classes when compiling in a dev environment with Windows OS. (a7c3c9e)
  • Fix #2672. Fix cast errors when getApplicationContext() is overridden. (4b695ae)

Dagger 2.37

10 Jun 21:43
Compare
Choose a tag to compare

What’s New in Dagger

Bug Fixes

  • Fix #1079: Added an automatic module name to the com.google.dagger:dagger artifact to improve Java 9 compatibility. (cb30885)
  • Removed the com.google.dagger:dagger-android-jarimpl artifact. This was an internal-only artifact, so its removal should not affect users. (6da2e7e)

What’s New in Hilt

Build performance improvements for Gradle

There’s a new flag, enableAggregatingTask, supported by the Hilt Gradle plugin that allows Hilt to perform classpath aggregation in a dedicated Gradle task. This allows Hilt’s annotation processors to be “isolating” so that they are only invoked when necessary. This reduces incremental compilation times by reducing how often an incremental change causes a rebuild of the Dagger components. For details on how to enable this flag see https://dagger.dev/hilt/gradle-setup#aggregating-task.

Note that the default for enableAggregatingTask is currently false, but it will be changed to true in an upcoming release, so please try to enable this flag and report any issues.

Also, note that enableAggregatingTask will automatically enable sharing test components, so please read the caveats for enabling that flag as well.

Finally, enableAggregatingTask replaces enableExperimentalClasspathAggregation which will be removed in an upcoming release. Please replace any usages of enableExperimentalClasspathAggregation with enableAggregatingTask.

Bug Fixes

  • Fix #2662: Fixes an issue in Hilt's bytecode transform that would cause classes to fail validation if they contained an instantiation of an object whose type is the same as the superclass of the @androidentrypoint annotated class. (839a849)

Dagger 2.36

26 May 00:00
Compare
Choose a tag to compare

What’s New in Dagger

New breaking changes

  • Added compile time set binding validation for cases where the same binding key is bound into a set multiple times. Previously, cases of this could result in a runtime failure due to a similar check at runtime, but in rare cases that don’t trigger the runtime error, this could be a breaking change. (cf20470)

Bug Fixes

  • Make nested subcomponents and switching provider impls static within the generated component class. This is in preparation for eventually unnesting these classes from within their parent component to avoid issues that arise from deeply nested class names being too long. (d9f08aa)

What’s New in Hilt

Fragment#getContext() behavior fixed behind a flag

Currently, a Hilt fragment’s getContext() method incorrectly continues to return a context value even after the fragment is removed. This differs from the behavior of a regular fragment. Fixing this is a breaking change that may introduce crashes at runtime if code incorrectly accessed the fragment’s context after removal and relied on Hilt’s incorrect behavior, so a flag has been introduced with the new fixed behavior default off.

Please enable the flag with -Adagger.hilt.android.useFragmentGetContextFix=true to roll out this change at your own discretion. You may choose to, for example, start by enabling this only in development or some small testing population to find errors. In a future release, this flag will be defaulted to true and then in some release after that, the flag will be removed. (5ce0cea)

Bug Fixes

  • Fix a bug where a Hilt fragment’s getContext() method could not be called before super.onAttach(). (8acc433)
  • Fix compatibility issue with the Hilt Gradle Plugin and Android Gradle Plugin 7.0 (371a2c3)
  • Fix lint issue with Hilt testing classes that get compiled to reference invalid ReflectiveOperationException for API < 19. (e58abc3)