Kotlin Multiplatform library template for quick-starts without dealing with boilerplate code
It covers the following boilerplate
- Publication to local and remote maven repository
- Multiplatform module conventions
- Gradle files and build scripts
- Version catalog
- Popular gitignore settings
- GitHub release actions script
- Sample shared module
To use this template all you have to do is to follow these steps:
- Download a zip file or clone this repository (Don't forget to change git remote settings)
- Replace
com.attafitamim.kalib
with your package everywhere in the project - Replace
klib-template
with your library name everywhere in the project - Adjust targets in
MultiplatformConventions.kt
- Adjust publishing information in
PublishConventions.kt
- Update
README.md
file
That's it! Now you can add your modules, dependencies, adjust targets and start coding!
To publish your library to maven central you need to follow these steps:
- Crate an account on central portal
- Create a namespace with your package as shown in these docs
- Generate a token as shown here
- Generate gpg key using your sonatype email, upload it, then confirm your email using the received link in your inbox
- Add secrets for publishing as shown here
- Don't forget to add secrets as repository secrets for GitHub actions as shown here
To publish your artifacts to central portal you can either run ./gradlew publishAllPublicationsToMavenCentralRepository
locally or create a GitHub release
Important
Don't forget to change publishing version in PublishConventions.kt
- Upgrade to Kotlin 2.0.0
- Add testing examples and GitHub actions for the matter
- Add lint example and GitHub actions for the matter