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
74 stars 29 forks source link

Issue with LogRocket package #939

Closed jpsim closed 8 months ago

jpsim commented 8 months ago

Hi Chuck,

I'm having some issues with the LogRocket package (https://github.com/LogRocket/logrocket-ios-swift-package?tab=readme-ov-file), which really just wraps a pre-built xcframework.

<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/LogRocket.h"
        ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/LogRocket.h"
        ^
LogRocket.framework/Headers/LogRocket.h:27:1: warning: umbrella header for module 'LogRocket' does not include header 'LROMachineContext.h'

^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/LogRocket.h"
        ^
LogRocket.framework/Headers/LogRocket.h:27:1: warning: umbrella header for module 'LogRocket' does not include header 'LROCrashMonitorContext.h'

^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/LogRocket.h"
        ^
LogRocket.framework/Headers/LogRocket.h:27:1: warning: umbrella header for module 'LogRocket' does not include header 'LROSystemCapabilities.h'

^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/LogRocket.h"
        ^
LogRocket.framework/Headers/LogRocket.h:27:1: warning: umbrella header for module 'LogRocket' does not include header 'LROCLogger.h'

^

I don't see these errors when importing the xcframework via SwiftPM, so I'm wondering if this could be a rules_swift_package_manager issue.

The easiest way for me to share repro steps is to apply these changes to the Lottie iOS example:

diff --git a/examples/lottie_ios_example/LottieExample/AppDelegate.swift b/examples/lottie_ios_example/LottieExample/AppDelegate.swift
index 2ead9dc..9f75294 100644
--- a/examples/lottie_ios_example/LottieExample/AppDelegate.swift
+++ b/examples/lottie_ios_example/LottieExample/AppDelegate.swift
@@ -2,6 +2,7 @@
 // Copyright © 2022 Airbnb Inc. All rights reserved.

 import UIKit
+import LogRocket

 @main
 class AppDelegate: UIResponder, UIApplicationDelegate {
diff --git a/examples/lottie_ios_example/LottieExample/BUILD.bazel b/examples/lottie_ios_example/LottieExample/BUILD.bazel
index 189843a..1cab3d0 100644
--- a/examples/lottie_ios_example/LottieExample/BUILD.bazel
+++ b/examples/lottie_ios_example/LottieExample/BUILD.bazel
@@ -13,7 +13,7 @@ swift_library(
     module_name = "LottieExample",
     tags = ["manual"],
     visibility = ["//visibility:public"],
-    deps = ["@swiftpkg_lottie_spm//:Lottie"],
+    deps = ["@swiftpkg_lottie_spm//:Lottie", "@swiftpkg_logrocket_ios_swift_package//:LogRocket"],
 )

 ios_application(
diff --git a/examples/lottie_ios_example/Package.swift b/examples/lottie_ios_example/Package.swift
index e5c48fc..57244f4 100644
--- a/examples/lottie_ios_example/Package.swift
+++ b/examples/lottie_ios_example/Package.swift
@@ -6,5 +6,6 @@ let package = Package(
     name: "lottie_ios_example",
     dependencies: [
         .package(url: "https://github.com/airbnb/lottie-spm", from: "4.4.1"),
+        .package(url: "https://github.com/LogRocket/logrocket-ios-swift-package", exact: "1.32.0"),
     ]
 )

And run:

$ bazel run //:tidy
$ bazel build //LottieExample:iosapp
cgrindel commented 8 months ago

If it is still handy, could you post the generated BUILD.bazel file for LogRocket package?

jpsim commented 8 months ago

The umbrella header was missing some headers, LogRocket 1.32.1 fixes it. I don't know why this was failing the build in Bazel despite these only being warnings, and the build succeeding with SwiftPM, but I think it's ok to just close this since the framework was just broken and it's now fixed.