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

Use of library from commonMain in Kotlin Multiplatform Project #460

Closed
joreilly opened this issue Dec 7, 2021 · 9 comments · Fixed by smithy-lang/smithy-kotlin#646 or #610
Closed
Assignees
Labels
guidance Question that needs advice or information.

Comments

@joreilly
Copy link

joreilly commented Dec 7, 2021

Describe the issue

I can include following for example as commonMain dependency in shared module of a Kotlin Multiplatform project and access/use code from JVM and Android code but if I try to use from commonMain source then only certain symbols appear to be resolvable (for example can access StaticCredentialsProvider but not DynamoDbClient). Perhaps this is expected right now?

api("aws.sdk.kotlin:dynamodb:0.9.4-beta")

Steps to Reproduce

per description

Current behavior

per description

AWS Kotlin SDK version used

0.9.4

Platform (JVM/JS/Native)

JVM/Android/Common

Operating System and version

macOS 11.4

@joreilly joreilly added guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged. labels Dec 7, 2021
@aajtodd
Copy link
Collaborator

aajtodd commented Dec 8, 2021

Yes this is expected right now. The services are built with the Kotlin/JVM plugin still. You should be able to access them from a JVM sourceSet. Most of the runtime itself is implemented with the multiplatform plugin which is why you can access it from common.

Support for other targets is on our roadmap. The best thing you can do right now is to upvote the existing issues with the targets you would like to see supported.

I agree that the ability to use the services in a common sourceSet (targeting only jvm() and android() for now of course) would be useful but it may not come until we get to supporting one of the other KMP targets outright.

@aajtodd aajtodd removed the needs-triage This issue or PR still needs to be triaged. label Dec 8, 2021
@kggilmer
Copy link
Contributor

kggilmer commented Dec 8, 2021

Here is a list of all of our existing feature requests @joreilly , and these two are particular to KMP/js and KMP/native support.

@aajtodd
Copy link
Collaborator

aajtodd commented Jan 13, 2022

related to: smithy-lang/smithy-kotlin#437

Once that's done we should be able to update the service builds to publish as KMP projects (with only JVM target support for now) with all the KMP metadata.

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@ianbotsf
Copy link
Contributor

The fix for this issue has been pushed to main and should be included in the next release (likely this week). With that release, it should be possible to reference service clients and related types from common source sets (instead of requiring JVM).

Note that the AWS SDK for Kotlin does yet not support non-JVM targets but they are on our roadmap as #228 and #229.

@joreilly
Copy link
Author

I see that a 0.16.0 version was released but doesn't look like it's been published yet?

@aajtodd
Copy link
Collaborator

aajtodd commented May 27, 2022

We were having some issues syncing with maven central, it appears to be available now (e.g. dynamodb-jvm)

NOTE: we accidentally cut this release without the -beta qualifier. Future dev preview releases will use this qualifier again though.

@joreilly
Copy link
Author

joreilly commented May 27, 2022

Let me know if it's better to create another issue for this but getting following now when trying (in JVM code) to populate DynamoDb table (on M1 device)....seems related to aws/aws-sdk-java-v2#2942 ?

Unable to unpack AWS CRT lib: java.io.IOException: Unable to open library in jar for AWS CRT: /osx/armv8/libaws-crt-jni.dylib
java.io.IOException: Unable to open library in jar for AWS CRT: /osx/armv8/libaws-crt-jni.dylib

...actually, looks like this is already captured in #473

I'm assuming this probably isn't new behaviour with this version but just that I moved over to using M1 device since I was trying this before.

@ianbotsf
Copy link
Contributor

That's correct @joreilly, this is a known issue. We're in the final stages of changes which will remove the CRT as a required dependency and enable the AWS SDK for Kotlin to run on Apple M1 so hopefully that issue won't be around much longer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Question that needs advice or information.
Projects
None yet
4 participants