Skip to content

Commit

Permalink
fix: fix native build of s3 when aws-crt is not present (#858)
Browse files Browse the repository at this point in the history
  • Loading branch information
scrocquesel authored Jul 26, 2023
1 parent 99d3126 commit f882f30
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/includes/attributes.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:quarkus-version: 3.2.1.Final
:quarkus-version: 3.2.2.Final
:quarkus-amazon-services-version: 2.4.1
:maven-version: 3.8.1+

Expand Down
5 changes: 5 additions & 0 deletions s3/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@
<groupId>org.jboss.logging</groupId>
<artifactId>commons-logging-jboss-logging</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.sdk</groupId>
<artifactId>graal-sdk</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package io.quarkus.amazon.s3.runtime;

import java.util.Arrays;
import java.util.function.BooleanSupplier;

import com.oracle.svm.core.annotate.Delete;
import com.oracle.svm.core.annotate.TargetClass;

import software.amazon.awssdk.services.s3.internal.crt.DefaultS3CrtAsyncClient;
import software.amazon.awssdk.services.s3.internal.crt.S3CrtAsyncClient;

public class S3CrtSubstitutions {

static final String SOFTWARE_AMAZON_AWSSDK_CRT_PACKAGE = "software.amazon.awssdk.crt";

static final class IsCrtAbsent implements BooleanSupplier {
@Override
public boolean getAsBoolean() {
return !Arrays.asList(Package.getPackages()).stream()
.map(p -> p.getName())
.anyMatch(p -> p.equals(SOFTWARE_AMAZON_AWSSDK_CRT_PACKAGE));
}
}
}

@TargetClass(value = DefaultS3CrtAsyncClient.class, onlyWith = S3CrtSubstitutions.IsCrtAbsent.class)
@Delete
final class Delete_DefaultS3CrtAsyncClient {
}

@TargetClass(value = S3CrtAsyncClient.class, onlyWith = S3CrtSubstitutions.IsCrtAbsent.class)
@Delete
final class Delete_S3CrtAsyncClient {
}

0 comments on commit f882f30

Please sign in to comment.