13

I'm trying to use BUCK with the Realm pod.

I've set up my buck file as:

apple_pod_lib(
    name = "Realm",
    visibility = ["PUBLIC"],
    exported_headers = glob([
        "Realm/**/*.h",
        "Realm/**/*.hpp",
    ]),
    srcs = glob([
        "Realm/**/.{m,mm,cpp}",
    ]),
)

apple_pod_lib(
    name = "RealmSwift",
    visibility = ["PUBLIC"],
    swift_version = "4",
    deps = [
        "//Pods:Realm"
    ],
    srcs = glob([
        "RealmSwift/**/*.swift",
    ]),
)

using the pod macro from Airbnb.

However I can't build my project as this failed with

In target '//Pods:Realm', 'Realm/history.hpp' maps to the following header files:
- /BuckSample/Pods/Realm/include/core/realm/sync/history.hpp
- /BuckSample/Pods/Realm/include/core/realm/history.hpp

Please rename one of them or export one of them to a different path.

I've also tried manually specifying the files & headers to include, looking at the PodSpec from those repos, but I could not get it to work as I was then missing some files for the project to compile in Xcode.

Guig
  • 9,891
  • 7
  • 64
  • 126
  • It looks like what I need it to have BUCK keep the path to the header in instead of trying to export everything to "history.hpp" so that this makes sense https://github.com/realm/realm-object-store/blob/f59cb85414b22722660ad06186357ecfa01bc64f/src/shared_realm.cpp#L34-L42 – Guig Dec 28 '18 at 21:33

1 Answers1

1

As a workaround, I was able to install the prebuilt framework through Carthage as:

# Cartfile
github "realm/realm-cocoa"

# Carthage/BUCK
prebuilt_apple_framework(
    name = "Realm",
    framework = "Build/iOS/Realm.framework",
    preferred_linkage = "shared",
    visibility = ["PUBLIC"],
)

prebuilt_apple_framework(
    name = "RealmSwift",
    framework = "Build/iOS/RealmSwift.framework",
    preferred_linkage = "shared",
    visibility = ["PUBLIC"],
    deps = [
      ":Realm",
    ]
)

# Where my library is
apple_library(
    name = "LibraryWithRealm",
    visibility = ["PUBLIC"],
    swift_version = "5.0",
    modular = True,
    deps = [
        "//Carthage:RealmSwift",
    ]
)
Guig
  • 9,891
  • 7
  • 64
  • 126