Skip to content

Commit

Permalink
refactor: migrate to Java ServiceLoader for plugin registration
Browse files Browse the repository at this point in the history
  • Loading branch information
fhussonnois committed Apr 24, 2024
1 parent 2debfb5 commit 21c016d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2
Expand Down
19 changes: 7 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ repositories {
}
}

sourceCompatibility = 17
targetCompatibility = 17
sourceCompatibility = 21
targetCompatibility = 21

group "io.kestra.plugin"
description 'Access and manipulate MongoDB data within Kestra workflows.'
Expand All @@ -33,22 +33,16 @@ tasks.withType(JavaCompile) {
}

dependencies {
// lombok
// Lombok
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"

// micronaut
annotationProcessor platform("io.micronaut.platform:micronaut-platform:$micronautVersion")
annotationProcessor "io.micronaut:micronaut-inject-java"
annotationProcessor "io.micronaut.validation:micronaut-validation-processor"

// Micronaut
compileOnly platform("io.micronaut.platform:micronaut-platform:$micronautVersion")
compileOnly "io.micronaut:micronaut-inject"
compileOnly "io.micronaut.validation:micronaut-validation"
compileOnly "io.micronaut:micronaut-jackson-databind"
compileOnly "io.micronaut.reactor:micronaut-reactor"

// kestra
// Kestra
annotationProcessor group: "io.kestra", name: "processor", version: kestraVersion
compileOnly group: "io.kestra", name: "core", version: kestraVersion

api 'org.mongodb:mongodb-driver-sync:5.0.1'
Expand Down Expand Up @@ -85,6 +79,7 @@ dependencies {
testImplementation "io.micronaut.test:micronaut-test-junit5"

// kestra
testAnnotationProcessor group: "io.kestra", name: "processor", version: kestraVersion
testImplementation group: "io.kestra", name: "core", version: kestraVersion
testImplementation group: "io.kestra", name: "storage-local", version: kestraVersion

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=0.17.0-SNAPSHOT
kestraVersion=[0.16,)
kestraVersion=[0.17,)
micronautVersion=4.3.7
lombokVersion=1.18.32
2 changes: 0 additions & 2 deletions src/main/java/io/kestra/plugin/mongodb/Delete.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import io.kestra.core.models.executions.metrics.Counter;
import io.kestra.core.models.tasks.RunnableTask;
import io.kestra.core.runners.RunContext;
import io.micronaut.core.annotation.Introspected;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.experimental.SuperBuilder;
Expand Down Expand Up @@ -90,7 +89,6 @@ public Delete.Output run(RunContext runContext) throws Exception {
}
}

@Introspected
public enum Operation {
DELETE_ONE,
DELETE_MANY
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/io/kestra/plugin/mongodb/MongoDbConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import io.kestra.core.exceptions.IllegalVariableEvaluationException;
import io.kestra.core.models.annotations.PluginProperty;
import io.kestra.core.runners.RunContext;
import io.micronaut.core.annotation.Introspected;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
Expand All @@ -17,7 +16,6 @@
@SuperBuilder
@NoArgsConstructor
@Getter
@Introspected
public class MongoDbConnection {
@Schema(
title = "Connection string to MongoDB server.",
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/io/kestra/plugin/mongodb/Update.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import io.kestra.core.models.executions.metrics.Counter;
import io.kestra.core.models.tasks.RunnableTask;
import io.kestra.core.runners.RunContext;
import io.micronaut.core.annotation.Introspected;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.experimental.SuperBuilder;
Expand Down Expand Up @@ -123,7 +122,6 @@ public Update.Output run(RunContext runContext) throws Exception {
}
}

@Introspected
public enum Operation {
REPLACE_ONE,
UPDATE_ONE,
Expand Down

0 comments on commit 21c016d

Please sign in to comment.