Skip to content

Commit

Permalink
Version bumps and ktlint
Browse files Browse the repository at this point in the history
  • Loading branch information
mpetuska committed Jan 12, 2022
1 parent b030b12 commit e125166
Show file tree
Hide file tree
Showing 16 changed files with 232 additions and 137 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
root = true

[*]
[*.{kt,kts}]
indent_size = 2
continuation_indent_size = 4
ij_kotlin_name_count_to_use_star_import = unset
disabled_rules = no-wildcard-imports
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ env:
jobs:
check:
name: Check on ${{ matrix.os.runner }}
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.os.runner }}
defaults:
run:
shell: ${{ matrix.os.shell }}
strategy:
fail-fast: false
matrix:
os:
- runner: macos-latest
- runner: macos-11
shell: bash
- runner: ubuntu-latest
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
fail-fast: false
matrix:
os:
- runner: macos-latest
- runner: macos-11
shell: bash
- runner: windows-latest
shell: msys2 {0}
Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:
tasks: publishToSonatype closeSonatypeStagingRepository
enabled: ${{ github.event.inputs.skipMavenCentral != 'y' }}
os:
- runner: macos-latest
- runner: macos-11
shell: bash
- runner: windows-latest
shell: msys2 {0}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sandbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
fail-fast: false
matrix:
os:
- runner: macos-latest
- runner: macos-11
shell: bash
- runner: windows-latest
shell: msys2 {0}
Expand Down
3 changes: 3 additions & 0 deletions .sdkmanrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Enable auto-env through the sdkman_auto_env config
# Add key=value pairs of SDKs to use below
java=11.0.2-open
17 changes: 14 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
# v1.1.3
# 1.1.4

## Changes

* Back to spotless + ktlint
* Fixed GH actions issues with runners
* `local.properties` support
* Custom refreshVersions rules setup
* `.sdkmanrc` for easier local env setup
* Version bumps ([email protected], [email protected])

# 1.1.3

## Changes

* Swapped out ktlint for spotless + ktfmt
* Disabling git hooks on CI
* Added android support

# v1.1.2
# 1.1.2

## Changes

Expand All @@ -20,7 +31,7 @@
* watchosSimulatorArm64() target added
* tvosSimulatorArm64() target added

# v1.1.1
# 1.1.1

## Changes

Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ except deprecated wasm32.

* Native target grouping and shared sourceSets
* Wrapper library module that declares dependencies on all lib modules
* Uniform configuration via conventional plugins `convention.common`, `convention.library` & `convention.publishing`
* Uniform configuration via conventional plugins `plugin.common`, `plugin.library-mpp` & `plugin.publishing-mpp`
* 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
Expand All @@ -26,6 +26,7 @@ except deprecated wasm32.
* GH check action for platform dependant tests on PRs
* Maven Central publishing setup
* GH Packages publishing setup
* `SDKMAN` support for local env (`sdk man env install` to get the required JDM and `sdkman env` to switch to it)

## Setup

Expand All @@ -37,7 +38,7 @@ This README contains some useful badges for your project. To tailor them to your
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
* `Version maven-central` - change all occurrences of `dev.petuska` to your own group and `template-kmp-library` to your
root library name

### gradle.properties
Expand All @@ -54,22 +55,22 @@ Have a look at `gradle.properties` file and change these properties as needed

### 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.
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] & [./lib/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
config, you only need to make changes as needed in [./buildSrc/src/main/kotlin/plugin.library-mpp.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
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`
at [./.github/workflows/release.yml#L80]`

* `SIGNING_KEY` - GPG signing key
* `SIGNING_KEY_ID` - GPG signing key ID
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pluginManagement {
plugins {
id("de.fayard.refreshVersions") version "0.23.0"
id("de.fayard.refreshVersions") version "0.30.2"
}
}

Expand Down
25 changes: 23 additions & 2 deletions buildSrc/src/main/kotlin/plugin.common.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import de.fayard.refreshVersions.core.versionFor
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinTest
import java.util.Properties

plugins {
id("com.diffplug.spotless")
idea
}

rootDir.resolve("local.properties").takeIf(File::exists)?.let {
Properties().apply {
it.inputStream().use(::load)
}.mapKeys { (k, _) -> k.toString() }
}?.toList()?.forEach { (k, v) ->
project.extra[k] = v
}

repositories {
mavenCentral()
google()
Expand All @@ -19,8 +29,19 @@ idea {
}

spotless {
kotlin { ktfmt() }
kotlinGradle { ktfmt() }
val ktlintSettings = mapOf(
"indent_size" to "2",
"continuation_indent_size" to "4",
"disabled_rules" to "no-wildcard-imports"
)
kotlin {
target("src/**/*.kt")
ktlint(versionFor("version.ktlint")).userData(ktlintSettings)
}
kotlinGradle {
target("*.kts")
ktlint(versionFor("version.ktlint")).userData(ktlintSettings)
}
}

tasks {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit e125166

Please sign in to comment.