From c5347502825cd77711ebeeed28a07819e72081f1 Mon Sep 17 00:00:00 2001 From: Yongshun Shreck Ye Date: Fri, 15 Nov 2024 21:52:26 +0800 Subject: [PATCH] Create modules/subprojects to split code into, and move the example and benchmark code into the module "integrated" IntelliJ IDEA Code Analysis shows there are 5 errors. --- .../src/main/kotlin/conventions.gradle.kts | 12 +------- .../main/kotlin/lib-conventions.gradle.kts | 15 ++++++++++ .../exposed-vertx-sql-client-postgresql.api | 0 {lib => core}/build.gradle.kts | 19 ++----------- .../exposedvertxsqlclient/ConnectionConfig.kt | 0 .../exposedvertxsqlclient/ConnectionType.kt | 0 .../exposedvertxsqlclient/DatabaseClient.kt | 0 .../exposedvertxsqlclient/EvscConfig.kt | 0 .../ExperimentalEvscApi.kt | 0 .../exposedvertxsqlclient/ExposedDatabases.kt | 0 .../LocalConnectionConfig.kt | 0 .../exposedvertxsqlclient/VertxSqlClients.kt | 0 .../ClassPropertyMapping.kt | 0 .../sql/DatabaseClientSql.kt | 0 .../mapping/DatabaseClientSqlWithMapper.kt | 0 .../datamapping/RowDataQueryMapper.kt | 0 integrated/README.md | 3 ++ integrated/build.gradle.kts | 28 +++++++++++++++++++ .../exposed/benchmark/AbstractBenchmark.kt | 0 .../exposed/benchmark/EmptyBenchmark.kt | 0 .../PreparedSqlGenerationBenchmark.kt | 0 .../exposed/benchmark/StatementBenchmark.kt | 0 .../exposed/benchmark/TransactionBenchmark.kt | 0 .../WithContainerizedDatabaseBenchmark.kt | 0 .../exposed/benchmark/table/Tables.kt | 0 .../exposedvertxsqlclient/Examples.kt | 0 .../exposedvertxsqlclient/MappingExamples.kt | 0 postgresql/build.gradle.kts | 13 +++++++++ settings.gradle.kts | 14 ++++++++-- sql-dsl-with-mapper/build.gradle.kts | 10 +++++++ 30 files changed, 85 insertions(+), 29 deletions(-) create mode 100644 buildSrc/src/main/kotlin/lib-conventions.gradle.kts rename {lib => core}/api/exposed-vertx-sql-client-postgresql.api (100%) rename {lib => core}/build.gradle.kts (70%) rename {lib => core}/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ConnectionConfig.kt (100%) rename {lib => core}/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ConnectionType.kt (100%) rename {lib => core}/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/DatabaseClient.kt (100%) rename {lib => core}/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/EvscConfig.kt (100%) rename {lib => core}/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ExperimentalEvscApi.kt (100%) rename {lib => core}/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ExposedDatabases.kt (100%) rename {lib => core}/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/LocalConnectionConfig.kt (100%) rename {lib => core}/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/VertxSqlClients.kt (100%) rename {lib => core}/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/classpropertymapping/ClassPropertyMapping.kt (100%) rename {lib => core}/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/sql/DatabaseClientSql.kt (100%) rename {lib => core}/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/sql/mapping/DatabaseClientSqlWithMapper.kt (100%) rename {lib => core}/src/main/kotlin/com/huanshankeji/vertx/sqlclient/datamapping/RowDataQueryMapper.kt (100%) create mode 100644 integrated/README.md create mode 100644 integrated/build.gradle.kts rename {lib => integrated}/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/AbstractBenchmark.kt (100%) rename {lib => integrated}/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/EmptyBenchmark.kt (100%) rename {lib => integrated}/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/PreparedSqlGenerationBenchmark.kt (100%) rename {lib => integrated}/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/StatementBenchmark.kt (100%) rename {lib => integrated}/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/TransactionBenchmark.kt (100%) rename {lib => integrated}/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/WithContainerizedDatabaseBenchmark.kt (100%) rename {lib => integrated}/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/table/Tables.kt (100%) rename {lib => integrated}/src/test/kotlin/com/huanshankeji/exposedvertxsqlclient/Examples.kt (100%) rename {lib => integrated}/src/test/kotlin/com/huanshankeji/exposedvertxsqlclient/MappingExamples.kt (100%) create mode 100644 postgresql/build.gradle.kts create mode 100644 sql-dsl-with-mapper/build.gradle.kts diff --git a/buildSrc/src/main/kotlin/conventions.gradle.kts b/buildSrc/src/main/kotlin/conventions.gradle.kts index adb9b61..0015b4b 100644 --- a/buildSrc/src/main/kotlin/conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/conventions.gradle.kts @@ -1,12 +1,8 @@ -import com.huanshankeji.team.`Shreck Ye` -import com.huanshankeji.team.pomForTeamDefaultOpenSource import com.huanshankeji.team.repositoriesAddTeamGithubPackagesMavenRegistry -import org.gradle.kotlin.dsl.repositories plugins { id("com.huanshankeji.team.with-group") - id("com.huanshankeji.kotlin-jvm-library-sonatype-ossrh-publish-conventions") - id("com.huanshankeji.team.default-github-packages-maven-publish") + kotlin("jvm") } repositories { @@ -18,9 +14,3 @@ repositoriesAddTeamGithubPackagesMavenRegistry("kotlin-common") kotlin.jvmToolchain(8) version = projectVersion - -publishing.publications.getByName("maven") { - pomForTeamDefaultOpenSource(project, "Exposed Vert.x SQL Client", "Exposed on top of Vert.x Reactive SQL Client") { - `Shreck Ye`() - } -} diff --git a/buildSrc/src/main/kotlin/lib-conventions.gradle.kts b/buildSrc/src/main/kotlin/lib-conventions.gradle.kts new file mode 100644 index 0000000..e679e3d --- /dev/null +++ b/buildSrc/src/main/kotlin/lib-conventions.gradle.kts @@ -0,0 +1,15 @@ +import com.huanshankeji.team.`Shreck Ye` +import com.huanshankeji.team.pomForTeamDefaultOpenSource + +plugins { + id("conventions") + id("com.huanshankeji.kotlin-jvm-library-sonatype-ossrh-publish-conventions") + id("com.huanshankeji.team.default-github-packages-maven-publish") + id("com.huanshankeji.team.dokka.github-dokka-convention") +} + +publishing.publications.getByName("maven") { + pomForTeamDefaultOpenSource(project, "Exposed Vert.x SQL Client", "Exposed on top of Vert.x Reactive SQL Client") { + `Shreck Ye`() + } +} diff --git a/lib/api/exposed-vertx-sql-client-postgresql.api b/core/api/exposed-vertx-sql-client-postgresql.api similarity index 100% rename from lib/api/exposed-vertx-sql-client-postgresql.api rename to core/api/exposed-vertx-sql-client-postgresql.api diff --git a/lib/build.gradle.kts b/core/build.gradle.kts similarity index 70% rename from lib/build.gradle.kts rename to core/build.gradle.kts index 27c95c6..1cb9160 100644 --- a/lib/build.gradle.kts +++ b/core/build.gradle.kts @@ -1,7 +1,5 @@ plugins { - conventions - id("com.huanshankeji.benchmark.kotlinx-benchmark-jvm-conventions") - id("com.huanshankeji.team.dokka.github-dokka-convention") + `lib-conventions` } dependencies { @@ -9,7 +7,7 @@ dependencies { // TODO: remove the Exposed JDBC dependency and the PostgresSQL dependency when there is no need to to generate SQLs with an Exposed transaction runtimeOnly(commonDependencies.exposed.module("jdbc")) api(commonDependencies.kotlinCommon.exposed()) - implementation("com.huanshankeji:exposed-adt-mapping:${DependencyVersions.exposedAdtMapping}") + implementation("com.huanshankeji:exposed-adt-mapping:${DependencyVersions.exposedAdtMapping}") // TODO remove when code is moved out with(commonDependencies.vertx) { implementation(platformStackDepchain()) @@ -25,20 +23,9 @@ dependencies { implementation(commonDependencies.kotlinCommon.net()) } - +// TODO remove when code is moved out // for PostgreSQL dependencies { runtimeOnly(commonDependencies.postgreSql()) implementation(commonDependencies.vertx.moduleWithoutVersion("pg-client")) } - -afterEvaluate { -// for the benchmarks - dependencies { - with(commonDependencies.testContainers) { - "benchmarksImplementation"(platformBom()) - "benchmarksImplementation"(postgreSql) - } - "benchmarksImplementation"(commonDependencies.slf4j.simple()) - } -} diff --git a/lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ConnectionConfig.kt b/core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ConnectionConfig.kt similarity index 100% rename from lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ConnectionConfig.kt rename to core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ConnectionConfig.kt diff --git a/lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ConnectionType.kt b/core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ConnectionType.kt similarity index 100% rename from lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ConnectionType.kt rename to core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ConnectionType.kt diff --git a/lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/DatabaseClient.kt b/core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/DatabaseClient.kt similarity index 100% rename from lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/DatabaseClient.kt rename to core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/DatabaseClient.kt diff --git a/lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/EvscConfig.kt b/core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/EvscConfig.kt similarity index 100% rename from lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/EvscConfig.kt rename to core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/EvscConfig.kt diff --git a/lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ExperimentalEvscApi.kt b/core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ExperimentalEvscApi.kt similarity index 100% rename from lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ExperimentalEvscApi.kt rename to core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ExperimentalEvscApi.kt diff --git a/lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ExposedDatabases.kt b/core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ExposedDatabases.kt similarity index 100% rename from lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ExposedDatabases.kt rename to core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/ExposedDatabases.kt diff --git a/lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/LocalConnectionConfig.kt b/core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/LocalConnectionConfig.kt similarity index 100% rename from lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/LocalConnectionConfig.kt rename to core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/LocalConnectionConfig.kt diff --git a/lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/VertxSqlClients.kt b/core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/VertxSqlClients.kt similarity index 100% rename from lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/VertxSqlClients.kt rename to core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/VertxSqlClients.kt diff --git a/lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/classpropertymapping/ClassPropertyMapping.kt b/core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/classpropertymapping/ClassPropertyMapping.kt similarity index 100% rename from lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/classpropertymapping/ClassPropertyMapping.kt rename to core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/classpropertymapping/ClassPropertyMapping.kt diff --git a/lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/sql/DatabaseClientSql.kt b/core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/sql/DatabaseClientSql.kt similarity index 100% rename from lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/sql/DatabaseClientSql.kt rename to core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/sql/DatabaseClientSql.kt diff --git a/lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/sql/mapping/DatabaseClientSqlWithMapper.kt b/core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/sql/mapping/DatabaseClientSqlWithMapper.kt similarity index 100% rename from lib/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/sql/mapping/DatabaseClientSqlWithMapper.kt rename to core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/sql/mapping/DatabaseClientSqlWithMapper.kt diff --git a/lib/src/main/kotlin/com/huanshankeji/vertx/sqlclient/datamapping/RowDataQueryMapper.kt b/core/src/main/kotlin/com/huanshankeji/vertx/sqlclient/datamapping/RowDataQueryMapper.kt similarity index 100% rename from lib/src/main/kotlin/com/huanshankeji/vertx/sqlclient/datamapping/RowDataQueryMapper.kt rename to core/src/main/kotlin/com/huanshankeji/vertx/sqlclient/datamapping/RowDataQueryMapper.kt diff --git a/integrated/README.md b/integrated/README.md new file mode 100644 index 0000000..64e0db5 --- /dev/null +++ b/integrated/README.md @@ -0,0 +1,3 @@ +# The integrated module + +This module includes tests, benchmarks, and examples. diff --git a/integrated/build.gradle.kts b/integrated/build.gradle.kts new file mode 100644 index 0000000..1806076 --- /dev/null +++ b/integrated/build.gradle.kts @@ -0,0 +1,28 @@ +import com.huanshankeji.cpnProject + +plugins { + conventions + id("com.huanshankeji.benchmark.kotlinx-benchmark-jvm-conventions") +} + +dependencies { + with(commonDependencies.vertx) { implementation(platformStackDepchain()) } // needed + + implementation(cpnProject(project, ":core")) + + testImplementation("com.huanshankeji:exposed-adt-mapping:${DependencyVersions.exposedAdtMapping}") + testImplementation(cpnProject(project, ":sql-dsl-with-mapper")) +} + +afterEvaluate { +// for the benchmarks + dependencies { + "benchmarksImplementation"(cpnProject(project, ":postgresql")) + + with(commonDependencies.testContainers) { + "benchmarksImplementation"(platformBom()) + "benchmarksImplementation"(postgreSql) + } + "benchmarksImplementation"(commonDependencies.slf4j.simple()) + } +} diff --git a/lib/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/AbstractBenchmark.kt b/integrated/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/AbstractBenchmark.kt similarity index 100% rename from lib/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/AbstractBenchmark.kt rename to integrated/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/AbstractBenchmark.kt diff --git a/lib/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/EmptyBenchmark.kt b/integrated/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/EmptyBenchmark.kt similarity index 100% rename from lib/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/EmptyBenchmark.kt rename to integrated/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/EmptyBenchmark.kt diff --git a/lib/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/PreparedSqlGenerationBenchmark.kt b/integrated/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/PreparedSqlGenerationBenchmark.kt similarity index 100% rename from lib/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/PreparedSqlGenerationBenchmark.kt rename to integrated/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/PreparedSqlGenerationBenchmark.kt diff --git a/lib/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/StatementBenchmark.kt b/integrated/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/StatementBenchmark.kt similarity index 100% rename from lib/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/StatementBenchmark.kt rename to integrated/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/StatementBenchmark.kt diff --git a/lib/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/TransactionBenchmark.kt b/integrated/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/TransactionBenchmark.kt similarity index 100% rename from lib/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/TransactionBenchmark.kt rename to integrated/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/TransactionBenchmark.kt diff --git a/lib/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/WithContainerizedDatabaseBenchmark.kt b/integrated/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/WithContainerizedDatabaseBenchmark.kt similarity index 100% rename from lib/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/WithContainerizedDatabaseBenchmark.kt rename to integrated/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/WithContainerizedDatabaseBenchmark.kt diff --git a/lib/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/table/Tables.kt b/integrated/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/table/Tables.kt similarity index 100% rename from lib/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/table/Tables.kt rename to integrated/src/benchmarks/kotlin/com/huanshankeji/exposed/benchmark/table/Tables.kt diff --git a/lib/src/test/kotlin/com/huanshankeji/exposedvertxsqlclient/Examples.kt b/integrated/src/test/kotlin/com/huanshankeji/exposedvertxsqlclient/Examples.kt similarity index 100% rename from lib/src/test/kotlin/com/huanshankeji/exposedvertxsqlclient/Examples.kt rename to integrated/src/test/kotlin/com/huanshankeji/exposedvertxsqlclient/Examples.kt diff --git a/lib/src/test/kotlin/com/huanshankeji/exposedvertxsqlclient/MappingExamples.kt b/integrated/src/test/kotlin/com/huanshankeji/exposedvertxsqlclient/MappingExamples.kt similarity index 100% rename from lib/src/test/kotlin/com/huanshankeji/exposedvertxsqlclient/MappingExamples.kt rename to integrated/src/test/kotlin/com/huanshankeji/exposedvertxsqlclient/MappingExamples.kt diff --git a/postgresql/build.gradle.kts b/postgresql/build.gradle.kts new file mode 100644 index 0000000..f23dd0d --- /dev/null +++ b/postgresql/build.gradle.kts @@ -0,0 +1,13 @@ +import com.huanshankeji.cpnProject + +plugins { + `lib-conventions` +} + +dependencies { + with(commonDependencies.vertx) { implementation(platformStackDepchain()) } // needed + implementation(cpnProject(project, ":core")) + + runtimeOnly(commonDependencies.postgreSql()) + implementation(commonDependencies.vertx.moduleWithoutVersion("pg-client")) +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 75fcf49..e5c9abd 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,6 +1,16 @@ rootProject.name = "exposed-vertx-sql-client" -include("lib") -project(":lib").name = rootProject.name + "-postgresql" + +include("core") +include("sql-dsl-with-mapper") +include("postgresql") +include("integrated") + +fun ProjectDescriptor.setProjectConcatenatedNames(prefix: String) { + name = prefix + name + for (child in children) + child.setProjectConcatenatedNames("$name-") +} +rootProject.setProjectConcatenatedNames("") // for Dokka @Suppress("UnstableApiUsage") diff --git a/sql-dsl-with-mapper/build.gradle.kts b/sql-dsl-with-mapper/build.gradle.kts new file mode 100644 index 0000000..c83f97f --- /dev/null +++ b/sql-dsl-with-mapper/build.gradle.kts @@ -0,0 +1,10 @@ +import com.huanshankeji.cpnProject + +plugins { + `lib-conventions` +} + +dependencies { + with(commonDependencies.vertx) { implementation(platformStackDepchain()) } // needed + implementation(cpnProject(project, ":core")) +}