* 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
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
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
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
* 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
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
This allows us to handle this consistently between cc_binary and
cc_library* types.
Test: build/bazel/ci/bp2build.sh
Change-Id: I996f42bbe591215217c3d561662e775925b871ff
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Because it's commonly useful and not cc/ specific
Also export GenerateBazelBuildActions and update uses
Test: Existing tests pass
Change-Id: Ibc6858bb1129afba181a7686dda432defe33b00d
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
- 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
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
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
This reverts commit cacb972dcd.
Relanding along with one more fix in prebuilts/ndk
Change-Id: I65cbc3c5d72bb47bd00e123c63911c9baa1e5f03
Test: m checkbuild
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
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
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
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
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
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
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
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
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
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
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
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
This fixes a test and rolls forward I28cf7437ee96cdf2fdbcb1eda2303691cff08ba4
Test: m nothing
Test: See I28cf7437ee96cdf2fdbcb1eda2303691cff08ba4
Change-Id: I0e450c28e70087e406e7b562d7e772785f177379
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
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
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
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
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
Test: cd bp2build; go test
Test: bazel build //bionic/...
Test: ./build/bazel/scripts/run_presubmits.sh
Change-Id: I71e279470a0d69b243dd0a2b53ce31842fd36ee4
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
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
Doesn't work when depends on arch/target/etc., but good enough for
libdl_android.
Bug: 186650430
Test: Presubmits.
Change-Id: Ib0facb41a89454717c74663e5e078aedd33d1b9c
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
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
This allows us to remove libasync_safe from the mixed builds denylist.
Test: mixed_libc.sh CI script
Change-Id: Ibafd231284864078bf30340f919d39e5098843ce
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
Remove llndk_library in favor of cc_library with llndk.symbol_file.
Bug: 170784825
Test: m checkbuild
Test: TestLlndkLibrary
Change-Id: I43580976589a7a2a176d7442be53fa043c0c8324
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
This reverts commit 758140ceae.
Reason for revert: modifying glob results no longer corrupts cache after aosp/1557261
Change-Id: Id94f1f5835a93e83dc9f465627913b91908d3560
This reverts commit c2aff9e9fd.
Reason for revert: modifying glob results no longer corrupts cache after aosp/1557261
Change-Id: I682b92ad08c82ac4fa5482497cb587bd0223d21b
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
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
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
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
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
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
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
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
This change fixes a bug that the versioning macro (__LIBNAME_API__) is
omitted for prebuilts providing a stub.
Bug: 175166063
Test: m nothing
Change-Id: I1cce5ab58ef245622861200ec0d8b0f84e3178ed
Allowing header_libs to refer to a cc_library, cc_library_static
or cc_library_shared was unintentional, make it an error.
Fixes: 173252016
Test: m checkbuild
Change-Id: I9f7986f6ca37deddf1f208b15a87d3c0cff25585
* Consolidate the two shouldCreateSourceAbiDump() in cc/cc.go and
cc/library.go into cc/sabi.go.
* Rename SAbiProperties.CreateSAbiDumps to ShouldCreateSourceAbiDump.
* sabiDepsMutator determines whether a library needs to generate ABI
dump, and mark their ShouldCreateSourceAbiDump property.
* After this change, sabi.Properties.ShouldCreateSourceAbiDump is the
single source of truth of whether ABI dump should be created or not.
GenerateAndroidBuildActions() should check the property, or call the
property accessor (*sabi).shouldCreateSourceAbiDump().
* classifySourceAbiDump() is no longer a *libraryDecorator receiver.
Instead it uses the libraryInterface object in the
ctx.Module().(*cc.Module).library field. This way
classifySourceAbiDump() doesn't need to depend on the internal fields
of libraryDecorator.
Bug: 145608479
Bug: 173492236
Test: Presubmit
Test: Dump the list of module names marked by sabi_deps mutator
Change-Id: Ibfc29fe0153551ab6e2d56ff38ab9bae2c179e0b
* Rename `vndk_deps` mutator to `sabi_deps` to better reflect its
purpose.
* Eliminate duplication of ABI dump generation logic. sabiDepsMutator
should call libraryDecorator.shouldCreateSourceAbiDump() to determine
if a module needs to be marked with CreateSAbiDumps.
* Non-VNDK libraries that are opt-in to ABI check would have their
dependencies correctly marked with CreateSAbiDumps.
* Refactor some lines to idiomatic syntax.
* Add comment strings.
Bug: 145608479
Bug: 173492236
Test: TH presubmit
Change-Id: I99e97787bdf2a4f0c970809161b64aa668ff3d1a
Refactors parts of CC to prepare for preliminary support for using Rust
static libraries in vendor images. Some previously private functions are
made public, and additional functions are added to LinkableInterface so
GetMakeLinkType can be passed a LinkableInterface.
Bug: 172525289
Test: m
Change-Id: I5fda48e79532fe9ceab255e18d910af58048a123
Enable the RuleBuilder and RuleBuilderCommand methods to access
the BuilderContext by passing it to NewRuleBuilder instead of
RuleBuilder.Build.
Test: genrule_test.go
Test: rule_builder_test.go
Test: m checkbuild
Change-Id: I63e6597e19167393876dc2259d6f521363b7dabc
Storing ndkKnownLibs prevents multiple tests from running in parallel
as one may be writing to the list while another is reading from it.
Store it in the config so each test has its own copy.
Test: go test -race ./apex
Change-Id: Iba57c9494012c9e0ae9e5ffaa63b9b2bd2c77492
To make a module available to product variants, it must define
`product_available: true`. `vendor_available: true` will not create
product variants any more.
However, in this CL, we don't change the behavior of
`vendor_available` property. It still creates both variants. After we
update all Android.bp files that need to provide product variants
with `product_available: true`, we may upload the remaining patches.
Bug: 150902910
Test: lunch aosp_arm64-userdebug && m
Change-Id: I0fd5be7bbae2c45d5cab3c3c2ca49f53a9b6f975
The stubs methods are very specific to cc for now, move them out
of LinkableInterface so they are not shared with rust. Instead,
create a cc.Module.library field that contains the libraryInterface
to simplify calling libraryInterface methods on cc modules.
Test: all Soong tests
Test: no change to Soong outputs
Change-Id: I0289d866ce1f7a765631fe3101a62b1b4988ba1c
Add vendor_ramdisk_available and vendor_ramdisk attribute to
various rules. When a vendor_ramdisk variant of a module is
generated, it is installed to $OUT/vendor-ramdisk.
It is similar to a ramdisk image.
Test: m nothing -j
Change-Id: Ib2d16459f3094dbe21c3bdb7c016cb4b2bf62765
Prepare for making the relationship between an llndk_library stubs
module and the cc_library implementation module explicit by
adding an llndk_stubs property. Each cc_library will be updated
to point to its llndk_library, and the llndk_library name will
be changed to make the .llndk suffix explicit. Then the implicit
connection and suffix can be removed.
Bug: 170784825
Test: m checkbuild
Change-Id: I6b0482a3f286ec29b2e928551aa4317749f2b499
VNDK libs are installed as part of VNDK APEX, so we don't need to
install them at all.
Bug: 170711679
Test: m
Change-Id: I62b881d6e65d6b007db1d26ab314c140c60e8a4e
* changes:
Move LLNDK and NDK versionSelectorMutator special cases into versionedInterface
use version mutator for CRT
Use version mutator for NDK
Reuse more of apex stubs implementation for llndk stubs
Use libraryInterface instead of concrete type asserts for stubs
In apex_set and cc_prebuilt_library_*, provide a way to specify an
alternative source to use when build with sanitizers.
Test: prebuilt_test, apex_test
Change-Id: I1ab8091bf696d94da3547cf5248853df489bdee6
Implement stubsVersions on *llndkStubDecorator and *stubDecorator to
handle the special cases in versionSelectorMutator.
Test: m checkbuild
Change-Id: Idc985c52f91450df42c0275b2b2acef3f2ed8868
Move the CRT objects into the version mutator and retire the
ndk_api mutator.
Test: no change to build.ninja or Android-${TARGET_PRODUCT}.mk
Change-Id: Ibbbde323e3e0e8e4702dda4f3828a49786280118
The ndk_api mutator is similar to the version mutator. Move the
ndk_library ndk_api variations into the version mutator instead,
which will help later when consolidating the stubs handling
between NDK, LLDNK and Apex libraries.
Test: No change to build.ninja or Android-${TARGET_PRODUCT}.mk
Change-Id: I51417cf669265762c15f7289e1dc186d017ef4a9
Use the linker script and exported flags support from apex stubs
for llndk stubs.
Test: no change to build.ninja or Android-${TARGET_PRODUCT}.mk
Change-Id: I9886498dcac7419958d290de99cf5f39f5fdedee
Start consolidating stubs, llndk stubs, and ndk stubs by replacing
all of the concrete type asserts in the stubs methods with
libraryInterface.
Test: no change to build.ninja, Android-${TARGET_PRODUCT}.mk
Change-Id: I195d99c91e5f7afda5bcb489d20b524b3300c1b1
Export information about static libraries, shared libraries and
exported flags through Providers instead of accessing the module
directly. Much more is left to be converted, but this significantly
simplifies the dependencies on libraries with stubs by making it easy
for a module to masquerade as another by simply exporting the
providers from the other module. Instead of depending on all the
versions of a library and then picking which one to use later, it
can depend only on the implementation variant and then select the
right SharedLibraryInfo from the variant.
Test: m checkbuild
Test: only expected changes to build.ninja
Change-Id: I1fd9eb4d251cf96ed8398d586efc3e0817663c76
A global variant was used to store the global mapping between
modules and APEXes. Replace it with storing pointers to APEX
contents inside each module so that they can query the contents
of any APEXes they belong to.
Bug: 146393795
Test: all Soong tests
Test: single line change to build.ninja host install dependency ordering
Test: no Android-${TARGET_PRODUCT}.mk, make_vars-${TARGET_PRODUCT}.mk or late-${TARGET_PRODUCT}.mk
Change-Id: Id2d7b73ea27f8c3b41d30820bdd86b65c539bfa4
Don't create empty version variants for binaries, objects, rust
rlibs or rust dylibs.
Test: no change to build.ninja
Change-Id: I62d4d43da476eafdb258a08b5ada758bb2971a1a
Whole_static_libs required custom error checking when
AllowMissingDependencies was set because it could end up depending
on an empty list of objects, which would leave nothing in the
dependency tree that had been replaced with an ErrorRule.
Reuse the prebuilts case to depend on the .a file when there
are no objects and remove the custom error handling.
Test: TestEmptyWholeStaticLibsAllowMissingDependencies
Change-Id: Ic3216235f7e5ae8b5b6ab31ef2ca35c3994d82aa
A per-context variable is used to store the list of modules that
contain stubs and their available versions. Stores the list of the
stubs versions on the implementation module, and then use the new
return values from AddVariationDependencies to expand dependencies
on implementation libraries to also depend on the stubs libraries.
Adds a new mutator pass to propagate list of stub versions to llndk
libraries.
Also creates an alias version variation called "latest" to allow
depending on the latest version without having to know what it is.
Test: all Soong tests
Test: no change to build.ninja, Android-${TARGET_PRODUCT}.mk, make_vars-${TARGET_PRODUCT}.mk or late-${TARGET_PRODUCT}.mk
Change-Id: If19659e2e5828c860fd4d679ef79a414b7ea2efc
The cc stripping logic can be reused for Rust. Export the Stripper
structure for that purpose. Extract the strip-related flags from
builderFlags into StripFlags. Add the method flagsToStripFlags
(similarly to flagsToBuilderFlags).
Add the helper method disableStripping on libraryDecorator.
Test: m
Bug: 153430439
Change-Id: I11aef1abb8d498a4c1672500a7398279edf7f548
We don't need the prebuilt versions. The NDK CRT objects are (now)
built from the platform sources and the only difference is that the
NDK CRT objects also include an ELF note that identifies the NDK
version, which isn't helpful for anything built by the platform.
Add a `crt` property to cc_object that allows CRT objects to identify
themselves. CRT objects, unlike other modules, will have a variant
built per-API level they support, rather than just an SDK variant and
a platform variant. This is needed because new CRT objects will rely
on APIs not available in old libcs and old CRT objects will not
support all the features of a modern one.
Test: treehugger
Bug: http://b/159925977
Change-Id: I6595485fa1bfe0ad4945193d344b863f64eec654
Alias the shared variation if it exists, otherwise the static variation.
This allows modules that are not aware of shared library variations
(like cc_genrule) to depend on shared libraries by depending on
just the normal image, os and arch variations.
Bug: 162437057
Test: TestLibraryGenruleCmd
Change-Id: Icec57d43538e01ab05cc50d4e3f9a11cc55f0162
Use local variations and an alias for the "" variation for
versionMutator. Local variations are used here because the variation
of one module doesn't affect the variation it should depend on - a
module with variation version:29 will manually link against dependencies
with the correct version variation, and don't need it to be automatically
resolved. The alias allows other modules to depend on a module
mutated by the version mutator without specifying the version: ""
variation. This allows removing the variation on genrule modules.
The motiviation here is to make sure versionMutator calls AliasVariation,
which will allow the previous linkageMutator to also use AliasVariation.
Bug: 162437057
Test: no change to build.ninja, make_vars-aosp_crosshatch.mk, Android-aosp_crosshatch.mk or late-aosp_crosshatch.mk
Change-Id: Ibb030cc4334e47511b8ab5bc3eb8a5ae39ad0023
unavailable-to-platform case.
This removes the special case added in https://r.android.com/1274763
from SkipInstall(), so that it doesn't cause conflicting AndroidMk
entries when a cc_prebuilt_library_static module has prefer:true and
the corresponding source module exists.
Test: `m` in a tree with a snapshot created from art-module-sdk where
the libartimagevalues module has prefer:true
Bug: 151303681
Change-Id: I651ae325753b707296892adb4cae80daaddb6af2
dependencyTag uses a set of predefined tags to identify different types
of dependencies. There are already multiple bits of metadata stored
in the dependency tag (Library, Shared, ReexportFlags), and supporting
them all requires a combinatorial explosion of predefined tags and
causes issues when using equality comparisons if a new bit of metadata
is added.
Add a new libraryDependencyTag type that will contain the metadata
bits, and replace the quality comparisons with checks on the metadata
bits.
There are 5 TODOs where modifying the checks identified problems with
the existing checks. These were left in place to produce identical
build output and will be fixed separately.
Bug: 162437057
Test: no change to build.ninja or {Android,make_vars,late}-${TARGET_PRODUCT}.mk
Change-Id: I72d4207dcf381c07c92e00e5a03968ebb5ed8d30
This CL adds "dists" to the base property struct to support multiple
dist file configurations, and generic tag support to dist tagged outputs
of modules.
Fixes: b/152834186
Test: soong tests and `m sdk dist`
Change-Id: I80c86bc9b7b09e671f640a4480c45d438bdd9a2a
Signed-off-by: Jingwen Chen <jingwen@google.com>
When a lib has sdk_version set, an SDK variant and a platform variant
are created by the sdkMutator. Then by the versionMutator, if the
library had 'stubs.versions' property, one or more versioned variants
and one impl variant are created for each of the two (SDK and platform)
variants. As a concrete example,
cc_library {
name: "foo",
sdk_version: "current",
stubs: { versions: ["1", "2"], },
}
would create 6 variants:
1) (sdk: "", version: "")
2) (sdk: "", version: "1")
3) (sdk: "", version: "2")
4) (sdk: "sdk", version: "")
5) (sdk: "sdk", version: "1")
6) (sdk: "sdk", version: "2")
This is somewhat uncessary because the need for the SDK mutator is to
have the platform variant (sdk:"") of a lib where sdk_version is unset,
which actually makes sens for the impl variant (version:""), but not
the versioned variants (version:"1" or version:"2").
This is not only unncessary, but also causes duplicate module
definitions in the Make side when doing an unbundled build. Specifically,
The #1 and #4 above both are emitted to Make and get the same name
"foo".
To fix the problem and not to create unnecessary variants, the versioned
variants are no longer created for the sdk variant. So, foo now has
the following variants only.
1) (sdk: "", version: "") // not emitted to Make (by versionMutator)
2) (sdk: "", version: "1") // not emitted to Make (by versionMutator)
3) (sdk: "", version: "2") // emitted to Make (by versionMutator)
4) (sdk: "sdk", version: "") // not emitted to Make (by versionMutator)
Bug: 159106705
Test: Add sdk_version:"minimum" to libnativehelper in libnativehelper/Android.bp.
m SOONG_ALLOW_MISSING_DEPENDENCIES=true TARGET_BUILD_UNBUNDLED=true libnativehelper
Change-Id: I6f02f4189e5504286174ccff1642166da82d00c9
No matter what BOARD_VNDK_VERSION is set to, VNDKs should be regarded as
PLATFORM_VNDK_VERSION. This fixes an abidiff error due to the version
mismatch.
Bug: 157106227
Test: manual test with BOARD_VNDK_VERSION
Change-Id: I0d262b8ee5ac6f40fea7c2fb18322531434c0b4b
libeigen exports entire directory, but only two directories contain
actual exported headers. And some of headers have no extension. This
adds a special behaviour for external/eigen when capturing snapshot.
Exempt-From-Owner-Approval: cherry-pick from internal branch
Bug: 157106227
Test: m vendor-snapshot captures libeigen's headers
Change-Id: I82f27d4c6c4d472f47d54c545328150697b8cda3
Merged-In: I82f27d4c6c4d472f47d54c545328150697b8cda3
(cherry picked from commit 67f3dbca2f)
objects.
Necessary to make whole_static_libs work with
cc_prebuilt_library_static since it doesn't propagate the list of
object files.
Test: Build & boot
Test: m libsigchain && \
ar t out/soong/.intermediates/art/sigchainlib/libsigchain/android_arm64_armv8-a_cortex-a73_static/libsigchain.a
(Check that the list is sigchain.o followed by async_safe_log.o, both
in a normal build and in one where async_safe is a prebuilt static
lib.)
Bug: 154248570
Change-Id: Iaada8490ce713c13804b5771ad606f4a27e72a2f
"version" mutator creates stubs variants for "cc" libraries with
"stubs.versions". These stubs are for APEX-APEX or APEX-Platform
boundaries.
For host/ramdisk/recovery variants, stubs are not necessary.
Exempt-From-Owner-Approval: cp from internal
Bug: 153698496
Test: m
Merged-In: Id576c4318d9d69246a4a7e2fb4145d5fd2ab9416
Change-Id: Id576c4318d9d69246a4a7e2fb4145d5fd2ab9416
(cherry picked from commit c40b5193fe)
Apex can use codenames like "Q", "R" for its min_sdk_version property.
Also, cc_library can use codenames for its stubs.versions.
Bug: 152655956
Test: m
Merged-In: I077ad7b2ac5d90b4c8708921e43846206f05ba70
Change-Id: I077ad7b2ac5d90b4c8708921e43846206f05ba70
(cherry picked from commit 29e91d2121)
Revert submission 1242911-sdk_version_variant
Reason for revert: b/153394225
Reverted Changes:
Ife99745fb:Use libnativewindow for platform variant of libagq...
I1bae84c43:Use libnativewindow for platform variant of androi...
I6e6021ed3:Use stl to depend on libc++
Ife99745fb:Use libnativewindow for platform variant of libRSS...
I2c9f439b9:Fix static dependency on libprotobuf-cpp-lite-ndk
Iff2aff9cf:Set sdk_version for cc_genrules used by modules wi...
I7d72934aa:Add sdk mutator for native modules
Ief378a007:Use sdk variant of Soong modules when LOCAL_SDK_VE...
Bug: 149591340
Change-Id: I798fa902c779469c6382b6699351e5d12bf14785
Fixes: 153394225
This partially reverts https://r.android.com/1278193. The propagated
symbol files contain all versions, even though only one is applicable
in a given SDK snapshot.
It's uncertain what repercussions this might have, but one is that if
we were to update a snapshot for a fixed version then it might change
because the symbol file contains new versions that aren't applicable.
Since the symbol file isn't actually needed at this point it's better
to wait with this step until the use cases for it are more clear.
Test: m nothing
Test: Create an SDK snapshot with Bionic libs, drop it into a
master-art tree without bionic/ in it, build ART APEXes, and check
that the Soong phase completes (specifically that the stubs are
detected even without symbol files).
Bug: 152481980
Change-Id: Ic79f89bc6d11d0b6552fa20791f5680ff9a40c0d
Necessary to make the APEX build logic treat the libraries as API
boundaries rather than dependencies to bundle.
The .so files in the snapshots are the compiled stub libraries in this
case. They are strictly speaking redundant since they can be generated
from the .map.txt files in the snapshots, but doing that would require
extending the cc_prebuilt_library(_shared) module types with a full
compiler pass etc, and that would break a lot of assumptions in the cc
package.
Test: m nothing
Test: Create an SDK snapshot with Bionic libs, drop it into a
master-art tree without bionic/ in it, build ART APEXes, and check
that the Soong phase completes (specifically no errors about various
APEX libs requiring libc that is not available to them).
Bug: 152481980
Change-Id: I31b928e6261198b6dd6f6b17196e714f07b64172
Compiling native modules against the NDK disables platform features
like ASAN. For anything shipped on the system image there is no
reason to compile against the NDK. Add a new mutator to Soong that
creates a platform and an SDK variant for modules that set
sdk_version, and ignore sdk_version for the platform variant. The
SDK variant will be used for embedding in APKs that may be installed
on older platforms. Apexes use their own variants that enforce
backwards compatibility.
Test: sdk_test.go
Test: TestJNIPackaging
Bug: 149591340
Change-Id: I7d72934aaee2e1326cc0ba5f29f51f14feec4521
platform.
The NOTICE file generation depends on the NOTICE targets for all static
library dependencies. If such a dependency didn't have
//apex_available:platform it didn't get any AndroidMk entry and hence
no NOTICE target via soong_cc_prebuilt.mk. If it was then depended upon
by a binary or library that is accessible to platform, the NOTICE
dependency failed.
Normally such a dependency is invalid, but there are corner cases where
binaries go neither into platform nor any APEX module, and they can
legitimately have such dependencies (cf. b/152241137).
With this CL requests to skip installation of such a static libraries
are ignored so that they get AndroidMk entries, which will always have
LOCAL_UNINSTALLABLE_MODULE set.
Test: "m simpleperf_ndk" with https://r.android.com/1273016, which
removes //apex_available:platform from libs that simpleperf_ndk
depends on statically.
Bug: 152241137
Bug: 149217815
Change-Id: If36e85dd16ade56d4ec1d6744811df5a15b6242c
A library may have both VNDK variant and stubs. getRefAbiDumpFile should
differentiate its vendor and core variants.
Bug: 152277104
Test: Add dumps to platform/ and vndk/ ; make libselinux.vendor libselinux
Change-Id: Iad038cf4cd3eccc3dfbef13fab67da044498ce77
Necessary to get correct prebuilts for many Bionic libs.
Cleaned up numerious "system_shared_libs: []" from test fixtures, since
they otherwise would need correction in the expected results, and it is
better to have a single test focused on testing system_shared_libs
propagation.
Test: m nothing
Bug: 152255951
Change-Id: If2e8a5296223e6281d833312660e8e9e4cd184c0
This reverts commit 380fc3615c.
Reason for revert: breaking one of internal targets
Change-Id: Ica96c44078e5a7f674410828af3ba851317775dd
Exempt-From-Owner-Approval: revert to fix build failure
Added link type support in module creation code as cc_prebuilt_library
has to provide both shared and static libraries.
Had to add some calls to FirstUniquePaths() around the include dirs
settings in library_sdk_member as otherwise the shared variant contains
duplicate include dirs (presumably because it gets one set from its
dependency on the static variant and one set of its own). That
difference in include dirs causes problems in the generated
cc_prebuilt_library.
Test: m nothing
Bug: 142918168
Change-Id: Ie7f23fc2341c83c7814cc98e3970df4f5d4c8423
Even though use_vendor:true is prohibited, there is media.swcodec apex
which is still use_vendor: true and also needs to support Android10.
(min_sdk_version: 29)
Because LLNDK stubs were provided only for the current VNDK version,
media.swcodec couldn't be built against min_sdk_version: 29.
This change introduces additional versions for LLNDK stubs which are
enforced when an apex with use_vendor: true sets min_sdk_version.
To make things easier, the versions of LLNDK stubs are borrowed from its
implementation libraries.
Bug: 147450930
Bug: 149591522
Test: TARGET_BUILD_APPS=com.android.media.swcodec m
(with min_sdk_version: 29 set)
check if liblog/libc/libm/libdl stubs are 29
check if 29 stubs don't have new symbols.
Change-Id: I79946cbb4da6617138a96d2b254349d3a298e77b
Use the result of regex.ReplaceAllString()
Bug: 149591522 (not directly related to this)
Test: m (with new unit test)
Change-Id: Ifce07547ccc067f1ee5bd8467c2fb7d7f8387b8e
This change ensures that the runtime dependencies between a
binary/shared library are correctly specified in the snapshot so that
the build can ensure that shared libraries are built before the targets
that use them.
It adds support for differentiating between references that are
required to refer to another sdk member (required) and those that may
refer to either an sdk member or a non-sdk member (optional). The
latter is used for shared library references as the libraries used by
an sdk member may be provided from outside the sdk. e.g. liblog is not
part of the ART module but is used by some members of the ART sdk.
Bug: 142935992
Test: m nothing
Change-Id: Ia8509ffe79b208c23beba1880fe9c8a92b732685
The sdk snapshot creates two prebuilts for each member one that is
versioned and one that is not. If they are both installed then they
lead to duplicate rules in make for creating the same installed file.
This change adds an installable property to cc modules that will
prevent the installation of the file and then adds installable: false
on the versioned prebuilt for cc modules.
Bug: 142935992
Test: m nothing
Change-Id: I4cb294c2b0c8a3f411eea569775835d9e41726d6
Becase there can be more than one stub libraries, LOCAL_MODULE should be
suffixed with SubName just like NDK stub.
Note that suffix should not be appended to the latest version if the
library is provided by APEX, Otherwise, those libs always need to be
referenced with suffix in .mk files.
Bug: 145796956
Test: m
Change-Id: If503fa651a63b0b215742553b250ecf5e0a30971
VNDK and vendor snapshot singleton work in a single thread, so globbing
in singleton results in ridiculus running time. Moving codes to
GenerateAndroidBuildActions to reduce running time.
Bug: 150406226
Test: VNDK_SNAPSHOT_BUILD_ARTIFACTS=true m dist vndk vendor-snapshot
Test: vendorSnapshotSingleton build time became 0.56s (from 10s)
Test: build.ninja building time became 1m11s (from 1m21s)
Change-Id: I4a081eef5847c62ca00280ca426f5b4e10f87b59
This commit adds a header ABI checker option to check all APIs that can
be found. Without this option, the checker by default only checks the
class/struct/enum that are directly or indirectly referred by one of the
exported symbols. With `check_all_apis: true,`, the checker will check
all class/struct/enum.
Bug: 141709599
Test: Add `header_abi_checker: { check_all_apis: true, }` to a library
and see breakage if I change some enum.
Change-Id: I61f90e07b60a6752fc6be4398420c1ad1291102f
In preparation for adding cc_library_headers support to
sdk/module_exports.
Two changes were needed to make the prebuilt version work.
1) Had to stop the prebuilt version of the library from creating static
and shared variants for header only.
2) Had to allow the code to export/reexport include dirs to run even
when no src is provided.
Bug: 148933848
Test: m nothing
Change-Id: Idd50ed38bc90d1d93551f78e6310f167941487d9
Rename the two prefix-in-list funcs so that their usages are clearer.
Also find and replace all the code that essentially does either.
This introduces additional loops in some places, but I think the added
readability and simplicity outweighs the performance degradation, which
should be negligible anyway.
Test: m nothing
Test: TreeHugger
Change-Id: I37e2276ca0c815105ed0031f23c0b1264b480e4f
If CFI is enabled for a module, no-vendor-variant VNDK will fail
because CFI is not used for the vendor variant.
Bug: 148638729
Test: Remove libstagefright_bufferpool@2.0 from the whitelist. Build on
crosshatch is successful. Build on a ARM32 device with
TARGET_VNDK_USE_CORE_VARIANT set and check no-vendor-variant VNDK
is still enabled for libstagefright_bufferpool@2.0.
Change-Id: Ib0a411d7ea769097186afa802751b0796527ec76
These libraries don't have a core variant against which to check
for identicalness.
Bug: 148526685
Test: built a previously failing target with this change (succeeded)
Change-Id: Ide8ec58df1868175f52c005bf73bb81fc196a571
If a VNDK library does not require using different core and vendor
variants, emit LOCAL_CHECK_SAME_VNDK_VARIANTS so that the two variants
can be checked for identicalness.
Bug: 145157349
Test: With the corresponding change in build/make, remove libbinder
from build/soong/cc/config/vndk.go and check a build fails
even without TARGET_VNDK_USE_CORE_VARIANT set.
Change-Id: I7698edf9a24b0df150c0e4f7d8dd4926f053eee8
The cc library and cc binary (and other cc module types) are all
instances of cc.Module. So, to differentiate between them and make
sure that only appropriate library instances can be added to
native_shared/static_libs this adds a special sdkMemberTypes field to
Module which if set specifies the SdkMemberTypes the module supports.
If it is not set then the module type cannot be used in the sdk at all.
Corrects an issue with one of the tests where a prebuilt cc
library was added to the sdk instead of a source cc library.
Adds a new test to ensure that cc_library_(shared|static)_host module
types work with the sdk as well and another test to ensure that
cc_library can be used as either.
Bug: 142918168
Test: m checkbuild
Change-Id: I359cdbdd15328ca571f276d2b6ce9a229ebb2c86
The exported include dirs includes both source and generated
directories (e.g. containing aidl generated headers). The latter are
always arch specific so if they are present they make all the include
directories arch specific.
This change separates the source and generated include dirs so that
the source include dirs (which are probably not arch specific) can be
optimized separately from the arch specific generated include dirs.
The FilterPathList() func was refactored to extract the more general
FilterPathListPredicate() func.
A number of tests needed to be updated to reflect the more optimal
snapshot creation.
Bug: 142918168
Test: m checkbuild
Change-Id: Id1a23d35a45b250ae2168834f9c2a65c86a5fd77
Previously, code that attempted to optimize the generated .bp rules
treated the properties structure as a single entity. So, a single arch
specific value would cause all properties to be treated as arch
specific. Also, that code was specific to one structure type.
This generalizes the optimization to work with any properties structure
which will be helpful for other multi-variant module types. It also
treats each property separately.
The hasArchSpecificFlags field has been removed from nativeLibInfo and
a commonProperties field has been added instead into which the common
values will be found. File path creation that conditionally prefixed a
path with archType has been replaced with general code that relies on
archType being "" for common properties and filepath.Join(..) ignoring
empty string components.
The common and arch variant properties are always processed. The first
within the context of the .bp module's property set and the latter
within an arch specific property set. There are always some properties
that are arch specific, e.g. outputFile, so there is no need to worry
about an empty arch property set being created.
The archSpecificNativeLibInfo type was renamed nativeLibInfoProperties
as it may not be arch specific.
The printExportedDirCopyCommandsForNativeLibs variable was renamed to
addExportedDirCopyCommandsForNativeLibs as it no longer does any
printing.
Bug: 142918168
Test: m checkbuild
Change-Id: Iad45913299c37fd76fe03ed0ca68bdc68ed76431
Parameterized the cc.librarySdkMemberType to allow it to support
both static and shared libraries. Created two instances, one for shared
and one for static libraries. A follow up change will add support for
libraries that can be both.
Added *librarySdkMemberType to nativeMemberInfo as information from
there is needed when generating the snapshot.
Made organizeVariants() func a method of *librarySdkMemberType so that
it can initialize the new field. Moved it to be with all the other
methods of that type.
Added host and device tests for the new module type.
Bug: 142918168
Test: m nothing
Change-Id: I00b1e8424b9d81f7d15edc4883971d10668ec2cc
This is needed for a follow up change that makes sure that the
prebuilt modules have the same visibility as the source modules.
Bug: 143678475
Test: m conscrypt-module-sdk
Change-Id: I9461c8c094ab19ee9ececb5e5fd50565789f2fa2
For VNDK snapshot and SDK snapshot, deps files have been used to capture
generated headers. But exported deps might contain intermediate phony
files instead of actual header files, which are for optimization of
ninja. To correctly capture all headers, exported generated header files
are gathered separately.
Bug: 65377115
Test: m nothing
Change-Id: Ia03fa69186490a818578190e3c0bfb0261d1fd6e
Extracts the type specific functionality into the SdkMemberType
interface which has to be implemented by each module type that can
be added as a member of the sdk. It provides functionality to add
the required dependencies for the module type, check to see if a
resolved module is the correct instance and build the snapshot.
The latter was previously part of SdkAware but was moved because
it has to be able to process multiple SdkAware variants so delegating
it to a single instance did not make sense.
The custom code for handling each member type specific property,
e.g. java_libs, has been replaced with common code that processes
a list of sdkMemberListProperty struct which associates the
property (name and getter) with the SdkMemberType and a special
DependencyTag which is passed to the SdkMemberType when it has to add
dependencies.
The DependencyTag contains a reference to the appropriate
sdkMemberListProperty which allows the resolved dependencies to be
grouped by type.
Previously, the dependency collection methods would ignore a module if
it was an unsupported type because they did not have a way of
determining which property it was initially listed in. That meant it
was possible to add say a droidstubs module to the java_libs property
(and because they had the same variants) it would work as if it was
added to the stubs_sources property. Or alternatively, a module of an
unsupported type could be added to any property and it would just be
ignored.
However, the DependencyTag provides information about which property
a resolved module was referenced in and so it can detect when the
resolved module is of the wrong type and report an error. That check
identified a bug in one of the tests where the sdk referenced a
java_import module (which is not allowed in an sdk) instead of a
java_library module (which is allowed). That test was fixed as part
of this.
A list of sdkMemberListProperty structs defines the member properties
supported by the sdk and are processed in order to ensure consistent
behaviour.
The resolved dependencies are grouped by type and each group is then
processed in defined order. Within each type dependencies are grouped
by name and encapsulated behind an SdkMember interface which includes
the name and the list of variants.
The Droidstubs and java.Library types can only support one variant and
will fail if given more.
The processing for the native_shared_libs property has been moved into
the cc/library.go file so the sdk package code should now have no type
specific information in it apart from what is if the list of
sdkMemberListProperty structs.
Bug: 143678475
Test: m conscrypt-module-sdk
Change-Id: I10203594d33dbf53441f655aff124f9ab3538d87
This commit enables ABI checks for shared libs exported by APEX and
explicitly enabled ABI checks.
Bug: 145608479
Test: m com.android.resolv
Change-Id: I3b58178b0258df35fcc848e84642152516f6774f