From a6e952eeadb2ea416e73980a4778c96f60c470a8 Mon Sep 17 00:00:00 2001 From: Edric Date: Tue, 7 May 2024 00:43:07 +0800 Subject: [PATCH] fix(buildSrc): add missing `hasType` extension function This checks if there's an extension of the specified type --- .../main/kotlin/io/github/edricchan03/plugin/library/Utils.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/buildSrc/src/main/kotlin/io/github/edricchan03/plugin/library/Utils.kt b/buildSrc/src/main/kotlin/io/github/edricchan03/plugin/library/Utils.kt index ad34d40..f849642 100644 --- a/buildSrc/src/main/kotlin/io/github/edricchan03/plugin/library/Utils.kt +++ b/buildSrc/src/main/kotlin/io/github/edricchan03/plugin/library/Utils.kt @@ -2,7 +2,9 @@ package io.github.edricchan03.plugin.library import io.github.edricchan03.plugin.library.extensions.LibraryPluginExtension import org.gradle.api.Project +import org.gradle.api.plugins.ExtensionContainer import org.gradle.api.publish.maven.MavenPom +import org.gradle.kotlin.dsl.findByType import org.gradle.util.Path as GradleProjectPath internal val Project.pathAsFilePath @@ -64,6 +66,8 @@ fun MavenPom.setConventions(project: Project, extension: LibraryPluginExtension) } } +internal inline fun ExtensionContainer.hasType() = findByType() != null + /** The GitHub repository for the project. */ const val SOURCE_URL = "https://github.com/EdricChan03/androidx-ktx-extras"