Created
September 19, 2022 11:43
-
-
Save 47star/f802ca7dcb837dcd42424f416c263db3 to your computer and use it in GitHub Desktop.
Gradle Submodule Notation for Kotlin DSL
This file contains 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
class GradleSubmodule( | |
private val name: String, | |
private vararg val children: GradleSubmodule, | |
) { | |
operator fun unaryPlus() = load("") | |
private fun load(parent: String) { | |
include("$parent:$name") | |
for (child in children) { | |
child.load("$parent:$name") | |
} | |
} | |
} | |
+GradleSubmodule( | |
"modules", | |
GradleSubmodule( | |
"a", | |
GradleSubmodule("a"), | |
), | |
GradleSubmodule("b"), | |
GradleSubmodule("c"), | |
GradleSubmodule("d"), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment