Skip to content

Commit fc31beb

Browse files
Merge pull request #462 from kotlin-orm/v3.6.x
Release v3.6.0
2 parents 85647c0 + 13478e6 commit fc31beb

File tree

158 files changed

+9563
-2438
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+9563
-2438
lines changed

.github/workflows/build.yml

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,21 @@ on:
99

1010
jobs:
1111
build:
12+
name: Build with JDK ${{ matrix.java }}
1213
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: true
16+
matrix:
17+
java: [8, 11, 17, 19]
1318
steps:
1419
- name: Checkout Code
15-
uses: actions/checkout@v2
20+
uses: actions/checkout@v3
1621

1722
- name: Setup Java
18-
uses: actions/setup-java@v2
23+
uses: actions/setup-java@v3
1924
with:
20-
distribution: temurin
21-
java-version: 8
25+
distribution: zulu
26+
java-version: ${{ matrix.java }}
2227

2328
- name: Setup Gradle
2429
uses: gradle/gradle-build-action@v2
@@ -29,6 +34,64 @@ jobs:
2934
- name: Run Tests
3035
run: ./gradlew check
3136

37+
- name: Generate JaCoCo Report
38+
run: ./gradlew jacocoTestReport
39+
40+
- name: Generate JaCoCo Badges
41+
uses: cicirello/jacoco-badge-generator@v2
42+
with:
43+
generate-branches-badge: true
44+
jacoco-csv-file: >
45+
ktorm-core/build/reports/jacoco/test/jacocoTestReport.csv
46+
ktorm-global/build/reports/jacoco/test/jacocoTestReport.csv
47+
ktorm-jackson/build/reports/jacoco/test/jacocoTestReport.csv
48+
ktorm-support-mysql/build/reports/jacoco/test/jacocoTestReport.csv
49+
ktorm-support-oracle/build/reports/jacoco/test/jacocoTestReport.csv
50+
ktorm-support-postgresql/build/reports/jacoco/test/jacocoTestReport.csv
51+
ktorm-support-sqlite/build/reports/jacoco/test/jacocoTestReport.csv
52+
ktorm-support-sqlserver/build/reports/jacoco/test/jacocoTestReport.csv
53+
54+
- name: Upload Jacoco Badges
55+
if: matrix.java == '8'
56+
continue-on-error: true
57+
run: |
58+
REPO_DIR=~/.ktorm/temp/repo/ktorm-docs
59+
git clone --depth=1 --branch=master https://github.com/kotlin-orm/ktorm-docs.git "$REPO_DIR"
60+
61+
cp .github/badges/jacoco.svg "$REPO_DIR/source/images"
62+
cp .github/badges/branches.svg "$REPO_DIR/source/images"
63+
cd "$REPO_DIR"
64+
65+
if [[ `git status --porcelain` ]]; then
66+
git config user.name 'vince'
67+
git config user.email 'me@liuwj.me'
68+
git add .
69+
git commit -m "[github actions] update jacoco badges"
70+
git push "https://$GIT_PUSH_TOKEN@github.com/kotlin-orm/ktorm-docs.git" master
71+
fi
72+
env:
73+
GIT_PUSH_TOKEN: ${{secrets.GIT_PUSH_TOKEN}}
74+
75+
publish:
76+
name: Publish Artifacts
77+
runs-on: ubuntu-latest
78+
needs: build
79+
steps:
80+
- name: Checkout Code
81+
uses: actions/checkout@v3
82+
83+
- name: Setup Java
84+
uses: actions/setup-java@v3
85+
with:
86+
distribution: zulu
87+
java-version: 8
88+
89+
- name: Setup Gradle
90+
uses: gradle/gradle-build-action@v2
91+
92+
- name: Assemble the Project
93+
run: ./gradlew assemble
94+
3295
- name: Publish Artifacts
3396
run: |
3497
if [[ $(cat "ktorm.version") =~ "SNAPSHOT" ]] ; then
@@ -45,4 +108,4 @@ jobs:
45108
OSSRH_PASSWORD: ${{secrets.OSSRH_PASSWORD}}
46109
GPG_KEY_ID: ${{secrets.GPG_KEY_ID}}
47110
GPG_PASSWORD: ${{secrets.GPG_PASSWORD}}
48-
GPG_SECRET_KEY: ${{secrets.GPG_SECRET_KEY}}
111+
GPG_SECRET_KEY: ${{secrets.GPG_SECRET_KEY}}

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ Pull requests are always welcome and can be a quick way to get your fix or impro
99
- By contributing to Ktorm, you agree that your contributions will be licensed under [Apache License 2.0](LICENSE).
1010
- Coding Conventions are very important. Refer to the [Kotlin Style Guide](https://kotlinlang.org/docs/reference/coding-conventions.html) for the recommended coding standards of Ktorm.
1111
- If you've added code that should be tested, add tests and ensure they all pass. If you've changed APIs, update the documentation.
12-
- If it's your first time contributing to Ktorm, please also update [this file](buildSrc/src/main/kotlin/ktorm.maven-publish.gradle.kts), add your GitHub ID to the developer's info, which will let more people know your contributions.
12+
- If it's your first time contributing to Ktorm, please also update [this file](buildSrc/src/main/kotlin/ktorm.publish.gradle.kts), add your GitHub ID to the developer's info, which will let more people know your contributions.

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
group = "org.ktorm"
3-
version = file("ktorm.version").readText()
3+
version = file("ktorm.version").readLines()[0]
44

55
task("printClasspath") {
66
doLast {

buildSrc/build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
plugins {
3-
id("org.gradle.kotlin.kotlin-dsl") version "2.1.7"
3+
id("org.gradle.kotlin.kotlin-dsl") version "2.4.1"
44
}
55

66
repositories {
@@ -9,6 +9,7 @@ repositories {
99
}
1010

1111
dependencies {
12-
api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.32")
12+
api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22")
13+
api("org.moditect:moditect-gradle-plugin:1.0.0-rc3")
1314
api("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.20.0")
1415
}

buildSrc/src/main/kotlin/ktorm.module-conventions.gradle.kts

Lines changed: 0 additions & 46 deletions
This file was deleted.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
2+
group = rootProject.group
3+
version = rootProject.version
4+
5+
plugins {
6+
id("kotlin")
7+
id("org.gradle.jacoco")
8+
id("org.moditect.gradleplugin")
9+
id("io.gitlab.arturbosch.detekt")
10+
id("ktorm.source-header-check")
11+
id("ktorm.publish")
12+
}
13+
14+
repositories {
15+
mavenCentral()
16+
}
17+
18+
dependencies {
19+
api(kotlin("stdlib"))
20+
api(kotlin("reflect"))
21+
testImplementation(kotlin("test-junit"))
22+
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:${detekt.toolVersion}")
23+
}
24+
25+
moditect {
26+
// Generate a multi-release jar, the module descriptor will be located at META-INF/versions/9/module-info.class
27+
addMainModuleInfo {
28+
jvmVersion.set("9")
29+
overwriteExistingFiles.set(true)
30+
module {
31+
moduleInfoFile = file("src/main/moditect/module-info.java")
32+
}
33+
}
34+
35+
// Let kotlin compiler know the module descriptor.
36+
if (JavaVersion.current() >= JavaVersion.VERSION_1_9) {
37+
sourceSets.main {
38+
kotlin.srcDir("src/main/moditect")
39+
}
40+
}
41+
42+
// Workaround to avoid circular task dependencies, see https://github.com/moditect/moditect-gradle-plugin/issues/14
43+
afterEvaluate {
44+
val compileJava = tasks.compileJava.get()
45+
val addDependenciesModuleInfo = tasks.addDependenciesModuleInfo.get()
46+
compileJava.setDependsOn(compileJava.dependsOn - addDependenciesModuleInfo)
47+
}
48+
}
49+
50+
detekt {
51+
source = files("src/main/kotlin")
52+
config = files("${project.rootDir}/detekt.yml")
53+
}
54+
55+
tasks {
56+
compileKotlin {
57+
kotlinOptions {
58+
jvmTarget = "1.8"
59+
allWarningsAsErrors = true
60+
freeCompilerArgs = listOf("-Xexplicit-api=strict")
61+
}
62+
}
63+
64+
compileTestKotlin {
65+
kotlinOptions {
66+
jvmTarget = "1.8"
67+
freeCompilerArgs = listOf("-Xjvm-default=all")
68+
}
69+
}
70+
71+
jacocoTestReport {
72+
reports {
73+
csv.required.set(true)
74+
xml.required.set(true)
75+
html.required.set(true)
76+
}
77+
}
78+
}

buildSrc/src/main/kotlin/ktorm.maven-publish.gradle.kts renamed to buildSrc/src/main/kotlin/ktorm.publish.gradle.kts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,30 @@ publishing {
131131
name.set("ccr")
132132
email.set("2938137849@qq.com")
133133
}
134+
developer {
135+
id.set("zuisong")
136+
name.set("zuisong")
137+
email.set("com.me@foxmail.com")
138+
}
139+
developer {
140+
id.set("svenallers")
141+
name.set("Sven Allers")
142+
email.set("sven.allers@gmx.de")
143+
}
144+
developer {
145+
id.set("lookup-cat")
146+
name.set("夜里的向日葵")
147+
email.set("641571835@qq.com")
148+
}
149+
developer {
150+
id.set("michaelfyc")
151+
name.set("michaelfyc")
152+
email.set("michael.fyc@outlook.com")
153+
}
154+
developer {
155+
id.set("brohacz")
156+
name.set("Michal Brosig")
157+
}
134158
}
135159
}
136160
}

buildSrc/src/main/kotlin/ktorm.source-header-check.gradle.kts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55

66
val licenseHeaderText = """
77
/*
8-
* Copyright 2018-2022 the original author or authors.
8+
* Copyright 2018-2023 the original author or authors.
99
*
1010
* Licensed under the Apache License, Version 2.0 (the "License");
1111
* you may not use this file except in compliance with the License.
@@ -38,4 +38,6 @@ val checkSourceHeader by tasks.registering {
3838
}
3939
}
4040

41-
tasks["check"].dependsOn(checkSourceHeader)
41+
tasks.check {
42+
dependsOn(checkSourceHeader)
43+
}

buildSrc/src/main/kotlin/ktorm.tuples-generation.gradle.kts renamed to buildSrc/src/main/kotlin/ktorm.tuples-codegen.gradle.kts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ val generateTuples by tasks.registering {
282282
outputFile.bufferedWriter().use { writer ->
283283
writer.write("""
284284
/*
285-
* Copyright 2018-2022 the original author or authors.
285+
* Copyright 2018-2023 the original author or authors.
286286
*
287287
* Licensed under the Apache License, Version 2.0 (the "License");
288288
* you may not use this file except in compliance with the License.
@@ -297,7 +297,7 @@ val generateTuples by tasks.registering {
297297
* limitations under the License.
298298
*/
299299
300-
// Auto-generated by ktorm.tuples-generation.gradle.kts, DO NOT EDIT!
300+
// Auto-generated by ktorm.tuples-codegen.gradle.kts, DO NOT EDIT!
301301
302302
package org.ktorm.entity
303303
@@ -347,9 +347,15 @@ val generateTuples by tasks.registering {
347347
}
348348
}
349349

350-
sourceSets.main {
351-
java.srcDirs(generatedSourceDir)
350+
tasks {
351+
compileKotlin {
352+
dependsOn(generateTuples)
353+
}
354+
"jarSources" {
355+
dependsOn(generateTuples)
356+
}
352357
}
353358

354-
tasks["compileKotlin"].dependsOn(generateTuples)
355-
tasks["jarSources"].dependsOn(generateTuples)
359+
sourceSets.main {
360+
kotlin.srcDir(generatedSourceDir)
361+
}

detekt.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ complexity:
5454
includeStaticDeclarations: false
5555
ComplexMethod:
5656
active: true
57-
threshold: 15
57+
threshold: 20
5858
ignoreSingleWhenExpression: true
5959
ignoreSimpleWhenEntries: true
6060
LabeledExpression:
@@ -197,7 +197,7 @@ formatting:
197197
indentSize: 4
198198
continuationIndentSize: 4
199199
MaximumLineLength:
200-
active: true
200+
active: false
201201
maxLineLength: 120
202202
ModifierOrdering:
203203
active: true
@@ -409,7 +409,7 @@ style:
409409
maxJumpCount: 2
410410
MagicNumber:
411411
active: true
412-
ignoreNumbers: '-1,0,1,2,3'
412+
ignoreNumbers: '-1,0,1,2,3,60'
413413
ignoreHashCodeFunction: true
414414
ignorePropertyDeclaration: false
415415
ignoreConstantDeclaration: true
@@ -460,7 +460,7 @@ style:
460460
SpacingBetweenPackageAndImports:
461461
active: true
462462
ThrowsCount:
463-
active: true
463+
active: false
464464
max: 2
465465
TrailingWhitespace:
466466
active: true
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-7.4.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)