Fix the snapshot handling of generated headers
Previously, the snapshot handling code did not preserve the directory structure of generated include directories and instead just copied the headers into the same module specific directory and added that single directory to the export_include_dirs (or similar) property. That had a couple of issues: * The include directory was repeated in the ..._include_dirs property. * It did not work when the include directories overlapped. In the latter case it had a couple of issues: * Code which compiled fine against the source would not compile against the prebuilt. * Header files were duplicated in the output. e.g. assume the following generated header file structure: foo/ foo.h bar/ bar.h baz/ baz.h When the sdk snapshot was passed include directories of "foo", "bar" and headers of "foo/foo.h", "bar/bar.h", "bar/baz/baz.h" it would generate a snapshot with the structure: include_gen/ foo.h bar.h baz/ baz.h And: export_include_dirs: ["include_gen", "include_gen"] However, when the include directories overlapped and include directories of "foo", "bar" and "bar/baz" were passed in the directory structure would be the same and the export_include_dirs would contain 3 usages of "include_gen". That meant that source code which used the following would build against the source (because it would find "baz.h" in the "bar/baz" include directory) but would fail when built against the prebuilts because the "include_gen" directory did not contain "baz.h": #include "baz.h" This change preserves the input directory structure for generated files in a similar way to how it does it for source files. So, the snapshot structure looks something like this: include_gen/ foo/ foo.h bar/ bar.h baz/ baz.h And: export_include_dirs: [ "include_gen/foo", "include_gen/bar", "include_gen/bar/baz", ], Bug: 180427921 Test: m nothing Change-Id: Id69eef8cf5eecd033841d3b7cd0c044a697ce404
Loading
Please register or sign in to comment