buck icon indicating copy to clipboard operation
buck copied to clipboard

How can I use BUCK build with a pod that has several files with the same name?

Open gsabran opened this issue 5 years ago • 3 comments

(I asked on SO but I'm not sure which one is the preferred channel)

I'm trying to use BUCK with the Realm pod that has several files with the same name. My buck build is failing 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.

In the module, those files are imported as

#include <realm/history.hpp>
#include <realm/sync/history.hpp>

but it seems that BUCK is trying to map both of them to Realm/history.hpp How can I tell BUCK to only map to the full path and not just the filename as well?

gsabran avatar Jan 13 '19 03:01 gsabran

There are a few ways to change the way headers are mapped in Buck.

On Apple rules, there is the header_prefix_path argument On cxx rules, there is the header_namespace argument

And on both, the headers parameter allows specifying a dictionary, where the value is the path to the header and the key is the path you want it accessible by. So you could have a dictionary like

headers = {
  "history.hpp": "history.hpp",
  "synchistory.hpp": "sync/history.hpp",
}

(I'm not suggesting those are the names you should use, just illustrating how it works)

scottrice avatar Jan 20 '19 02:01 scottrice

So it turns out Realm is really not a straightforwards pod, including submodules and some scripts to be run when generating the project. I think I've been able to deal with the header mappings, but that's not enough to get things to work. If you want to have a look I've set up a debug project trying:

  • building from the code downloaded with cocoapods (commit)
  • using the framework downloaded directly (commit)

Are you planning for a direct support of Pod / Carthage so that modules imports is much simpler?

gsabran avatar Feb 01 '19 23:02 gsabran

@gsabran Do you want to add your working versions here to the this sample Buck project? https://github.com/airbnb/BuckSample/blob/master/Pods/BUCK

shepting avatar Apr 14 '20 21:04 shepting