Skip to content

Commit f258717

Browse files
Merge pull request #567 from kotlin-orm/dev
Release 4.1.0
2 parents f59e406 + c4b9347 commit f258717

File tree

36 files changed

+843
-80
lines changed

36 files changed

+843
-80
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ jobs:
1414
strategy:
1515
fail-fast: true
1616
matrix:
17-
java: [8, 11, 17, 20]
17+
java: [8, 11, 17, 21]
1818
steps:
1919
- name: Checkout Code
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
2121

2222
- name: Setup Java
23-
uses: actions/setup-java@v3
23+
uses: actions/setup-java@v4
2424
with:
2525
distribution: zulu
2626
java-version: ${{ matrix.java }}
2727

2828
- name: Setup Gradle
29-
uses: gradle/gradle-build-action@v2
29+
uses: gradle/actions/setup-gradle@v3
3030

3131
- name: Assemble the Project
3232
run: ./gradlew assemble
@@ -45,6 +45,8 @@ jobs:
4545
ktorm-core/build/reports/jacoco/test/jacocoTestReport.csv
4646
ktorm-global/build/reports/jacoco/test/jacocoTestReport.csv
4747
ktorm-jackson/build/reports/jacoco/test/jacocoTestReport.csv
48+
ktorm-ksp-annotations/build/reports/jacoco/test/jacocoTestReport.csv
49+
ktorm-ksp-compiler/build/reports/jacoco/test/jacocoTestReport.csv
4850
ktorm-support-mysql/build/reports/jacoco/test/jacocoTestReport.csv
4951
ktorm-support-oracle/build/reports/jacoco/test/jacocoTestReport.csv
5052
ktorm-support-postgresql/build/reports/jacoco/test/jacocoTestReport.csv
@@ -78,16 +80,16 @@ jobs:
7880
needs: build
7981
steps:
8082
- name: Checkout Code
81-
uses: actions/checkout@v3
83+
uses: actions/checkout@v4
8284

8385
- name: Setup Java
84-
uses: actions/setup-java@v3
86+
uses: actions/setup-java@v4
8587
with:
8688
distribution: zulu
8789
java-version: 8
8890

8991
- name: Setup Gradle
90-
uses: gradle/gradle-build-action@v2
92+
uses: gradle/actions/setup-gradle@v3
9193

9294
- name: Assemble the Project
9395
run: ./gradlew assemble

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ object Employees : Table<Employee>("t_employee") {
260260
}
261261
```
262262

263-
> Naming Strategy: It's highly recommended to name your entity classes by singular nouns, name table objects by plurals (eg. Employee/Employees, Department/Departments).
263+
> Naming Strategy: It's highly recommended to name your entity classes by singular nouns, name table objects by plurals (e.g. Employee/Employees, Department/Departments).
264264
265265
Now that column bindings are configured, so we can use [sequence APIs](#Entity-Sequence-APIs) to perform many operations on entities. Let's add two extension properties for `Database` first. These properties return new created sequence objects via `sequenceOf` and they can help us improve the readability of the code:
266266

buildSrc/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repositories {
99
}
1010

1111
dependencies {
12-
api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0")
13-
api("org.moditect:moditect-gradle-plugin:1.0.0-rc3")
14-
api("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.1")
12+
api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
13+
api("org.moditect:moditect:1.0.0.RC1")
14+
api("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.6")
1515
}
Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
11

22
plugins {
33
id("kotlin")
4-
id("org.moditect.gradleplugin")
54
}
65

7-
moditect {
8-
// Generate a multi-release jar, the module descriptor will be located at META-INF/versions/9/module-info.class
9-
addMainModuleInfo {
10-
jvmVersion.set("9")
11-
overwriteExistingFiles.set(true)
12-
module {
13-
moduleInfoFile = file("src/main/moditect/module-info.java")
6+
val moditect by tasks.registering {
7+
doLast {
8+
// Generate a multi-release modulized jar, module descriptor position: META-INF/versions/9/module-info.class
9+
val inputJar = tasks.jar.flatMap { it.archiveFile }.map { it.asFile.toPath() }.get()
10+
val outputDir = file("build/moditect").apply { mkdirs() }.toPath()
11+
val moduleInfo = file("src/main/moditect/module-info.java").readText()
12+
val version = project.version.toString()
13+
org.moditect.commands.AddModuleInfo(moduleInfo, null, version, inputJar, outputDir, "9", true).run()
14+
15+
// Replace the original jar with the modulized jar.
16+
copy {
17+
from(outputDir.resolve(inputJar.fileName))
18+
into(inputJar.parent)
1419
}
1520
}
21+
}
1622

17-
// Let kotlin compiler know the module descriptor.
18-
if (JavaVersion.current() >= JavaVersion.VERSION_1_9) {
19-
sourceSets.main {
20-
kotlin.srcDir("src/main/moditect")
21-
}
23+
tasks {
24+
moditect {
25+
dependsOn(jar)
2226
}
27+
jar {
28+
finalizedBy(moditect)
29+
}
30+
}
2331

24-
// Workaround to avoid circular task dependencies, see https://github.com/moditect/moditect-gradle-plugin/issues/14
25-
afterEvaluate {
26-
val compileJava = tasks.compileJava.get()
27-
val addDependenciesModuleInfo = tasks.addDependenciesModuleInfo.get()
28-
compileJava.setDependsOn(compileJava.dependsOn - addDependenciesModuleInfo)
32+
if (JavaVersion.current() >= JavaVersion.VERSION_1_9) {
33+
// Let kotlin compiler know the module descriptor.
34+
sourceSets.main {
35+
kotlin.srcDir("src/main/moditect")
2936
}
3037
}

buildSrc/src/main/kotlin/ktorm.publish.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ publishing {
155155
id.set("brohacz")
156156
name.set("Michal Brosig")
157157
}
158+
developer {
159+
id.set("hc224")
160+
name.set("hc224")
161+
email.set("hc224@pm.me")
162+
}
158163
}
159164
}
160165
}

detekt.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ complexity:
4949
active: true
5050
threshold: 4
5151
ComplexInterface:
52-
active: true
52+
active: false
5353
threshold: 12
5454
includeStaticDeclarations: false
5555
CyclomaticComplexMethod:
@@ -75,7 +75,7 @@ complexity:
7575
active: false
7676
threshold: 7
7777
NestedBlockDepth:
78-
active: true
78+
active: false
7979
threshold: 5
8080
StringLiteralDuplication:
8181
active: false
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

ktorm-core/ktorm-core.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ val testOutput by configurations.creating {
1919
}
2020

2121
val testJar by tasks.registering(Jar::class) {
22-
dependsOn("testClasses")
22+
dependsOn(tasks.testClasses)
2323
from(sourceSets.test.map { it.output })
2424
archiveClassifier.set("test")
2525
}

ktorm-core/src/main/kotlin/org/ktorm/database/CachedRowSet.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ public open class CachedRowSet(rs: ResultSet) : ResultSet {
609609
return index
610610
}
611611
}
612+
612613
throw SQLException("Invalid column name: $columnLabel")
613614
}
614615

ktorm-core/src/main/kotlin/org/ktorm/database/Database.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public class Database(
147147
public val name: String
148148

149149
/**
150-
* The name of the connected database product, eg. MySQL, H2.
150+
* The name of the connected database product, e.g. MySQL, H2.
151151
*/
152152
public val productName: String
153153

0 commit comments

Comments
 (0)