bazel-ios/rules_ios

`generates_header=True` does not work in `0.25.0` or `0.26.0`, while using `apple_framework` in `bazel-ios/rules_ios`

Closed this issue · 6 comments

I built a small demo for this bug (maybe regression). There's no such a bug while using 0.24.0: https://github.com/imWildCat/BazelSwiftMixedFrameworkMissingSwiftHeaderDemo

In this demo, I didn't use rules_swift directly. Instead, I used apple_framework to build a framework with Swift/Objc:

load("@build_bazel_rules_ios//rules:framework.bzl", "apple_framework")

apple_framework(
    name = "MixedLangFramework",
    srcs = glob(
        [
            "**/*.swift",
            "**/*.m",
            "**/*.h",
        ],
    ),
    public_headers = glob([
        "**/*.h",
    ]),
    module_name = "MixedLangFramework",
    visibility = ["//visibility:public"],
)

With 0.25.0 or 0.26.0, ModuleName-Swift.h is missing:

Target //MixedLangFramework:MixedLangFramework up-to-date:
  bazel-out/applebin_ios-ios_x86_64-fastbuild-ST-f35b32a85dd9/bin/MixedLangFramework/MixedLangFramework/MixedLangFramework.framework/MixedLangFramework
  bazel-out/applebin_ios-ios_x86_64-fastbuild-ST-f35b32a85dd9/bin/MixedLangFramework/MixedLangFramework/MixedLangFramework.framework/Modules/MixedLangFramework.swiftmodule/x86_64.swiftmodule
-  bazel-out/applebin_ios-ios_x86_64-fastbuild-ST-f35b32a85dd9/bin/MixedLangFramework/MixedLangFramework/MixedLangFramework.framework/Headers/MixedLangFramework-Swift.h
  bazel-out/applebin_ios-ios_x86_64-fastbuild-ST-f35b32a85dd9/bin/MixedLangFramework/MixedLangFramework/MixedLangFramework.framework/Headers/DemoManager.h
  bazel-out/applebin_ios-ios_x86_64-fastbuild-ST-f35b32a85dd9/bin/MixedLangFramework/MixedLangFramework/MixedLangFramework.framework/Headers/SwiftLibrary.h
  bazel-out/applebin_ios-ios_x86_64-fastbuild-ST-f35b32a85dd9/bin/MixedLangFramework/MixedLangFramework/MixedLangFramework.framework/Headers/MixedLangFramework-umbrella.h
  bazel-out/applebin_ios-ios_x86_64-fastbuild-ST-f35b32a85dd9/bin/MixedLangFramework/MixedLangFramework/MixedLangFramework.framework/Modules/module.modulemap

In https://github.com/bazel-ios/rules_ios/blob/master/rules/repositories.bzl, rules_ios is using a forked version of this repo.

Not sure how to fix it?

ob commented

I suspect this is fixed by #424

Great, thank you very much!

Still seeing it in a large project. Let me investigate a bit.

ob commented

yeah, something else is going on, #427 shows other problems

ob commented

I think #427 should've fixed this.

Thanks @ob, I can confirm this fix using our codebase!

Very appreciated!