Hi! I was wondering if there’s a way to enhance wh...
# gradle
v
Hi! I was wondering if there’s a way to enhance what
gradle init --dsl kotlin --type kotlin-application
is doing, namely instead of having:
Copy code
\
|-\src
|-build.gradle.kts
|-settings.gradle.kts
have it generate a project with app module & buildSrc.
Copy code
\
|-\app
|-\buildSrc
|-build.gradle.kts
|-settings.gradle.kts
Rationale: I want to have more modules, reuse constants via buildSrc and default project layout is a PITA to change
l
I made a Kotlin script to create modules from templates: https://github.com/LouisCAD/Splitties/blob/eb4cc37027b0f6a9ca34be24816016142ae8d869/scripts/Create-new-module.kts You can find example templates here: https://github.com/LouisCAD/Splitties/tree/eb4cc37027b0f6a9ca34be24816016142ae8d869/scripts/gradle_templates I'm planning to put it in a GitHub template soon to help people create Kotlin multiplatform projects faster. That base should work for Android or JVM only projects too.
v
looks interesting, can you interpolate any values inside template files? e.g. create test files with package name and all that jazz?
l
Yes, it supports what I call "keyed euro string templates" (
€{this is a key that will have its value prompted by the script}
) for files, and supports package names in hierarchies, see any of the templates I linked. I made it to ease modularization.