platform_build_soong/cc
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
..
config __ANDROID_UNGUARDED_AVAILABILITY__ is gone now. 2021-02-19 10:43:19 -08:00
libbuildversion Add LOCAL_LICENSE_KINDS to build/soong 2021-02-06 04:23:21 +00:00
ndk_api_coverage_parser Add LOCAL_LICENSE_KINDS to build/soong 2021-02-06 04:23:21 +00:00
ndkstubgen Add LOCAL_LICENSE_KINDS to build/soong 2021-02-06 04:23:21 +00:00
symbolfile Add LOCAL_LICENSE_KINDS to build/soong 2021-02-06 04:23:21 +00:00
Android.bp Add LOCAL_LICENSE_KINDS to build/soong 2021-02-06 04:23:21 +00:00
OWNERS Refactor OWNERS files in platform/build/soong. 2020-10-08 16:14:32 -07:00
androidmk.go rust: Add rust_ffi_static vendor ramdisk Support 2021-02-08 09:36:26 -05:00
api_level.go Replace stringly-typed API levels. 2020-09-18 12:41:28 -07:00
binary.go bp2build: convert paths/module refs to Bazel label 2021-02-04 13:45:56 -05:00
binary_sdk_member.go Create fewer empty version variants 2020-10-05 18:57:21 -07:00
builder.go Merge "Soong: add missing header-abi-dumper inputs" 2020-12-09 07:26:36 +00:00
cc.go bp2build: cc_object converter. 2021-02-18 03:27:28 -05:00
cc_test.go Add tests for exported generated headers 2021-02-19 17:12:01 +00:00
ccdeps.go Add soong cc and java deps to general-tests dist 2020-07-06 16:19:56 -07:00
cflag_artifacts.go Pass pctx and ctx to NewRuleBuilder 2020-12-01 16:22:16 -08:00
check.go Remove unnecessary snake case variables. 2020-12-22 12:38:35 -08:00
cmakelists.go Remove unnecessary snake case variables. 2020-12-22 12:38:35 -08:00
compdb.go Sandbox soong_build by changing to root directory 2020-01-11 01:11:46 +00:00
compiler.go __ANDROID_API__ tracks min_sdk_version 2021-01-13 03:12:24 +09:00
compiler_test.go Revert "Make lots of tests run in parallel" 2020-10-09 18:34:24 -07:00
coverage.go Build against cfi supported coverage lib 2021-01-14 11:46:10 -08:00
fuzz.go Non-installable module should not be installed into a fuzzer .zip package 2021-02-17 16:40:25 +00:00
gen.go Pass pctx and ctx to NewRuleBuilder 2020-12-01 16:22:16 -08:00
gen_test.go Reland: Rewrite sbox to use a textproto manifest 2020-11-20 15:45:04 -08:00
genrule.go Define odm_available property to install a vendor variant to odm 2021-01-25 17:08:44 +09:00
genrule_test.go Move genrule on top of RuleBuilder 2020-11-17 11:23:45 -08:00
image.go Remove global state on module suffixes from vendor and recovery snapshots 2021-02-01 20:06:29 +09:00
installer.go Only output make targets for uninstallable static libs in the APEX 2020-08-06 22:52:58 +01:00
kernel_headers.go Start using Providers instead of direct module access 2020-10-12 16:55:47 -07:00
library.go bp2build: cc_object converter. 2021-02-18 03:27:28 -05:00
library_headers.go bp2build: cc_object converter. 2021-02-18 03:27:28 -05:00
library_headers_test.go Revert "Make lots of tests run in parallel" 2020-10-09 18:34:24 -07:00
library_sdk_member.go Fix the snapshot handling of generated headers 2021-02-22 18:23:22 +00:00
library_test.go Revert "Make lots of tests run in parallel" 2020-10-09 18:34:24 -07:00
linkable.go Use target dependent module to update the name suffix 2021-02-03 19:42:29 +09:00
linker.go bp2build: convert paths/module refs to Bazel label 2021-02-04 13:45:56 -05:00
llndk_library.go Create LLNDK vendor variants when DeviceVndkVersion is not set 2021-01-07 17:19:27 -08:00
lto.go Global ThinLTO: opt out vndk binaries as a workaround 2020-10-09 22:08:11 +08:00
makevars.go Merge "Remove remaining libnativehelper implicit includes" 2021-01-13 06:11:03 +00:00
ndk_headers.go Remove unused mips workarounds. 2020-03-06 18:15:44 -08:00
ndk_library.go Don't create SDK variants for native bridge modules 2021-01-19 15:00:45 -08:00
ndk_prebuilt.go Don't create SDK variants for native bridge modules 2021-01-19 15:00:45 -08:00
ndk_sysroot.go Move stubs related methods out of LinkableInterface 2020-10-29 14:17:54 -07:00
object.go bp2build: cc_object converter. 2021-02-18 03:27:28 -05:00
object_test.go Revert "Make lots of tests run in parallel" 2020-10-09 18:34:24 -07:00
pgo.go Remove unnecessary snake case variables. 2020-12-22 12:38:35 -08:00
prebuilt.go Merge "versioning macro is exported from prebuilt stubs as well" 2020-12-16 01:31:10 +00:00
prebuilt_test.go Refactor 'in_make' to mean Kati is not skipped. 2020-11-23 00:29:18 -05:00
proto.go Pass pctx and ctx to NewRuleBuilder 2020-12-01 16:22:16 -08:00
proto_test.go Revert "Make lots of tests run in parallel" 2020-10-09 18:34:24 -07:00
pylintrc Fix pylint issues in gen_stub_libs. 2020-07-16 13:21:43 -07:00
rs.go Remove obsolete PDK build functionality 2020-08-11 01:11:44 +00:00
sabi.go Don't rewrite LLNDK dependencies with .llndk suffix 2020-12-21 17:53:30 -08:00
sanitize.go Remove some global state from vendor and recovery snapshots 2021-02-01 20:02:39 +09:00
sdk.go Remove some global state from vendor and recovery snapshots 2021-02-01 20:02:39 +09:00
sdk_test.go Revert "Make lots of tests run in parallel" 2020-10-09 18:34:24 -07:00
snapshot_prebuilt.go Implement directed recovery snapshot. 2021-02-09 08:25:34 -08:00
snapshot_utils.go Implement directed vendor snapshot 2021-01-18 20:08:09 +09:00
stl.go Switch platform EH unwinder to prebuilt LLVM libunwind 2021-01-13 19:51:06 -08:00
strip.go Allow stripping host modules 2020-12-04 09:43:49 -08:00
stub_library.go Generate system stub library list at build time 2020-12-01 14:09:03 +09:00
sysprop.go Add comments about sysprop_library 2020-11-24 14:13:31 +09:00
test.go Update test_min_api_level for cc_test 2021-02-20 00:46:21 +00:00
test_data_test.go Pass Config to NewTestContext instead of ctx.Register 2020-11-12 10:07:49 -08:00
testing.go rust: Add rust_ffi_static vendor ramdisk Support 2021-02-08 09:36:26 -05:00
tidy.go Change default DEFAULT_TIDY_HEADER_DIRS to empty 2021-02-12 13:50:38 -08:00
toolchain_library.go Improve commenting for cc/builer.go, and kill dead code 2020-12-01 18:28:38 -05:00
util.go Add some comments for VNDK / vendor snapshots 2020-12-10 21:12:39 +09:00
vendor_public_library.go cc: export Stripper struct 2020-08-27 10:13:42 +02:00
vendor_snapshot.go Generate fake versions of modules excluded in directed vendor snapshot. 2021-02-05 17:53:53 +00:00
vendor_snapshot_test.go Implement directed recovery snapshot. 2021-02-09 08:25:34 -08:00
vndk.go Merge "Remove global state from VNDK" 2021-01-14 18:31:06 +00:00
vndk_prebuilt.go Remove global state on module suffixes from vendor and recovery snapshots 2021-02-01 20:06:29 +09:00