Skip to content

Commit 10279cd

Browse files
authored
Update Komapper to v0.26.0 (#78)
* Introduce new features * Use Ktlint Gradle instead of Spotless plugin for Gradle * Add the spring native example * Build with JDK 11 * Update Komapper to v0.26.0
1 parent 92b5884 commit 10279cd

File tree

29 files changed

+251
-68
lines changed

29 files changed

+251
-68
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v2
1717

18-
- name: Set up JDK 8
18+
- name: Set up JDK 11
1919
uses: actions/setup-java@v2
2020
with:
2121
distribution: 'zulu'
22-
java-version: 8
22+
java-version: 11
2323

2424
- name: Assemble and Check
2525
uses: gradle/gradle-build-action@v2

build.gradle.kts

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,46 @@
11
plugins {
22
java
33
kotlin("jvm")
4-
id("com.diffplug.spotless") version "6.1.2"
4+
id("org.jlleitschuh.gradle.ktlint") version "10.2.1"
55
}
66

7-
val ktlintVersion: String by project
8-
97
val springBootProjects = subprojects.filter {
108
it.name.startsWith("spring-boot") || it.name == "jpetstore"
119
}
1210

1311
allprojects {
1412
apply(plugin = "base")
15-
apply(plugin = "com.diffplug.spotless")
13+
apply(plugin = "org.jlleitschuh.gradle.ktlint")
14+
15+
ktlint {
16+
filter {
17+
exclude("build/**")
18+
if (project.name == "codegen") {
19+
exclude("src/**")
20+
}
21+
}
22+
}
1623

1724
repositories {
18-
mavenCentral()
1925
mavenLocal()
26+
mavenCentral()
27+
maven { url = uri("https://repo.spring.io/release") }
28+
maven { url = uri("https://repo.spring.io/milestone") }
29+
maven { url = uri("https://repo.spring.io/snapshot") }
2030
}
2131

22-
spotless {
23-
kotlinGradle {
24-
ktlint(ktlintVersion)
32+
tasks {
33+
val pairs = listOf(
34+
"ktlintKotlinScriptCheck" to "ktlintKotlinScriptFormat",
35+
"ktlintMainSourceSetCheck" to "ktlintMainSourceSetFormat",
36+
"ktlintTestSourceSetCheck" to "ktlintTestSourceSetFormat",
37+
)
38+
for ((checkTask, formatTask) in pairs) {
39+
findByName(checkTask)?.mustRunAfter(formatTask)
2540
}
26-
}
2741

28-
tasks {
2942
build {
30-
dependsOn(spotlessApply)
43+
dependsOn("ktlintFormat")
3144
}
3245
}
3346
}
@@ -44,12 +57,9 @@ subprojects {
4457
}
4558
}
4659

47-
if (project.name != "codegen") {
48-
spotless {
49-
kotlin {
50-
targetExclude("build/**")
51-
ktlint(ktlintVersion)
52-
}
60+
kotlin {
61+
jvmToolchain {
62+
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(11))
5363
}
5464
}
5565

codegen/build.gradle.kts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@ buildscript {
1313

1414
plugins {
1515
application
16+
idea
1617
id("com.google.devtools.ksp")
1718
id("org.komapper.gradle")
1819
}
1920

2021
val komapperVersion: String by project
2122

22-
kotlin {
23-
sourceSets.main {
24-
kotlin.srcDir("build/generated/ksp/main/kotlin")
23+
idea {
24+
module {
25+
sourceDirs = sourceDirs + file("build/generated/ksp/main/kotlin")
26+
testSourceDirs = testSourceDirs + file("build/generated/ksp/test/kotlin")
27+
generatedSourceDirs = generatedSourceDirs + file("build/generated/ksp/main/kotlin") + file("build/generated/ksp/test/kotlin")
2528
}
2629
}
2730

comparison-with-exposed/build.gradle.kts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
application
3+
idea
34
id("com.google.devtools.ksp")
45
}
56

@@ -15,9 +16,11 @@ dependencies {
1516
ksp("org.komapper:komapper-processor:$komapperVersion")
1617
}
1718

18-
kotlin {
19-
sourceSets.main {
20-
kotlin.srcDir("build/generated/ksp/main/kotlin")
19+
idea {
20+
module {
21+
sourceDirs = sourceDirs + file("build/generated/ksp/main/kotlin")
22+
testSourceDirs = testSourceDirs + file("build/generated/ksp/test/kotlin")
23+
generatedSourceDirs = generatedSourceDirs + file("build/generated/ksp/main/kotlin") + file("build/generated/ksp/test/kotlin")
2124
}
2225
}
2326

console-jdbc/build.gradle.kts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
plugins {
22
application
3+
idea
34
id("com.google.devtools.ksp")
45
}
56

67
val komapperVersion: String by project
78

8-
kotlin {
9-
sourceSets.main {
10-
kotlin.srcDir("build/generated/ksp/main/kotlin")
9+
idea {
10+
module {
11+
sourceDirs = sourceDirs + file("build/generated/ksp/main/kotlin")
12+
testSourceDirs = testSourceDirs + file("build/generated/ksp/test/kotlin")
13+
generatedSourceDirs = generatedSourceDirs + file("build/generated/ksp/main/kotlin") + file("build/generated/ksp/test/kotlin")
1114
}
1215
}
1316

console-r2dbc/build.gradle.kts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
plugins {
22
application
3+
idea
34
id("com.google.devtools.ksp")
45
}
56

67
val komapperVersion: String by project
78

8-
kotlin {
9-
sourceSets.main {
10-
kotlin.srcDir("build/generated/ksp/main/kotlin")
9+
idea {
10+
module {
11+
sourceDirs = sourceDirs + file("build/generated/ksp/main/kotlin")
12+
testSourceDirs = testSourceDirs + file("build/generated/ksp/test/kotlin")
13+
generatedSourceDirs = generatedSourceDirs + file("build/generated/ksp/main/kotlin") + file("build/generated/ksp/test/kotlin")
1114
}
1215
}
1316

gradle.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ group=org.komapper
55
version=0.0.1
66

77
kotlinVersion=1.5.31
8-
komapperVersion=0.25.0
8+
komapperVersion=0.26.0
99
kspVersion=1.5.31-1.0.1
10-
ktlintVersion=0.43.0

jpetstore/build.gradle.kts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
plugins {
2+
idea
23
id("org.springframework.boot") version "2.6.2"
34
id("com.google.devtools.ksp")
45
kotlin("plugin.spring")
@@ -8,12 +9,11 @@ apply(plugin = "io.spring.dependency-management")
89

910
val komapperVersion: String by project
1011

11-
kotlin {
12-
sourceSets.main {
13-
kotlin.srcDirs("build/generated/ksp/main/kotlin")
14-
}
15-
jvmToolchain {
16-
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(11))
12+
idea {
13+
module {
14+
sourceDirs = sourceDirs + file("build/generated/ksp/main/kotlin")
15+
testSourceDirs = testSourceDirs + file("build/generated/ksp/test/kotlin")
16+
generatedSourceDirs = generatedSourceDirs + file("build/generated/ksp/main/kotlin") + file("build/generated/ksp/test/kotlin")
1717
}
1818
}
1919

@@ -29,6 +29,7 @@ repositories {
2929

3030
dependencies {
3131
implementation("org.komapper:komapper-spring-boot-starter-jdbc:$komapperVersion")
32+
implementation("org.komapper:komapper-sqlcommenter:$komapperVersion")
3233
implementation("org.komapper:komapper-dialect-h2-jdbc:$komapperVersion")
3334
ksp("org.komapper:komapper-processor:$komapperVersion")
3435

jpetstore/src/main/kotlin/org/komapper/example/model/OrderAggregate.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ import org.komapper.example.entity.Product
88
class OrderAggregate(
99
val order: Order,
1010
val orderStatus: OrderStatus,
11-
val lineItemList: List<LineItem>,
11+
val lineItemSet: Set<LineItem>,
1212
val lineItem_product: Map<LineItem, Product?>,
1313
)

jpetstore/src/main/kotlin/org/komapper/example/model/ProductAggregate.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ import org.komapper.example.entity.Product
55

66
class ProductAggregate(
77
val product: Product,
8-
val itemList: List<Item>,
8+
val itemSet: Set<Item>,
99
)

0 commit comments

Comments
 (0)