Created
February 6, 2020 03:54
-
-
Save BoxResin/6a1f53786109f5cad99464429bba9fe7 to your computer and use it in GitHub Desktop.
Gradle 서브 모듈 자동 탐지하여 include 하는 스크립트
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
/** [name] 디렉터리 아래의 모듈을 모두 탐색하여 `AAA:BBB:CCC` 형식으로 반환한다. */ | |
fun submodule(name: String): Array<String> { | |
// 모듈 디렉터리 탐색하기 | |
val submoduleDirs: List<File> = fileTree(name) | |
.matching { include("**/*.gradle.kts") } | |
.map { gradleScript: File -> gradleScript.parentFile } | |
.distinct() | |
// gradle 프로젝트 이름 형식으로 고치기 | |
return submoduleDirs | |
.map { it.toRelativeString(rootDir).replace('\\', ':').replace('/', ':') } | |
.toTypedArray() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
사용 방법