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
libicu_* fuzzer depends on installable cc modules and non-installable
cc modules with the same name, because the non-installable modules are
stubs used in the compile-time, and shouldn't be used in runtime.
Bug: 175583039
Test: make haiku dist
Test: Run 2 arbitrary binaries from out/dist/fuzz-target-x86_64.zip on device
Test: Run 2 arbitrary binaries from out/dist/fuzz-host-x86_64.zip on host
Change-Id: I0ecf24bb83e3985da3b8f393adab8c87ab7400c6
* Default -header-filter will now contain only module directory.
* In a clean build of aosp_x86_64-eng, this change can reduce
the number of (duplicated) clang-tidy warnings by 77% or more.
* When compiled with WITH_TIDY=1, if DEFAULT_TIDY_HEADER_DIRS is
not set, warnings from a header file will be shown only if
the file is in a module's (sub)directory.
* Set DEFAULT_TIDY_HEADER_DIRS="bionic/|bootable/|build/|cts/|\
dalvik/|developers/|development/|frameworks/|\
libcore/|libnativehelper/|system/"
will get before this change's -header-filter.
* Fix a bug: Default header-filter was not added when
tidy_flags was defined in a module.
With this fix, some incorrectly hidden header file tidy warnings
will now show up.
Bug: 179530304
Test: make with WITH_TIDY=1 and various setting of DEFAULT_TIDY_HEADER_DIRS
Change-Id: Ia0c05349908a730862dae36be9a2dbe4f44fb6da
Similar to our vendor support, this adds support for linking rust static
libraries to vendor ramdisk cc modules.
A bug fix is also included where a restriction against setting rust_ffi
vendor-specific was not being enforced.
Bug: 179397942
Test: Example modules link, Soong tests pass.
Change-Id: I737cdf0c2f49ab349bcea2a0429e6298ebc1313e
When using the directed vendor snapshot, the build fails because soong
fails to find some variants of the modules that have been excluded
from VENDOR_SNAPSHOT_MODULES, even though those modules are not going
to be used by the build.
The solution implemented here is to generate fake versions of those
modules (empty files) and include them in the generated Android.bp,
so that soong finds the modules, even though trying to use them would
fail.
Bug: 171821997
Bug: 179275601
Test: source build/envsetup.sh
Test: m -j nothing
Change-Id: Ibd3e963ab3e5504c0ac817f7cabbd241bf47a5cb
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
New clang compiler issue too many such warnings.
Bug: 179065588
Bug: 179309338
Bug: 179278370
Test: make, presubmit
Change-Id: I9948a4b34ec75a01aa24c2fd753722b072ae5202
This currently expands all globs, still need to support converting glob
syntax.
Test: go build_conversion_test
Test: GENERATE_BAZEL_FILES=true m nothing
Test: m nothing
Bug: 165114590
Change-Id: If7b26e8e663d17566fad9614ca87a8da1f095284
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
When a module has both 'product_specific: true' and
'vendor_available: true', the module does not have core variant but
have product and vendor variant modules. As the module generated
multiple variants, the names of the modules have the variant name
suffix. However, it did not create the module with the base module
name because it does not have core variant.
As the base module, in this case, is the product variant, use the
base module name for the product variant without adding the
'.product' suffix to it.
Bug: 161913599
Test: m hidl_test_product@2.0-adapter-helper
Change-Id: I904b43744579a6e89cecbc2e529122eaa8b14cae
The module names for vendor and product variants have the image
variant suffix to avoid conflict with the core modules. It requires
updating the module names in the dependency tree with the suffixes.
We had a hidden bug that used the original module properties to
update the names of its dependent modules.
Also, it must cover the product variants modules.
Test: updated cc_test.go and build
Change-Id: I6b4ea062d13c8fac1e699138d44376e52e0d7852
Switching all cc_test_host to unit_tests: true by default.
Resolved all the failures (passing presubmit) to enable this.
Test: presubmit trigger
Bug: 177450457
Change-Id: I815e40786c0b62cf0aadd9b837d35c48332639da
Propgate the Android.mk suffix from source modules into the snapshot so
that it can be used for the prebuilt modules.
Bug: 177098205
Test: vendor_snapshot_test.go
Change-Id: Iea151dc91395f714fbcad1df3a6fd0874e5455d9
Snapshots storead global sets of modules that should be replaced with
vendor snapshot modules. Move the data instead to a vendor_snapshot
or recovery_snapshot module type that depends on all the modules in
the snapshot, and then have modules that should use the snaphsot
depend on it to query for the set of modules that should be replaced.
Bug: 177098205
Test: vendor_snapshot_test.go
Change-Id: I2826adacfb473e9139b5ea93ba83b8a54cc1a56b
Adds the ability to define data files that should be installed alongside
the test.
This also fixes a bug wherein rust_test properties were duplicated.
Bug: 171710847
Test: rust_test module with "data" property installs files to device.
Change-Id: I091489afaf7e76b751a33a28049590d9fb39fe5f
This change adds a new arch named "armv8-a-branchprot". The new target
is no different from the usual "armv8-a" variant except it has the
compiler flag "-mbranch-protection=standard" set.
With this flag compiler emits Armv8.3-A Pointer Authentication and
Armv8.5-A Branch Target Identification instructions. All of these
instructions are in the hint space; therefore devices which do not
support any of these extensions would execute them as NOPs.
In terms of directory structure there is no change in the output of
build/soong/scripts/build-ndk-prebuilts.sh script.
Test: build NDK prebuilts
Change-Id: Ie52ccba5653fbf567f0b7ca312d8a8e71602ad06
As AIDL version rule is changed, change VNDK list accordingly.
'unstable' and non-versioned aidl module will be cleaned up
Bug: 150578172
Test: m
Change-Id: I3e82b2c01f1fca75ac97985053b4a5826d151340
Merged-In: I3e82b2c01f1fca75ac97985053b4a5826d151340
* Now CLANG_ANALYZER_CHECKS=1 simply enable all clang-analyzer-* checks.
Test: make with WITH_TIDY=1 CLANG_ANALYZER_CHECKS=1
Change-Id: Ib97a2c491df66088197805e979e4bec28f2f433c
'vendor_available: true' creates a vendor variant from a system
module. The vendor variant of the module is installed to /vendor.
However, we may want to install the vendor variant to /odm, instead.
'device_specific: true' does not work for this purpose because
'vendor_available: true' is allowed only for the system or product
modules to create a vendor variant. But 'device_specific: true'
itself creates a vendor variant that may not work with
'vendor_available: true'.
To install the vendor variant to /odm, we define a new property
'odm_available'. 'odm_available' is exactly the same as the
'vendor_available' except the install path of the vendor variant.
By defining 'odm_available: true', the vendor variant of the module
will be installed to /odm or /vendor/odm instead of /vendor.
Bug: 176147321
Bug: 176079978
Test: check if a module with 'odm_available: true' is installed to
/vendor/odm
Change-Id: I2d16bd2c515796597b2fbd1eb66f7c2736434697
Test that the correct suffix is added to the Make references to a
vendor_available library in a vendor snapshot.
Bug: 177098205
Test: vendor_snapshot_test.go
Change-Id: I0c9b81d63798e221db856fa0e4742a467c356fcb
Move the vendor snapshot tests into vendor_snapshot_test.go to
reduce the size of cc_test.go
Bug: 177098205
Test: go test ./build/soong/cc/...
Change-Id: Ib1120f986fc0111a9487fce00539a4c5ae7e2e87
*_available will not provide if a module is VNDK-private or not.
Fixed it by using IsVndkPrivate() with private() interface.
By allowing exclude_from_vendor_snapshot for vendor_available
modules, available() interface is no longer required. Tests are
updated for exclude_from_vendor_snapshot on vendor_available modules.
Bug: 175768895
Test: m nothing
Change-Id: I9ff85256170d59b378a4c354d5c007cfbeacabc5
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
Historically we've only had to add one major release a year to the Mac
SDK allowlist, but this year the versioning scheme changed and 11.1 is a
minor update to 11 (instead of 10.x.1 like in years past). Unfortunately
the Xcode tools don't let you just specify '11' like they did with
'10.x', so this is more complicated to fix in a scalable way.
Test: build with xcode 12.3 and macOS SDK 11.1
Change-Id: I2e88e9289727261389a863e7147a0b146ec5148a
The following warnings have been turned on, and turned on as errors:
-Wbool-operation
-Wimplicit-int-float-conversion
-Wint-in-bool-context
-Wstring-compare
-Wstring-plus-int
-Wxor-used-as-pow
Test: no extra tests necessary
Change-Id: Ic8ab26de9e5323e9b81ad79eef787abfb264848c
cc_test without sanitize:memtag_heap acts as if it has implicit
sanitize{memtag_heap:true, diag:{memtag_heap:true}}. This is unaffected
by SANITIZE_TARGET.
Refactor the test to cover all permutations.
Change memtag include lists to act similar to SANITIZE_TARGET_DIAG: the
the sync include list upgrades async targets to sync, unless diag is
explicitly set to false in the target definition.
Bug: b/135772972
Test: cc_test.go
Change-Id: I6a969f2f5804cd5f47fc4e93a20e3b99ea5fa111
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
Windows prefer32 was implemented in cc, which caused a mismatch
between cc and other packages like python. This manifested as
missing variant when a python_test_host with compile_multilib: "first"
tried to depend on a cc_binary_host, which implicitly has multilib
"first".
Fixes: 177904375
Test: m checkbuild
Change-Id: Iaaac16ae171c06d90d04d7cac11789d3f39b8d99
* WITH_TIDY=1 should not include clang-analyzer-* checks
because they are too slow.
* Nightly builds will use both WITH_TIDY=1 and
CLANG_ANALYZER_CHECKS=1.
Bug: 173736193
Test: make with WITH_TIDY=1 and CLANG_ANALYZER_CHECKS=1
Change-Id: I3885fd0e20475ceee5e3798bffc11a61994ac113
Native bridge modules never need to build against NDK stubs, so
don't create SDK variants. Also clear the sdk_version property
for modules that don't have SDK variants so that later code doesn't
use it to trigger SDK behaviors.
Test: m checkbuild
Change-Id: I1920fa82e9fab06235f01a62624382efa16cc6e3
Vendors can now generate only needed modules by setting the following
Makefile variables:
- DIRECTED_VENDOR_SNAPSHOT: set to true
- VENDOR_SNAPSHOT_MODULES: list of snapshot candidates
e.g.
DIRECTED_VENDOR_SNAPSHOT := true
VENDOR_SNAPSHOT_MODULES := toybox_vendor sh_vendor libbase libcutils ...
Bug: 157967325
Test: m dist vendor-snapshot after setting those in BoardConfig.mk
Change-Id: I6515a43d9358d94483d7c7fa2b066f9dd457f6aa
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
* clang-analyzer is slow and enables clang-diagnostic-padded,
which cannot be suppressed yet.
Test: make with WITH_TIDY=1 for crosshatch-userdebug
Change-Id: I20193f0db3154b037d58c5ca012a9e753b176722
* This allows local projects to enable clang-tidy
and catch errors in a default build, but allows
all warnings in a global build with WITH_TIDY=1.
Test: make with WITH_TIDY=1
Change-Id: I92a10af24b23ee9f04eebb0513e8f611dd7dcf59
This change turns -Wunguarded-availability option which enforces calls
to APIs which are introduced after the min_sdk_version of the
compliation unit to be guarded with __builtin_available check. For
example, let's assume that we have foo() which was introduced with API
level 30.
void foo() __INTRODUCED_IN(30);
Then if foo() is called for a module whose min_sdk_version is less than
30, say 26, it should be called as below:
if (__builtin_available(android 30, *)) {
foo();
} else {
// fallback impl
}
For modules whose min_sdk_version is >=30, the guard is not required.
Bug: 150860940
Bug: 134795810
Test: m
Change-Id: I084148b9a051350626a37cb394daa4398b7332d5
The change will detect if a module is compiled against cfi support, and
will usebuild the coverage build against the libprofile that supports cfi. This is to resolve compilation errors when
building against modules with cfi support.
Bug: 177098919
Test: forrest build for cf_x86_phone-userdebug_coverage http://go/forrest-run/L81700000786828933
Change-Id: I8e0421cdf1c6e499292cfa3457cefd3c42f13155
Merged-In: I8e0421cdf1c6e499292cfa3457cefd3c42f13155
The check no longer tracks private dependencies like stubImplDepTag and
staticVariantTag. It also doesn't do the check for double_loadable
libraries that are not depended on by a LLNDK library.
Bug: N/A
Test: m
Test: add 'double_loadable: true, gen_trace: true` to an aidl_interface
module. The build doesn't break.
Change-Id: Iccd1a9d445a48d03c373708ba1bdd34b9a7f152d
For the platform libc++ STL, remove the
-Wl,--exclude-libs,libunwind_llvm.a argument, which is redundant with
the same argument in deviceGlobalLdflags.
Bug: http://b/153025717
Test: device boots
Change-Id: Idd7791d52f74aab2d5f59419fb75f841fc29a2eb
Move the global lists of VNDK modules into boolean properties on the
modules themselves, and use the new SingletonModule functionality
to visit all modules and collect the list of modules with the properties
set.
Bug: 176904285
Test: all soong tests
Test: m checkbuild
Test: compare Soong outputs
Change-Id: Icf7e2f8f190a517d30f0780e98762bc0084ddb24
Previously, for cc_* modules, __ANDROID_API__ tracked the sdk_version
property. This however has caused a few number of problems:
1. It's confusing. __ANDROID_API__ has meant minSdkVersion. Therefore
the sdk_version property should mean minSdkVersion (since the macro
tracks the property). However, the introduction of the new
min_sdk_version property (which is currently for APEX) made this very
confusing. Also, this is not consistent with the java_* modules where
sdk_version means compileSdkVersion.
2. This is preventing go/android-future-symbols. The plan is to make the
APIs that are above the minSdkVersion available as weak symbols.
Previously those APIs had to be accessed via dlsym because they are
hidden behind the __ANDROID_API__ macro at build-time. To use make the
APIs visible at build-time, the module authors had to __ANDROID_API__
beyond their minSdkVersion. This is against the definition of
__ANDROID_API__.
To solve above problems, __ANDROID_API__ now correctly tracks
min_sdk_version. In addition, min_sdk_version now defaults to
sdk_version. Therefore, most of the modules that don't set
min_sdk_version aren't affected by this change.
Bug: 163288375
Test: m
Change-Id: I645e6bb1234c27ae0a69b7b87a59206cfd350744