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

[Feature] Add ability to specify external dependencies #37

Open
IlyaGulya opened this issue Aug 2, 2024 · 13 comments
Open

[Feature] Add ability to specify external dependencies #37

IlyaGulya opened this issue Aug 2, 2024 · 13 comments

Comments

@IlyaGulya
Copy link
Collaborator

Tracking issue for external dependencies.

We should allow either of these two options:

  1. Provide path to custom Package.swift, parse it and configure cinterop accordingly
  2. Add APIs to give user more flexibility around Package.swift configuration.
@jvondermarck
Copy link

When it will be available ? I really need to use external dependencies...

@IlyaGulya
Copy link
Collaborator Author

When it will be available ? I really need to use external dependencies...

Unfortunately, I'm quite busy for the next couple of weeks 🙁
I will be able to start investigating this issue on the beginning of October.

@jvondermarck
Copy link

Awesome, if you do this feature, it will be insane because so far there is literally NO WAY to call Swift code from your kotlin code that use external libraries.

@misha-dorokhin-fourthline

We are really interested to see this feature working. Is there any update? How can we help?

@estreteca
Copy link

Super interesado en esta funcionalidad, realmente es muy complicado usas sdk externos en KMP

@IlyaGulya
Copy link
Collaborator Author

Small update: I'm working on it, but this is quite challenging task to do.
@jvondermarck @misha-dorokhin-fourthline @estreteca
It would be nice if you will share with me your use cases and how you are expecting to use this feature.
What project structure do you have?
All these questions are crucial to make good API.

Currently I have extremely basic implementation which supports only one KMP module and does not support any other use-case: #47
I'm planning on making SNAPSHOT releases on this weekend

@frankois944
Copy link

frankois944 commented Nov 3, 2024

@IlyaGulya if you can reproduce (or even call) from Gradle the following command

  • swift package add-dependency
  • swift package add-target-dependency

The official command for updating a package file from command line.

The best way is using what the command line is offering.

UPDATE: after reading your PR, you're doing it yourself, not the command line.

@frankois944
Copy link

frankois944 commented Nov 3, 2024

By exemple: You can generate and check what you're doing for a package by the following commands

swift package init --name cinteropName --type empty --disable-xctest --disable-swift-testing
swift package add-dependency https://github.com/firebase/firebase-ios-sdk.git --from 11.0.0
swift package add-target --type library cinteropName
swift package add-target-dependency FirebaseAuth cinteropName --package firebase-ios-sdk
swift package add-product --targets cinteropName --type static-library cinteropName

In this current case, the package name of Firebase need to be declared and also the platform target of the generated product.

The platform can't be added from the command line (nooooh!) and local package directly.

then test with swift build cmd

@frankois944
Copy link

frankois944 commented Nov 3, 2024

@IlyaGulya I did something from a fork of your current PR branch, replacing text manipulation by the command line and more.
See my PR : #49

All tests are passing and if you like it, tell me.

@IlyaGulya
Copy link
Collaborator Author

@frankois944 thanks, I will take a look this week!

@frankois944
Copy link

frankois944 commented Nov 7, 2024

@IlyaGulya on the continuation of the PR #49, I have made another branch for managing local/remote binary (not in PR right now).

@estreteca
Copy link

@IlyaGulya For example, I need to use the swift package manager sdk, or my own .framework locally. How would I do it? I import my packages normally in Swift, but in my classes and functions @objc I could use it without the compatibility problem that it generates

@frankois944
Copy link

frankois944 commented Nov 15, 2024

@estreteca
we can't import directly a spm dependency to a kmp project like CocoaPods.
SPM can't generate the header/bridge, which is mandatory, of a product's dependency but only the final product.

The current work will make possible to add external dependency of the source swift file used.
This plugin makes the bridge easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants