2024-01-08 23:12:39 +01:00
|
|
|
include(":core")
|
|
|
|
|
|
|
|
// Load all modules under /lib
|
2024-01-16 10:45:09 +01:00
|
|
|
File(rootDir, "lib").eachDir { include("lib:${it.name}") }
|
2024-01-08 23:12:39 +01:00
|
|
|
|
2024-02-13 15:16:14 +01:00
|
|
|
// Load all modules under /lib-multisrc
|
|
|
|
File(rootDir, "lib-multisrc").eachDir { include("lib-multisrc:${it.name}") }
|
|
|
|
|
2024-02-13 22:43:41 +01:00
|
|
|
if (System.getenv("CI") != "true") {
|
2024-01-08 23:12:39 +01:00
|
|
|
// Local development (full project build)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add or remove modules to load as needed for local development here.
|
|
|
|
*/
|
|
|
|
loadAllIndividualExtensions()
|
|
|
|
// loadIndividualExtension("all", "mangadex")
|
|
|
|
} else {
|
|
|
|
// Running in CI (GitHub Actions)
|
|
|
|
|
|
|
|
val chunkSize = System.getenv("CI_CHUNK_SIZE").toInt()
|
|
|
|
val chunk = System.getenv("CI_CHUNK_NUM").toInt()
|
|
|
|
|
2024-02-13 22:43:41 +01:00
|
|
|
run {
|
2024-01-08 23:12:39 +01:00
|
|
|
// Loads individual extensions
|
|
|
|
File(rootDir, "src").getChunk(chunk, chunkSize)?.forEach {
|
|
|
|
val name = ":extensions:individual:${it.parentFile.name}:${it.name}"
|
|
|
|
println(name)
|
|
|
|
include(name)
|
|
|
|
project(name).projectDir = File("src/${it.parentFile.name}/${it.name}")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fun loadAllIndividualExtensions() {
|
|
|
|
File(rootDir, "src").eachDir { dir ->
|
|
|
|
dir.eachDir { subdir ->
|
|
|
|
val name = ":extensions:individual:${dir.name}:${subdir.name}"
|
|
|
|
include(name)
|
|
|
|
project(name).projectDir = File("src/${dir.name}/${subdir.name}")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fun loadIndividualExtension(lang: String, name: String) {
|
|
|
|
val projectName = ":extensions:individual:$lang:$name"
|
|
|
|
include(projectName)
|
|
|
|
project(projectName).projectDir = File("src/${lang}/${name}")
|
|
|
|
}
|
|
|
|
|
|
|
|
fun File.getChunk(chunk: Int, chunkSize: Int): List<File>? {
|
|
|
|
return listFiles()
|
|
|
|
// Lang folder
|
|
|
|
?.filter { it.isDirectory }
|
|
|
|
// Extension subfolders
|
|
|
|
?.mapNotNull { dir -> dir.listFiles()?.filter { it.isDirectory } }
|
|
|
|
?.flatten()
|
|
|
|
?.sortedBy { it.name }
|
|
|
|
?.chunked(chunkSize)
|
|
|
|
?.get(chunk)
|
|
|
|
}
|
|
|
|
|
|
|
|
fun File.eachDir(block: (File) -> Unit) {
|
2024-02-13 15:16:14 +01:00
|
|
|
val files = listFiles() ?: return
|
|
|
|
for (file in files) {
|
|
|
|
if (file.isDirectory && file.name != ".gradle" && file.name != "build") {
|
|
|
|
block(file)
|
|
|
|
}
|
|
|
|
}
|
2024-01-08 23:12:39 +01:00
|
|
|
}
|