/kmp-simplelog

A simple logger library written in Kotlin Multiplatform

Primary LanguageKotlinApache License 2.0Apache-2.0

official project

Multiplatform library template

What is it?

It is the barebones library project intended to quickly bootstrap a Kotlin Multiplatform library, that is deployable to Maven Central.

It has only one function: generate the Fibonacci sequence starting from platform-provided numbers. Also, it has a test for each platform just to be sure that tests run.

Note that no other actions or tools usually required for the library development are set up, such as [tracking of backwards compatibility] (https://kotlinlang.org/docs/jvm-api-guidelines-backward-compatibility.html#tools-designed-to-enforce-backward-compatibility), explicit API mode, licensing, contribution guideline, code of conduct and others.

How do I build it?

    1. If you need the Android support update namespace there too
    2. If you don't need an Android support delete the android section

At this stage, you have everything set to work with Kotlin Multiplatform. The project should be buildable (but you might need to provide actual starting values for the platforms you need).

How do I make it build on GitHub Actions?

To make it work on GitHub actions, you need to update the matrix section in gradle.yml. If you didn't change platforms in build.gradle.kts you don't need to touch anything. But still read it to understand how it works.

Also, currently, it only runs tests, but you can change this behaviour as you wish by modifying matrix and the Gradle build command

How do I deploy it to Maven Central?

The most part of the job is already automated for you. However, deployment to Maven Central requires some manual work from your side.

    • You will have to prove that you own your desired namespace
    • Create a GPG key with gpg --gen-key, use the same email address you used to sign up to the Sonatype Jira
    • Find your key id in the output of the previous command looking like D89FAAEB4CECAFD199A2F5E612C6F735F7A9A519
    • Upload your key to a keyserver, for example
    gpg --send-keys --keyserver keyserver.ubuntu.com "<your key id>"
    • Now you should create secrets available to your GitHub Actions
    1. via gh command
    gh secret set OSSRH_GPG_SECRET_KEY -a actions --body "$(gpg --export-secret-key --armor "<your key id>")"
    gh secret set OSSRH_GPG_SECRET_KEY_ID -a actions --body "<your key id>"
    gh secret set OSSRH_GPG_SECRET_KEY_PASSWORD -a actions --body "<your key password>"
    gh secret set OSSRH_PASSWORD -a actions --body "<your sonatype account password>"
    gh secret set OSSRH_USERNAME -a actions --body "<your sonatype account username>"
    1. Or via the interface in SettingsSecrets and VariablesActions, same variables as in 1.
    • Call deployment manually when ready in ActionsRun Workflow
    • When you see in your account on https://oss.sonatype.org that everything is fine, you can release your staging repositories and add target releaseSonatypeStagingRepository to deploy.yml after this line. This way artifacts will be published to central automatically when tests pass.