Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: migrate to Java ServiceLoader for plugin registration #118

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,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
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