File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
dokka-runners/dokka-gradle-plugin/src/main/kotlin/adapters Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -453,11 +453,18 @@ private class KotlinCompilationDetailsBuilder(
453453 return when (this ) {
454454 is KotlinMetadataCompilation <* > -> true
455455
456+ // Use string-based comparison, not the actual classes, because AGP has deprecated and
457+ // moved the Library/Application classes to a different package.
458+ // Using strings is more widely compatible.
456459 is KotlinJvmAndroidCompilation -> {
457- // Use string-based comparison, not the actual classes, because AGP has deprecated and
458- // moved the Library/Application classes to a different package.
459- // Using strings is more widely compatible.
460- val variantName = androidVariant::class .jvmName
460+ // `runCatching` is used here, in case `androidVariant` will be removed in a future version of KGP.
461+ val variantName = runCatching {
462+ // https://youtrack.jetbrains.com/issue/KT-77023:
463+ // `androidVariant` has `null` value in case of AGP/built-in Kotlin project.
464+ @Suppress(" DEPRECATION" , " UNNECESSARY_NOT_NULL_ASSERTION" )
465+ androidVariant!! ::class .jvmName
466+ }.getOrNull() ? : return true // published by default
467+
461468 " LibraryVariant" in variantName || " ApplicationVariant" in variantName
462469 }
463470
You can’t perform that action at this time.
0 commit comments