Commit graph

649 commits

Author SHA1 Message Date
Treehugger Robot
bf9c26c364 Merge changes I1270e8d0,I61731a5e
* changes:
  Move function PathForVndkRefAbiDump to Prevent unnecessary exports in paths.go
  Change the type of parameter prevVersion to int in sourceAbiDump
2022-09-01 06:37:20 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
a56e97042c Support suffix property in bp2build
Support this in cc_{binary,library{,_shared}}

Bug: 204811222
Test: Suffix additions to cc_{binary,library{,_shared}}_conversion_test.go
Test: mixed_{libc,droid}.sh also builds newly allowlisted
Change-Id: I596694794b01b04c542cbcd7d54baeb7d914ba50
2022-08-31 18:06:21 +00:00
Mu-Le Lee
f5ed30b2aa Move function PathForVndkRefAbiDump to Prevent unnecessary exports in paths.go
This CL moves function PathForVndkRefAbiDump from android/paths.go to
cc/library.go to prevent unnecessary exports.

Test: make libz
Bug: 239915696
Change-Id: I1270e8d07edb09d93621c049acab9196757d356b
2022-08-31 06:04:27 +00:00
Mu-Le Lee
1304393b36 Change the type of parameter prevVersion to int in sourceAbiDump
Since the caller is doing Itoa and pass it into sourceAbiDump(), and
sourceAbiDump() is calling Atoi to convert it back, it makes sense to
not do the Itoa in the first place.

Test: make libz
Bug: 244009549
Change-Id: I61731a5eb442b5a1a8f50c820a673d9b2204c3a0
2022-08-31 05:51:35 +00:00
Vinh Tran
9f6796ab17 Convert cc library with AIDL to cc_aidl_library
Change-Id: I1056b37cf09f4341bf2c2545c9069dbe49ea5ab3
Test: USE_BAZEL_ANALYSIS=1 m libbinder
Bug: 243010121
Fix: 243015050
2022-08-26 16:21:53 -04:00
Cole Faust
5fa4e961fb bp2build support for instruction_set
Convert `instruction_set: "arm"` to an
"arm_isa_arm" bazel feature.

Bug: 215719349
Test: go tests
Change-Id: Ib976d23d2a57e8c0ab5d83ec994a0b7f3c69a7fe
2022-08-26 10:13:34 -07:00
Wei Li
81852ca9ac Add bp2build converter for cc library stubs and use the stub library target of a library while linking it in APEXs.
Bug: 231322789
Test: with this CL on internal master,
1) b build --verbose_failures //vendor/google/modules/AdbdGoogle:com.google.android.adbd --config=android_x86_64
2) adb install bazel-bin/vendor/google/modules/AdbdGoogle/com.google.android.adbd.apex, and adbd is activated successfully on cuttlefish device.
3) m mts && mts-tradefed run mts-adbd, and there is no failure with cuttlefish device
4) packages/modules/adb/test_device.py, and there is no failure with cuttlefish device.

Change-Id: I81b6f5336cacf35c68957ae2dac65f985b6eafb9
2022-08-25 13:28:40 -07:00
Chris Parsons
ad876010fe Refactor mixed build allowlist handling
This refactoring prepares for introduction of bazel prod mode, an
alternative mechanism for mixed builds allowlist handling.

 * Decide bazel-mode as close to soong_build main as possible
 * BazelContext itself decides whether a module is allowlisted
 * Separate bp2build and mixed build allowlist

Test: m nothing, manually verified all modules are mixed build disabled
(via metrics)
Test: USE_BAZEL_ANALYSIS=1 m nothing, manually verified that mixed build
disabled/enabled modules are identical before and after change.

Change-Id: I0f55d8b85000cb4a871a099edc6d7d868d7df509
2022-08-23 13:15:12 -04:00
Treehugger Robot
12bd7c7538 Merge "#apex symbols no longer contribute to platform libraries" 2022-08-19 23:55:00 +00:00
Cole Faust
6b29f593ea Bp2build support for runtime_libs
Bug: 213201180
Test: Updated the minimal apex in the build/bazel cl to include runtime_libs so the apex diff test will test it
Change-Id: I10add1895cfa122a370d24196a33ec2dcfafccfc
2022-08-17 15:20:17 -07:00
Mu-Le Lee
8f74418389 Merge "Diff source dump and previous version dump for Cross-Version ABI Check" 2022-08-16 05:07:28 +00:00
Yu Liu
1175c057d6 Filter out headers generated by bazel in snapshot.
Bug: 242220039
Test: Manually verified that mixed build works
Change-Id: I3daf0b8a7deab275eb52a1c5e30724fda433461d
2022-08-15 12:34:20 -07:00
Sam Delmerico
fae47f9522 bp2build special case for libcrypto_for_testing
A new module libcrypto_for_testing was added that uses the
inject_bssl_hash property, but this property is currently only available
for the libcrypto module specifically.

Test: CI
Change-Id: I1b83de02a2990b7503980bf6a85611683427baf9
2022-08-08 13:35:08 -04:00
Mu-Le Lee
0a9005eaad Diff source dump and previous version dump for Cross-Version ABI Check
Created a function to determine the current finalization stage by
environment variable and the existence of a version folder
prebuilt/abi-dumps/<lib_type>/<platform_sdk_version>/.
Assign the corresponding prevVersion with the current stage and generate
mk commands to diff source and previous dump to
{fileName}.{prevVersion}.abidiff with diff flag --allow-extension and
--advice-only
The test is verified in all stages. lsdumps should be prepared in
advance.
For stage 1: current/ and PLATFORM_SDK_VERSION/
For stage 2: current/ and {PLATFORM_SDK_VERSION-1}/
For stage 3: PLATFORM_SDK_VERSION/ and {PLATFORM_SDK_VERSION-1}/
The definition of stages could be found at
"go/cross-version-abi-check#bookmark=id.vpflkul2z968"

Test: make libbinder_ndk
Bug: 238387082
Change-Id: Ic29456113a541650c75fa38c5c4f2d6d2e76a877
2022-08-05 05:37:42 +00:00
Mu-Le Lee
5e04753bb6 Diff source dump and current version dump for Cross-Version ABI Check
In the newly proposed Cross-Verison ABI Check, the path of dump that
LLNDK, NDK and mainline reference to is changed to:
Before finalization: current/
After finalization: {PLATFORM_SDK_VERSION}/
In addition, a related CL(aosp/2147882) modifies the script to create
dump to folders that match the current finalization stage.

Test: make libbinder_ndk
Bug: 238387082
Change-Id: I92a4a52c26c85cf4c866b441e54291c6a624fbf4
2022-08-02 17:35:15 +00:00
Mu-Le Lee
6f84b7763e Merge "Move LLNDK ABI dumps from vndk/ to platform/" 2022-07-22 10:44:06 +00:00
Jiyong Park
ffea9b3b0e #apex symbols no longer contribute to platform libraries
Bug: 239274367
Test: m
Change-Id: I7a6cd0f46071d5dbbf9510df5693a0d6b95e10c0
2022-07-19 13:47:19 +09:00
Jiyong Park
85cc35a143 Distinguish # apex and # systemapi symbols
Previously, the symbol tag `# apex` was treated the same as `#
systemapi`. With this CL, they have different meanings.

`# systemapi`: APIs that are defined in the platform (the non-updatable
part), and are exposed to unbundled system components like APEX

`# apex`: APIs that are defined in the APEX and are exposed to the
platform or other APEXes

Bug: 239274367
Test: m
Change-Id: I0484ea349656dbbd337e5fe3a5970f0ad275b807
2022-07-19 13:47:19 +09:00
Mu-Le Lee
85155c8ada Move LLNDK ABI dumps from vndk/ to platform/
Since vndk libraries don't need to maintain Cross-Version abi
compatibility. The newly proposed Cross-Version ABi checking mechanism
is applied to only ndk/ and platform/. The reference dumps of LLNDK
libraries should get from platform/ to be benefited from this checking
mechanism.

Test: mkdir -p prebuilts/abi-dumps/platform/UpsideDownCake/64/x86_64/source-based/ && cp prebuilts/abi-dumps/vndk/32/64/x86_64/source-based/libvndksupport.so.lsdump "$_"
      make libvndksupport -j
Bug: 238383845
Change-Id: I663511d60623cd23619166d8d63fd26220a930e2
2022-07-08 08:17:29 +00:00
Yi Kong
cf57a641ba Don't pass deprecated -single_module linker flag on Darwin
man ld:
> -single_module
>     This is now the default so does not need to be specified.

Bug: 236924555
Test: m adb
Change-Id: If33a5c955deca4548c57703b232a3b9c0eaa3563
2022-06-24 18:49:04 +08:00
Treehugger Robot
5d069fb876 Merge "Add diff_flags as a header_abi_checker property" 2022-06-02 04:14:57 +00:00
Treehugger Robot
ced67ded0b Merge "Remove -sha256 flag when calling bssl_inject_hash." 2022-05-31 16:53:06 +00:00
Hsin-Yi Chen
6ad1e4b5ea Add diff_flags as a header_abi_checker property
The property allows developers to add extra flags to header-abi-diff for
specific libraries.

Bug: 232891473
Test: m libbinder.vendor
Change-Id: I203af73c784dfc7738bb64f57b224c08d5c595ce
Merged-In: I203af73c784dfc7738bb64f57b224c08d5c595ce
(cherry picked from commit 4f992b663f)
2022-05-26 15:12:37 +08:00
Liz Kammer
707f65d3d5 Merge "Remove library decorator for extracting headers" 2022-05-23 19:36:57 +00:00
Chris Parsons
6ce2cf9b69 cc bazel handlers: use better interface checking
This is a far better approach for ensuring that bazel handlers implement
the BazelHandler interface, as it causes a compile error if they do not
implement the appropriate interface methods.

Test: Manually verified no change in ninja file
Change-Id: I63a4f8b57e3aedd4c0915c2fd2eb7029e9a993aa
2022-05-20 10:54:17 -04:00
Chris Parsons
f874e46153 Refactor mixed builds to only take one pass
This large refactoring has both immense performance implications and
improves mixed builds complexity / usability. Summary:

1. Queueing calls to Bazel is done in a new mutator instead of a full
   soong_build pass. Normal soong_build flow is interrupted (via a
   functional hook in blueprint) to invoke bazel and parse its response.
2. Implementing mixed build support for additional modules is as simple
   as implementing MixedBuildsBuildable. In this interface, define the
   request that must be queued to Bazel, and then subsequently define
   how to handle the returned bazel cquery metadata.
3. Mixed builds consists of only a single pass. This greatly
   improves mixed build performance.

Result:
  A 33% runtime improvement on soong analysis phase with mixed builds.

Caveats:
  C++ BazelHandler handling still remains a bit of a mess; I did what
  I could within this CL's scope, but this may require additional cleanup.

Test: Treehugger
Test: Verified that aosp_arm ninja file is bit-for-bit identical with or
without this change.

Change-Id: I412d9c94d429105f4ebfafc84100d546069e6621
2022-05-20 10:04:13 -04:00
Pete Bentley
c0d89b3db1 Remove -sha256 flag when calling bssl_inject_hash.
Flag removed upstream, all platforms now use SHA-256
for libcrypto integrity hash.

Test: m && flashall
Change-Id: I453edebb80ec2a853d54ce5c3f055b6456010524
2022-05-18 18:01:22 +01:00
Liz Kammer
5454944b9a Remove library decorator for extracting headers
It is unused and removing it allows us to use the same function for
prebuilt/not libraries.

Test: bp2build.sh
Change-Id: I92ac56496cff2c2e55d6eb9f261fe75a1b232856
2022-05-13 19:52:27 -04:00
Treehugger Robot
7f5b4e3229 Merge "Remove version_selector mutator" 2022-05-03 03:06:57 +00:00
Yu Liu
a79c946fb0 Support use_version_lib in cc_binary.
Bug: 208481704
Test: Add unit test
Change-Id: I7cf299dd6b3287974067234687b3b2495a85d31e
2022-04-15 15:45:06 -07:00
Liz Kammer
2394224da3 Remove version_selector mutator
This mutator simply set a mutated property immediately before a separate
mutator used the value in the property. Instead of a separate mutator,
condense the two into a single mutator pass.

Test: CI
Change-Id: I26c392cdb96f6182a19fbcf0cf3f88a8fc72f81c
2022-04-08 16:17:12 -04:00
Yu Liu
fc603167f4 Support tailoring clang --target flag based on min sdk version.
Bug: 215748260
Test: Tested using aquery to verify the --target flag; add added unit

Change-Id: Ifb13509db7d1e110316aa44d55ec9cccaa4b83d1
2022-03-18 01:16:52 +00:00
Chih-Hung Hsieh
9db8a0c5b2 Add tidy_timeout_srcs property
Similar to `tidy_disabled_srcs`, a `tidy_timeout_srcs` list
can be used to include all source files that took long to compile
with clang-tidy. Files listed in `tidy_timeout_srcs` will not
be compiled by clang-tidy when `TIDY_TIMEOUT` is defined.

Bug: 201099167
Test: TIDY_TIME=90 make droid tidy-soong_subset
Change-Id: Ie0bfda66caae4445d10117ceefa1b5b8c1ecf256
2022-02-17 14:48:40 -08:00
Colin Cross
a2bcf2c4b8 Fix transitive whole_static_libs on prebuilt static libraries
whole_static_libs on static library usually uses the .o files from
the dependency, but on a prebuilt static library has to use the .a file.
whole_static_libs on a static library that itself has whole_static_libs
on a prebuilt static library also needs to use the .a file transitively.

Test: TestWholeStaticLibPrebuilts
Change-Id: I9d4aabf72be0941b461a72e610f2b28287251cb2
2022-02-11 13:51:41 -08:00
Liz Kammer
da0b38772d Merge "Create subdir for cc rules." 2022-02-10 14:16:07 +00:00
Yu Liu
febce2dfa7 Merge "Support bssl hash injection for libcrypto." 2022-02-08 16:59:34 +00:00
Yu Liu
75be7b94d6 Support bssl hash injection for libcrypto.
Bug: 215541108
Test: Build libcrypto with Bazel and verify the hash injected, add unit
test
Change-Id: I0375307aab0b1e60a8be298d680e1e0af1ebb454

Change-Id: I9133ce398e2024fe7834a292bf2f5ba3222d630b
2022-02-07 14:15:42 -08:00
Liz Kammer
0ea7998208 Update error messages for failed globs.
Currently error messages appear like:
&fs.PathError{Op:"open", Path:"..." Err:0x18}
which make them difficult to parse.

Test: CI
Change-Id: I18da18abc43230d0ea37d166179d07e585077f51
2022-02-07 08:56:47 -05:00
Liz Kammer
2b376bca00 Create subdir for cc rules.
Test: mixed_libc.sh
Change-Id: I7f43f283f40ad6236dcedfccae175a007ea252d2
2022-01-27 11:16:34 -05:00
Jingwen Chen
0ee88a6b65 Implement stubs.symbol_file and stubs.versions for cc_library_shared bp2build.
This CL turns the stubs.symbol_file and stubs.versions properties into
stubs_symbol_file and stubs_version attributes on the cc_shared_library
target. See associated build/bazel change on how these attributes are
used to generate stub libraries.

Bug: 207812332

Test: New tests
Test: CI
Change-Id: Ie23eafb9903a131d92ff4e251215e998cea0a763
2022-01-17 13:03:12 +00:00
Chih-Hung Hsieh
7540a78a35 Generate tidy-* rules unless tidy is disabled
* make tidy-soong_subset, or make tidy-<any_directory>,
  should trigger the same clang-tidy compilations
  with or without global WITH_TIDY=1.
* Normal make should not trigger clang-tidy compilations
  unless global WITH_TIDY=1 or a module has set tidy:true.

Bug: 213918926
Test: NINJA_ARGS="-n" make tidy-soong_subset
Test: NINJA_ARGS="-n" make <some-library>
Change-Id: Iafffd3894abe137c9584c2c01830898422f9a677
2022-01-12 16:48:40 -08:00
Liz Kammer
3d3b35c94e Revert "Revert "bp2build: convert host & prebuilt header libraries""
This reverts commit 105deedfc7.

Reason for revert: Revert with forward fix

Change-Id: Ib0b6f6b1cbb011b4c5f2133e1cc15ec76ff29253
2022-01-11 16:02:50 +00:00
Jingwen Chen
105deedfc7 Revert "bp2build: convert host & prebuilt header libraries"
This reverts commit d8a72d7dc9.

Reason for revert: root cause for b/214013899

Change-Id: If769708408c419c2fd3d9484fbf40202b7276299
2022-01-11 12:51:27 +00:00
Liz Kammer
d8a72d7dc9 bp2build: convert host & prebuilt header libraries
Test: bp2build.sh
Change-Id: If8165eac7c17c4eef3686067257aa792121db59d
2021-12-22 16:34:27 -05:00
Chris Parsons
58852a05f3 Handle the 'enabled' property in bp2build
Also fix some bugs pertaining to configurable attribute handling of bool
attributes and label sttributes, so that they may support values across
multiple different axes at the same time.

Test: unit tests for bp2build
Test: mixed_droid

Change-Id: I411efcfddf02d55dbc0775962068a11348a8bb2c
2021-12-21 16:37:32 -05:00
Wei Li
bafb6d6612 Add the initial implementation of bp2build converter for java_library,
java_library_host, java_binary_host and cc_library_host_shared so
signapk tool can be built with Bazel.

Test: b build //build/bazel/examples/apex/minimal:build.bazel.examples.apex.minimal
Test: jarsigner -verify -verbose build.bazel.examples.apex.minimal.apex
Bug: 209876137
Bug: 196204358
Bug: 210158864
Bug: 210159074
Bug: 210158872
Change-Id: I855884159d25e69d8f9623792c376da820a1eb4c
2021-12-14 17:23:19 -08:00
Liz Kammer
be46fccc40 Use one mutator for all bp2build conversion.
Each conversion required defining a separate mutator, which will each
operate on _all_ modules and requires each to repeat checks whether the
mutator should operator. Instead, we introduce a single mutator and
modules can define a ConvertWithBp2build to implement bp2build
conversion for that module.

Test: bp2build.sh
Bug: 183079158
Change-Id: I99d4b51f441c2903879092c5b56313d606d4338d
2021-12-14 09:37:45 -05:00
Liz Kammer
1263d9bdb1 Handle includes for generated headers
For generated headers, Soong introduces the package to the includes (and
re-exports as necessary).

Test: bp2build.sh
Change-Id: Iea9cda859ddaa3e5393f0f4533c15fc60222c408
2021-12-13 12:06:39 -05:00
Rupert Shuttleworth
484aa25875 Add initial support for use_version_lib.
Test: Resolves build error for BP2BUILD_VERBOSE=1 b build //packages/modules/adb:libadbd_core
Test: Added unit test

Bug: 208481704

Change-Id: I4022c686c7baf050de3f97295fe4654515622a66
2021-12-13 06:21:16 -05:00
Dan Willemsen
4745007bb1 Add Darwin x86_64+arm64 universal binary support
This is configured from Make by setting up Darwin+Arm64 as a HOST_CROSS
target (which is largely true, as binaries can't be executed on X86_64
machines). On the Soong side, it's a bit blurier, as we don't current
have any other users that are the same OS but not natively executable
(Linux/musl is executable, Windows/x86 is a different OS).

Instead of requiring cc_binary/etc to become multi-architecture-aware
and using something like common_first/MultiTarget, this defaults all
non-multi-architecture-aware modules to be built with both
architectures. It then adds a dependency with the
DarwinUniversalVariantTag so that supporting modules can get the outputs
of the other variant.

Cc uses that dependency tag to run lipo on shared libraries and binaries
so that the output of the x86_64 variant is actually a fat binary
including both architectures.

Bug: 203607969
Test: build sdk-repo targets on a Mac
Change-Id: Icbddb0a177c0ba19d3e0d11f8cf568e0d1ea3245
2021-12-07 22:01:25 -08:00
Chih-hung Hsieh
970f8388a8 Merge "object files depend only on NDK headers" 2021-12-07 02:00:50 +00:00
Chris Parsons
77acf2e5c1 bp2build: split full_cc_library into shared/static
Test: mixed_droid.sh in conjunction with rule changes
Test: bp2build.sh
Change-Id: If0577065fd39a0446eab16b62c15204d43207e19
2021-12-06 14:11:40 -05:00
Chih-Hung Hsieh
f6ca1b961b object files depend only on NDK headers
* shared libraries and binaries can depend on NDK share libraries

Bug: 208310402
Test: WITH_TIDY=1 make tidy-soong
Test: WITH_TIDY=1 make droid
Change-Id: I88ca8555c62d5ca49e36ca089749722166afec30
2021-12-05 18:10:13 -08:00
Liz Kammer
12615dbbca bp2build: support full/lite protos in cc libs
Test: bp2build.sh
Bug: 200601772
Change-Id: I3a7e00546726bc63b5eb8d5604557c5988a5320b
2021-12-02 11:00:46 -05:00
Chris Parsons
79bd2b7761 bp2build implementation for c_std
Test: mixed_droid in conjunction with topic changes
Change-Id: Ic673c1b269f5082b490b32057eb60f3b73eb0940
2021-11-29 18:38:31 -05:00
Jingwen Chen
a47f28d28e bp2build: add support for soong_config_module_type.
Test: CI, go unit test
Bug: 198556411
Change-Id: Idf862904d51d822f92af0c072341c31b7a02fc64
2021-11-08 13:38:28 +00:00
Ivan Lozano
7b0781d14c rust: Emit toc files for cdylibs
Write toc files that list the exported symbols so dependents are
only rebuilt if the exported symbols change.

This exports the CC function TransformSharedObjectToToc, and also
removes an unused arg from its signature.

Bug: 178185435
Test: New Soong test passes.
Test: m <toc file path>
Change-Id: I7ab69bf7e7f32f25eb4c7ca9d18d877dac1511db
2021-11-03 15:34:50 -04:00
Colin Cross
4985224198 Merge "Make installable arch-variant and static vs shared variant for cc modules" 2021-10-30 04:56:22 +00:00
Colin Cross
1bc9412fb3 Make installable arch-variant and static vs shared variant for cc modules
libc's native_bridge shared variant needs to be installable: false,
make the installable property arch-variant and allow the static and
shared clauses to override it.

This relands I8e0eaed2169e89520b07bb0326bb97ac0b4a70ac with fixes to
allow only the shared variant to be marked installable: false.

Bug: 204136549
Test: m checkbuild
Change-Id: Ie579b5ba56ca21f4d9243088afd5078d8c122a68
2021-10-29 15:00:38 -07:00
Chih-hung Hsieh
4dceb3705f Merge "Do not add .tidy files as RBE link inputs" 2021-10-27 20:29:04 +00:00
Liz Kammer
e6583482a8 bp2build: Handle export_generated_header property
The generated_header property resides in BaseCompilerProperties, while
export_generated_header resides in BaseLinkerProperties. Previously
bp2build handled these property structs separately; however, these two
related properties residing in separate structs requires restructuring
the code to allow access to both BaseCompilerProperties and
BaseLinkerProperties for a single axis/configuration combination to
resolve which generated headers are exported/not for the
axis/configuration..

Test: go test soong tests
Test: build/bazel/ci/bp2build.sh
Change-Id: Id150003637fd19d87e8dc5d6941e9f36dc4031dd
2021-10-26 15:10:41 -04:00
Chih-Hung Hsieh
3bb934f0ad Do not add .tidy files as RBE link inputs
* RBE adds implicit dependent files as inputs
  and creates too long commands.
* Adds .tidy files as validation paths.
* Change type of tidyFiles to WritablePaths.

Bug: 203577539
Test: lunch aosp_cf_arm64_phone-userdebug; USE_RBE=true WITH_TIDY=1 make
Test: USE_RBE=true WITH_TIDY=1 mm in external/skia
Change-Id: I5fc9d6f8c9c58abcd3721ca9fbae1bc785e4e609
2021-10-25 12:24:30 -07:00
Chris Parsons
787fb36189 Add OS to configuration key in mixed builds
This also removes the special-case filegroup from mixed builds
buildroot; no special handling is required. Since we're currently
hardcoding linux_x86_64 as our host platform, it should be fine
to continue assumping that hardcoded host for now.

Test: USE_BAZEL_ANALYSIS=1 m adbd
Change-Id: I35509f4eb33ba7a243fab4c34b35958f6f2fceab
2021-10-19 16:55:52 -04:00
Liz Kammer
d2871189b1 Update version_script to be handled as linkopt
This allows us to handle this consistently between cc_binary and
cc_library* types.

Test: build/bazel/ci/bp2build.sh
Change-Id: I996f42bbe591215217c3d561662e775925b871ff
2021-10-13 08:36:58 -04:00
Jingwen Chen
5b11ab1a69 Convert cpp_std to be an attribute instead of a copt.
This attribute is then converted into a feature in cc_library_static.

Fixes: 202518741
Test: CI
Change-Id: I070b56a1e96680ffad0466d085caaab2e9308ebc
2021-10-11 17:44:33 +00:00
Liz Kammer
0eae52e0de bp2build; Update handling of linker flags
Test: build/bazel/ci/bp2build.sh
Bug: 197920036
Change-Id: I6e3100574fa0e40bcd8cf0e6af0efd3310aa41bf
2021-10-07 16:07:40 -04:00
Jingwen Chen
6ada589f6e Add support for nocrt by translating it to link_crt in bp2build.
If nocrt is true, then the compilation for cc_shared_library,
cc_binary (shared or static binaries) will _not_ link against their
respective crtbegin and crtend libraries.

nocrt is true only for the Bionic libraries themselves. For everything
else that links against the Bionic runtime, crtbegin and crtend
libraries are used. This makes the "nocrt: false" case the majority.
Hence, if nocrt is explicitly false, we omit the generating attribute in
bp2build.

If nocrt is explicitly true (link_crt is false), the Starlark macro will
disable the link_crt cc_toolchain feature.

Test: new tests
Test: CI
Fixes: 187928070
Fixes: 197946668
Change-Id: I8947789930e599dc802d8eae440859257d044475
2021-10-07 14:04:39 +00:00
Treehugger Robot
d905146590 Merge "Bp2Build common properties auto-handling" 2021-10-04 19:02:07 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
447f6c99c9 Bp2Build common properties auto-handling
Introduce `commonAttributes` & `fillCommonBp2BuildModuleAttrs used in
CreateBazelTargetModule

Adapt `bp2BuildInfo` to use `commonAttrs` instead of `Name`.
And thus also all downstream users of `CreateBazelTargetModule`.

As initial user, the Soong `required` property will be
translated to Bazel's `data`.

Bug: 198146582, 196091467
Test: build_converstion_test.go:TestCommonBp2BuildModuleAttrs
Test: go test
Test: mixed_{libc,droid}.sh
Change-Id: Ib500e40f7e2cb48c459f1ebe3188962fc41ec124
2021-10-04 14:43:04 +00:00
Colin Cross
ceaa5328f0 Export SOONG_CC_API_XML to Make outside androidmk
This relands Ie0a945d879de4f99ce76d005aea8041719c244f7 with a fix
to prevent building XMl files for multiple variants of a library.

The SOONG_CC_API_XML values are needed for modules that are not
exported to Make, export them from a singleton that covers all
modules instead of an AndroidMkProvider that may not be called
for some modules.

Bug: 193819970
Test: forrest
Change-Id: I54710c00901976a736e88126f406e02b1f3c3586
2021-09-30 13:11:48 -07:00
Colin Cross
2cec05d37b Revert "Export SOONG_CC_API_XML to Make outside androidmk"
This reverts commit ebb32c486a.

Reason for revert: breaks coverage build (b/201600003)
Bug: 193819970
Bug: 201600003

Change-Id: I65969c4a62165c40dded2794b757469909bf8ca6
2021-09-30 03:14:40 +00:00
Colin Cross
ebb32c486a Export SOONG_CC_API_XML to Make outside androidmk
The SOONG_CC_API_XML values are needed for modules that are not
exported to Make, export them from a singleton that covers all
modules instead of an AndroidMkProvider that may not be called
for some modules.

Bug: 193819970
Test: manual
Change-Id: Ie0a945d879de4f99ce76d005aea8041719c244f7
2021-09-28 16:39:13 -07:00
Chris Parsons
a967f253e6 Add stl property support for bp2build
Test: mixed_libc
Test: USE_BAZEL_ANALYSIS=1 m libbase
Change-Id: If56d4a728de3ae4022cc9dadadc9bf8b952f9eaf
2021-09-24 13:51:56 -04:00
Liz Kammer
7a210ac233 bp2build: Add support for export_.*headers props
Soong supports export_.*_headers properties, the libraries contained in
this list must also be within a shared/static/whole_static/header libs
property. For bp2build, we eliminate this duplication. The libraries
not listed in an export_.*_headers property will migrate to an attribute
prepended with implementation_, those in export_.*_headers will not have
a prefix.

Test: build/bazel/ci/bp2build.sh
Test: build/bazel/ci/mixed_libc.sh
Bug: 198241472
Change-Id: I3eb84c983ec5d241c8a568e411dfd5619d3184a7
2021-09-23 16:07:45 -04:00
Christopher Parsons
ce0944fc96 Merge "bp2build: reference static variants directly" 2021-09-21 15:13:43 +00:00
Chih-Hung Hsieh
769a51cc6a Add tidy_disabled_srcs property.
Used as a supplement to C/C++ srcs to disable
clang-tidy for selected srcs, when a library
contains many files in srcs and only some of them
are too large to compile with clang-tidy.

Test: WITH_TIDY=1 TIDY_TIMEOUT=90 make tidy-soong
Bug: 198098397
Change-Id: Ib32eb0e46ddbc717999797717bfd8c57e182ee88
2021-09-20 18:17:59 -07:00
Chris Parsons
953b35623a bp2build: reference static variants directly
Previously, when referencing a cc_library as a static_lib from a
converted module, the corresponding target would depend on the "root
target" of that cc_library. This resulted in a superfluous dependency on
the shared target of the cc_library dependency. This superfluous
dependency could sometimes result in cycles.

This change ensures the static target name is directly specified in such
cases.

Test: mixed_libc.sh CI
Test: USE_BAZEL_ANALYSIS=1 m fmtlib
Change-Id: I36ee9f0a9017b1e9d73df9e3174669107f0afd4f
2021-09-20 15:15:29 -04:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
62585e8436 Expose TocFile via CcInfo
To reflect what's provided in SharedLibraryInfoProvider

Move the logic for identifying the toc file into Starlark
instead of the Soong Go code.

Adapt TestGetCcInfoParseResults to expect the toc as well.

Test: build/bazel/cquery/request_type_test.go:TestGetCcInfoParseResults
Test: cc/library_test.go:TestCcLibrarySharedWithBazel
Test: build/bazel/ci/mixed_{libc,droid}.sh
Change-Id: I40ad47158cb98b14ca03c21e351988818cb01770
2021-09-16 20:55:10 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
bc4e734e59 Incorporate cc_library_shared into mixed builds
The infrastructure is already there via its need in
`cc_library`. Therefore, just enable it by setting
the `bazelHandler` in `LibrarySharedFactory`, and
add a test to verify the functionality.

Bug: 198817980
Test: cc/library_test.go:TestCcLibrarySharedWithBazel
Change-Id: Ibff80616632af59a0e409110f8645e028f99c7d6
2021-09-16 18:13:52 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
ac5097fcf4 Create bp2build converter for cc_shared_library
Factor out shareable code with cc_static_library

Remove `Linkstatic` field for shared cases,
because it's redundant with the rule

Bug: 198241907
Test: cc_library_shared_conversion_test.go
Test: mixed_{libc,droid}.sh
Change-Id: I5be3b66f812893bce41edb425fbd143ab22d9051
2021-09-16 15:00:56 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
a5474e36c5 Remove Linkstatic field for static cases
With the explicit implementation of cc_library_shared,
this is now redundant for both, so remove it.

Test: cc_library_static_conversion_test.go
Test: mixed_{libc,droid}.sh
Change-Id: I6e7733ca08c254562e95e70d93c9f519719d8a18
2021-09-16 15:00:47 +00:00
Liz Kammer
35687bc77a Split local/absolute include into attributes
Previously these were expanded into copts, requiring making all includes
absolute and duplicating includes to account for potentially generated
files. We now can handle both of these properly on the Bazel side, so
let's clean up build files a bit.

Test: bp2build.sh
Change-Id: I6c6160738cd6c269408c6c7a37010654d84f3c9d
2021-09-13 12:49:42 +00:00
Liz Kammer
5fad501aeb bp2build: Split export_{includes,system_includes}
The specification of exporting includes vs system includes has an impact
on inclusion sort order. Conflating the two caused some symbols to not
be resolved correctly.

Bug: 198403271
Test: build/bazel/ci/bp2build.sh
Test: USE_BAZEL_ANALYSIS=1 m libbacktrace_no_dex succeeds with libc++_*
      modules removed from mixed build denylist (would fail otherwise)
Change-Id: I08aff253d8962dc678ed10214b1c171330e0fe19
2021-09-09 15:59:05 -04:00
Liz Kammer
7cbf7738f2 Cleanup unused code for bp2build conversion.
This code to support bp2build-specific modules is no longer necessary as
we do not create bp2build modules after https://r.android.com/1792714

Test: build/bazel/ci/bp2build.sh
Change-Id: I20d3c42f7e3516554cfb537fef05ba40d222dbeb
2021-09-07 13:19:21 -04:00
Sophie Zheng
d9287b6c35 Merge "Also generate api lists based on symbol files for cc_library rule during build time." 2021-08-25 04:16:34 +00:00
sophiez
4c4f80326d Also generate api lists based on symbol files for cc_library rule during build time.
Test: build/soong/soong_ui.bash --make-mode SKIP_ABI_CHECKS=true TARGET_PRODUCT=aosp_cf_x86_phone TARGET_BUILD_VARIANT=userdebug droid dist DIST_DIR=/usr/local/google/home/sophiez/my_dist_dir EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true CLANG_COVERAGE=true SKIP_BOOT_JARS_CHECK=true

Change-Id: Ic857c14c5c258b8f4d150cc71ce9eabce33d7d54
2021-08-24 17:39:45 -07:00
Liz Kammer
380dbb9327 Merge "Don't create a new module for bp2build conversion." 2021-08-18 19:28:20 +00:00
Jay Patel
eaf5e1b3ec Merge "Allow PRODUCT_CFI_INCLUDE_PATHS to work with blueprints also" 2021-08-18 15:18:41 +00:00
Liz Kammer
2ada09a546 Don't create a new module for bp2build conversion.
A performance improvement for bp2build as Blueprint/Soong no longer have
the overhead of additional modules. The creation of these modules
results in:
* traversal of additional modules for each subsequent mutator
* synchronization over a go channel to collect newly created modules:
https://cs.android.com/android/platform/superproject/+/master:build/blueprint/context.go;l=2594,2600;drc=1602226f23181b8c3fbfcaf3358f0297e839d7d3

We avoid both of these by storing the information directly in the
underlying module.

Also as a fringe benefit, removes some necessary boilerplate for
conversion.

For benchmarks, reduces runtime ~1% for 1% converted, ~24% for 100%
converted. See more: go/benchmarks-for-https:-r.android.com-1792714

Test: ran benchmarks/tests in bp2build
Test: build/bazel/ci/bp2build.sh
Change-Id: Ie9273b8cbab5bc6edac1728067ce184382feb211
2021-08-17 15:57:09 -04:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
0d99045b69 Lift BazelHandler interface into android/
Because it's commonly useful and not cc/ specific
Also export GenerateBazelBuildActions and update uses

Test: Existing tests pass
Change-Id: Ibc6858bb1129afba181a7686dda432defe33b00d
2021-08-11 18:19:40 +00:00
Chris Parsons
2c7883941e Support rtti in bp2build
Rtti was already handled by bazel macros, so this change simply
propagates the rtti bit to these macros.

Test: Run bp2build, build //external/libcxxabi:all
Change-Id: I63296db2db868202874c8bd0b1de6310f7bb85c7
2021-08-10 11:58:07 -04:00
Chris Parsons
51f8c39261 bp2build: handle system_shared_libs
- If no system_shared_libs is specified, bp2build writes no attribute
value. In this case, the bazel library macros determine the correct
default behavior.
- If any system_shared_libs is specified for any variant, then bp2build
writes the value verbatim. This includes if an empty list is specified,
as this should override defaulting behavior.

Note this defaulting behavior is incomplete and will be incorrect in
corner cases. For example, if, in an Android.bp, system_shared_libs is
specified for os.linux_bionic but not for os.android, then the bazel
default for os.android will be incorrect. However, there are no current
modules in AOSP which fit this case.

As a related fix, supports static struct for cc_library_static.

Also, removes some elements from the bp2build denylist.

Test: mixed_droid CI
Change-Id: Iee5feeaaf05e8e7209c7a90c913173832ad7bf91
2021-08-09 11:41:09 -04:00
Elvis Chien
9c99354465 Allow PRODUCT_CFI_INCLUDE_PATHS to work with blueprints also
but disable it for host modules like how it's done for Android.mk

Bug:
179233410

Test:
m -j32

Change-Id: I246cd9163e06997a2b50cd25688370690c8929af
2021-08-04 18:07:51 +08:00
Treehugger Robot
2231f8a21c Merge "Remove default_shared_libs" 2021-07-23 21:18:51 +00:00
Colin Cross
6b8f4253eb Remove default_shared_libs
system_shared_libs has been modified to have the same behavior as
the newly added default_shared_libs, remove default_shared_libs in
favor of system_shared_libs.

This reverts Ia2349d84c70e503916f90a5d2702e135248f73df and renames
the default_shared_libs property in cc_object (which never had
system_shared_libs) to system_shared_libs.

Bug: 193559105
Test: m checkbuild
Change-Id: I46672e3a096b6ea94ff4c10e1c31e8fd010a163c
2021-07-22 12:10:11 -07:00
Chris Parsons
69fa9f9e5e Seperate asflags and cflags
This fixes a bug which was a misunderstanding of soong properties:
Soong's cflags pertain only to C and C++ language, whereas bazel's copts
pertain to all three languages. This change ensures that asflags are
added as specifically asflags, and the 'copts' for the static library
macro pertains only to C and C++ languages.

This requires a somewhat hacky workaround for asflags, however: Since
assembly sources also need includepath-related flags, this duplicates
these flags between copts and asflags. To reduce verbosity of
bp2build-generated targets, this also ensures that asflags are omitted
in cases where there are no assembly sources.

Test: Mixed build droid CI
Change-Id: Ic0babed1f90d6dc82e5788638681ce5b995043f8
2021-07-13 14:06:14 -04:00
Colin Cross
e19e6196b9 Merge "Add default_shared_libs property" 2021-06-30 14:27:20 +00:00
Colin Cross
dd8b6911ac Merge "Reland "Consistently prepend arch-specific headers"" 2021-06-30 00:19:56 +00:00
Colin Cross
0ed579efd9 Reland "Consistently prepend arch-specific headers"
This reverts commit cacb972dcd.

Relanding along with one more fix in prebuilts/ndk

Change-Id: I65cbc3c5d72bb47bd00e123c63911c9baa1e5f03
Test: m checkbuild
2021-06-29 00:51:12 +00:00
Colin Cross
e86698f28a Merge "Revert "Consistently prepend arch-specific headers"" 2021-06-28 23:59:48 +00:00
Colin Cross
cacb972dcd Revert "Consistently prepend arch-specific headers"
This reverts commit e945a4d212.

Reason for revert: broke full-eng checkbuild

Change-Id: I0036fed96aa727b63c16982151fd661923e77e59
2021-06-28 23:58:59 +00:00
Colin Cross
99f5cc002b Merge "Consistently prepend arch-specific headers" 2021-06-28 22:55:35 +00:00
Colin Cross
9ecb42dd31 Add default_shared_libs property
Building against a locally-built libc besides bionic requires setting
system_shared_libs to avoid circular dependencies, but modules all
over the tree assume that system_shared_libs only affects modules
building against bionic.  Add a new default_shared_libs property
that applies to all modules, which will generally be set in
arch-specific clauses to only affect the desired set of modules.

Bug: 190084016
Test: m checkbuild
Change-Id: Ia2349d84c70e503916f90a5d2702e135248f73df
2021-06-22 16:54:40 -07:00
Colin Cross
d1a2813063 Move default crt objects into Toolchain
Move the crt objects spread around cc/library.go and cc/binary.go
into the Toolchain.  This will simplify adding new toolchains that
have custom crt objects.

Test: m checkbuild
Test: go test ./cc/...
Change-Id: I7fdc1f53769799cb9c10e3e5816dabee0f918768
2021-06-22 16:54:40 -07:00
Colin Cross
baf4f0c30a Merge changes Ie384089d,Ie2e954cd
* changes:
  Support genrules as CrtBegin and CrtEnd
  Support multiple CrtBegin and CrtEnd files
2021-06-16 16:50:59 +00:00
Colin Cross
f77d3804fc Merge changes from topic "host_bionic_no_inject"
* changes:
  Give extracted linker sections pretty names
  Stop injecting symbols into host bionic binaries
2021-06-16 16:50:05 +00:00
Jingwen Chen
d51502d238 Merge "Make SharedLibraryInfo comment clearer." 2021-06-16 12:01:21 +00:00
Jingwen Chen
c4dc9b4f08 bp2build: group shared/static attrs into a struct.
This makes bp2build generate these attrs into a Starlark dictionary,
passed into the cc_library macro directly. This makes the BUILD target
representation more similar to the Android.bp one, and also makes
it more legible.

Test: TH
Change-Id: I42b427cc4b22c6376d3d24e40b9af1692bb0c692
2021-06-16 05:40:37 +00:00
Jingwen Chen
702963e74d Make SharedLibraryInfo comment clearer.
Nit from aosp/1727935

Test: TH
Change-Id: I4cf6d63fb3b1f0bd1762d5e4ea261aa8f5a4b580
2021-06-15 23:44:13 +00:00
Chris Parsons
94a0bba5a9 Support cc_library_shared for mixed builds
Authors: cparsons, eakammer, jingwen

This CL also contains .toc file integration between Bazel and Make.

Fixes: b/190524879

Test: build/bazel/ci/mixed_droid.sh

Co-authored-by: Christopher Parsons <cparsons@google.com>
Co-authored-by: Liz Kammer <eakammer@google.com>
Co-authored-by: Jingwen Chen <jingwen@google.com>

Change-Id: If484042a58cb9f0db6d30a460f415f5684b4cbf6
2021-06-15 12:40:28 +00:00
Colin Cross
e945a4d212 Consistently prepend arch-specific headers
Add variant_prepend to Export_include_dirs, Export_system_include_dirs
and Generated_headers to match Local_include_dirs so that
architecture-specific headers are found before common headers.

Test: m checkbuild
Test: TestIncludeDirectoryOrdering
Change-Id: I2bf9d4373fd256e500c1f8d6c84cf593e8fdd170
2021-06-14 18:12:58 -07:00
Colin Cross
c465efd5d4 Support multiple CrtBegin and CrtEnd files
Host bionic will use multiple files for CrtBegin, make CrtBegin and
CrtEnd Paths instead of OptionalPath.

Test: go test ./build/soong/cc/...
Change-Id: Ie2e954cd87808a903617696da443009f6173e312
2021-06-11 18:00:04 -07:00
Colin Cross
f04eb99acc Stop injecting symbols into host bionic binaries
The host bionic bootstrapping no longer needs an injected symbol.
Replace host_bionic_inject with host_bionic_verify that validates
the resulting binary, and add it as a validation dependency of the
binary.

Test: build and run host bionic binary
Change-Id: I3e303d2a164b6eef851bdc8075e6ee456c05b0a8
2021-06-11 15:22:41 -07:00
Jingwen Chen
3d383bbeb9 bp2build: support strip properties.
This CL adds support to bp2build for generating all strip-related
properties into a strip dictionary as a parameter in the cc_library
macro.

With the dictionary, it's easy to organize related attributes and
directly expand into a stripped_shared_library's attributes.

Test: //build/bazel/tests/bionic:compare_libc_stripping
Test: TH
Fixes: b/187928597
Change-Id: Ifea68d48fe295e71a43b12876cb168c475a62187
2021-06-10 05:22:50 +00:00
Treehugger Robot
75851d2fb6 Merge "Only store what's used in SharedLibraryInfo" 2021-06-09 05:49:15 +00:00
Liz Kammer
d366c909ca Handle no_libcrt in bp2build.
Test: ci/bp2build.sh
Bug: 187928307
Change-Id: Ib80c4318169652b322e5d878c8784679e42f87dd
2021-06-08 17:18:22 -04:00
Liz Kammer
ef6dfea679 Only store what's used in SharedLibraryInfo
There was a reference to the static library provider, but only the
transitive static deps were used, so only store that part. Other members
were stored but unused anywhere.

Test: go test soong tests
Test: m nothing
Change-Id: I12a6b94806c052c3f0df3cab0a10f17042af1c38
2021-06-08 16:44:23 -04:00
Lukacs T. Berki
1af9316e0a Remove sort_bss_symbols_by_size.
Its only use was removed in aosp/1717013.

Bug: 187928080
Test: Presubmits.
Change-Id: If6acbfe8ba21ec4dc34166768ba1bde3bb78123c
2021-06-07 09:23:15 +02:00
Dan Albert
07538bb56b Merge "Use libabigail to track NDK ABIs." 2021-06-04 21:06:00 +00:00
Christopher Parsons
fa4ab8a7f4 Merge "Support mixedbuilds for static variant cc_library" 2021-06-04 15:09:21 +00:00
Liz Kammer
9abd62d133 Use maps in bazel *attribute types
This is to simplify the process of resolving label + exclude labels
across the various configuration axes we have and across the various
properties/modules that use this behavior.

Test: ci/bp2build.sh && ci/mixed_droid.sh
Change-Id: I8efae3e75ddb365384f5caaf5bb504a5206618d3
2021-06-03 17:37:56 -04:00
Dan Albert
f1d14c7e67 Use libabigail to track NDK ABIs.
The local diffing behavior is currently flagged off so we can land
this in stages.

Test: pytest cc
Test: treehugger
Test: development/tools/update_ndk_abi.sh
Test: m ndk
Bug: http://b/156513478
Change-Id: Iccb314411bc74ea3ddfea8b85b0539709295f65a
2021-06-03 14:29:03 -07:00
Chris Parsons
bcc9b88d49 Support mixedbuilds for static variant cc_library
Test: mixed_droid CI
Change-Id: I3126b528b375462d78e8146b5432d1e5cec20829
2021-06-03 16:52:46 -04:00
Ivan Lozano
39f901a137 Merge "Export cc vendor functions for usage by rust." 2021-06-03 15:50:36 +00:00
Ivan Lozano
d67a6b0a88 Export cc vendor functions for usage by rust.
This CL exports and refactors some cc vendor-snapshot related functions
so they can be reused by rust modules to support vendor snapshotting.

Bug: 184042776
Test: m nothing
Change-Id: I12706e62ce0ac3b2b4298085fafc1d77b8e0a0c4
2021-06-03 08:31:55 -04:00
Jingwen Chen
14a8bda31e bp2build: split as, c, and cpp srcs for cc_library
This CL adds support for cc_library to correctly split c, as and cpp
srcs in shared/static nested props, as well as splitting
the *filegroup* deps in those props, where each filegroup is expanded
into its own c, cpp and as srcs filegroups. This ensures that the
correct sources go into cc_library_static's underlying cc_libraries for
c, cpp and as sources respectively.

See the bp2build conversion test for a better visualization.

Bug: 183064430

Test: TH
Change-Id: I29add5140672d042adff65527d8b65f4a5f0a05b
2021-06-03 05:00:37 +00:00
Treehugger Robot
ebdf61ece2 Merge "Remove versioned LLNDK stubs" 2021-06-01 18:38:52 +00:00
Chris Parsons
990c4f4fc3 Rollforward "Split asm and c flags and srcs in..."
This fixes a test and rolls forward I28cf7437ee96cdf2fdbcb1eda2303691cff08ba4

Test: m nothing
Test: See I28cf7437ee96cdf2fdbcb1eda2303691cff08ba4
Change-Id: I0e450c28e70087e406e7b562d7e772785f177379
2021-05-25 12:15:52 -04:00
Colin Cross
52aa4e1fd4 Revert "Split asm and c flags and srcs in bp2build output"
Revert submission 1714835-roboleaf-asm-c

Reason for revert: TestCcLibraryStaticProductVariableSelects fails everywhere
Reverted Changes:
I28cf7437e:Split asm and c flags and srcs in bp2build output
I2b47e6b55:Split libraries by language in cc_library_static

Change-Id: I85d39a462f0a5b3f5ff3d685906813fab9f01358
2021-05-25 15:20:39 +00:00
Chris Parsons
af24cdd99f Split asm and c flags and srcs in bp2build output
This allows removal of almost all current items from the mixed build
denylist, which were previously broken due to being unable to separately
control flags for compilations of different languages within the same
target.

Note that this does not appropriately implement asm/c srcs and flags for
either the shared variant or the static variant. This will require a
followup.

Test: bp2build.sh and mixed_libc.sh CI scripts
Test: Updated b2build tests

Change-Id: I28cf7437ee96cdf2fdbcb1eda2303691cff08ba4
2021-05-24 21:49:14 -04:00
Chris Parsons
d6358775c8 Propagate unexported deps via implementation_deps
Test: bp2build and mixed_libc CI
Test: Manually verified that libc_bionic_ndk compilation gets the
appropriate headers (and no extra headers) from downstream

Change-Id: I79eb6e8ec1d415bd50d12105da4cf97101f95474
2021-05-20 12:05:24 -04:00
Inseob Kim
cc12d90753 Fix missing headers for vndk snapshotted libc
VNDK snapshot depends on addExportedGeneratedHeaders to grab generated
headers. This change adds a missing addExportedGeneratedHeaders call to
make libc's headers captured correctly.

Bug: 181326838
Test: VNDK_SNAPSHOT_BUILD_ARTIFACTS=true m dist vndk && unzip -l
out/dist/*.zip

Change-Id: Iaa89b5255c836761a26c77bb27f35f768f49039e
2021-05-14 20:15:55 +09:00
Chris Parsons
0864831019 Handle cc_library shared/static only properties
Also handle whole_static_libs via a different attribute
(whole_archive_deps), separating these dependencies from regular static
deps.

Test: Build //bionic/libdl with bazel in conjunction with bzl
changes

Change-Id: I45019b6127a0d2731592ec35537ca15e77001cc2
2021-05-10 14:06:47 -04:00
Rupert Shuttleworth
c50fa8dd05 Add support for shared_libs in cc_library targets.
Test: cd bp2build; go test

Test: bazel build //bionic/...

Test: ./build/bazel/scripts/run_presubmits.sh

Change-Id: I71e279470a0d69b243dd0a2b53ce31842fd36ee4
2021-05-10 03:35:32 -04:00
Colin Cross
c1b3644e91 Remove versioned LLNDK stubs
Nothing links against the versioned LLNDK stubs, only current and the
implementation are used.  Remove the numbered LLNDK variants.

Also remove llndkStubDepTag, it is never used to add a dependency.

Test: TestLlndkLibrary
Change-Id: Idde62007d77b8e6ceee31144c05756faf9b41f23
2021-05-06 23:50:22 +00:00
Jingwen Chen
179856a69d bp2build: build static version of libstdc++.
This CL adds the ability to filter cc_library modules to only generate
their static variant of their shared variant isn't ready.

For example, the libstdc++ library is buildable as a static library,
which libc depends on. However, the shared variant of libstdc++ depends
on libc, which has to come later.

This CL introduces that abstraction to break up bp2build conversion into
more atomic steps to help with conversion.

Test: TH (bazel build //bionic/... incl. libstdc++'s static variant)
Bug: 186489250
Bug: 186822597

Change-Id: I3e2fe748e4e3d3b656760da4807f342d67c8f45f
2021-05-04 02:06:41 +00:00
Lukacs T. Berki
1353e59690 Handle the version_script property.
Doesn't work when depends on arch/target/etc., but good enough for
libdl_android.

Bug: 186650430
Test: Presubmits.
Change-Id: Ib0facb41a89454717c74663e5e078aedd33d1b9c
2021-04-30 16:46:41 +02:00
Colin Cross
e07056af41 Merge "Remove global state from vendor public libraries" 2021-04-29 16:16:42 +00:00
Jingwen Chen
53681ef590 bp2build: make libdl build.
This CL adds support for the static and shared props, forwarding
whole_static_libs and srcs to the underlying shared library's
static_deps and static library's srcs respectively.

Test: TH
Fixes: 186609667
Change-Id: I84f838361c7758b256b2a163af894c502de03109
2021-04-29 08:59:02 +00:00
Colin Cross
5423a9c513 Merge "Remove obsolete llndk_library" 2021-04-28 23:25:06 +00:00
Colin Cross
5271fea26c Remove global state from vendor public libraries
Remove the global list of vendor public library modules used to rewrite
dependencies from the vendor module to the stubs for system modules,
and replace it with building the stubs directly in the system variant
of the vendor module.

Bug: 178231622
Test: vendor_public_library_test.go
Change-Id: I826e69ffd507d7e85fa3d4d85b5157428c642143
2021-04-27 16:26:00 -07:00
Chris Parsons
f60ecf081e Mixed builds: propagate includes from cc_* targets
This allows us to remove libasync_safe from the mixed builds denylist.

Test: mixed_libc.sh CI script
Change-Id: Ibafd231284864078bf30340f919d39e5098843ce
2021-04-27 15:04:37 -04:00
Colin Cross
8fb66f48c7 Merge "Add support for cc_library_headers to replace llndk_headers" 2021-04-27 16:40:48 +00:00
Jingwen Chen
882bcc1c1c bp2build: remove header globs in generated srcs.
Not needed anymore for bp2build-incremental since https://android-review.googlesource.com/q/topic:no-include-check.

Not needed for mixed builds either, since cc compile actions aren't sandboxed.

Fixes: 186488830
Test: treehugger and go tests

Change-Id: Ib5d4908dcce6bf910a653c457bb251d726e717d4
2021-04-27 06:26:40 +00:00
Colin Cross
203b421043 Remove obsolete llndk_library
Remove llndk_library in favor of cc_library with llndk.symbol_file.

Bug: 170784825
Test: m checkbuild
Test: TestLlndkLibrary
Change-Id: I43580976589a7a2a176d7442be53fa043c0c8324
2021-04-26 18:41:00 -07:00
Colin Cross
1f3f130e29 Add support for cc_library_headers to replace llndk_headers
Set llndk.llndk_headers: true to allow a cc_library_headers
module to be used by a cc_library module with llndk.symbol_file set.

Bug: 170784825
Test: TestLlndkHeaders
Change-Id: Ib65a4b70717dc9a54ae30f2991485bb1bb9b8409
2021-04-26 18:37:44 -07:00
Treehugger Robot
459c532e44 Merge "Incorporate cc_library_headers into mixed builds" 2021-04-23 15:14:55 +00:00
Liz Kammer
b6a55bf065 Incorporate cc_library_headers into mixed builds
Test: go soong tests
Test: bp2build generate & sync; mixed build libc; mixed build su (su is
      an Android.mk target that relies on converted a cc_library_headers)
Bug: 181552740
Change-Id: I9efd587970551fd41f642a208f0aa0a80e8694e0
2021-04-23 09:37:33 -04:00
Colin Cross
7c6a485f64 Merge changes from topic "remove_llndk_library1"
* changes:
  Support cc_library as LLNDK without llndk_library
  Dedup include dir paths
2021-04-22 23:33:29 +00:00
Jingwen Chen
ed9c17d033 bp2build: refactor/standardize cc_* bp2build converters
This CL refactors the cc* bp2build converters to use the common
attribute extractors in cc/bp2build.go.

This also adds include_build_directory to be handled by the compiler
attr extractor to generate recursive headers as inputs.

This also turns include_dirs and local_include_dirs into the
execroot-relative -I flags.

e.g. if a module in  bionic/libc has "private" in local_include_dirs,
the "-Ibionic/libc/private" copt is generated for it.

Fixes: 185139955

Test: TH
Test: Forrest for mixed_clean-droid
Change-Id: Ib67056482227e62068fbbea0455035bdf5d56319
2021-04-22 08:31:24 +00:00
Colin Cross
0fb7fcd3a6 Support cc_library as LLNDK without llndk_library
Allow cc_library modules to configure themselves as an LLNDK library
using llndk.symbol_file instead of llndk_stubs pointing to an
llndk_library module.

Bug: 170784825
Test: TestEmbeddedLlndkLibrary
Change-Id: Id884cdada7094bbea6809a98e687e039778c5dc6
2021-04-20 22:24:11 -07:00
Colin Cross
c82e6e2e8f Dedup include dir paths
Remove duplicates from include dir paths before setting
FlagExporterInfoProvider.  Duplicates often occur, for example due to
inheriting export_include_dirs from the static variant of a library to
the shared variant of the library that also gets the same
export_include_dirs.

Test: m checkbuild
Change-Id: I71f9e841547db64cbabcd95288ee93ef21fab4fb
2021-04-20 18:22:58 -07:00
Treehugger Robot
aef14db78a Merge changes from topic "tvts-test-host-jni"
* changes:
  Add jni_libs property to java tests
  Add Target to cc.SharedLibraryInfo
2021-04-17 04:35:24 +00:00
Treehugger Robot
0b21bf60b6 Merge "Document stubs in cc_library." 2021-04-16 11:57:32 +00:00
Liz Kammer
fe23bf3eb0 Add tests for request_type ParseResult functions.
Test: go test request_type_test
Test: bp2build generate & sync; mixed build libc
Change-Id: Id0b813e9de4d02d8625e42549999659ccb005c6d
2021-04-12 16:23:53 -04:00
Liz Kammer
b71794d8e6 Consolidate cc-specific cqueries.
There is little overlap at this point, but we expect these to converge
more over time, to handle exported includes, libs, etc., this will allow
those changes to be handled in one place and allow more consolidation of
code.

Test: bp2build generate & sync; mixed build libc
Change-Id: I51685dad9f4fc11a634965a3c9e84f4a0e279ecb
2021-04-12 15:59:08 -04:00
Jingwen Chen
107c0de80e bp2build: refactor compiler/linker prop function.
This changes the return value into a compiler/linker attr struct to
standardize callsites and make it easier to retrieve the parsed attrs.

Test: TH
Change-Id: I1e3956e7cb5d924ce8472ece940faea459beef37
2021-04-09 10:45:48 +00:00
Jingwen Chen
6393098ecf bp2build: cc_library converter for //bionic/libdl:libdl_android
This CL contains the converter for libdl_android, a cc_library that
expands into a cc_shared_library and a regular cc_library.

Test: TH
Test: bp2build; bazel test //build/bazel/tests/...

Change-Id: If70641a538211b0d6b2aac0e4d0d06912318304d
2021-04-09 09:42:53 +00:00
Rupert Shuttleworth
c58d3d214e Be more explicit about headers in cc_library_static targets.
Test: bp2build-sync.py write; bazel build //bionic/...
Change-Id: I253b55f4d3cbe76805691b32e761016950871601
2021-04-08 09:43:04 +00:00
Rupert Shuttleworth
64a90286c4 Merge "Support arch variations for export_system_include_dirs in cc_library_headers bp2build converter." 2021-04-08 00:54:47 +00:00
Rupert Shuttleworth
b815168474 Support arch variations for export_system_include_dirs in cc_library_headers bp2build converter.
Test: Added unit test
Test: bp2build-sync.py write; bazel build //bionic/... works for more cc_library_static targets (in a parent CL)
Change-Id: Ib487216a4bcbc52958ff948722dae347b0d8b606
2021-04-07 16:05:44 +00:00
Chris Parsons
eefc9e6a62 Fix note_memtag bionic libraries in mixed builds
Required fixes:
  - Set MakeLinkType for libraries, even in mixed build mode.
  - Set snapshot header information to empty list, which passes
        validation logic for depending modules

Fixing these libraries also requires a Starlark change to
cc_library_static.bzl, which will be submitted separately.

Additionally, this adds better error messaging in the event that
output files are missing from a mixed-build library.

Test: USE_BAZEL_ANALYSIS=1 m libc
Test: USE_BAZEL_ANALYSIS=1 m runtime-module-sdk
Change-Id: Iad2c4d46359986fb0a43263292a15ed45fabbac7
2021-04-05 15:27:55 -04:00
Jingwen Chen
91220d7334 Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.

This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.

These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.

This enables //bionic/libc:libc_headers to be generated correctly, from:

    cc_library_headers {
        name: "libc_headers",
        target: {
            android: {
                header_libs: ["libc_headers_arch"],
                export_header_lib_headers: ["libc_headers_arch"],
            },
            linux_bionic: {
                header_libs: ["libc_headers_arch"],
                export_header_lib_headers: ["libc_headers_arch"],
            },
        },
        // omitted props
    }

to:

    cc_library_headers(
        name = "libc_headers",
        deps = [] + select({
            "//build/bazel/platforms/os:android": [
                ":libc_headers_arch",
            ],
            "//build/bazel/platforms/os:linux_bionic": [
                ":libc_headers_arch",
            ],
            "//conditions:default": [],
        }),
    )

Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786

Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-04-02 08:17:34 +00:00
Treehugger Robot
25c47a43a5 Merge ""current" is implicitly added to stubs.versions" 2021-04-01 04:53:55 +00:00
Jiyong Park
d4a3a137ed "current" is implicitly added to stubs.versions
So far, when a library `libfoo` has `stubs.versions: ["10", "11"]`, then
`shared_libs: ["libfoo"]` is linked to the version 11 of the stub.

This requires the author of `libfoo` to manually update the property
whenever a new version is introduced. Otherwise, clients are not able
to use the newly added APIs because the latest stub is for an old
version.

This change eliminates the need for manual updating. "current" version
is always implicitly added to `stubs.versions`. It is added even when
nothing is set on the property, if `stubs.symbol_file` is set. i.e.

```
cc_library {
    name: "libfoo",
    stubs: {
        symbol_file: "libfoo.map.txt",
	// no versions: [...] needed
    },
}

cc_library {
    name: "a_client",
    shared_libs: ["libfoo"],
    apex_available: ["myapex"],
    min_sdk_version: "29",
}

apex {
    name: "myapex",
    native_shared_libraries: ["a_client"],
    min_sdk_version: "29",
}
```

`a_client` links to the "current" stub of `libfoo` that has all symbols
shown in the map file.

Note that, above doesn't mean that the client has unlimited access to
APIs that are introduced even after the min_sdk_version of the client
(29 in this example). The use of such APIs still has to be guarded with
`__builtin_available` check.

Bug: N/A
Test: m
Change-Id: I70bb1600c18e74d36c6b24c3569d2149f02aaf96
2021-04-01 09:58:53 +09:00
Jose Galmes
0d736917e6 Fix missing snapshot headers.
Bug: 184057288
Test: Run unit tests using:
Test: source build/envsetup.sh
Test: m -j nothing
Change-Id: If7402be9199313f9f03627cad662405b03b5d0fe
2021-03-30 17:27:45 -07:00
Jingwen Chen
0702791a99 bp2build: arch-configurable selects for label list attrs.
This CL adds the configurable LabelListAttribute support to bp2build.

Test: go test
Change-Id: I2ef9e385d9cf1b1845988128eca1d8cda1ecb5e8
2021-03-30 13:22:48 +00:00
Treehugger Robot
10906f5cc6 Merge changes from topic "min_sdk_version"
* changes:
  Versioned CRT objects are built with correct __ANDROID_API__
  Always respect min_sdk_version
2021-03-26 08:07:28 +00:00
Rupert Shuttleworth
095081c6d7 Add bp2build support for cc_library_static.
Also refactor bp2build-related code for cc_library_headers.

(Retry of previous CL after the presubmit failed to detect a merge conflict)

Test: Added unit test.

Test: bp2build-sync.py write; bazel build //bionic/... still works (but bp2build is disabled for most cc_library_static targets for other reasons)
Change-Id: I2f4405c2fea305623bbc6daaaf62808b0c074216
2021-03-25 15:16:11 +00:00
Jingwen Chen
f9410540a8 Revert "Add bp2build support for cc_library_static."
Revert submission 1594391-bp2build-cc_library_static

Reason for revert: Broke the build on aosp-master
Reverted Changes:
Ib16ccf31a:Add cc_library_static macro to help with bp2build ...
I37c856be2:Add bp2build support for cc_library_static.

Change-Id: Ie94d5bc6da81758cd4e0461c08a810a29643c971
2021-03-25 06:11:59 +00:00
Rupert Shuttleworth
21e743df41 Add bp2build support for cc_library_static.
Also refactor bp2build-related code for cc_library_headers.

Test: Added unit test.

Test: bp2build-sync.py write; bazel build //bionic/... still works (but bp2build is disabled for most cc_library_static targets for other reasons)

Change-Id: I37c856be20a47b154909338a22a7dba1ab55693f
2021-03-24 13:56:44 +00:00
Jiyong Park
fdaa5f7164 Versioned CRT objects are built with correct __ANDROID_API__
Background: `min_sdk_version` of a crt object is the oldest SDK version
that the crt object supports. When it's set to for example 16, Soong
creates a number of versioned variants of the crt object starting from
16 to the latest version. The variant for version X is provided to NDK
clients having `min_sdk_version` set to X.

Problem: all versioned variants of a crt object were built with `-target
<arch>-linux-android16`. Therefore they all have been with `#define __ANDROID_API__
16`.  This is because the mutated variants still have the same
min_sdk_version property and the clang triple follows min_sdk_version,
not sdk_version. This is too conservative and against our intention to
provide the latest crt object that matches with the min_sdk_version of
the client.

In the other hand, the platform(non-sdk) variant of the crt object
doesn't have such a problem. min_sdk_version is completely ignored.
However, this is a bug and will be fixed by aosp/1640364. As a side
effect of the fixing, the platform variant will begin to built with a
very old __ANDROID_API__ which unnecessarily turns off the new platform
features like the TLS segment over-alignment.

This change fixes the problems:

* For the versioned variants of crt objects, we set both
`min_sdk_version` and `sdk_versio` to the version that the variant is
created for.

* For the platform variant of crt objects, `min_sdk_version` is force
reset to "current".

Bug: 183191008
Test: m

Change-Id: I8c9d0fcea816de8cd1532dac4a47eee4f726c037
2021-03-23 01:18:31 +09:00
Chris Parsons
944e7d01aa Refactor and cleanup of cquery processing
Test: USE_BAZEL_ANALYSIS=1 m libc
Change-Id: Iaf9a92e84d39c132e2444a8aaafd79505a12b8ec
2021-03-16 14:39:16 -04:00
Chris Parsons
808d84c45d mixed builds for cc_static_library without deps
Test: Manual mixed builds testing of `libc` target with manually
migrated "libc_nopthread" and "libc_init_dynamic".

Change-Id: If7d67e95eca9899271b1eeb662c7c2e571f64afa
2021-03-10 13:24:59 -05:00
Paul Duffin
37e0de5004 Only export sysprop headers in exported sysprop include directory
Bug: 180712399
Test: m nothing
Change-Id: Ia93d20fe0fecf977773257fa43fe40e7fe9f024f
2021-02-22 18:05:18 +00:00
Paul Duffin
33056e8a9a Export aidl, proto and sysprop generated headers separately
Previously, a cc library that included .aidl, .proto and/or .sysprop
files and exported headers generated from at least one of those types
would actually export generated headers from all of them.

While headers generated from .sysprop files are always exported those
generated from .aidl or .proto should only be exported when explicitly
requested.

This change treats them separately as expected. It has the potential
to break the build as it could reduce the set of headers exported and
so a dependent module that needed those would break. The fix in that
case is to simply add one (or both) of the following to the module
that previously exported those headers:

  aidl: {
    export_aidl_headers: true,
  }

  proto: {
    export_proto_headers: true,
  }

Bug: 180712399
Test: m droid
Change-Id: I488182e27dd423d261443612f98d5c112dd3ef8f
2021-02-22 18:05:10 +00:00
Jingwen Chen
8c1b97e01b bp2build: cc_object converter.
This CL introduces a basic bp2build converter for cc_object modules.
cc_objects maps cleanly to cc_library targets, but with -fnoaddrsig.

This CL also demonstrates generating include deps within a macro to
allow the cc_object compilation to depend on a relative-include header
within an include dir.

e.g. if "foo.cc" includes "android/log.h" and the latter is located at
"include/android/log.h", the autogenerated header deps would export
"android/log.h" correctly to the foo.cc upstream target.

Test: GENERATE_BAZEL_FILES=true m nothing && bp2build-sync write && bazel build //bionic/libc:crtbegin_so1

Change-Id: Ifd9e097051ec184ab0a1929d07918f0ff4f24d98
2021-02-18 03:27:28 -05:00
Rupert Shuttleworth
54e7841b90 Add cc_library_headers support to bp2build.
Test: Added cc_conversion_test.go.
Change-Id: Id4459d2c2fa02687a374cd9fb25d687e9678218c
2021-02-16 23:07:01 +00:00
Treehugger Robot
509ab03f12 Merge "Ensure that stubs.symbol_file has ".map.txt" suffix" 2021-02-10 01:07:30 +00:00
Jooyung Han
11b0fbdbf6 cc: fix version macro for stubs
When a cc module is built against a stub, compiler passes version macro
of the stub lib. Version macro should be numeric, so codenames or
"current" should be mapped to numbers just like how ndkstubgen maps to.

* "current" -> future (10000)
* codenames -> look up api_level.json
* otherwise -> cast to int

Bug: 179329813
Test: m / soong test / manually check the output build.ninja
Change-Id: Ic0e1dd904984e161694a0b77fad5559c06a4462f
2021-02-05 11:27:57 +09:00
Jiyong Park
a417557f80 Ensure that stubs.symbol_file has ".map.txt" suffix
The property refers to the symbol file that describes APIs across
updatable components like APEXes and system/vendor. Since it's important
to keep the APIs backwards incompatible, any change to the APIs should
be reviewed/gated by the NDK API council. The map.txt suffix is the key
for trigging the NDK API review by gerrit.

Bug: N/A
Test: m nothing
Change-Id: I01eae9c6a106d301863ec86e169111712af74d3f
2021-02-04 21:05:47 +09:00
Colin Cross
2df8177575 Add Target to cc.SharedLibraryInfo
Dependencies from common arch modules like java libraires to cc modules
may need to retrieve the Target of the library, add it to
SharedLibraryInfo.

Bug: 176593487
Test: cc_test.go
Change-Id: I93ab9da5fab2ccc42c6b483a6d83c071b541d1e6
2021-01-26 11:02:53 -08:00
Colin Cross
1f2f4eb07d Revert "Revert "Truncate vendor snapshot header glob list after filtering it""
This reverts commit 758140ceae.

Reason for revert: modifying glob results no longer corrupts cache after aosp/1557261

Change-Id: Id94f1f5835a93e83dc9f465627913b91908d3560
2021-01-22 18:06:57 +00:00
Colin Cross
ec118d0734 Revert "Revert "Speed up vendor snapshot header globs""
This reverts commit c2aff9e9fd.

Reason for revert: modifying glob results no longer corrupts cache after aosp/1557261

Change-Id: I682b92ad08c82ac4fa5482497cb587bd0223d21b
2021-01-22 18:05:59 +00:00
Sally Yuen
c2aff9e9fd Revert "Speed up vendor snapshot header globs"
This reverts commit 0f93e5b9fb.

Reason for revert: causing extra soong regenerations

Change-Id: I4ed2e5c82dfe3e99fbb9590b80f92c79a27e8025
2021-01-21 20:17:33 +00:00
Sally Yuen
758140ceae Revert "Truncate vendor snapshot header glob list after filtering it"
This reverts commit 3a62a9cc2b.

Reason for revert:  causing extra soong regenerations

Change-Id: I4ceb5334634613a00ac9c312b75c623a8aced8ab
2021-01-21 20:17:07 +00:00
Colin Cross
3a62a9cc2b Truncate vendor snapshot header glob list after filtering it
Test: m checkbuild
Change-Id: I4847bff5c03844194a9a80e8cb24a60694db6208
2021-01-21 00:46:46 +00:00
Colin Cross
0f93e5b9fb Speed up vendor snapshot header globs
The vendor snapshot header globs were repeated 9 times, once for each
possible header suffix.  Globbing is not a fast operation, so this
took 9.68s of CPU time in my AOSP builds.  Replace it instead with a
single glob, followed by filtering down to the desired header
extensions.

Test: m checkbuild
Change-Id: I9c8f8cdad8cbffc0a42217659a48dd9d676e4e4c
2021-01-20 18:36:25 +00:00
Inseob Kim
0641004a3f Refine sysprop_library header rules
Instead of unreliable giant if clause, it's enough to check dependency
between platform (system, system-ext), product, and vendor.

Test: sysprop_test soong test
Test: link against host_supported sysprop_library and use internal props
Change-Id: I7bd5df00b302fa261eff5120106aacc3df93c1b2
2021-01-18 15:23:28 +09:00
Colin Cross
4f4f8ebd3f Fix llndk_library init
llndk_library modules were not calling module.Init(), which caused them
not to register ModuleBase.VendorProperties.  Unregistered property
structs lose their values during cloning, which caused the shared
variants of llndk_library modules to not have IsLLNDK set.

Call module.Init(), which registers ModuleBase.VendorProperties.  Also
add a helper function to filter out llndk_library modules that now
show up in the list of modules with IsLLNDK set.

Bug: 170784825
Test: m checkbuild
Change-Id: Iafde85f6a95e85a618f6f7d7a210398febb6b158
2021-01-06 17:50:48 -08:00
Jose "Pepe" Galmes
7ba6f1cca7 Merge "Support for recovery snapshot." 2021-01-06 21:17:54 +00:00
Florian Mayer
6dab96cb58 Document stubs in cc_library.
Change-Id: I36a9b884a8cc53e6a7192ef159e0cb2fdbb0e511
2020-12-31 11:39:48 +00:00
Justin Yun
31094b10d2 Skip product variant for core-variant VNDK
VNDK "mustUseVendorVariant" option checks only for the vendor
variant. Since the product variant of the VNDK is skipped from
installing, we don't need check product variant for
"mustUseVendorVariant" check.

Bug: 176268903
Test: m libxml2.product
      m libxml2.vendor
Change-Id: I3b10f0579aceca1fb32fa4d6fb21dc020a35874d
2020-12-24 16:11:23 +09:00
Jose Galmes
6f843bc4ba Support for recovery snapshot.
Bug: 171231437

Test: source build/envsetup.sh
Test: ALLOW_MISSING_DEPENDENCIES=true m -j nothing

Change-Id: I74636cf7f97e027a229a5ef7c776f2b7a42ead95
2020-12-23 10:34:44 -08:00
Justin Yun
6977e8a80c 'vendor_available: *' will not create product variant
With this patch, `vendor_available: true` will no longer creates
product variant. Instead, modules need to set `product_available:
true` if they have to be available to product vanriant.
If both properties are defined for VNDKs, they must have the same
values.

Bug: 150902910
Test: m nothing
Change-Id: I28fb6886e6114583227a31151136627c8516ac9c
2020-12-23 18:14:30 +09:00
Jaewoong Jung
18aefc1977 Remove unnecessary snake case variables.
Test: m nothing + TreeHugger
Change-Id: I99f7162944daa6c57c6ae4763261e108bb5cb6b1
2020-12-22 12:38:35 -08:00
Colin Cross
127bb8b9f6 Don't rewrite LLNDK dependencies with .llndk suffix
Rewriting LLNDK dependencies with .llndk suffix requries referencing
a global data structure to determine if a given library is an LLNDK
library and therefore needs the .llndk suffix.  References to
global data structures from mutators must be removed to support
incremental Soong analysis.  Instead, move the LLNDK stubs rules
into the vendor variant of the implementing cc_library so that
the original name can be used.

As an incremental step, the llndk_library modules are left in
place, and the properties are copied into the cc_library via
the dependency specified by the llndk_stub property.  A followup
will move the LLNDK properties directly into the cc_library and
delete the llndk_library modules.

The global list of LLNDK libraries is kept for now as it is used
to generate the vndk.libraries.txt file.

Bug: 170784825
Test: m checkbuild
Test: compare Soong outputs
Test: all Soong tests
Change-Id: I2a942b21c162541a49e27b2e5833c9aebccff1d0
2020-12-21 17:53:30 -08:00
Colin Cross
adc81a0783 Don't strip stub libraries
LLNDK and NDK stubs are already not stripped, don't strip APEX stubs
either.

Test: m checkbuild
Change-Id: I9a50df4b8b73d764ca81634a8a3014726eceda99
2020-12-21 15:54:09 -08:00
Colin Cross
a9c8c9f145 Call ctx.InstallFile for uninstallable cc modules
SkipInstall is actually primarily used to prevent making a module
visible to Make, rename it and add new SkipInstall that actually
skips installation without affecting Make.

Call c.SkipInstall() for uninstallable cc modules to allow calling
c.installer.install, which will collect PackagingSpecs for
uninstallable cc modules, allowing them to be used by genrules.

Bug: 124313442
Test: m checkbuild
Change-Id: I8038ed5c6f05c989ac21ec06c4552fb3136b9a7a
2020-12-17 10:02:18 -08:00
Colin Cross
95b07f2b59 Don't copy uninstallable variants of NDK libraries to sysroot
After the next patch libraryDecorator.install will be called for
uninstallable variants of modules, manually filter them out when
copying to the NDK sysroot.

Bug: 124313442
Test: m checkbuild
Change-Id: I28b538d4ae271dc5e27c386d7cfa538ac0ed841b
2020-12-17 10:02:18 -08:00