diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 02e9de338..e698b1965 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,15 +44,81 @@ jobs: run: ./gradlew clean build - name: Perform publish - run: ./gradlew publish + run: ./gradlew publish -PreleaseBundle=all env: JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_USERNAME }} JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_PASSWORD }} - - name: Release to Maven Central portal + - name: Release core projects to Maven Central portal run: | for i in {1..3}; do - if ./gradlew jreleaserFullRelease --no-daemon --stacktrace; then + if ./gradlew jreleaserFullRelease -PreleaseBundle=core --no-daemon --stacktrace; then + exit 0 + fi + if [ $i -eq 3 ]; then + echo "Failed release after 3 attempts" + exit 1 + fi + echo + echo "********************************************************************************** RELEASE ATTEMPT($((i + 1))) **********************************************************************************" + sleep 5 + done + env: + JRELEASER_GITHUB_TOKEN: ${{ secrets.FLAMINGOCK_JRELEASER_GITHUB_TOKEN }} + JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_USERNAME }} + JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_PASSWORD }} + JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_PUBLIC_KEY }} + JRELEASER_GPG_SECRET_KEY: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_SECRET_KEY }} + JRELEASER_GPG_PASSPHRASE: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_PASSPHRASE }} + + - name: Release driver projects to Maven Central portal + run: | + for i in {1..3}; do + if ./gradlew jreleaserFullRelease -PreleaseBundle=driver --no-daemon --stacktrace; then + exit 0 + fi + if [ $i -eq 3 ]; then + echo "Failed release after 3 attempts" + exit 1 + fi + echo + echo "********************************************************************************** RELEASE ATTEMPT($((i + 1))) **********************************************************************************" + sleep 5 + done + env: + JRELEASER_GITHUB_TOKEN: ${{ secrets.FLAMINGOCK_JRELEASER_GITHUB_TOKEN }} + JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_USERNAME }} + JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_PASSWORD }} + JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_PUBLIC_KEY }} + JRELEASER_GPG_SECRET_KEY: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_SECRET_KEY }} + JRELEASER_GPG_PASSPHRASE: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_PASSPHRASE }} + + - name: Release template projects to Maven Central portal + run: | + for i in {1..3}; do + if ./gradlew jreleaserFullRelease -PreleaseBundle=template --no-daemon --stacktrace; then + exit 0 + fi + if [ $i -eq 3 ]; then + echo "Failed release after 3 attempts" + exit 1 + fi + echo + echo "********************************************************************************** RELEASE ATTEMPT($((i + 1))) **********************************************************************************" + sleep 5 + done + env: + JRELEASER_GITHUB_TOKEN: ${{ secrets.FLAMINGOCK_JRELEASER_GITHUB_TOKEN }} + JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_USERNAME }} + JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_PASSWORD }} + JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_PUBLIC_KEY }} + JRELEASER_GPG_SECRET_KEY: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_SECRET_KEY }} + JRELEASER_GPG_PASSPHRASE: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_PASSPHRASE }} + + - name: Release transactioner projects to Maven Central portal + run: | + for i in {1..3}; do + if ./gradlew jreleaserFullRelease -PreleaseBundle=transactioner --no-daemon --stacktrace; then exit 0 fi if [ $i -eq 3 ]; then diff --git a/build.gradle.kts b/build.gradle.kts index fb1dadc61..935c42627 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,53 +28,81 @@ plugins { allprojects { group = "io.flamingock" - version = "0.0.12-beta" + version = "0.0.13-beta" apply(plugin = "org.jetbrains.kotlin.jvm") } -val projectsToRelease = setOf( +val coreProjects = setOf( "flamingock-core", "flamingock-core-api", + "flamingock-core-template", "flamingock-springboot-v2-runner", "flamingock-springboot-v3-runner", + "utils" +) + +val localDriverProjects = setOf( + "driver-common", "couchbase-driver", "couchbase-springboot-v2-driver", "dynamodb-driver", + "mongodb-facade", "mongodb-springdata-v2-driver", "mongodb-springdata-v3-driver", "mongodb-springdata-v4-driver", "mongodb-sync-v4-driver", - "mongodb-v3-driver", + "mongodb-v3-driver" +) + +val templateProjects = setOf( "sql-template", - "sql-springboot-template", + "sql-springboot-template" +) + + +val transactionerProjects = setOf( "sql-cloud-transactioner" ) +val allProjects = coreProjects + localDriverProjects + templateProjects + transactionerProjects -val projectNameMaxLength = projectsToRelease.maxOf { it.length } + +val projectNameMaxLength = coreProjects.maxOf { it.length } val tabWidth = 8 //Usually 8 spaces) val statusPosition = ((projectNameMaxLength / tabWidth) + 1) * tabWidth val httpClient: HttpClient = HttpClient.newHttpClient() val mavenUsername: String? = System.getenv("JRELEASER_MAVENCENTRAL_USERNAME") val mavenPassword: String? = System.getenv("JRELEASER_MAVENCENTRAL_PASSWORD") -val encodedCredentials: String? = if(mavenUsername != null && mavenPassword != null)Base64.getEncoder() +val encodedCredentials: String? = if (mavenUsername != null && mavenPassword != null) Base64.getEncoder() .encodeToString("$mavenUsername:$mavenPassword".toByteArray()) else null +val releaseBundle: String? = project.findProperty("releaseBundle") as String? +val projectsToRelease = when(releaseBundle) { + "core" -> coreProjects + "driver" -> localDriverProjects + "template" -> templateProjects + "transactioner" -> transactionerProjects + "all" -> allProjects + else -> setOf() +} val isReleasing = getIsReleasing() +if(isReleasing) { + logger.lifecycle("Release bundle: $releaseBundle") +} + subprojects { apply(plugin = "java-library") - val tabsPrefix = getTabsPrefix() - if(isReleasing) { + if (isReleasing) { if (project.isReleasable()) { - if(!project.getIfAlreadyReleasedFromCentralPortal()) { - logger.lifecycle("${project.name}${tabsPrefix}[ \uD83D\uDE80 PUBLISHING ]") + if (!project.getIfAlreadyReleasedFromCentralPortal()) { + logger.lifecycle("${project.name}${tabsPrefix}\uD83D\uDE80 PUBLISHING") java { withSourcesJar() withJavadocJar() @@ -219,10 +247,10 @@ subprojects { } } } else { - logger.lifecycle("${project.name}${tabsPrefix}[ ✅ ALREADY PUBLISHED ]") + logger.lifecycle("${project.name}${tabsPrefix}✅ ALREADY PUBLISHED") } } else { - logger.lifecycle("${project.name}${tabsPrefix}[ \uD83D\uDCA4 NOT RELEASABLE ]") + logger.debug("${project.name}${tabsPrefix}\uD83D\uDCA4 NOT RELEASABLE") } } @@ -278,14 +306,10 @@ subprojects { fun Project.isReleasable(): Boolean = projectsToRelease.contains(name) -fun Project.getIfAlreadyReleasedFromCentralPortal() : Boolean { +fun Project.getIfAlreadyReleasedFromCentralPortal(): Boolean { val url = "https://central.sonatype.com/api/v1/publisher/published?namespace=${group}&name=$name&version=$version" - val request = HttpRequest.newBuilder() - .uri(URI.create(url)) - .header("accept", "application/json") - .header("Authorization", "Basic $encodedCredentials") - .GET() - .build() + val request = HttpRequest.newBuilder().uri(URI.create(url)).header("accept", "application/json") + .header("Authorization", "Basic $encodedCredentials").GET().build() val response = httpClient.send(request, HttpResponse.BodyHandlers.ofString()) @@ -307,13 +331,6 @@ fun Project.getIfAlreadyReleasedFromCentralPortal() : Boolean { } -fun getTabsPrefix(): String { - val currentPosition = project.name.length - val tabsNeeded = ((statusPosition - currentPosition + tabWidth - 1) / tabWidth) + 1 - return "\t".repeat(tabsNeeded) -} - - val String.isPalindrome: Boolean get() = this == this.reversed() @@ -323,5 +340,5 @@ fun Project.getTabsPrefix(): String { return "\t".repeat(tabsNeeded) } -fun Project.getIsReleasing() = gradle.startParameter.taskNames.contains("jreleaserFullRelease") || - gradle.startParameter.taskNames.contains("publish") \ No newline at end of file +fun Project.getIsReleasing() = + gradle.startParameter.taskNames.contains("jreleaserFullRelease") || gradle.startParameter.taskNames.contains("publish") \ No newline at end of file diff --git a/internal/legacy-importer-mongodb/build.gradle.kts b/cloud-importers/mongodb-sync4-cloud-importer/build.gradle.kts similarity index 79% rename from internal/legacy-importer-mongodb/build.gradle.kts rename to cloud-importers/mongodb-sync4-cloud-importer/build.gradle.kts index 3c02a7ddc..8452002cd 100644 --- a/internal/legacy-importer-mongodb/build.gradle.kts +++ b/cloud-importers/mongodb-sync4-cloud-importer/build.gradle.kts @@ -1,7 +1,7 @@ val jacksonVersion = "2.16.0" dependencies { - api(project(":utils")) - api(project(":flamingock-core-api")) + implementation(project(":utils")) + implementation(project(":flamingock-core-api")) implementation("org.mongodb:mongodb-driver-sync:4.3.3") implementation(project(":flamingock-core")) diff --git a/internal/legacy-importer-mongodb/src/main/java/flamingock/internal/legacy/importer/mongodb/ImporterService.java b/cloud-importers/mongodb-sync4-cloud-importer/src/main/java/io/flamingock/importer/cloud/mongodb/ImporterService.java similarity index 80% rename from internal/legacy-importer-mongodb/src/main/java/flamingock/internal/legacy/importer/mongodb/ImporterService.java rename to cloud-importers/mongodb-sync4-cloud-importer/src/main/java/io/flamingock/importer/cloud/mongodb/ImporterService.java index f56571dfb..a85fe7360 100644 --- a/internal/legacy-importer-mongodb/src/main/java/flamingock/internal/legacy/importer/mongodb/ImporterService.java +++ b/cloud-importers/mongodb-sync4-cloud-importer/src/main/java/io/flamingock/importer/cloud/mongodb/ImporterService.java @@ -1,4 +1,4 @@ -package flamingock.internal.legacy.importer.mongodb; +package io.flamingock.importer.cloud.mongodb; import io.flamingock.commons.utils.http.Http; diff --git a/internal/legacy-importer-mongodb/src/main/java/flamingock/internal/legacy/importer/mongodb/MongoDBLegacyImportConfiguration.java b/cloud-importers/mongodb-sync4-cloud-importer/src/main/java/io/flamingock/importer/cloud/mongodb/MongoDBLegacyImportConfiguration.java similarity index 95% rename from internal/legacy-importer-mongodb/src/main/java/flamingock/internal/legacy/importer/mongodb/MongoDBLegacyImportConfiguration.java rename to cloud-importers/mongodb-sync4-cloud-importer/src/main/java/io/flamingock/importer/cloud/mongodb/MongoDBLegacyImportConfiguration.java index a9198ee81..c04988450 100644 --- a/internal/legacy-importer-mongodb/src/main/java/flamingock/internal/legacy/importer/mongodb/MongoDBLegacyImportConfiguration.java +++ b/cloud-importers/mongodb-sync4-cloud-importer/src/main/java/io/flamingock/importer/cloud/mongodb/MongoDBLegacyImportConfiguration.java @@ -1,4 +1,4 @@ -package flamingock.internal.legacy.importer.mongodb; +package io.flamingock.importer.cloud.mongodb; import io.flamingock.commons.utils.id.EnvironmentId; import io.flamingock.commons.utils.id.ServiceId; diff --git a/internal/legacy-importer-mongodb/src/main/java/flamingock/internal/legacy/importer/mongodb/MongoDBLegacyImporter.java b/cloud-importers/mongodb-sync4-cloud-importer/src/main/java/io/flamingock/importer/cloud/mongodb/MongoDBLegacyImporter.java similarity index 96% rename from internal/legacy-importer-mongodb/src/main/java/flamingock/internal/legacy/importer/mongodb/MongoDBLegacyImporter.java rename to cloud-importers/mongodb-sync4-cloud-importer/src/main/java/io/flamingock/importer/cloud/mongodb/MongoDBLegacyImporter.java index cdc4658f3..4d23a6db8 100644 --- a/internal/legacy-importer-mongodb/src/main/java/flamingock/internal/legacy/importer/mongodb/MongoDBLegacyImporter.java +++ b/cloud-importers/mongodb-sync4-cloud-importer/src/main/java/io/flamingock/importer/cloud/mongodb/MongoDBLegacyImporter.java @@ -1,4 +1,4 @@ -package flamingock.internal.legacy.importer.mongodb; +package io.flamingock.importer.cloud.mongodb; import io.flamingock.core.api.CloudSystemModule; import io.flamingock.core.runtime.dependency.Dependency; diff --git a/internal/legacy-importer-mongodb/src/main/java/flamingock/internal/legacy/importer/mongodb/MongockLegacyImporterChangeUnit.java b/cloud-importers/mongodb-sync4-cloud-importer/src/main/java/io/flamingock/importer/cloud/mongodb/MongockLegacyImporterChangeUnit.java similarity index 96% rename from internal/legacy-importer-mongodb/src/main/java/flamingock/internal/legacy/importer/mongodb/MongockLegacyImporterChangeUnit.java rename to cloud-importers/mongodb-sync4-cloud-importer/src/main/java/io/flamingock/importer/cloud/mongodb/MongockLegacyImporterChangeUnit.java index 714911741..6fd5f3202 100644 --- a/internal/legacy-importer-mongodb/src/main/java/flamingock/internal/legacy/importer/mongodb/MongockLegacyImporterChangeUnit.java +++ b/cloud-importers/mongodb-sync4-cloud-importer/src/main/java/io/flamingock/importer/cloud/mongodb/MongockLegacyImporterChangeUnit.java @@ -14,17 +14,17 @@ * limitations under the License. */ -package flamingock.internal.legacy.importer.mongodb; +package io.flamingock.importer.cloud.mongodb; import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoDatabase; -import io.changock.migration.api.annotations.NonLockGuarded; import io.flamingock.commons.utils.JsonObjectMapper; import io.flamingock.commons.utils.RunnerId; import io.flamingock.commons.utils.http.Http; import io.flamingock.core.api.annotations.ChangeUnit; import io.flamingock.core.api.annotations.Execution; +import io.flamingock.core.api.annotations.NonLockGuarded; import io.flamingock.core.api.annotations.SystemChange; import org.apache.http.impl.client.HttpClients; import org.bson.Document; diff --git a/cloud-transactioners/sql-cloud-transactioner/src/test/java/io/flamingock/cloud/transaction/sql/changes/happypath/HappyCreateTableClientsChange.java b/cloud-transactioners/sql-cloud-transactioner/src/test/java/io/flamingock/cloud/transaction/sql/changes/happypath/HappyCreateTableClientsChange.java index e6c9846bf..42d1dc059 100644 --- a/cloud-transactioners/sql-cloud-transactioner/src/test/java/io/flamingock/cloud/transaction/sql/changes/happypath/HappyCreateTableClientsChange.java +++ b/cloud-transactioners/sql-cloud-transactioner/src/test/java/io/flamingock/cloud/transaction/sql/changes/happypath/HappyCreateTableClientsChange.java @@ -16,9 +16,10 @@ package io.flamingock.cloud.transaction.sql.changes.happypath; -import io.changock.migration.api.annotations.NonLockGuarded; + import io.flamingock.core.api.annotations.ChangeUnit; import io.flamingock.core.api.annotations.Execution; +import io.flamingock.core.api.annotations.NonLockGuarded; import java.sql.Connection; import java.sql.SQLException; diff --git a/cloud-transactioners/sql-cloud-transactioner/src/test/java/io/flamingock/cloud/transaction/sql/changes/happypath/HappyInsertClientsChange.java b/cloud-transactioners/sql-cloud-transactioner/src/test/java/io/flamingock/cloud/transaction/sql/changes/happypath/HappyInsertClientsChange.java index 934eddc37..008ca5e56 100644 --- a/cloud-transactioners/sql-cloud-transactioner/src/test/java/io/flamingock/cloud/transaction/sql/changes/happypath/HappyInsertClientsChange.java +++ b/cloud-transactioners/sql-cloud-transactioner/src/test/java/io/flamingock/cloud/transaction/sql/changes/happypath/HappyInsertClientsChange.java @@ -16,7 +16,7 @@ package io.flamingock.cloud.transaction.sql.changes.happypath; -import io.changock.migration.api.annotations.NonLockGuarded; +import io.flamingock.core.api.annotations.NonLockGuarded; import io.flamingock.core.api.annotations.ChangeUnit; import io.flamingock.core.api.annotations.Execution; diff --git a/cloud-transactioners/sql-cloud-transactioner/src/test/java/io/flamingock/cloud/transaction/sql/changes/unhappypath/UnhappyCreateTableClientsChange.java b/cloud-transactioners/sql-cloud-transactioner/src/test/java/io/flamingock/cloud/transaction/sql/changes/unhappypath/UnhappyCreateTableClientsChange.java index 3e49d93f3..7c8501122 100644 --- a/cloud-transactioners/sql-cloud-transactioner/src/test/java/io/flamingock/cloud/transaction/sql/changes/unhappypath/UnhappyCreateTableClientsChange.java +++ b/cloud-transactioners/sql-cloud-transactioner/src/test/java/io/flamingock/cloud/transaction/sql/changes/unhappypath/UnhappyCreateTableClientsChange.java @@ -16,7 +16,7 @@ package io.flamingock.cloud.transaction.sql.changes.unhappypath; -import io.changock.migration.api.annotations.NonLockGuarded; +import io.flamingock.core.api.annotations.NonLockGuarded; import io.flamingock.core.api.annotations.ChangeUnit; import io.flamingock.core.api.annotations.Execution; diff --git a/cloud-transactioners/sql-cloud-transactioner/src/test/java/io/flamingock/cloud/transaction/sql/changes/unhappypath/UnhappyInsertionClientsChange.java b/cloud-transactioners/sql-cloud-transactioner/src/test/java/io/flamingock/cloud/transaction/sql/changes/unhappypath/UnhappyInsertionClientsChange.java index cc5c81896..1ddb3bc92 100644 --- a/cloud-transactioners/sql-cloud-transactioner/src/test/java/io/flamingock/cloud/transaction/sql/changes/unhappypath/UnhappyInsertionClientsChange.java +++ b/cloud-transactioners/sql-cloud-transactioner/src/test/java/io/flamingock/cloud/transaction/sql/changes/unhappypath/UnhappyInsertionClientsChange.java @@ -16,7 +16,7 @@ package io.flamingock.cloud.transaction.sql.changes.unhappypath; -import io.changock.migration.api.annotations.NonLockGuarded; +import io.flamingock.core.api.annotations.NonLockGuarded; import io.flamingock.core.api.annotations.ChangeUnit; import io.flamingock.core.api.annotations.Execution; diff --git a/examples/databases/legacy-mongodb-importer/build.gradle.kts b/examples/databases/legacy-mongodb-importer/build.gradle.kts index 9f7da46d0..ac563a4ef 100644 --- a/examples/databases/legacy-mongodb-importer/build.gradle.kts +++ b/examples/databases/legacy-mongodb-importer/build.gradle.kts @@ -12,7 +12,7 @@ dependencies { implementation("com.mysql:mysql-connector-j:8.2.0") implementation(project(":templates:sql-template")) - implementation(project(":internal:legacy-importer-mongodb")) + implementation(project(":cloud-importers:mongodb-sync4-cloud-importer")) implementation(project(":local-drivers:mongodb:mongodb-sync-v4-driver")) implementation("org.mongodb:mongodb-driver-sync:$mongodbVersion") diff --git a/examples/databases/legacy-mongodb-importer/src/main/java/io/flamingock/examples/mysql/standalone/LegacyImporterMongoDBApplication.java b/examples/databases/legacy-mongodb-importer/src/main/java/io/flamingock/examples/mysql/standalone/LegacyImporterMongoDBApplication.java index 848c45526..4c107d9e4 100644 --- a/examples/databases/legacy-mongodb-importer/src/main/java/io/flamingock/examples/mysql/standalone/LegacyImporterMongoDBApplication.java +++ b/examples/databases/legacy-mongodb-importer/src/main/java/io/flamingock/examples/mysql/standalone/LegacyImporterMongoDBApplication.java @@ -20,7 +20,7 @@ import com.mongodb.MongoClientSettings; import com.mongodb.client.MongoClient; import com.mongodb.client.MongoClients; -import flamingock.internal.legacy.importer.mongodb.MongoDBLegacyImporter; +import io.flamingock.importer.cloud.mongodb.MongoDBLegacyImporter; import io.flamingock.core.configurator.standalone.FlamingockStandalone; import org.bson.codecs.configuration.CodecRegistries; import org.bson.codecs.configuration.CodecRegistry; @@ -51,9 +51,6 @@ public void run(MongoClient mongoClient, String databaseName) throws ClassNotFou .setEnvironment(ENVIRONMENT) .setService(SERVICE_NAME) .addSystemModule(new MongoDBLegacyImporter(MONGODB_CHANGELOG_COLLECTION)) - .setLockAcquiredForMillis(6 * 1000L)//this is just to show how is set. Default value is still 60 * 1000L - .setLockQuitTryingAfterMillis(10 * 1000L)//this is just to show how is set. Default value is still 3 * 60 * 1000L - .setLockTryFrequencyMillis(3000L)//this is just to show how is set. Default value is still 1000L .addDependency(mongoClient.getDatabase(databaseName)) .build() .run(); diff --git a/examples/databases/legacy-mongodb-importer/src/test/java/SuccessExecutionImporterTest.java b/examples/databases/legacy-mongodb-importer/src/test/java/SuccessExecutionImporterTest.java index 028461da0..4f1d19f9d 100644 --- a/examples/databases/legacy-mongodb-importer/src/test/java/SuccessExecutionImporterTest.java +++ b/examples/databases/legacy-mongodb-importer/src/test/java/SuccessExecutionImporterTest.java @@ -18,8 +18,8 @@ import com.mongodb.MongoClientSettings; import com.mongodb.client.MongoClient; import com.mongodb.client.MongoClients; -import flamingock.internal.legacy.importer.mongodb.MongoDBLegacyImporter; -import flamingock.internal.legacy.importer.mongodb.MongockLegacyImporterChangeUnit; +import io.flamingock.importer.cloud.mongodb.MongoDBLegacyImporter; +import io.flamingock.importer.cloud.mongodb.MongockLegacyImporterChangeUnit; import io.flamingock.common.test.cloud.AuditEntryExpectation; import io.flamingock.common.test.cloud.MockRunnerServer; import io.flamingock.common.test.cloud.MongockLegacyAuditEntry; diff --git a/examples/databases/mysql-standalone/build.gradle.kts b/examples/databases/mysql-standalone/build.gradle.kts index dad8eda70..1b8134f10 100644 --- a/examples/databases/mysql-standalone/build.gradle.kts +++ b/examples/databases/mysql-standalone/build.gradle.kts @@ -15,7 +15,7 @@ dependencies { implementation("com.mysql:mysql-connector-j:8.2.0") implementation(project(":templates:sql-template")) - implementation(project(":internal:legacy-importer-mongodb")) + implementation(project(":cloud-importers:mongodb-sync4-cloud-importer")) implementation("org.slf4j:slf4j-simple:2.0.6") diff --git a/examples/databases/mysql-standalone/src/main/java/io/flamingock/examples/mysql/standalone/MysqlStandaloneApplication.java b/examples/databases/mysql-standalone/src/main/java/io/flamingock/examples/mysql/standalone/MysqlStandaloneApplication.java index 27dd6df03..d82da610a 100644 --- a/examples/databases/mysql-standalone/src/main/java/io/flamingock/examples/mysql/standalone/MysqlStandaloneApplication.java +++ b/examples/databases/mysql-standalone/src/main/java/io/flamingock/examples/mysql/standalone/MysqlStandaloneApplication.java @@ -16,7 +16,6 @@ package io.flamingock.examples.mysql.standalone; -import flamingock.internal.legacy.importer.mongodb.MongoDBLegacyImporter; import io.flamingock.cloud.transaction.sql.SqlCloudTransactioner; import io.flamingock.cloud.transaction.sql.SqlDialect; import io.flamingock.core.cloud.transaction.CloudTransactioner; diff --git a/flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/audit/AuditEntryRequest.java b/flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/audit/AuditEntryRequest.java similarity index 100% rename from flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/audit/AuditEntryRequest.java rename to flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/audit/AuditEntryRequest.java diff --git a/flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/auth/AuthRequest.java b/flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/auth/AuthRequest.java similarity index 100% rename from flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/auth/AuthRequest.java rename to flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/auth/AuthRequest.java diff --git a/flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/auth/AuthResponse.java b/flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/auth/AuthResponse.java similarity index 100% rename from flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/auth/AuthResponse.java rename to flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/auth/AuthResponse.java diff --git a/flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/lock/LockExtensionRequest.java b/flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/lock/LockExtensionRequest.java similarity index 100% rename from flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/lock/LockExtensionRequest.java rename to flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/lock/LockExtensionRequest.java diff --git a/flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/lock/LockResponse.java b/flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/lock/LockResponse.java similarity index 100% rename from flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/lock/LockResponse.java rename to flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/lock/LockResponse.java diff --git a/flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/planner/ExecutionPlanRequest.java b/flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/planner/ExecutionPlanRequest.java similarity index 100% rename from flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/planner/ExecutionPlanRequest.java rename to flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/planner/ExecutionPlanRequest.java diff --git a/flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/planner/ExecutionPlanResponse.java b/flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/planner/ExecutionPlanResponse.java similarity index 100% rename from flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/planner/ExecutionPlanResponse.java rename to flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/planner/ExecutionPlanResponse.java diff --git a/flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/planner/StageRequest.java b/flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/planner/StageRequest.java similarity index 100% rename from flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/planner/StageRequest.java rename to flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/planner/StageRequest.java diff --git a/flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/transaction/OngoingStatus.java b/flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/transaction/OngoingStatus.java similarity index 100% rename from flamingock-core-cloud-api/src/main/java/io/flamingock/core/cloud/api/transaction/OngoingStatus.java rename to flamingock-core-api/src/main/java/io/flamingock/core/cloud/api/transaction/OngoingStatus.java diff --git a/flamingock-core-cloud-api/build.gradle.kts b/flamingock-core-cloud-api/build.gradle.kts deleted file mode 100644 index df70cbb66..000000000 --- a/flamingock-core-cloud-api/build.gradle.kts +++ /dev/null @@ -1,3 +0,0 @@ -val jacksonVersion = "2.16.0" -dependencies { -} diff --git a/flamingock-template/build.gradle.kts b/flamingock-core-template/build.gradle.kts similarity index 100% rename from flamingock-template/build.gradle.kts rename to flamingock-core-template/build.gradle.kts diff --git a/flamingock-template/src/main/java/io/flamingock/template/TemplateFactory.java b/flamingock-core-template/src/main/java/io/flamingock/template/TemplateFactory.java similarity index 100% rename from flamingock-template/src/main/java/io/flamingock/template/TemplateFactory.java rename to flamingock-core-template/src/main/java/io/flamingock/template/TemplateFactory.java diff --git a/flamingock-template/src/main/java/io/flamingock/template/TemplateModule.java b/flamingock-core-template/src/main/java/io/flamingock/template/TemplateModule.java similarity index 100% rename from flamingock-template/src/main/java/io/flamingock/template/TemplateModule.java rename to flamingock-core-template/src/main/java/io/flamingock/template/TemplateModule.java diff --git a/flamingock-template/src/main/java/io/flamingock/template/TemplateSpec.java b/flamingock-core-template/src/main/java/io/flamingock/template/TemplateSpec.java similarity index 100% rename from flamingock-template/src/main/java/io/flamingock/template/TemplateSpec.java rename to flamingock-core-template/src/main/java/io/flamingock/template/TemplateSpec.java diff --git a/flamingock-template/src/main/java/io/flamingock/template/TemplatedTaskDefinition.java b/flamingock-core-template/src/main/java/io/flamingock/template/TemplatedTaskDefinition.java similarity index 100% rename from flamingock-template/src/main/java/io/flamingock/template/TemplatedTaskDefinition.java rename to flamingock-core-template/src/main/java/io/flamingock/template/TemplatedTaskDefinition.java diff --git a/flamingock-template/src/main/java/io/flamingock/template/TransactionalTemplateSpec.java b/flamingock-core-template/src/main/java/io/flamingock/template/TransactionalTemplateSpec.java similarity index 100% rename from flamingock-template/src/main/java/io/flamingock/template/TransactionalTemplateSpec.java rename to flamingock-core-template/src/main/java/io/flamingock/template/TransactionalTemplateSpec.java diff --git a/flamingock-template/src/main/java/io/flamingock/template/annotations/TemplateConfigSetter.java b/flamingock-core-template/src/main/java/io/flamingock/template/annotations/TemplateConfigSetter.java similarity index 100% rename from flamingock-template/src/main/java/io/flamingock/template/annotations/TemplateConfigSetter.java rename to flamingock-core-template/src/main/java/io/flamingock/template/annotations/TemplateConfigSetter.java diff --git a/flamingock-template/src/main/java/io/flamingock/template/annotations/TemplateConfigValidator.java b/flamingock-core-template/src/main/java/io/flamingock/template/annotations/TemplateConfigValidator.java similarity index 100% rename from flamingock-template/src/main/java/io/flamingock/template/annotations/TemplateConfigValidator.java rename to flamingock-core-template/src/main/java/io/flamingock/template/annotations/TemplateConfigValidator.java diff --git a/flamingock-template/src/main/java/io/flamingock/template/annotations/TemplateExecution.java b/flamingock-core-template/src/main/java/io/flamingock/template/annotations/TemplateExecution.java similarity index 100% rename from flamingock-template/src/main/java/io/flamingock/template/annotations/TemplateExecution.java rename to flamingock-core-template/src/main/java/io/flamingock/template/annotations/TemplateExecution.java diff --git a/flamingock-template/src/main/java/io/flamingock/template/annotations/TemplateRollbackExecution.java b/flamingock-core-template/src/main/java/io/flamingock/template/annotations/TemplateRollbackExecution.java similarity index 100% rename from flamingock-template/src/main/java/io/flamingock/template/annotations/TemplateRollbackExecution.java rename to flamingock-core-template/src/main/java/io/flamingock/template/annotations/TemplateRollbackExecution.java diff --git a/flamingock-core/build.gradle.kts b/flamingock-core/build.gradle.kts index 7e2a1690c..57f1d3275 100644 --- a/flamingock-core/build.gradle.kts +++ b/flamingock-core/build.gradle.kts @@ -1,8 +1,7 @@ val jacksonVersion = "2.16.0" dependencies { api(project(":flamingock-core-api")) - api(project(":flamingock-core-cloud-api")) - api(project(":flamingock-template")) + api(project(":flamingock-core-template")) api(project(":utils")) api("javax.inject:javax.inject:1") api("org.reflections:reflections:0.10.1") diff --git a/flamingock-core/src/main/java/io/flamingock/core/cloud/planner/ExecutionPlanMapper.java b/flamingock-core/src/main/java/io/flamingock/core/cloud/planner/ExecutionPlanMapper.java index 990e30fd1..e2eac2fa2 100644 --- a/flamingock-core/src/main/java/io/flamingock/core/cloud/planner/ExecutionPlanMapper.java +++ b/flamingock-core/src/main/java/io/flamingock/core/cloud/planner/ExecutionPlanMapper.java @@ -33,7 +33,6 @@ import java.util.ArrayList; import java.util.Collections; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; diff --git a/flamingock-core/src/main/java/io/flamingock/core/configurator/legacy/LegacyMigration.java b/flamingock-core/src/main/java/io/flamingock/core/configurator/legacy/LegacyMigration.java index 6097ad26c..3eadc7432 100644 --- a/flamingock-core/src/main/java/io/flamingock/core/configurator/legacy/LegacyMigration.java +++ b/flamingock-core/src/main/java/io/flamingock/core/configurator/legacy/LegacyMigration.java @@ -16,8 +16,8 @@ package io.flamingock.core.configurator.legacy; -import io.changock.migration.api.annotations.NonLockGuarded; -import io.changock.migration.api.annotations.NonLockGuardedType; +import io.flamingock.core.api.annotations.NonLockGuarded; +import io.flamingock.core.api.annotations.NonLockGuardedType; @NonLockGuarded(NonLockGuardedType.NONE) public class LegacyMigration { diff --git a/flamingock-core/src/main/java/io/flamingock/core/runtime/RuntimeManager.java b/flamingock-core/src/main/java/io/flamingock/core/runtime/RuntimeManager.java index 8596ca24e..eb67a93ff 100644 --- a/flamingock-core/src/main/java/io/flamingock/core/runtime/RuntimeManager.java +++ b/flamingock-core/src/main/java/io/flamingock/core/runtime/RuntimeManager.java @@ -16,30 +16,26 @@ package io.flamingock.core.runtime; -import io.changock.migration.api.annotations.NonLockGuarded; -import io.flamingock.core.api.metadata.FlamingockMetadata; -import io.mongock.api.annotations.ChangeUnitConstructor; -import io.flamingock.core.api.annotations.FlamingockConstructor; +import io.flamingock.commons.utils.Constants; +import io.flamingock.commons.utils.StringUtil; +import io.flamingock.core.api.annotations.NonLockGuarded; import io.flamingock.core.api.exception.FlamingockException; +import io.flamingock.core.api.metadata.FlamingockMetadata; import io.flamingock.core.engine.lock.Lock; import io.flamingock.core.runtime.dependency.Dependency; import io.flamingock.core.runtime.dependency.DependencyInjectable; import io.flamingock.core.runtime.dependency.DependencyInjectableContext; import io.flamingock.core.runtime.dependency.exception.DependencyInjectionException; import io.flamingock.core.runtime.proxy.LockGuardProxyFactory; -import io.flamingock.commons.utils.Constants; -import io.flamingock.commons.utils.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.inject.Named; import java.lang.reflect.Constructor; import java.lang.reflect.Executable; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Parameter; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -50,28 +46,43 @@ public final class RuntimeManager implements DependencyInjectable { private static final Logger logger = LoggerFactory.getLogger(RuntimeManager.class); - private final FlamingockMetadata flamingockMetadata; - - - public static Builder builder() { - return new Builder(); - } - private static final Function parameterNameProvider = parameter -> parameter.isAnnotationPresent(Named.class) ? parameter.getAnnotation(Named.class).value() : null; + private final FlamingockMetadata flamingockMetadata; private final Set> nonProxyableTypes = Collections.emptySet(); private final DependencyInjectableContext dependencyContext; private final LockGuardProxyFactory proxyFactory; - private RuntimeManager(LockGuardProxyFactory proxyFactory, - DependencyInjectableContext dependencyContext, + DependencyInjectableContext dependencyContext, FlamingockMetadata flamingockMetadata) { this.dependencyContext = dependencyContext; this.proxyFactory = proxyFactory; this.flamingockMetadata = flamingockMetadata; } + public static Builder builder() { + return new Builder(); + } + + public static void logMethodWithArguments(String methodName, List changelogInvocationParameters) { + String arguments = changelogInvocationParameters.stream() + .map(RuntimeManager::getParameterType) + .collect(Collectors.joining(", ")); + logger.debug("method[{}] with arguments: [{}]", methodName, arguments); + + } + + private static String getParameterType(Object obj) { + String className = obj != null ? obj.getClass().getName() : "{null argument}"; + int mongockProxyPrefixIndex = className.indexOf(Constants.PROXY_MONGOCK_PREFIX); + if (mongockProxyPrefixIndex > 0) { + return className.substring(0, mongockProxyPrefixIndex); + } else { + return className; + } + } + @Override public void addDependencies(Collection dependencies) { dependencyContext.addDependencies(dependencies); @@ -121,6 +132,8 @@ private Object getParameter(Class type, Parameter parameter) { boolean lockGuarded = !type.isAnnotationPresent(NonLockGuarded.class) && !parameter.isAnnotationPresent(NonLockGuarded.class) + && !type.isAnnotationPresent(io.changock.migration.api.annotations.NonLockGuarded.class) + && !parameter.isAnnotationPresent(io.changock.migration.api.annotations.NonLockGuarded.class) && !nonProxyableTypes.contains(type) && (flamingockMetadata == null || !flamingockMetadata.isSuppressedProxies()); @@ -134,25 +147,6 @@ private String getParameterName(Parameter parameter) { return parameterNameProvider.apply(parameter); } - - public static void logMethodWithArguments(String methodName, List changelogInvocationParameters) { - String arguments = changelogInvocationParameters.stream() - .map(RuntimeManager::getParameterType) - .collect(Collectors.joining(", ")); - logger.debug("method[{}] with arguments: [{}]", methodName, arguments); - - } - - private static String getParameterType(Object obj) { - String className = obj != null ? obj.getClass().getName() : "{null argument}"; - int mongockProxyPrefixIndex = className.indexOf(Constants.PROXY_MONGOCK_PREFIX); - if (mongockProxyPrefixIndex > 0) { - return className.substring(0, mongockProxyPrefixIndex); - } else { - return className; - } - } - public static final class Builder { private DependencyInjectableContext dependencyContext; diff --git a/metadata-generator/src/main/java/io/flamingock/metadata/MetadataBundlerPlugin.kt b/metadata-generator/src/main/java/io/flamingock/metadata/MetadataBundlerPlugin.kt index eb2c9bc20..40b4c7b90 100644 --- a/metadata-generator/src/main/java/io/flamingock/metadata/MetadataBundlerPlugin.kt +++ b/metadata-generator/src/main/java/io/flamingock/metadata/MetadataBundlerPlugin.kt @@ -13,14 +13,14 @@ class MetadataBundlerPlugin : Plugin { override fun apply(project: Project) { val copyMetadata = project.tasks.register("copyMetadata") { dependsOn("compileJava") - from("${project.buildDir}/generated/sources/annotationProcessor/java/main/" + FlamingockMetadata.FILE_PATH) + from("${project.layout.buildDirectory}/generated/sources/annotationProcessor/java/main/" + FlamingockMetadata.FILE_PATH) into("${project.projectDir}$DESTINY_FOLDER") } val copyClassesToRegister = project.tasks.register("copyClassesToRegister") { dependsOn("compileJava") - from("${project.buildDir}/generated/sources/annotationProcessor/java/main/" + Constants.GRAALVM_REFLECT_CLASSES_PATH) + from("${project.layout.buildDirectory}/generated/sources/annotationProcessor/java/main/" + Constants.GRAALVM_REFLECT_CLASSES_PATH) into("${project.projectDir}$DESTINY_FOLDER") } diff --git a/settings.gradle.kts b/settings.gradle.kts index 92bb757f2..fbfaf709f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -5,9 +5,9 @@ rootProject.name = "flamingock-project" ////////////////////////////////////// // CORE ////////////////////////////////////// -include("flamingock-template") -project(":flamingock-template").projectDir = file("flamingock-template") -project(":flamingock-template").name = "flamingock-template" +include("flamingock-core-template") +project(":flamingock-core-template").projectDir = file("flamingock-core-template") +project(":flamingock-core-template").name = "flamingock-core-template" include("cloud-transactioners:sql-cloud-transactioner") @@ -19,10 +19,6 @@ include("flamingock-core-api") project(":flamingock-core-api").name = "flamingock-core-api" project(":flamingock-core-api").projectDir = file("flamingock-core-api") -include("flamingock-core-cloud-api") -project(":flamingock-core-cloud-api").projectDir = file("flamingock-core-cloud-api") -project(":flamingock-core-cloud-api").name = "flamingock-core-cloud-api" - include("flamingock-core") project(":flamingock-core").projectDir = file("flamingock-core") project(":flamingock-core").name = "flamingock-core" @@ -156,6 +152,6 @@ project(":metadata-generator").projectDir = file("metadata-generator") ////////////////////////////////////// // INTERNAL ////////////////////////////////////// -include("internal:legacy-importer-mongodb") -project(":internal:legacy-importer-mongodb").name = "legacy-importer-mongodb" -project(":internal:legacy-importer-mongodb").projectDir = file("internal/legacy-importer-mongodb") +include("cloud-importers:mongodb-sync4-cloud-importer") +project(":cloud-importers:mongodb-sync4-cloud-importer").name = "mongodb-sync4-cloud-importer" +project(":cloud-importers:mongodb-sync4-cloud-importer").projectDir = file("cloud-importers/mongodb-sync4-cloud-importer") diff --git a/templates/sql-template/build.gradle.kts b/templates/sql-template/build.gradle.kts index baac6366f..4d526a9f2 100644 --- a/templates/sql-template/build.gradle.kts +++ b/templates/sql-template/build.gradle.kts @@ -1,6 +1,6 @@ dependencies { - implementation(project(":flamingock-core")) - implementation(project(":flamingock-template")) + implementation(project(":flamingock-core-api")) + implementation(project(":flamingock-core-template")) } description = "${project.name}'s description" \ No newline at end of file diff --git a/templates/sql-template/src/main/java/io/flamingock/template/sql/SqlTemplateConfiguration.java b/templates/sql-template/src/main/java/io/flamingock/template/sql/SqlTemplateConfiguration.java index 571dee658..88ccd3345 100644 --- a/templates/sql-template/src/main/java/io/flamingock/template/sql/SqlTemplateConfiguration.java +++ b/templates/sql-template/src/main/java/io/flamingock/template/sql/SqlTemplateConfiguration.java @@ -16,8 +16,9 @@ package io.flamingock.template.sql; -import io.changock.migration.api.annotations.NonLockGuarded; -import io.changock.migration.api.annotations.NonLockGuardedType; + +import io.flamingock.core.api.annotations.NonLockGuarded; +import io.flamingock.core.api.annotations.NonLockGuardedType; @NonLockGuarded(NonLockGuardedType.NONE) public class SqlTemplateConfiguration { diff --git a/utils-test/build.gradle.kts b/utils-test/build.gradle.kts index ab249a7c3..7d1ff4dba 100644 --- a/utils-test/build.gradle.kts +++ b/utils-test/build.gradle.kts @@ -2,7 +2,7 @@ val jacksonVersion = "2.16.0" dependencies { api(project(":utils")) - api(project(":flamingock-core-cloud-api")) + api(project(":flamingock-core-api")) api("javax.inject:javax.inject:1") api("org.reflections:reflections:0.10.1")