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 1b8c4cc commit 0aec784
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ repositories {
}
}

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

group "io.kestra.storage"
description = 'Google Cloud Storage storage plugin for Kestra'
Expand Down Expand Up @@ -57,6 +57,7 @@ dependencies {

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

// libs
api platform('com.google.cloud:libraries-bom:26.37.0')
Expand Down Expand Up @@ -99,6 +100,7 @@ dependencies {

testImplementation group: "io.kestra", name: "core", version: kestraVersion
testImplementation group: "io.kestra", name: "core", version: kestraVersion, classifier: 'tests'
testAnnotationProcessor group: "io.kestra", name: "processor", 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
5 changes: 4 additions & 1 deletion src/main/java/io/kestra/storage/gcs/GcsStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.api.gax.paging.Page;
import com.google.cloud.WriteChannel;
import com.google.cloud.storage.*;
import io.kestra.core.models.annotations.Plugin;
import io.kestra.core.storages.FileAttributes;
import io.micronaut.core.annotation.Introspected;
import io.kestra.core.storages.StorageInterface;
Expand All @@ -22,20 +23,22 @@

import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import lombok.NoArgsConstructor;

import static io.kestra.core.utils.Rethrow.throwFunction;

@Singleton
@GcsStorageEnabled
@Introspected
@Plugin
@NoArgsConstructor
public class GcsStorage implements StorageInterface {
@Inject
Storage storage;

@Inject
GcsConfig config;


private BlobId blob(String tenantId, URI uri) {
String path = getPath(tenantId, uri);
return blob(path);
Expand Down

0 comments on commit 0aec784

Please sign in to comment.