HeaderSymlinkWithHeaderMap missing in cache break Swift build
Right now if we use cxx_library or apple_library to build cxx files, it generate header map like
MyProject#header-mode-symlink-tree-with-header-map,headers.hmap.
However, this file is not cached correctly, if MyProject is not being updated in incremental build, this file will not exist.
This works fine when we only have objC code. But if you have a swift file which need to use the cxx files in MyProject, this will break.
Under current Buck build logic, we are using bridging header to import header files from MyProject to current project. But since the header map file is missing, the import will fail and receive error saying the header file not found.
Here is a sample https://github.com/zayhero/BugSample
Repo step:
- run
buck build ... --config cache.dir="~/.cache/buck/build-cache" --config cache.dir_mode=readwrite. Everything should works fine andGreeter#header-mode-symlink-tree-with-header-map,headers.hmapis generated. - run
rm -rf buck-outto clear the cache - edit
main.swiftto add one more line (anything is ok, e.g.Greeter.sayHello("ObjC Again")) - run
buck build ... --config cache.dir="~/.cache/buck/build-cache" --config cache.dir_mode=readonly. This should get the error:
[2017-04-23 10:50:44.553][error][command:f17fe6c9-f0aa-4629-836a-b121bfbce7aa][tid:30][com.facebook.buck.swift.SwiftCompileStep] Error running /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -frontend -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk -target x86_64-apple-ios10.3 -import-objc-header bridging-header.h -F /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks -Xcc -I/Users/brian_zhang/projects/airbnb/BugSample/buck-out/gen/Greeter#header-mode-symlink-tree-with-header-map,headers.hmap -Xcc -Ibuck-out/gen/SwiftCallsObjC#headers,iphonesimulator-x86_64 -Xcc -Ibuck-out/gen/SwiftCallsObjC#iphonesimulator-x86_64,private-headers -Xcc -I/Users/brian_zhang/projects/airbnb/BugSample/buck-out -c -enable-objc-interop -module-name SwiftCallsObjC -emit-module -emit-module-path buck-out/gen/SwiftCallsObjC#iphonesimulator-x86_64,swift-compile/SwiftCallsObjC.swiftmodule -o buck-out/gen/SwiftCallsObjC#iphonesimulator-x86_64,swift-compile/SwiftCallsObjC.o -emit-objc-header-path buck-out/gen/SwiftCallsObjC#iphonesimulator-x86_64,swift-compile/SwiftCallsObjC-Swift.h main.swift: /Users/brian_zhang/projects/airbnb/BugSample/./bridging-header.h:1:9: error: 'Greeter/Greeter.h' file not found #import <Greeter/Greeter.h>
cc @Coneko @nguyentruongtho
cc @milend
cc @robbertvanginkel
Any update on this?
This problem is resolve after @milend rewrite Buck. Closing it now.