Skip to content

Commit

Permalink
Only log duplicate library modules if there actually are duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
sjudd committed Sep 30, 2023
1 parent f0d2b16 commit 1863e67
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ import com.squareup.kotlinpoet.FileSpec
* `AppGlideModule` is found, we then generate Glide's configuration so that it calls the
* `AppGlideModule` and any included `LibraryGlideModules`. Using indexes allows us to process
* `LibraryGlideModules` in multiple rounds and/or libraries.
*
* TODO(b/239086146): Finish implementing the behavior described here.
*/
class GlideSymbolProcessor(private val environment: SymbolProcessorEnvironment) : SymbolProcessor {
var isAppGlideModuleGenerated = false
private var isAppGlideModuleGenerated = false

override fun process(resolver: Resolver): List<KSAnnotated> {
val symbols = resolver.getSymbolsWithAnnotation("com.bumptech.glide.annotation.GlideModule")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal class LibraryGlideModulesParser(
}
.toList()
val uniqueLibraryGlideModules = allLibraryGlideModules.associateBy { it.name }.values.toList()
if (uniqueLibraryGlideModules != libraryGlideModules) {
if (uniqueLibraryGlideModules.size != libraryGlideModules.size) {
// Find the set of modules that have been included more than once by mapping the qualified
// name of the module to a count of the number of times it's been seen. Duplicates are then
// any keys that have a value > 1.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class LibraryGlideModuleTests(override val sourceType: SourceType) : PerSourceTy
)

compileCurrentSourceType(kotlinModule, javaModule) {
assertThat(it.messages).doesNotContainMatch("[we]: \\[ksp] .*")
assertThat(it.exitCode).isEqualTo(ExitCode.OK)
assertFailsWith<FileNotFoundException> { it.generatedAppGlideModuleContents() }
}
Expand Down Expand Up @@ -100,6 +101,7 @@ class LibraryGlideModuleTests(override val sourceType: SourceType) : PerSourceTy
javaAppModule,
javaLibraryModule
) {
assertThat(it.messages).doesNotContainMatch("[we]: \\[ksp] .*")
assertThat(it.exitCode).isEqualTo(ExitCode.OK)
assertThat(it.generatedAppGlideModuleContents())
.hasSourceEqualTo(appGlideModuleWithLibraryModule)
Expand Down

0 comments on commit 1863e67

Please sign in to comment.