This is a development focused supplement to CONTRIBUTING.md.
Installing pre-commit hook is optional but can save you some headache when pushing unformatted code.
Installing git pre-commit hook that formats code with Ktlint:
cp scripts/git/pre-commit .git/hooks/pre-commitBefore pushing any changes make sure project builds without errors with:
./gradlew buildThis project uses Spock for testing.
Please use the Spec.groovy suffix on new test classes.
Pull requests that lower test coverage will not be merged.
Test coverage metric will be visible on GitHub Pull request page.
It can be also generated in IDE or via command line with ./gradlew build coverage
- check html report in
build/report/jacoco/coverage/html.
Before submitting a pull request test your changes locally on a sample project. There are few ways for local testing:
- Use one of the sample subprojects.
Samples projects require databases running on localhost. You can use docker compose file stored in
./scripts/dockerto start withdocker-compose up -dall the supported databases at once. - Publish library to maven local repository with
./gradlew publishToMavenLocaland use it in any project viamavenLocal()repository
Snapshot release is triggered automatically after merge to the main branch. To use a released snapshot version make sure to register Sonatype snapshot repository in gradle with:
// build.gradle.kts
repositories {
mavenCentral()
maven {
url = URI("https://oss.sonatype.org/content/repositories/snapshots")
}
}
The snapshot version can be found in GitHub Action build log.
There are no enforced code style rules for Java and Groovy sources.
Just please use IntelliJ code styles from "Project scheme" (.idea/codeStyles).
Kotlin codestyle is enforced by Ktlint.
Ktlint rules are already propagated to .idea/codeStyles.
You can validate Kotlin code style in command line with:
./gradlew ktlintCheckBefore writing a commit message read this article.
If change adds new feature or modifies a new one update documentation and examples.
To run documentation server locally:
- Install python3 locally
- Go to
cd docs - Install dependencies
pip install -r mkdocs-requirements.txt - Run
mkdocs serve