From a7c3c9ee5c4aa32a6f6ab8b1ed6646d00c784bf6 Mon Sep 17 00:00:00 2001 From: Daniel Santiago Date: Mon, 28 Jun 2021 14:12:58 -0700 Subject: [PATCH] Use File APIs when comparing paths in the AggregatedPackagesTransform. Using file APIs allows for platform-agnostic path comparisons where as File#parent() returns a String which will contain path separators that are OS specific and will fail to match with the known aggregated packages path that use UNIX-based file separator '/'. Specifically this fixes an issue for Windows users whose file separators are '\'. Note that JarEntry path matching is String based but well formatted Jar files (which are Zip files) regardless of the host OS use forward slashes as path separator. Fixes https://github.com/google/dagger/issues/2695 RELNOTES=Fix an issue where `enableAggregatingTask` would not correctly generate Hilt classes when compiling in a dev environment with Windows OS. PiperOrigin-RevId: 381943832 --- .../hilt/android/plugin/util/AggregatedPackagesTransform.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/java/dagger/hilt/android/plugin/src/main/kotlin/dagger/hilt/android/plugin/util/AggregatedPackagesTransform.kt b/java/dagger/hilt/android/plugin/src/main/kotlin/dagger/hilt/android/plugin/util/AggregatedPackagesTransform.kt index fe6e1800154..0d813ae64c5 100644 --- a/java/dagger/hilt/android/plugin/src/main/kotlin/dagger/hilt/android/plugin/util/AggregatedPackagesTransform.kt +++ b/java/dagger/hilt/android/plugin/src/main/kotlin/dagger/hilt/android/plugin/util/AggregatedPackagesTransform.kt @@ -77,7 +77,10 @@ abstract class AggregatedPackagesTransform : TransformAction parentDirectory.endsWith(aggregatedPackage) }