2020-12-20 17:16:23 +00:00
|
|
|
include(":core")
|
2020-06-26 02:45:45 +00:00
|
|
|
|
2022-10-08 13:44:48 +00:00
|
|
|
listOf("dataimage", "unpacker", "cryptoaes").forEach {
|
|
|
|
include(":lib-$it")
|
|
|
|
project(":lib-$it").projectDir = File("lib/$it")
|
|
|
|
}
|
2022-09-24 18:53:39 +00:00
|
|
|
|
2022-06-05 00:55:39 +00:00
|
|
|
if (System.getenv("CI") == null || System.getenv("CI_MODULE_GEN") == "true") {
|
2021-06-20 21:45:22 +00:00
|
|
|
// Local development (full project build)
|
2021-02-13 00:05:45 +00:00
|
|
|
|
|
|
|
include(":multisrc")
|
|
|
|
project(":multisrc").projectDir = File("multisrc")
|
|
|
|
|
|
|
|
// Loads all extensions
|
|
|
|
File(rootDir, "src").eachDir { dir ->
|
|
|
|
dir.eachDir { subdir ->
|
2021-03-09 22:50:49 +00:00
|
|
|
val name = ":extensions:individual:${dir.name}:${subdir.name}"
|
2021-02-13 00:05:45 +00:00
|
|
|
include(name)
|
|
|
|
project(name).projectDir = File("src/${dir.name}/${subdir.name}")
|
|
|
|
}
|
2020-12-16 03:18:54 +00:00
|
|
|
}
|
2022-06-05 00:55:39 +00:00
|
|
|
// Loads all generated extensions from multisrc
|
2021-02-13 00:05:45 +00:00
|
|
|
File(rootDir, "generated-src").eachDir { dir ->
|
|
|
|
dir.eachDir { subdir ->
|
2021-03-09 22:50:49 +00:00
|
|
|
val name = ":extensions:multisrc:${dir.name}:${subdir.name}"
|
2021-02-13 00:05:45 +00:00
|
|
|
include(name)
|
|
|
|
project(name).projectDir = File("generated-src/${dir.name}/${subdir.name}")
|
|
|
|
}
|
2021-02-06 22:32:04 +00:00
|
|
|
}
|
2020-06-26 02:45:45 +00:00
|
|
|
|
2021-02-13 00:05:45 +00:00
|
|
|
/**
|
|
|
|
* If you're developing locally and only want to work with a single module,
|
|
|
|
* comment out the parts above and uncomment below.
|
|
|
|
*/
|
2021-08-22 14:30:29 +00:00
|
|
|
// val lang = "all"
|
|
|
|
// val name = "mangadex"
|
|
|
|
// val projectName = ":extensions:individual:$lang:$name"
|
2021-09-11 13:19:03 +00:00
|
|
|
// val projectName = ":extensions:multisrc:$lang:$name"
|
2021-08-22 14:30:29 +00:00
|
|
|
// include(projectName)
|
|
|
|
// project(projectName).projectDir = File("src/${lang}/${name}")
|
2021-09-11 13:19:03 +00:00
|
|
|
// project(projectName).projectDir = File("generated-src/${lang}/${name}")
|
2021-02-13 00:05:45 +00:00
|
|
|
} else {
|
|
|
|
// Running in CI (GitHub Actions)
|
|
|
|
|
|
|
|
val isMultisrc = System.getenv("CI_MULTISRC") == "true"
|
2022-06-05 00:55:39 +00:00
|
|
|
val chunkSize = System.getenv("CI_CHUNK_SIZE").toInt()
|
|
|
|
val chunk = System.getenv("CI_CHUNK_NUM").toInt()
|
2021-02-13 00:05:45 +00:00
|
|
|
|
|
|
|
if (isMultisrc) {
|
|
|
|
include(":multisrc")
|
|
|
|
project(":multisrc").projectDir = File("multisrc")
|
|
|
|
|
|
|
|
// Loads generated extensions from multisrc
|
2022-06-05 00:55:39 +00:00
|
|
|
File(rootDir, "generated-src").getChunk(chunk, chunkSize)?.forEach {
|
|
|
|
val name = ":extensions:multisrc:${it.parentFile.name}:${it.name}"
|
|
|
|
println(name)
|
|
|
|
include(name)
|
|
|
|
project(name).projectDir = File("generated-src/${it.parentFile.name}/${it.name}")
|
2021-02-13 00:05:45 +00:00
|
|
|
}
|
|
|
|
} else {
|
2022-06-05 00:55:39 +00: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}")
|
2021-02-13 00:05:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-12-11 14:41:48 +00:00
|
|
|
|
2022-06-05 00:55:39 +00:00
|
|
|
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) {
|
2020-06-26 02:45:45 +00:00
|
|
|
listFiles()?.filter { it.isDirectory }?.forEach { block(it) }
|
|
|
|
}
|