cgrindel / rules_swift_package_manager

Collection of utilities and Bazel rules to aid in the development and maintenance of Swift repositories using Bazel.
Apache License 2.0
68 stars 22 forks source link

Unable to link binary from spm #1089

Open mostafa-v opened 1 month ago

mostafa-v commented 1 month ago

Hi I want to integrate a package into my project. here are the steps:

Swift Package Manager

1. Add package to your project

2. Add -ObjC to OTHER_LDFLAGS

3. Ensure that your target is linked binary with YandexMobileAdsPackge (Your target -> Build Phases -> Link Binary With Libraries)

4. Add MobileAdsBundle.bundle from YandexMobileAds (Package Dependencies -> YandexMobileAdsPackage -> Referenced Binaries -> YandexMobileAds) to Copy Bundle Resource phase (Your target -> Build Phases -> Copy Bundle Resource)

5. Build and run.

https://github.com/yandexmobile/yandex-ads-sdk-ios

I have successfully did step 1 and 2. But I don't have any clue how to do step 3 and 4. and without doing them, I got lots of link errors in my build (which probably because I didn't do step 3).

I have successfully integrated other packages into my project, but all of them needed steps like step 1 and 2 and no steps like step 3 and 4.

cgrindel commented 1 month ago

For step 3, I believe that they are just saying that you need to reference the package in your project. The equivalent in Bazel is to reference the Bazel target for a product in the package in one of your swift_xxx targets.

For step 4, I believe that this is about how the resource bundle is packaged in the output. What are you building? iOS app?

@brentleyjones @luispadron Do you have any suggestions for @mostafa-v ?

luispadron commented 1 month ago

I agree that 3 - 4 just mean using those targets in the product you're building, more info on what kind of product would help.

mostafa-v commented 1 month ago

the whole project is ios app, but I add this package in a swift_library deps.

cgrindel commented 1 month ago

If you could provide a repro or at least more information about the errors, that could help use provide some advice.