63 lines
1.9 KiB
Groovy
63 lines
1.9 KiB
Groovy
|
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||
|
|
plugins {
|
||
|
|
// android
|
||
|
|
alias(libs.plugins.androidApplication) apply false
|
||
|
|
alias(libs.plugins.androidLibrary) apply false
|
||
|
|
// kotlin
|
||
|
|
alias(libs.plugins.kotlinAndroid) apply false
|
||
|
|
// kotlin-serialization
|
||
|
|
alias(libs.plugins.kotlinSerialization) apply false
|
||
|
|
// protobuf
|
||
|
|
alias(libs.plugins.protobuf) apply false
|
||
|
|
// navigation-safe-args
|
||
|
|
alias(libs.plugins.navigationSafeArgs) apply false
|
||
|
|
// hilt-android
|
||
|
|
alias(libs.plugins.hilt) apply false
|
||
|
|
// ksp
|
||
|
|
//alias(libs.plugins.ksp) apply false
|
||
|
|
// check versions
|
||
|
|
alias(libs.plugins.versions)
|
||
|
|
// graph
|
||
|
|
alias(libs.plugins.moduleGraph) apply true // Plugin applied to allow module graph generation
|
||
|
|
|
||
|
|
alias(libs.plugins.kotlin.kapt)
|
||
|
|
}
|
||
|
|
// Task to print all the module paths in the project e.g. :core:data
|
||
|
|
// Used by module graph generator script
|
||
|
|
tasks.register("printModulePaths") {
|
||
|
|
subprojects { subproject ->
|
||
|
|
if (subprojects.size() == 0) {
|
||
|
|
println(subproject.path)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
subprojects { subproject ->
|
||
|
|
if (subproject.getSubprojects().size() == 0) {
|
||
|
|
if (subproject.toString().endsWith(":app'")) {
|
||
|
|
apply plugin: 'com.android.application'
|
||
|
|
} else {
|
||
|
|
apply plugin: 'com.android.library'
|
||
|
|
}
|
||
|
|
|
||
|
|
android {
|
||
|
|
if (!subproject.toString().endsWith(":app'")) {
|
||
|
|
resourcePrefix = getResourcePrefix(path)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private static String getResourcePrefix(String name) {
|
||
|
|
String[] split = name.split("\\W")
|
||
|
|
StringBuilder result = new StringBuilder()
|
||
|
|
for (int i = 1; i < split.length; i++) {
|
||
|
|
if (i > 1 && split[i] == split[i - 1]) {
|
||
|
|
continue
|
||
|
|
}
|
||
|
|
result.append(split[i].toLowerCase()).append("_")
|
||
|
|
}
|
||
|
|
return result.toString()
|
||
|
|
}
|