-
-
Save andhikayuana/9ed8fc9edf5db167ffa770a72a507417 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun Project.android(): BaseExtension { | |
val android = project.extensions.findByType(BaseExtension::class.java) | |
if (android != null) { | |
return android | |
} else { | |
throw GradleException("Project $name is not an Android project") | |
} | |
} | |
fun BaseExtension.variants(): DomainObjectSet<out BaseVariant> { | |
return when (this) { | |
is AppExtension -> { | |
applicationVariants | |
} | |
is FeatureExtension ->{ | |
featureVariants | |
} | |
is LibraryExtension -> { | |
libraryVariants | |
} | |
else -> throw GradleException("Unsupported BaseExtension type!") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment