rules_swift_package_manager icon indicating copy to clipboard operation
rules_swift_package_manager copied to clipboard

Can't build Adjust SDK dependency

Open jflan-dd opened this issue 1 year ago • 5 comments

When I try to add dependency on https://github.com/adjust/ios_sdk I get this build failure.

/private/var/tmp/_bazel_johnflanagan/b8bc7972ecfebadd8d249c6ec0018f24/execroot/_main/external/rules_swift_package_manager~0.29.1~swift_deps~swiftpkg_ios_sdk/AdjustSdkStatic/module.modulemap:1:18: error: redefinition of module 'AdjustSdk'
framework module AdjustSdk {
                 ^
/private/var/tmp/_bazel_johnflanagan/b8bc7972ecfebadd8d249c6ec0018f24/execroot/_main/external/rules_swift_package_manager~0.29.1~swift_deps~swiftpkg_ios_sdk/ModuleMap/module.modulemap:1:18: note: previously defined here
framework module AdjustSdk {
                 ^
/private/var/tmp/_bazel_johnflanagan/b8bc7972ecfebadd8d249c6ec0018f24/execroot/_main/external/rules_swift_package_manager~0.29.1~swift_deps~swiftpkg_ios_sdk/AdjustSdkStatic/module.modulemap:1:18: error: redefinition of module 'AdjustSdk'
framework module AdjustSdk {
                 ^
/private/var/tmp/_bazel_johnflanagan/b8bc7972ecfebadd8d249c6ec0018f24/execroot/_main/external/rules_swift_package_manager~0.29.1~swift_deps~swiftpkg_ios_sdk/ModuleMap/module.modulemap:1:18: note: previously defined here
framework module AdjustSdk {

I'm not sure how to resolve those errors. The dependency works with vanilla SPM.

Thanks!

jflan-dd avatar Mar 27 '24 18:03 jflan-dd

rules_swift_package_manager creates modulemaps in certain situations. I suspect that we need to update the logic to check for a modulemap before we create one.

cgrindel avatar Mar 28 '24 13:03 cgrindel

@cgrindel creating a patch file to delete the ModuleMap folder at the root of https://github.com/adjust/ios_sdk resolves the issue for me. I don't see that folder directly referenced in the Package.swift file or the generated BUILD.bazel file, so I'm not sure why it's being included.

jflan-dd avatar Apr 23 '24 20:04 jflan-dd

I assume this is covered under the FAQ related to sandboxing?

brentleyjones avatar Apr 23 '24 23:04 brentleyjones

@brentleyjones The only mention of sandboxing I see in the FAQ is related to rules_xcodeproj, but I'm running into this issue with plain bazel build

jflan-dd avatar Apr 24 '24 14:04 jflan-dd

Does following the steps (without the rules_xcodeproj part) fix it? I think the modulemap should only be accidentally picked up when sandboxing is disabled.

brentleyjones avatar Apr 24 '24 14:04 brentleyjones

@jflan-dd Can you check that https://github.com/cgrindel/rules_swift_package_manager/pull/1085 fixes this for you?

brentleyjones avatar May 24 '24 16:05 brentleyjones

@brentleyjones The issues appears to be resolved with that fix. Thanks!

jflan-dd avatar May 30 '24 20:05 jflan-dd