Automates generation and update of Gradle config files in JS/Python way.
698
If you try to use https://start.spring.io/ , https://kmp.jetbrains.com/ , https://start.ktor.io/ , or https://code.quarkus.io/ you will find out that:
It's clear that for each company / team / individual templates should be different. That's why https://github.com/stepin/kbre-default-config is done as starting point, but you need to adapt it according to your preferences.
kbre tool uses your templates to create and update repos.
kbre started as Gradle macros tool, but now it doesn't depend on Gradle at all and can be used with any language.
Configuration (it's even better to fork that repository and use your own from the beginning):
cd ~
git clone https://github.com/stepin/kbre-default-config .krbe
Create new Spring app:
mkdir my-app
cd my-app
cat > kbre.yaml << \EOF
group: name.stepin
artifact: myapp
name: My app
description: Some description
preset: spring
type: root
extensions:
- graphql
- postgres
- flyway
- jooq
- dokka
- jib
- local-dev
- systemd-deployment
variables:
REPO: http://localhost:3000/stepin/kotlin-bootstrap-app/src/branch/main/src/main/kotlin
SONAR_HOST_URL: http://localhost:9000
SONAR_PROJECT_KEY: kotlin-bootstrap-app
SONAR_PROJECT_NAME: kotlin-bootstrap-app
SONAR_TOKEN: sqp_821b1d3209761625bdd29259674237d429bce626
EOF
alias kbre='docker run --rm -it -v $PWD:/data -w /data --user "$(id -u)" stepin/kbre'
kbre version
kbre new
Update (when config repo or kbre.yaml are changed):
cd my-app
kbre update
Top-level folders are presets. It's like template when you create new project in IDE. Currently, there are 3:
cli for Kotlin console appsspring for Kotlin web appsscript for Kotlin scriptsNext, type should be selected. It's main template files. Default is root. It's for root project. If you have
subprojects most probably you will need other type for it.
Extension is most powerful concept. First of all, you can just copy with replaced variables any files. There is also
special meaning for following files:
gradle/libs.versions.toml -- it will be merged with gradle/libs.versions.toml from typeimports.kts -- it will be added to %IMPORTS% variableplugins.kts -- it will be added to %PLUGINS% variabledeps.kts -- it will be added to %DEPS% variablebody.kts -- it will be added to %BODY% variableVariable is key/value. They are defined in kbre.yaml file and there are some pre-defined variable. In addition
to variables from extensions following variables are defined:
%PRESET% -- preset%TYPE% -- type%GROUP% -- maven's group%ARTIFACT% -- in a lot of places used as binary name%NAME% -- some human app name%DESCRIPTION% -- human app descriptionCurrent status: works for me. I use it for all projects.
Feel free to file bug reports. If I will be able to reproduce it I will fix it.
About new features: it's better to send PRs, not just ideas (as I already have ideas but limited time).
Some ideas:
krbe new commandkrbe init action for interactive creation of project (like in Poetry)libs.versions.toml has problems in some corner cases: it's interesting to have examplesmusl libc. Even gcompat package don't fix it (most probably some detection problem).Content type
Image
Digest
sha256:971f99068…
Size
29.3 MB
Last updated
about 2 years ago
docker pull stepin/kbre