platform_build_soong/sdk
Paul Duffin 42dd4e6cd6 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
2021-02-22 18:23:22 +00:00
..
Android.bp Add LOCAL_LICENSE_KINDS to build/soong 2021-02-06 04:23:21 +00:00
bp.go Handle property structs and BpPropertySets as values to AddProperty. 2020-09-25 00:33:04 +01:00
bp_test.go Revert "Make lots of tests run in parallel" 2020-10-09 18:34:24 -07:00
cc_sdk_test.go Fix the snapshot handling of generated headers 2021-02-22 18:23:22 +00:00
exports.go Restrict SdkMemberTypes that can be used with sdk/sdk_snapshot 2019-12-31 15:08:59 +00:00
exports_test.go Always set apex_available in SDK snapshots. 2020-11-04 18:44:14 +00:00
java_sdk_test.go Export implementation class jars for java_boot_libs 2021-02-05 13:35:25 +00:00
sdk.go Remove AndroidMkExtraFootersFunc entries param. 2020-12-07 10:23:54 -08:00
sdk_test.go Always set apex_available in SDK snapshots. 2020-11-04 18:44:14 +00:00
testing.go Fix the snapshot handling of generated headers 2021-02-22 18:23:22 +00:00
update.go Support testing versioned/unversioned sdk Android.bp files separately 2021-02-22 18:23:22 +00:00