Commit graph

13 commits

Author SHA1 Message Date
Kiyoung Kim
62ed3dd5f8 Rename export_headers of cc_api_variant
Rename export_headers of cc_api_variant as export_include_dirs, because
the property only supports header directory.

Bug: 244244438
Test: Cuttlefish vendor build succeeded
Change-Id: I6e1468f51694150c70d3b0def2917f0ba74f7ea0
2022-12-02 10:31:48 +09:00
Kiyoung Kim
d5d1ab1b3e Support NDK variant of cc_api_variant
Update cc build logic to support NDK variant of cc_api_variant. Any
cc_api_library with NDK variant of cc_api_variant would be treated as
similar with NDK library.

Bug: 259007436
Test: Cuttlefish vendor build succeeded
Change-Id: I75a7475f4fdcbac779f5aa64e76c60f94ea7ea1a
2022-11-30 16:36:14 +09:00
Kiyoung Kim
3d776f4e66 Make variant headers as arch variant
Make cc_api_variant's header property as arch variant, so headers can be
differed by arch variant

Bug: 244244438
Test: Panther vendorimage build succeeded
Change-Id: I400301793209c9e0214fc118cd4981194d507fbd
2022-11-11 12:59:21 +09:00
Kiyoung Kim
ee58c93075 CcApiLibrary Variants for LLNDK
Define CcApiLibrary Variants for LLNDK. Each variant will be defined as
below.

cc_api_variant {
  name: "libc",
  variant: "llndk",
  arch: {
    x86_64: {
      src: "libs/x86_64/libc.so",
    },
    ...
  },
}

And CcApiLibrary will be marked to use this variant as below.

cc_api_library {
  name: "libc",
  ...
  variants: [
    "llndk",
    ...
  ]
}

Soong will replace source of libc cc_api_library as src from
cc_api_variant during build time.

Bug: 244244438
Test: cf vendor build succeeded with LLNDK variants
Change-Id: I317ed1f558beb1f82f9f2d70811fa8f765bcad2b
2022-11-08 12:57:08 +09:00
Spandan Das
a3c8a175ca Assemble API surface headers before compiling rdeps
The current combined multi-tree build graph is not accurate. A vendor.c
file currently does not have a dependency on the assembled .h file in
multi-tree out. Previous successful builds of
`multitree_build vendor/vendorimage` were a happy
coincidence (presumably because the actions which copy the .h files from
a speciific inner tree to out/ are at the bottom of the build graph).

Fix this by exporting `cc_api_library.src` to be an order only
dependency of its rdeps (both compile and link). Making an .so file an
order only dependency of _compilation_ is probably confusing, but I
think it will be less confusing than the other alternative I could think
of (creating .timestamp files for each api_surface include dir and
creating phony targets to make them available from top-level to chdir'd
inner tree)

Test: go test ./cc
Test: orchestrator/prebuilts/build-tools/linux-x86/bin/nsjail --config
out/nsjail.cfg --
orchestrator/prebuilts/build-tools/linux-x86/bin/ninja -f
out/multitree.ninja -t path
vendor/out/soong/.intermediates/external/angle/angle_common/android_arm64_armv8-a_cortex-a53_static/obj/external/angle/src/common/android_util.o
out/api_surfaces/vendorapi/current/libc/libc_headers.contribution.androidos_include/features.h

(Path did not exist before this CL)

Change-Id: I74391100f2108993448004019eeba6456af0c12a
2022-10-26 21:10:44 +00:00
Treehugger Robot
1227abee34 Merge changes from topic "api_library_missing_deps"
* changes:
  Do not register missing deps
  Skip existence check for stub library files
2022-10-25 03:12:07 +00:00
Spandan Das
c6c10fa34f Do not register missing deps
This is a fix to aosp/2260763 and skips the existence check corectly.
Previously, it would not throw an exception during Soong analysis, but
would add the path to a `MissingDeps` object. The ninja graph generated
using this would throw an exception during ninja execution.

We should not do this check for `cc_api_library`. The prebuilt
library.so is missing in the build graph of the inner tree (expected),
but it will be present when the orchestrator creates the combined
multi-tree ninja graph.

Test: rm -rf out && multitree_build vendor/vendorimage
(I did not clean out/ in aosp/2260763, and therefore did not catch this
earlier)
Test: go test ./cc

Change-Id: I68d245acae3bfb777bfc8a72fb7cd4909cb0a289
2022-10-22 02:26:30 +00:00
Kiyoung Kim
bdb7495fe5 Remove unused module definitions in library stub
There are some module definitions which are implemented for the proof of
concept, but these modules are not in use now. This change removes
unused module definitions to reduce confusion.

Bug: N/A
Test: m nothing passed
Change-Id: I9b8efbc368436eaef66a4e6557006e87c0c27713
2022-10-19 04:04:55 +00:00
Spandan Das
f0beebc523 Skip existence check for stub library files
Switch from `PathForModuleSrc` to `PathForSource`. The latter does not
check that the target path exists in the tree. This is necessary since
the prebuilt stub and header directories are not guaranteed to exist
when Soong analysis begins (Step 2a)

Build orchestrator will be responsible for putting these files in the
right place as part of Multi-tree ninja invocation (Step 4)

Test: go test ./cc
Change-Id: I27175a8440fca6bba21197b1e106a22b733da882
2022-10-18 19:11:38 +00:00
Kiyoung Kim
51279d3a7b Define cc_api_headers module
Define cc_api_headers module to import from API surfaces and replace
existing header definition if needed.

Tested with :
cc_api_headers {
  name: "libc_headers",
  export_system_include_dirs: [
    "include",
  ],
  min_sdk_version: "1",
  sdk_version: "1",
  vendor_available: true,
  native_bridge_supported: true,
  ...
}

Bug: 236087698
Test: ALLOW_MISSING_DEPENDENCIES=true m -j vendorimage succeeded
Change-Id: I2c3294fe19a272453a168d8c7beeee9859bd4583
2022-09-01 11:24:35 +09:00
Kiyoung Kim
835c589a77 Fix bugs from cc_api_library build
There are some bugs found while building cc_api_library with original
library definition. This change fixes some bugs from cc_api_library.

* Generate MK information for cc_api_library.
* Mark cc_api_library as no CRT required.

Bug: 236087698
Test: ALLOW_MISSING_DEPENDENCIES=true m -j vendorimage succeeded
Change-Id: Ib411888fae41317c01378362cd5bdc87c2b588c5
2022-08-18 00:07:46 +00:00
Kiyoung Kim
487689eaee Introduce cc_api_library
Introduce cc_api_library, which reflects imported API from other
inner-tree. This cc_api_library module type will later refer from
the other ninja module which generates stub library from the interface
description.

Tested environment :
* original libc definition has been removed temporarily, to ensure that
  imported api stub library is being used from build
* Added new definition of libc as below
 cc_api_library {
  name: "libc",
  arch: {
    x86: {
      src: "libs/x86/libc.so",
    },
    x86_64: {
      src: "libs/x86_64/libc.so",
    },
  },
  header_libs: [
    "libc_headers",
  ],
  export_header_lib_headers: ["libc_headers"],
  min_sdk_version: "9",
  vendor_available: true,
 }

Bug: 236087698
Test: `ALLOW_MISSING_DEPENDENCIES=true m vendorimage` succeeded
Change-Id: I67070b0f3561aa2afd73b6c1c0fdf4255218baac
2022-08-10 10:12:18 +09:00
Inseob Kim
5eb7ee9fad Prototype changes for multitree
This change contains a prototype implementation for multitree. Several
interfaces and modules are added.

1. Imported/Exported
Modules implementing Exportable interface can export artifacts to other
components. "imported_filegroup" modules can import generated artifacts from other exported modules.

2. Multitree metadata
It contains information about imported/exported modules in each
component, and can be generated via "m update-meta".

3. cc library stub
It's based on prototype stub libraries. It uses imported/exported
mechanism to expose a C API, with a map.txt file and header files.

Bug: 230448564
Test: m
Change-Id: Id7ff7618e2c630c5617a564d8b23b60a1cc9c8e8
2022-04-28 08:20:10 +00:00