-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Conventions Rework * Conventions Rework * Conventions Rework * Conventions Rework * Conventions Rework * Conventions Rework * GH Actions fixes * Kotlin 1.5.0 * Kotlin 1.5.20-RC * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423 * Kotlin 1.5.30-dev-2423
- Loading branch information
Showing
78 changed files
with
702 additions
and
463 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ build/ | |
.vscode/ | ||
local.properties | ||
*.hprof | ||
lint.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,85 @@ | ||
[![Dokka docs](https://img.shields.io/badge/docs-dokka-orange?style=flat-square)](http://mpetuska.github.io/template-kmp-library) | ||
[![Version maven-central](https://img.shields.io/maven-central/v/dev.petuska/template-kmp-library?logo=apache-maven&style=flat-square)](https://mvnrepository.com/artifact/dev.petuska/template-kmp-library/latest) | ||
|
||
# template-kmp-library | ||
|
||
Kotlin multiplatform library template. | ||
|
||
Has a baseline setup for a multiplatform library supporting all kotlin [targets](https://kotlinlang.org/docs/mpp-supported-platforms.html) | ||
Has a baseline setup for a multiplatform library supporting all | ||
kotlin [targets](https://kotlinlang.org/docs/mpp-supported-platforms.html) | ||
except android (any help in getting that setup welcome) & deprecated wasm32. | ||
|
||
## Features | ||
|
||
* Native target grouping and shared sourceSets | ||
* Wrapper library module that declares dependencies on all lib modules | ||
* Uniform configuration via conventional plugins `local.common-conventions` & `local.library-conventions` | ||
* Uniform configuration via conventional plugins `convention.common`, `convention.library` & `convention.publishing` | ||
* Local `test` module for shared test utilities (a helper function to run coroutine tests in common sourceSet included) | ||
* Local `sandbox` module for easy library consumer side checks | ||
* Publication control to avoid multiple publications for targets that can be built on multiple hosts | ||
* `ktlint` plugin with automatic `git-hooks` | ||
* `refreshVersions` plugin for better library version control | ||
* Main host for publications can be changed via `gradle.properties#project.mainOS` property | ||
* Gradle Build Scan setup | ||
* GH dependabot setup | ||
* GH release action for platform dependant publications | ||
* GH check action for platform dependant tests on PRs | ||
* Maven Central publishing setup | ||
* GH Packages publishing setup | ||
|
||
## Setup | ||
|
||
Here are some pointers to help you get up and running with this template | ||
|
||
### Badges | ||
|
||
This README contains some useful badges for your project. To tailor them to your artefacts the following changes needs | ||
to be made: | ||
|
||
* `Dokka docs` - change the link as `(http://$GH_USERNAME.github.io/$GH_PROJECT_NAME)` | ||
* `Version maven-central - change all occurrences of `dev.petuska` to your own group and `template-kmp-library` to your | ||
root library name | ||
|
||
### gradle.properties | ||
|
||
Have a look at `gradle.properties` file and change these properties as needed | ||
|
||
* `gh.owner.id` - main library developer's username | ||
* `gh.owner.name` - main library developer's name | ||
* `gh.owner.email` - main library developer's email | ||
* `project.mainOS` - main host to publish cross-platform artefacts from (to avoid duplicate publications) | ||
* `group` - artefacts' group | ||
* `description` - library description | ||
* `version` - library version (overridden in CI, so doesn't really matter here) | ||
|
||
### Modules | ||
|
||
All the library modules should go to `/lib/` directory and be included in `/settings.gradle.kts`. There are already two | ||
sample modules to illustrate how simple the setup is (`/lib/template-kmp-library-core` & `template-kmp-library-dsl`). | ||
They both contain some sample code and tests that make use of local `/test` module with testing utilities. | ||
|
||
### Kotlin Targets | ||
|
||
The template comes packed with all kotlin targets preconfigured, however if you want to remove some of them or tweak the | ||
config, you only need to make changes as needed in `/buildSrc/src/main/kotlin/convention.library.gradle.kts`. Removing | ||
targets from this file will not break any publications as they're configured on top of pre-registered targets. | ||
|
||
### GitHub Actions | ||
|
||
The template also comes with GH actions to check builds on PRs and publish artefacts when creating a GH release. By | ||
default, it'll publish to GH packages and Maven Central. However to fully unlock Maven Central publishing, you'll need | ||
to add these secrets to your GH repository. If you want to quickly disable Maven Central publishing, you can toggle it | ||
at `.github/workflows/release.yml#L80` | ||
|
||
* `SIGNING_KEY` - GPG signing key | ||
* `SIGNING_KEY_ID` - GPG signing key ID | ||
* `SIGNING_PASSWORD` - GPG signing key password (if set) | ||
* `SONATYPE_PASSWORD` - Sonatype PAT username | ||
* `SONATYPE_USERNAME` - Sonatype PAT password | ||
|
||
## Known Issues | ||
|
||
* [KT-46957](https://youtrack.jetbrains.com/issue/KT-46957) - Commonizer breaks for linuxMips32. This is fixed and | ||
scheduled to be released in 1.5.30-M1. However, to make the setup work now, the template is currently using dev build | ||
from kotlin snapshot repositories. If you'd like to use a stable kotlin version instead, remove linuxMips32 from linux | ||
native target group in `/buildSrc/src/main/kotlin/convention.library.gradle.kts`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,33 @@ | ||
plugins { | ||
id("local.library-conventions") | ||
id("convention.publishing-nexus") | ||
id("com.github.jakemarsden.git-hooks") | ||
idea | ||
} | ||
|
||
kotlin { | ||
sourceSets { | ||
commonMain { | ||
dependencies { | ||
subprojects.filter { it.path.startsWith(":lib:") }.forEach { | ||
api(it) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
gitHooks { | ||
setHooks( | ||
mapOf( | ||
"post-checkout" to "ktlintApplyToIdea", | ||
"pre-commit" to "ktlintFormat", | ||
"pre-push" to "check" | ||
"pre-push" to "ktlintCheck" | ||
) | ||
) | ||
} | ||
|
||
idea { | ||
module { | ||
isDownloadSources = true | ||
isDownloadJavadoc = true | ||
gradleEnterprise { | ||
buildScan { | ||
termsOfServiceUrl = "https://gradle.com/terms-of-service" | ||
termsOfServiceAgree = "yes" | ||
} | ||
} | ||
|
||
kotlin { | ||
sourceSets { | ||
commonMain { | ||
dependencies { | ||
subprojects.filter { it.path.startsWith(":lib:") }.forEach { | ||
api(it) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import de.fayard.refreshVersions.bootstrapRefreshVersionsForBuildSrc | ||
|
||
buildscript { | ||
repositories { gradlePluginPortal() } | ||
dependencies.classpath("de.fayard.refreshVersions:refreshVersions:0.9.7") | ||
pluginManagement { | ||
plugins { | ||
id("de.fayard.refreshVersions") version "0.10.1" | ||
} | ||
} | ||
|
||
bootstrapRefreshVersionsForBuildSrc() | ||
plugins { | ||
id("de.fayard.refreshVersions") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
plugins { | ||
id("org.jlleitschuh.gradle.ktlint") | ||
idea | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
google() | ||
if (project.properties["project.useSnapshotRepositories"] == "true") { | ||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") | ||
} | ||
} | ||
|
||
idea { | ||
module { | ||
isDownloadSources = true | ||
isDownloadJavadoc = true | ||
} | ||
} | ||
|
||
tasks { | ||
withType<Test> { | ||
useJUnitPlatform() | ||
} | ||
} |
Oops, something went wrong.