Document how to load subset of modules for local dev
This commit is contained in:
parent
e2cdf2b34f
commit
c881cad5fe
|
@ -176,6 +176,13 @@ Each extension should reside in `src/<lang>/<mysourcename>`. Use `all` as `<lang
|
|||
|
||||
The `<lang>` used in the folder inside `src` should be the major `language` part. For example, if you will be creating a `pt-BR` source, use `<lang>` here as `pt` only. Inside the source class, use the full locale string instead.
|
||||
|
||||
### Loading a subset of Gradle modules
|
||||
|
||||
By default, all individual and generated multisrc extensions are loaded for local development.
|
||||
This may be inconvenient if you only need to work on one extension at a time.
|
||||
|
||||
To adjust which modules are loaded, make adjustments to the `settings.gradle.kts` file as needed.
|
||||
|
||||
#### Extension file structure
|
||||
|
||||
The simplest extension structure looks like this:
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx5120m
|
||||
org.gradle.jvmargs=-Xmx6144m
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include(":core")
|
||||
|
||||
// all the directories under /lib instead of manually adding each to a list
|
||||
// Load all modules under /lib
|
||||
File(rootDir, "lib").eachDir {
|
||||
val libName = it.name
|
||||
include(":lib-$libName")
|
||||
|
@ -13,34 +13,14 @@ if (System.getenv("CI") == null || System.getenv("CI_MODULE_GEN") == "true") {
|
|||
include(":multisrc")
|
||||
project(":multisrc").projectDir = File("multisrc")
|
||||
|
||||
// Loads all extensions
|
||||
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}")
|
||||
}
|
||||
}
|
||||
// Loads all generated extensions from multisrc
|
||||
File(rootDir, "generated-src").eachDir { dir ->
|
||||
dir.eachDir { subdir ->
|
||||
val name = ":extensions:multisrc:${dir.name}:${subdir.name}"
|
||||
include(name)
|
||||
project(name).projectDir = File("generated-src/${dir.name}/${subdir.name}")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If you're developing locally and only want to work with a single module,
|
||||
* comment out the parts above and uncomment below.
|
||||
* Add or remove modules to load as needed for local development here.
|
||||
* To generate multisrc extensions first, run the `:multisrc:generateExtensions` task first.
|
||||
*/
|
||||
// val lang = "all"
|
||||
// val name = "mangadex"
|
||||
// val projectName = ":extensions:individual:$lang:$name"
|
||||
// val projectName = ":extensions:multisrc:$lang:$name"
|
||||
// include(projectName)
|
||||
// project(projectName).projectDir = File("src/${lang}/${name}")
|
||||
// project(projectName).projectDir = File("generated-src/${lang}/${name}")
|
||||
loadAllIndividualExtensions()
|
||||
loadAllGeneratedMultisrcExtensions()
|
||||
// loadIndividualExtension("all", "mangadex")
|
||||
// loadGeneratedMultisrcExtension("en", "guya")
|
||||
} else {
|
||||
// Running in CI (GitHub Actions)
|
||||
|
||||
|
@ -70,6 +50,35 @@ if (System.getenv("CI") == null || System.getenv("CI_MODULE_GEN") == "true") {
|
|||
}
|
||||
}
|
||||
|
||||
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 loadAllGeneratedMultisrcExtensions() {
|
||||
File(rootDir, "generated-src").eachDir { dir ->
|
||||
dir.eachDir { subdir ->
|
||||
val name = ":extensions:multisrc:${dir.name}:${subdir.name}"
|
||||
include(name)
|
||||
project(name).projectDir = File("generated-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 loadGeneratedMultisrcExtension(lang: String, name: String) {
|
||||
val projectName = ":extensions:multisrc:$lang:$name"
|
||||
include(projectName)
|
||||
project(projectName).projectDir = File("generated-src/${lang}/${name}")
|
||||
}
|
||||
|
||||
fun File.getChunk(chunk: Int, chunkSize: Int): List<File>? {
|
||||
return listFiles()
|
||||
// Lang folder
|
||||
|
|
Loading…
Reference in New Issue