Coder Social home page Coder Social logo

Comments (4)

allevato avatar allevato commented on July 20, 2024 1

I also noticed that swift_import takes multiple archives, and multiple swiftmodules, this seems to conflict with new_objc_provider which expects only 1 of each of these. Would it be reasonable to either remove the array support from swift_import and require multiple swift_imports per module, or possibly assume the indexes of the libraries line up with their swiftmodules in the definition?

I think we want to retain the ability to list multiple modules and libraries in the rule; in the future I'd like for swift_import to have smarter handling of framework-based modules (where you have the Modules subdirectory with a file for each architecture), and it's a much better user experience for the BUILD author to just glob those and let the compiler sort it out than to select the right one based on target architecture.

Likewise, requiring indices to line up is fragile, so we should avoid that.

I'll have some feedback on your PR soon—the past couple weeks have been hectic and I'm trying to get some other changes pushed out that might affect your work.

from rules_swift.

allevato avatar allevato commented on July 20, 2024

I think I see what's happening here.

ios_unit_test uses apple_binary underneath to link the binary. Unlike swift_binary, apple_binary is a native rule so it doesn't know anything about SwiftInfo provider; it can only get the libraries that need to be linked from the Objc provider. We make this work for swift_library by also creating and propagating an Objc provider with the library in it: https://github.com/bazelbuild/rules_swift/blob/master/swift/internal/api.bzl#L626

So fixing this should just be a matter of having swift_import also propagate an Objc provider.

from rules_swift.

keith avatar keith commented on July 20, 2024

Thanks for the context, I've looked into a fix a bit more for this, it looks like there might be another issue related to this ObjC vs Swift rule. It seems like the SwiftToolchainInfo created here may also not be propagated, leading the the linker flags to the Swift libraries not being included in the final link. Would this make sense?

I also noticed that swift_import takes multiple archives, and multiple swiftmodules, this seems to conflict with new_objc_provider which expects only 1 of each of these. Would it be reasonable to either remove the array support from swift_import and require multiple swift_imports per module, or possibly assume the indexes of the libraries line up with their swiftmodules in the definition?

from rules_swift.

keith avatar keith commented on July 20, 2024

I've submitted an solution to this problem for discussion #38

from rules_swift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.