Created by: zayhero-zz
When we use bridging header to generate swift modules, swift sometimes include the bridging header into -Swift.h
. For example, sth like this
#import "bridging-header/bridging-header.h"
Theoretically, swift should only import bridging-header.h
instead of the full path, but that's not what they are doing right now.
And BUCK is not able to build the objC code if its importing the -Swift.h
. clang
throws this exception
In file included from CallHello.m:1:
In file included from CallHello.h:1:
buck-out/gen/Greeter#macosx-x86_64,static,swift-compile/Greeter-Swift.h:121:9: fatal error: 'bridging-header/bridging-header.h' file not found
#import "bridging-header/bridging-header.h"
To fix this problem, this PR is adding -iquote rootPath
into clang flags, so clang can build the objC files.
For testing, update the tests to verify the change.
PS. I am not sure if making change on AppleCxxPlatforms
is the best approach, please let me know if there is a better way. I am also thinking adding compiler_flags = ['-iquote', os.getcwd()]
in the build rule, but this seems too hacky to me.