Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,18 @@ private class KotlinCompilationDetailsBuilder(
return when (this) {
is KotlinMetadataCompilation<*> -> true

// Use string-based comparison, not the actual classes, because AGP has deprecated and
// moved the Library/Application classes to a different package.
// Using strings is more widely compatible.
is KotlinJvmAndroidCompilation -> {
// Use string-based comparison, not the actual classes, because AGP has deprecated and
// moved the Library/Application classes to a different package.
// Using strings is more widely compatible.
val variantName = androidVariant::class.jvmName
// `runCatching` is used here, in case `androidVariant` will be removed in a future version of KGP.
val variantName = runCatching {
// https://youtrack.jetbrains.com/issue/KT-77023:
// `androidVariant` has `null` value in case of AGP/built-in Kotlin project.
@Suppress("DEPRECATION", "UNNECESSARY_NOT_NULL_ASSERTION")
androidVariant!!::class.jvmName
}.getOrNull() ?: return true // published by default

"LibraryVariant" in variantName || "ApplicationVariant" in variantName
}

Expand Down
Loading