-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix native build of s3 when aws-crt is not present (#858)
- Loading branch information
1 parent
99d3126
commit f882f30
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
s3/runtime/src/main/java/io/quarkus/amazon/s3/runtime/S3CrtSubstitutions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
} |