Coder Social home page Coder Social logo

Comments (9)

lswith avatar lswith commented on May 24, 2024

An Example would be:

# In an External Workspace @Hello
objc_library(
    name = "Hello",
    srcs = glob([
        "Hello/*.m",
    ]),
    hdrs = glob([
        "Hello.*.h",
    ]),
)
# In My Current Workspace
swift_library(
     name = "GoodBye",
     srcs = glob([
          "GoodBye/*.swift",
     ]),
     module_name = "GoodBye",
     deps = [
         "@Hello//:Hello",
      ],
)

If in GoodBye I try to import Hello it will fail. The module name is actually Hello_Hello.

from rules_apple.

dmishe avatar dmishe commented on May 24, 2024

This is correct, though not well documented. Module names, by default, are full target labels with any non [a-zA-Z0-9] character replaced with "_". That is how @Hello//:Hello gets translated into Hello_Hello

from rules_apple.

lswith avatar lswith commented on May 24, 2024

can we add the ability to define a module name for these objects?

from rules_apple.

dmishe avatar dmishe commented on May 24, 2024

For swift_library, you can set your own module_name. For objc_library, not yet, that would be a feature request on Bazel itself.

from rules_apple.

lswith avatar lswith commented on May 24, 2024

This is causing bugs with importing. An example would be this:
Hello/BUILD

objc_library(
    name = "Hello",
    srcs = ["Hello.m"],
    hdrs = ["Hello.h"],
    deps = [
        "@Goodbye//:Goodbye",
    ],
)

Goodbye/BUILD

swift_library(
    name = "Goodbye",
    srcs = ["Goodbye.swift"],
    deps = [ 
        ":Goodbye_objc",
    ],
   module_name = "Goodbye",
)

objc_library(
    name = "Goodbye_objc",
    srcs = ["Goodbye.m"],
    hdrs = ["Goodbye.h"],
)

This causes the bug inside the Hello module:

bazel-out/darwin_x86_64-fastbuild/genfiles/Goodbye/Goodbye-Swift.h:138:9: fatal error: module 'Goodbye_Goodbye_objc' not found
@import Goodbye_Goodbye_objc;
 ~~~~~~~^~~~~~~~~~~~~~~~~~~

from rules_apple.

lswith avatar lswith commented on May 24, 2024

any updates on this?

from rules_apple.

dmishe avatar dmishe commented on May 24, 2024

lswith, could you paste the contents of Goodbye-Swift.h?

from rules_apple.

lswith avatar lswith commented on May 24, 2024

I decided to recreate the test again with the latest commits and it seems to be working from the hello folder. The Goodbye folder however, doesn't compile. https://github.com/lswith/bazel-ios-test

from rules_apple.

ob avatar ob commented on May 24, 2024

I think this was fixed by #5905 and it can be closed.

from rules_apple.

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.