Skip to content

Commit c74d4d7

Browse files
jselboJoshua Selbo
andauthored
Add tooling for Spotless + ktfmt (#562)
Co-authored-by: Joshua Selbo <jselbo@meta.com>
1 parent ae8905b commit c74d4d7

File tree

9 files changed

+48
-6
lines changed

9 files changed

+48
-6
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ jobs:
3131
- name: 1. Check out code
3232
uses: actions/checkout@v2 # https://github.com/actions/checkout
3333

34-
- name: 2. Set up Java 11
34+
- name: 2. Set up Java 17
3535
uses: actions/setup-java@v1 # https://github.com/actions/setup-java
3636
with:
37-
java-version: 11
37+
java-version: 17
3838

3939
- name: 3. Validate Gradle wrapper
4040
uses: gradle/actions/wrapper-validation@v4 # https://github.com/gradle/wrapper-validation-action
@@ -59,10 +59,10 @@ jobs:
5959
- name: 1. Check out code
6060
uses: actions/checkout@v2 # https://github.com/actions/checkout
6161

62-
- name: 2. Set up Java 11
62+
- name: 2. Set up Java 17
6363
uses: actions/setup-java@v1 # https://github.com/actions/setup-java
6464
with:
65-
java-version: 11
65+
java-version: 17
6666

6767
- name: 3. Build with Kotlin ${{ matrix.kotlin }} and mock-maker ${{ matrix.mock-maker }}
6868
run: |
@@ -90,10 +90,10 @@ jobs:
9090
with:
9191
fetch-depth: '0' # https://github.com/shipkit/shipkit-changelog#fetch-depth-on-ci
9292

93-
- name: Set up Java 11
93+
- name: Set up Java 17
9494
uses: actions/setup-java@v1
9595
with:
96-
java-version: 11
96+
java-version: 17
9797

9898
- name: Build and release
9999
run: ./gradlew githubRelease publishToSonatype closeAndReleaseStagingRepository releaseSummary

build-logic/build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
plugins {
2+
// doc: https://docs.gradle.org/current/userguide/kotlin_dsl.html
3+
`kotlin-dsl`
4+
}
5+
6+
dependencies {
7+
implementation("com.diffplug.spotless:com.diffplug.spotless.gradle.plugin:8.1.0")
8+
}

build-logic/settings.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencyResolutionManagement {
2+
repositories {
3+
mavenCentral()
4+
gradlePluginPortal()
5+
}
6+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
plugins {
2+
base
3+
id("mockito-kotlin.quality-spotless-conventions")
4+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import com.diffplug.gradle.spotless.SpotlessExtension
2+
3+
plugins {
4+
id("com.diffplug.spotless")
5+
}
6+
7+
configure<SpotlessExtension> {
8+
// We run the check separately on CI, so don't run this by default
9+
isEnforceCheck = false
10+
11+
kotlin {
12+
ktfmt().kotlinlangStyle()
13+
}
14+
}

mockito-kotlin/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
44
plugins {
55
id "org.jetbrains.kotlin.jvm"
66
id "org.jetbrains.dokka"
7+
id "mockito-kotlin.library-conventions"
78
}
89
apply from: '../gradle/publishing.gradle'
910

settings.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
pluginManagement {
2+
includeBuild 'build-logic'
3+
}
4+
15
rootProject.name = 'mockito-kotlin-root'
26

37
include 'mockito-kotlin'

tests/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
44
plugins {
55
id "org.gradle.java"
66
id "org.jetbrains.kotlin.jvm" version "${testKotlinVersion}"
7+
id "mockito-kotlin.library-conventions"
78
}
89

910
logger.lifecycle "${project} uses Kotlin ${testKotlinVersion}"

tests/settings.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
pluginManagement {
2+
includeBuild '../build-logic'
3+
}
4+
15
includeBuild '..'

0 commit comments

Comments
 (0)