diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index bb09b2f..80f1b01 100755 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -1,8 +1,6 @@ name: Java CI with Gradle env: - GITHUB_ACTOR: ${{ github.actor }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CI: true on: @@ -17,9 +15,12 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + packages: write steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 + - name: Set up JDK 21 uses: actions/setup-java@v4 with: @@ -40,4 +41,14 @@ jobs: path: '**/build/test-results/**/*.xml' - name: Containerize - run: ./gradlew jib -Djib.to.auth.username=${{ secrets.DOCKER_USR }} -Djib.to.auth.password=${{ secrets.DOCKER_PSW }} -Djib.console='plain' + run: ./gradlew jib -Djib.console='plain' + env: + DOCKER_USR: ${{ secrets.DOCKER_USR }} + DOCKER_PSW: ${{ secrets.DOCKER_PSW }} + + - name: Publish package + run: ./gradlew publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GNUPG_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GNUPG_PASSPHRASE }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 31ff3ba..2a2a2be 100755 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,45 +1,32 @@ -name: Release +name: Publish package to the Maven Central Repository + +env: + CI: true on: - workflow_dispatch: - inputs: - version: - description: 'Version' - required: true + release: + types: [ created ] jobs: - tagging: - name: Release of [${{ github.event.inputs.version }}] + publish_release: runs-on: ubuntu-latest - steps: - name: Checkout uses: actions/checkout@v4 - with: - ref: release/${{ github.event.inputs.version }} - fetch-depth: 0 - - - name: Config Git - run: | - git config user.name ${{ github.actor }} - git config user.email "${{ github.actor }}@users.noreply.github.com" - - name: Merge on master - run: | - git checkout master - git merge --no-ff release/${{ github.event.inputs.version }} - git push - - - name: Tag on master - run: | - git tag --annotate --message 'Release ${{ github.event.inputs.version }}' ${{ github.event.inputs.version }} - git push origin ${{ github.event.inputs.version }} - - - name: Merge on develop - run: | - git checkout develop - git merge --no-ff release/${{ github.event.inputs.version }} - git push - - - name: Delete released branch - run: git push origin :release/${{ github.event.inputs.version }} + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3.1.0 + + - name: Publish package + run: ./gradlew publish + env: + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GNUPG_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GNUPG_PASSPHRASE }} diff --git a/build.gradle.kts b/build.gradle.kts index 907e075..1e31541 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,9 +1,9 @@ plugins { java + id("org.ajoberstar.grgit") version "5.2.2" } -version = "1.0.0-SNAPSHOT" -group = "com.frogdevelopment" +group = "com.frogdevelopment.consul-populate" repositories { mavenCentral() @@ -13,3 +13,46 @@ java { sourceCompatibility = JavaVersion.toVersion("21") targetCompatibility = JavaVersion.toVersion("21") } + +afterEvaluate { + computeProjectVersion() +} + +fun computeProjectVersion() { + val branchName = grgit.branch.current().name + + println("Current branch: $branchName") + + val computedVersion = when (branchName) { + "HEAD" -> handleHead() + "develop" -> handleDevelop() + else -> handleBranch(branchName) + } + + allprojects { + group = rootProject.group + version = computedVersion + } + + println("Computed version: $version") +} + +fun handleHead(): String { + val githubRefName = System.getenv("GITHUB_REF_NAME") + if (githubRefName == null || githubRefName.isEmpty()) { + throw GradleException("One does not simply build from HEAD. Checkout to matching local branch !!") + } + return githubRefName +} + +fun handleDevelop(): String { + return "develop-SNAPSHOT" +} + +fun handleBranch(branchName: String): String { + val matchBranchResult = """^(?\w+)/(?
.+)?$""".toRegex().find(branchName) + val branchType = matchBranchResult!!.groups["type"]?.value!! + val branchDetails = matchBranchResult.groups["details"]?.value!! + + return "$branchType-$branchDetails-SNAPSHOT" +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 0000000..cc02e63 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + `kotlin-dsl` +} + +repositories { + gradlePluginPortal() +} diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts new file mode 100644 index 0000000..29744ec --- /dev/null +++ b/buildSrc/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "buildSrc" diff --git a/buildSrc/src/main/kotlin/com.frogdevelopment.publish-conventions.gradle.kts b/buildSrc/src/main/kotlin/com.frogdevelopment.publish-conventions.gradle.kts new file mode 100644 index 0000000..e4f087d --- /dev/null +++ b/buildSrc/src/main/kotlin/com.frogdevelopment.publish-conventions.gradle.kts @@ -0,0 +1,98 @@ +plugins { + java + `maven-publish` + signing +} + +java { + withJavadocJar() + withSourcesJar() +} + +publishing { + publications { + create("mavenJava") { + from(components["java"]) + + versionMapping { + usage("java-api") { + fromResolutionOf("runtimeClasspath") + } + usage("java-runtime") { + fromResolutionResult() + } + } + + pom { + description = project.description + url = "https://github.com/FrogDevelopment/consul-populate/wiki" + inceptionYear = "2024" + issueManagement { + system = "GitHub" + url = "https://github.com/FrogDevelopment/consul-populate/issues" + } + developers { + developer { + id = "FrogDevelopper" + name = "Le Gall Benoît" + email = "legall.benoit@gmail.com" + url = "https://github.com/FrogDevelopper" + timezone = "Europe/Paris" + } + } + licenses { + license { + name = "The Apache License, Version 2.0" + url = "https://www.apache.org/licenses/LICENSE-2.0.txt" + } + } + scm { + connection = "scm:git:git://github.com/FrogDevelopment/consul-populate.git" + developerConnection = "scm:git:ssh://github.com:FrogDevelopment/consul-populate.git" + url = "https://github.com/FrogDevelopment/consul-populate/tree/master" + } + distributionManagement { + downloadUrl = "https://github.com/FrogDevelopment/consul-populate/releases" + } + } + } + } + + repositories { + maven { + name = "sonatype" + url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") + credentials { + username = System.getenv("OSSRH_USERNAME") + password = System.getenv("OSSRH_TOKEN") + } + } + + maven { + name = "github" + url = uri("https://maven.pkg.github.com/FrogDevelopment/consul-populate") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } +} +val releaseVersion = """^\d+\.\d+\.\d+$""".toRegex().matches(version.toString()) +signing { + if (releaseVersion) { + val signingKey: String? by project + val signingPassword: String? by project + useInMemoryPgpKeys(signingKey, signingPassword) + sign(publishing.publications["mavenJava"]) + } +} + +tasks { + matching { it is PublishToMavenRepository && it.repository.name == "sonatype" }.all { + onlyIf { releaseVersion } + } + matching { it is PublishToMavenRepository && it.repository.name == "github" }.all { + onlyIf { !releaseVersion } + } +} diff --git a/consul-populate-cli/build.gradle.kts b/consul-populate-cli/build.gradle.kts index 9c24883..f01432e 100644 --- a/consul-populate-cli/build.gradle.kts +++ b/consul-populate-cli/build.gradle.kts @@ -1,6 +1,8 @@ plugins { id("io.micronaut.minimal.application") version "4.3.8" + id("com.frogdevelopment.publish-conventions") alias(libs.plugins.jib) + alias(libs.plugins.shadow) } micronaut { @@ -32,19 +34,40 @@ dependencies { testImplementation(libs.testcontainers.consul) testImplementation(libs.vertx.consul) testImplementation(libs.systemlambda) - } application { mainClass.set("com.frogdevelopment.consul.populate.ConsulPopulateCommand") } +publishing { + publications { + named("mavenJava") { + shadow.component(this) + + pom { + name = "Consul Populate - CLI" + description = "CLI executable for Consul Populate" + } + } + } +} + tasks { + jar { + enabled = false + } + shadowJar { +// minimize() waiting https://github.com/johnrengelman/shadow/pull/876 + archiveClassifier.set("") + } + + test { // https://github.com/stefanbirkner/system-lambda/issues/27 systemProperty("java.security.manager", "allow") - // #https://junit-pioneer.org/docs/environment-variables/#warnings-for-reflective-access + // https://junit-pioneer.org/docs/environment-variables/#warnings-for-reflective-access // jvmArgs = listOf("--add-opens java.base/java.util=ALL-UNNAMED","--add-opens java.base/java.lang=ALL-UNNAMED") // environment.put("CONSUL_HOST", "qwert") @@ -75,6 +98,12 @@ tasks { to { image = "frogdevelopment/consul-populate:${rootProject.version}" + if (System.getenv("CI") == "true") { + auth { + username = System.getenv("DOCKER_USR") + password = System.getenv("DOCKER_PSW") + } + } } container { diff --git a/consul-populate-core/build.gradle.kts b/consul-populate-core/build.gradle.kts index f1bb78b..1a3aa12 100644 --- a/consul-populate-core/build.gradle.kts +++ b/consul-populate-core/build.gradle.kts @@ -1,6 +1,6 @@ plugins { id("io.micronaut.minimal.library") version "4.3.8" - `maven-publish` + id("com.frogdevelopment.publish-conventions") } micronaut { @@ -34,3 +34,14 @@ dependencies { testImplementation(libs.testcontainers.junit) testImplementation(libs.testcontainers.consul) } + +publishing { + publications { + named("mavenJava") { + pom { + name = "Consul Populate - Core" + description = "Core library for Consul Populate" + } + } + } +} diff --git a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/DataImporter.java b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/DataImporter.java index a786b83..dd41fb4 100644 --- a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/DataImporter.java +++ b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/DataImporter.java @@ -4,8 +4,19 @@ import io.micronaut.core.annotation.NonNull; +/** + * Interface to extend with the specific import type implementation + * + * @author Le Gall Benoît + * @since 1.0.0 + */ public interface DataImporter { + /** + * Do the import from the data type + * + * @return Map of key-value to be imported into Consul's KV + */ @NonNull Map execute(); diff --git a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/PopulateService.java b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/PopulateService.java index dee872f..94c86a0 100644 --- a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/PopulateService.java +++ b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/PopulateService.java @@ -1,6 +1,15 @@ package com.frogdevelopment.consul.populate; +/** + * Entry point to run the data import + * + * @author Le Gall Benoît + * @since 1.0.0 + */ public interface PopulateService { + /** + * Main method that is going to do the defined import into Consul's KV + */ void populate(); } diff --git a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/PopulateServiceImpl.java b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/PopulateServiceImpl.java index 5d66010..de01b28 100644 --- a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/PopulateServiceImpl.java +++ b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/PopulateServiceImpl.java @@ -19,6 +19,10 @@ import io.vertx.ext.consul.TxnKVVerb; import io.vertx.ext.consul.TxnRequest; +/** + * @author Le Gall Benoît + * @since 1.0.0 + */ @Slf4j @Singleton @RequiredArgsConstructor @@ -32,7 +36,7 @@ class PopulateServiceImpl implements PopulateService { public void populate() { try { toBlocking(consulClient.leaderStatus()); - } catch (Exception e) { + } catch (final Exception e) { throw new IllegalStateException("Consul is not reachable/ready to be populate. Please check error logs", e); } @@ -40,7 +44,7 @@ public void populate() { log.info("Retrieving data to export"); // Importing data from configured type - var configsToImport = dataImporter.execute() + final var configsToImport = dataImporter.execute() .entrySet() .stream().collect(Collectors.toMap(entry -> kvPath + entry.getKey(), Map.Entry::getValue)); @@ -52,7 +56,7 @@ public void populate() { .forEach(txnRequest::addOperation); // retrieve current configs in Consul KV - var existingKeysInConsul = toBlocking(consulClient.getKeys(kvPath)); + final var existingKeysInConsul = toBlocking(consulClient.getKeys(kvPath)); // keep only those that are to be deleted (no present anymore in the data pushed) existingKeysInConsul.stream() @@ -61,7 +65,7 @@ public void populate() { .forEach(txnRequest::addOperation); log.info("Exporting data to consul"); - var result = toBlocking(consulClient.transaction(txnRequest)); + final var result = toBlocking(consulClient.transaction(txnRequest)); log.info("succeeded results size: {}", result.getResultsSize()); if (result.getErrorsSize() > 0) { log.error("Some operations ({}) lead to error:{}", diff --git a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/VertxUtils.java b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/VertxUtils.java index e175c76..d90dcbe 100644 --- a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/VertxUtils.java +++ b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/VertxUtils.java @@ -8,18 +8,34 @@ import io.vertx.core.Future; +/** + * Util class to help use the {@link io.vertx.core.Vertx} + * + * @author Le Gall Benoît + * @see Future + * @since 1.0.0 + */ @Slf4j @NoArgsConstructor(access = AccessLevel.PRIVATE) public class VertxUtils { + /** + * Util method to help use the Vertx {@link Future} as a blocking call + * + * @param future future to execute as a blocking code + * @param type of the result + * @return the result value + * @see Future + * @see java.util.concurrent.CompletionStage + */ public static T toBlocking(final Future future) { try { return future.toCompletionStage().toCompletableFuture().get(); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { log.warn("Interrupted!", e); Thread.currentThread().interrupt(); throw new IllegalStateException(e); - } catch (ExecutionException e) { + } catch (final ExecutionException e) { throw new IllegalStateException(e); } } diff --git a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/config/ConsulFactory.java b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/config/ConsulFactory.java index 9af63b1..dc14950 100644 --- a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/config/ConsulFactory.java +++ b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/config/ConsulFactory.java @@ -8,6 +8,12 @@ import io.vertx.ext.consul.ConsulClient; import io.vertx.ext.consul.ConsulClientOptions; +/** + * Factory managing {@link Vertx} classes instances for vertx-consul + * + * @author Le Gall Benoît + * @since 1.0.0 + */ @Factory public class ConsulFactory { diff --git a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/config/GlobalProperties.java b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/config/GlobalProperties.java index 0031af1..a127321 100644 --- a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/config/GlobalProperties.java +++ b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/config/GlobalProperties.java @@ -12,6 +12,12 @@ import io.micronaut.context.annotation.ConfigurationProperties; import io.micronaut.context.annotation.Context; +/** + * Properties for Consul connection and KV path + * + * @author Le Gall Benoît + * @since 1.0.0 + */ @Data @Context @ConfigurationProperties("consul") @@ -52,6 +58,12 @@ public class GlobalProperties { @NotNull private KV kv = new KV(); + /** + * KV configuration for the import + * + * @author Le Gall Benoît + * @since 1.0.0 + */ @Data @ConfigurationProperties("kv") public static class KV { @@ -68,7 +80,7 @@ public static class KV { private Optional<@Pattern(regexp = "[\\w\\-\\.]+") String> version = Optional.empty(); /** - * @return Path by concatenating {@code kv.path} & {@code kv.version} if present + * @return Path by concatenating {@code kv.path} and {@code kv.version} if present */ @ToString.Include(name = "path") public String getPath() { diff --git a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/config/ImportProperties.java b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/config/ImportProperties.java index 577207e..68e97c0 100644 --- a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/config/ImportProperties.java +++ b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/config/ImportProperties.java @@ -1,4 +1,8 @@ package com.frogdevelopment.consul.populate.config; +/** + * @author Le Gall Benoît + * @since 1.0.0 + */ public interface ImportProperties { } diff --git a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/config/package-info.java b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/config/package-info.java new file mode 100644 index 0000000..ab1c948 --- /dev/null +++ b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/config/package-info.java @@ -0,0 +1,7 @@ +/** + * Contains configuration required for the full process + * + * @author Le Gall Benoît + * @since 1.0.0 + */ +package com.frogdevelopment.consul.populate.config; diff --git a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/FilesImporter.java b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/FilesImporter.java index 7a60bf7..f967705 100644 --- a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/FilesImporter.java +++ b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/FilesImporter.java @@ -20,6 +20,12 @@ import io.micronaut.core.annotation.Nullable; import io.micronaut.core.util.ArrayUtils; +/** + * Base logic when importing data from files + * + * @author Le Gall Benoît + * @since 1.0.0 + */ @RequiredArgsConstructor abstract sealed class FilesImporter implements DataImporter permits JsonFilesImporter, PropertiesFilesImporter, YamlFilesImporter { @@ -108,6 +114,10 @@ private boolean filterFile(@NonNull final File file) { return isExtensionAccepted(extension); } + /** + * @param extension File extension + * @return {@code true} if the extension is supported + */ protected abstract boolean isExtensionAccepted(@NonNull final String extension); @Nullable diff --git a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/ImportFileProperties.java b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/ImportFileProperties.java index 1bcee8f..ea65cc3 100644 --- a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/ImportFileProperties.java +++ b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/ImportFileProperties.java @@ -9,6 +9,12 @@ import io.micronaut.context.annotation.ConfigurationProperties; +/** + * Properties for files import + * + * @author Le Gall Benoît + * @since 1.0.0 + */ @Data @ConfigurationProperties("consul.files") public final class ImportFileProperties implements ImportProperties { @@ -25,9 +31,15 @@ public final class ImportFileProperties implements ImportProperties { @NotBlank private String target; + /** + * Format of files to import + */ @NotNull private Format format = Format.YAML; + /** + * Supported type of file format + */ public enum Format { YAML, JSON, diff --git a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/JsonFilesImporter.java b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/JsonFilesImporter.java index a7b70e1..7e24840 100644 --- a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/JsonFilesImporter.java +++ b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/JsonFilesImporter.java @@ -17,6 +17,13 @@ import io.micronaut.core.annotation.NonNull; import io.micronaut.core.annotation.Nullable; +/** + * Implementation for JSON files import + * + * @author Le Gall Benoît + * @see ObjectMapper + * @since 1.0.0 + */ @Singleton @Requires(property = "consul.files.format", value = "JSON") public final class JsonFilesImporter extends FilesImporter { @@ -25,6 +32,12 @@ public final class JsonFilesImporter extends FilesImporter { private final ObjectMapper objectMapper; + /** + * Constructor + * + * @param importProperties Properties for the import + * @param objectMapper ObjectMapper instance used for Json I/O + */ public JsonFilesImporter(final ImportFileProperties importProperties, final ObjectMapper objectMapper) { super(importProperties); this.objectMapper = objectMapper; diff --git a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/MapHelper.java b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/MapHelper.java index fd6a3c1..f8ae753 100644 --- a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/MapHelper.java +++ b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/MapHelper.java @@ -9,9 +9,22 @@ import io.micronaut.core.annotation.NonNull; +/** + * Helper to merge maps + * + * @author Le Gall Benoît + * @since 1.0.0 + */ @NoArgsConstructor(access = AccessLevel.PRIVATE) public final class MapHelper { + /** + * Merging maps + * + * @param source Source to be merged + * @param override Data use to merge + * @return the merged result + */ static @NonNull Map> merge( @NonNull final Map> source, @NonNull final Map> override) { @@ -28,6 +41,12 @@ public final class MapHelper { return merged; } + /** + * + * @param source Source to be merged + * @param override Data use to merge + * @return the merged map + */ @SuppressWarnings({"rawtypes", "unchecked"}) static @NonNull SequencedMap mergeMaps(@NonNull final Map source, @NonNull final Map override) { diff --git a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/PropertiesFilesImporter.java b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/PropertiesFilesImporter.java index 85136d8..a7b76b7 100644 --- a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/PropertiesFilesImporter.java +++ b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/PropertiesFilesImporter.java @@ -15,12 +15,24 @@ import io.micronaut.core.annotation.NonNull; import io.micronaut.core.annotation.Nullable; +/** + * Implementation for Properties files import + * + * @author Le Gall Benoît + * @see Properties + * @since 1.0.0 + */ @Singleton @Requires(property = "consul.files.format", value = "PROPERTIES") public final class PropertiesFilesImporter extends FilesImporter { private static final List EXTENSIONS = List.of("properties"); + /** + * Constructor + * + * @param importProperties Properties for the import + */ public PropertiesFilesImporter(final ImportFileProperties importProperties) { super(importProperties); } diff --git a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/YamlFilesImporter.java b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/YamlFilesImporter.java index c25e0d3..08fe72d 100644 --- a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/YamlFilesImporter.java +++ b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/YamlFilesImporter.java @@ -14,6 +14,13 @@ import io.micronaut.core.annotation.NonNull; import io.micronaut.core.annotation.Nullable; +/** + * Implementation for YAML files import + * + * @author Le Gall Benoît + * @see Yaml + * @since 1.0.0 + */ @Singleton @Requires(property = "consul.files.format", value = "YAML") public final class YamlFilesImporter extends FilesImporter { @@ -22,6 +29,11 @@ public final class YamlFilesImporter extends FilesImporter { private final Yaml yaml = new Yaml(); + /** + * Constructor + * + * @param importProperties Properties for the import + */ public YamlFilesImporter(final ImportFileProperties importProperties) { super(importProperties); } diff --git a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/package-info.java b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/package-info.java index e576ab6..ed067e6 100644 --- a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/package-info.java +++ b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/files/package-info.java @@ -1,3 +1,9 @@ +/** + * Contains logic implementation for Files import + * + * @author Le Gall Benoît + * @since 1.0.0 + */ @Configuration @Requires(property = "consul.files") package com.frogdevelopment.consul.populate.files; diff --git a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/git/GitImporter.java b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/git/GitImporter.java index c651439..1cd0a72 100644 --- a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/git/GitImporter.java +++ b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/git/GitImporter.java @@ -7,6 +7,12 @@ import com.frogdevelopment.consul.populate.DataImporter; +/** + * Not supported yet + * + * @author Le Gall Benoît + * @since 1.0.0 + */ @Singleton @RequiredArgsConstructor public class GitImporter implements DataImporter { diff --git a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/git/package-info.java b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/git/package-info.java index e1b4e1b..e94d58a 100644 --- a/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/git/package-info.java +++ b/consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/git/package-info.java @@ -1,3 +1,9 @@ +/** + * Contains logic implementation for Git import + * + * @author Le Gall Benoît + * @since 1.0.0 + */ @Configuration @Requires(property = "consul.git") package com.frogdevelopment.consul.populate.git; diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1463f55..fa4affb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,6 +6,8 @@ testcontainers = "1.19.8" vertx = "4.5.7" plugin-jib = "3.4.2" +plugin-grgit = "5.2.2" +plugin-shadow = "8.1.1" [libraries] commons-io = { module = "commons-io:commons-io", version.ref = "commons-io" } @@ -18,3 +20,5 @@ vertx-consul = { module = "io.vertx:vertx-consul-client", version.ref = "vertx" [plugins] jib = { id = "com.google.cloud.tools.jib", version.ref = "plugin-jib" } +grgit = { id = "org.ajoberstar.grgit", version.ref = "plugin-grgit" } +shadow = { id = "com.github.johnrengelman.shadow", version.ref = "plugin-shadow" }