Commit graph

270 commits

Author SHA1 Message Date
Cole Faust
9decf834ce Only generate kythe xrefs on the primary module
Currently the kythe build is hitting the 6 hour timeout, but we're
generating kythe files for all variants. Generating them only for
the primary variant should drastically cut its runtime.

Bug: 345440993
Test: Presubmits
Change-Id: I3846b25c7f0bc22153e4f0a0cb81c5015854dd70
2024-06-11 11:50:47 -07:00
kellyhung
de1b6b0f64 Fix post command of clang_verify.
Bug: 311284462
Test: go test -run TestClangVerify
Change-Id: I116c4a3e1e5734a71e1bfd503ea2268a1a5643dd
2024-05-23 02:16:26 +00:00
kellyhung
d62ea30647 Add clang_verify property for cc.
This property is to support cflags "-Xclang -verify" build pass in Soong. The behaviors of clang_verify:
- append cflags "-Xclang -verify"
- append "&& touch $out" to the clang command line

Bug: 311284462
Test: go test -run TestClangVerify

Change-Id: Ic5825e2d649da4c3c5ed6da916e9804d7e3c03da
2024-05-21 11:31:48 +08:00
Ivan Lozano
e8fcd37775 Merge changes from topic "rust-made-to-order-staticlibs" into main
* changes:
  rust: made-to-order rust staticlibs
  rust: refactored transformSrctoCrate
2024-05-17 12:40:36 +00:00
Ivan Lozano
0a468a4f3b rust: made-to-order rust staticlibs
Whenever any two Rust static libraries are included
as static libraries anywhere in a CC dependency tree, we sometimes
get duplicate symbol errors. To avoid this, we no longer
directly link multiple rust static libs to CC modules.

Instead, we build rust_ffi_rlib modules and produce the actual
static library that gets linked against the CC module based on
that CC module's full list of Rust rlib dependencies.

This introduces a new static_rlibs property for cc modules to
define the rust_ffi_rlib dependencies, which are then used to
generate the module above.

This CL is intended to deprecate rust_ffi_static. It leaves
rust_ffi_static and rust_ffi static variants in place until
the remaining rust_ffi_static declarations and uses can be
removed. In the meantime, rust_ffi_static produces
rust_ffi_rlib variants as well to make the transition easier.

Bug: 254469782
Test: m # with no changes
Test: m libapexsupport # with static_rlibs
Test: m libunwindstack # with static_rlibs
Test: m netsimd # with static_rlibs, no duplicate symbols
Test: m blueprint_tests # New Soong tests

Change-Id: I47e27ac967ef0cad46d398ebf59d8275929ae28a
2024-05-16 13:00:43 -04:00
Ivan Lozano
3b591c771a rust: Support for generated c files from bindgen
To handle static inline functions, bindgen generates a C file which is
expected to be compiled and linked into dependents on the generated
bindgen source.

This CL adds support for cc modules ingesting this output and for
bindgen to produce it (and link it against the bindgen rust_library
variant as well).

Bug: 290347127
Test: m blueprint_tests
Test: Example module with static inline functions builds locally
Change-Id: I167a8356eb6e0059fc21169fd3bfc6bf4d9c812f
2024-05-03 14:01:09 -04:00
Hsin-Yi Chen
f6fc525a1a Let header-abi-linker filter llndk, apex, and systemapi symbols
This commit adds --include-symbol-tag and --symbol-tag-policy to
header-abi-linker commands. The arguments make header-abi-linker load
the symbols tagged with llndk/apex/systemapi from the version script.
It filters the function declarations by the symbols. The output dumps
will not contain unfinalized ABI.

Test: make findlsdumps
Bug: 333532038
Change-Id: I28234a3749f389b8a5a09ac84341b1fcd1ee88a6
2024-04-25 23:11:49 +08:00
Hsin-Yi Chen
af369886e5 Refactor header ABI checker code
- Extract duplicate code into exportedIncludeDirsForAbiCheck.
- Convert libraryDecorator.sAbiOutputFile to a local variable.

Test: make
Bug: 314010764
Change-Id: I99a0352b11347ad363df5645ba8e0faf9bc9a0aa
2024-04-03 09:09:18 +08:00
Luis Useche
342fa6b927 Add global C flags to compile_commands
This solves linter warnings in editor by adding flags to ignore errors
we don't care about. This also means that compile_commands.json is
closer to the flags we actually use for compilation.

Test: Checked generated compile_commands for new flags.

Change-Id: Id583da6eb5151a9baa9a47771f5f937c88bc43f7
2024-04-02 13:58:13 -07:00
Wei Li
5f5d271fc3 Build native libraries used by layoutlib.
Bug: 303904212
Test: m layoutlib dist; CIs
Change-Id: Id77cba97b2f66997431beb78ecc9d9b74b64b803
2023-12-12 05:06:20 +00:00
Pirama Arumuga Nainar
6c771e7d29 Revert "Remove flags rejected by RBE input processor"
This reverts commit a4724a0c4e.

Reason for revert: reclient has an updated deps scanner now.
Bug: http://b/248371171
Test: enable RBE; RBE_CLANG_TIDY_EXEC_STRATEGY=remote; make tidy-soong_subset


(cherry picked from https://android-review.googlesource.com/q/commit:2c36e5efceae94424b513878cf6dc4e9640651ab)
Merged-In: Id876bd7eee1e5606f8dc05903f77f135b47da360
Change-Id: Id876bd7eee1e5606f8dc05903f77f135b47da360
2023-11-21 19:54:27 +00:00
Colin Cross
f96b001064 Don't call android.PathForModuleSrc(ctx).String() to get ModuleDir
ctx.ModuleDir is much cheaper than android.PathForModuleSrc(ctx).String().

Test: builds
Change-Id: I81819088d9564b06a0336a59a45f2b110b0bd9d6
2023-11-02 19:07:49 +00:00
Hsin-Yi Chen
843c0638d6 Let header-abi-linker filter symbols by API level
In a trunk stable branch, the ABI-monitored libraries under different
release configurations share the source code. The exported symbols are
filtered by version scripts and API level. header-abi-linker needs to
take the API level as a parameter.

Test: make
Bug: 308192597
Change-Id: I4b55b7ec023451b3a4cd1da308a1de10842d51d2
2023-10-30 13:03:53 +08:00
Colin Cross
dea1d03975 Fix addrsig warnings
ld -r reorders symbols and invalidates the .llvm_addrsig section, which
then causes warnings if the resulting object is used with ld --icf=safe.
The warning is especially common when building with musl, as the
clang_rt.crt* objects have .llvm_addrsig sections, are linked into
libc_musl_crt* using ld -r, and are then linked into every other binary
and shared library with --icf=safe.

Strip the .llvm_addrsig section after ld -r to prevent the warnings.

Test: m USE_HOST_MUSL=true host-native -k
Change-Id: Ia52a4756b9ebbb62115898d0de9f8641e6fea705
2023-04-14 14:31:14 -07:00
zijunzhao
933e38093d Add noOverride64GlobalCflags support to Soong
Bug: b/261642850
Test: Build and check warnings. Add two xfail tests in bionic and see the
results locally.

Change-Id: I68fca0084787c329b6c49ce4dff6fd132f820735
2023-01-25 04:02:29 +00:00
Hsin-Yi Chen
0af4e6728a Deprecate ABI reference dumps in gzip
ABI dumps in gzip are no longer supported because they cannot be
reviewed or merged.

Bug: 227282691
Test: make
Change-Id: I9fdf943fb8ae30aeae884d4d361a65034ab6fa94
2022-11-30 15:02:18 +08:00
Hsin-Yi Chen
a6ddb144f8 Refactor the build rules for ABI diff
- Move the logic that determines the versioned dump directories
  from pathForVndkRefAbiDump to linkSAbiDumpFiles.
- Move sourceAbiDiff which generates the flags for ABI diff from
  builder.go to library.go.
- Define two functions that generate the rules for cross-version and
  same-version ABI diff.

Bug: 227282691
Test: make
Change-Id: Ic33799e86dd9ae627f5680b70973f96e15c030e9
2022-11-30 11:34:39 +08:00
Hsin-Yi Chen
7584bda227 Fix the condition for LLNDK ABI diff
IsLlndk() returns whether the library is an LLNDK stub. The ABI check
should identify LLNDK implementation by isImplementationForLLNDKPublic().

Test: development/vndk/tools/header-checker/utils/create_reference_dumps.py \
      && make
Bug: 227282691
Change-Id: I570871e24d9029992a722b3052f8bb6e7f3c0f52
2022-11-10 16:29:44 +08:00
Hsin-Yi Chen
d2079b646c Enable ABI diff between the source code and the previous version
This commit removes "-advice-only from" the command of cross-version ABI
diff. The ABI changes that are incompatible with the previous version
are propagated as build errors. The developers need to follow the
error message to resolve the ABI difference.

Test: make
Bug: 244520027
Change-Id: Ic6e7757d2b35b619afcc8f50c892d1cfe989c800
2022-10-27 18:03:09 +08:00
Chih-Hung Hsieh
a4724a0c4e Remove flags rejected by RBE input processor
* This is a temporary work around until the RBE input processor
  can handle those flags.
* It's okay to remove some cflags in clang-tidy command
  if they do not affect tidy check results.

Bug: 248371171
Test: enable RBE; RBE_CLANG_TIDY_EXEC_STRATEGY=remote; make tidy-soong_subset
Change-Id: If499bd7e1f0f89ccc3b7f7df7d67cfc64dc67028
2022-10-04 16:52:36 -07:00
Colin Cross
4fa894d366 Removed unused GCC references
Remove Toolchain.GccRoot, Toolchain.GccVersion, and Toolchain.GccTriple
that were only used by an unused function.  This removes most of the
references to GCC, although there are still some left in the host
toolchains.

Test: No change to build.ninja for aosp_cf_x86_64_phone-userdebug or aosp_raven-userdebug
Change-Id: I72b8af1f9aa83e6e15c9e00ed1e817b6cc3a031a
2022-09-30 19:32:48 -07:00
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
Steven Moreland
855094c759 Avoid dereferencing ANDROID_BUILD_TOP
We want to print to the user to use this variable, but it might
not be set in all environments where we run the build. Namely,
in sdk finalization CI.

Bug: 244456768
Test: N/A
Change-Id: I233e7d0ee6a7ed43760ad723fccd70ea97f7b806
2022-08-31 18:58:55 +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
Mu-Le Lee
f7d0b43782 Add target-version flags in header-abi-diff command
In Cross-Version ABI Check, the config of header-abi-diff would be
changed based on go/cross-version-abi-diff-configuration. Thus in soong,
the target-version flag should be added for header-abi-diff to determine
config section. The error message of header-abi-diff is also modified to
help developers resolve the incompatibility by updating the
header-abi-diff config.

Test: make and check the flag of generated header-abi-diff command
Bug: 239792343
Change-Id: Id94f577a42193ecf218dc94d0bfd2065fcdc2896
2022-08-27 08:37:35 +00:00
Hsin-Yi Chen
0713e4f173 Revert "Disable RBE for header-abi-dumper"
This reverts commit 6580d84f51.

Reason for revert: The bugfix for reproxy was released to this branch.

Test: make
Bug: 226497964
Change-Id: I38e30d3dc71fa7857a61fcadf5895075608fd966
2022-08-17 12:57:48 +08:00
Xin Li
6ef4fae229 Merge "DO NOT MERGE - Merge Android 13" 2022-08-16 19:08:20 +00: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
Treehugger Robot
dd3de9731a Merge "Move libFlags as well to the RSP file for link actions" am: e3048505c0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2145559

Change-Id: Ie8157ee7782841a2d4eda9719289b36f0f2faa0f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-18 05:06:03 +00:00
Kousik Kumar
01332cf3b4 Move libFlags as well to the RSP file for link actions
This is to avoid hitting command-line length issues when building with
RBE enabled for C++ links.

TESTED=ran a build with link actions and saw command-line getting
shorter in size from verbose.log
Bug: b/237480728

Change-Id: Id66165159388554bb76579080c5a6979dd670d22
2022-07-04 20:34:57 +00:00
Hsin-Yi Chen
4108552615 Merge "Remove unneeded logic from sourceAbiDiff" am: 6e9225d53c am: 76e7546a6b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2114875

Change-Id: I5768c30f4e80a65e0bb998c0700a7210c915e19d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-08 03:46:25 +00:00
Hsin-Yi Chen
6e9225d53c Merge "Remove unneeded logic from sourceAbiDiff" 2022-06-08 02:12:58 +00:00
Treehugger Robot
01346ff1a6 Merge "Use single clang-tidy build rule and clang-tidy.sh" am: b12ae4f2bd am: 011e470e5e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2110906

Change-Id: I52e5741db934b6166c3f6a9bb75bb0c6726b4bc5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-04 00:45:00 +00:00
Treehugger Robot
b12ae4f2bd Merge "Use single clang-tidy build rule and clang-tidy.sh" 2022-06-04 00:06:26 +00:00
Colin Cross
4ec2bf1467 Merge "Revert "Use --dependency-file when linking elf files."" am: b914e7f8c6 am: c43e5ff7cc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2115768

Change-Id: Ieed01217bf395e4951ff571a69b346327d584168
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-03 17:40:20 +00:00
Colin Cross
b914e7f8c6 Merge "Revert "Use --dependency-file when linking elf files."" 2022-06-03 16:53:54 +00:00
Colin Cross
32320e89fd Revert "Use --dependency-file when linking elf files."
This reverts commit 97d87760b4.

Reason for revert: b/234772469

Bug: 137961579
Bug: 234772469
Change-Id: I478f5a2696e87144d0123e8872c9f8ac1d5f24b0
2022-06-02 23:02:01 +00:00
Hsin-Yi Chen
dccddb6036 Remove unneeded logic from sourceAbiDiff
- The script creating reference dumps does not need --llndk. It can
  determine the library types automatically.
- NDK passes the ABI checks with -consider-opaque-types-different.
- All libraries checked by the ABI tools have exported headers and don't
  need -advice-only.

Bug: 232891473
Test: development/vndk/tools/header-checker/utils/create_reference_dumps.py \
      && make
Change-Id: Ia418022d6d0b46bfabefaa296fa81e80291fde32
2022-06-02 18:49:26 +08:00
Chih-Hung Hsieh
30ab2f059f Use single clang-tidy build rule and clang-tidy.sh
* The old jobs of two build rules are now combined into
  a new clang-tidy.sh wrapper.
  The clang-tidy build rule now calls clang-tidy.sh.

Bug: 234406661
Test: WITH_TIDY=1 make; make tidy-soong_subset
Change-Id: I91961edf96e9a546f0c3088715a6f2ca8796a21b
2022-05-31 18:46:39 -07: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
Hsin-Yi Chen
ab255ae347 Merge "Add diff_flags as a header_abi_checker property" into tm-dev am: 39a9db3bae
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/18482834

Change-Id: I6f53043eead9258ecc9903a3d779ed04df60aef2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-26 05:24:08 +00:00
Hsin-Yi Chen
4f992b663f 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
2022-05-19 15:19:57 +08:00
Treehugger Robot
0b80b69378 Merge "Use --dependency-file when linking elf files." am: ff22afa704 am: 87089903c2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1975926

Change-Id: I1413949241ed383368027fb3f1a10cb60cfb74f5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-29 18:09:12 +00:00
Colin Cross
97d87760b4 Use --dependency-file when linking elf files.
Use the new --dependency-file flag for lld to produce a deps file.

Fixes: 137961579
Test: m checkbuild
Change-Id: I4e0724795a4237ef4560f814e5ef40e44591d776
2022-04-26 13:58:01 -07:00
Hsin-Yi Chen
6580d84f51 Disable RBE for header-abi-dumper
The header-abi-dumper processes do not terminate when
USE_RBE_DUMPER=true. To unblock SDK finalization, the RBE rule is
disabled until the bug is fixed.

Test: make
Bug: 226497964
Change-Id: I3fc2357b71d346fcda431077a68c69757981318b
2022-04-18 05:35:35 +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
Chih-Hung Hsieh
8439a141a7 Compare tidy_disabled_srcs list by string values
* Cannot use android.Path as key because some srcs and
  and tidy_disabled_srcs items could have the same path
  string but different android.Paths objects.

Bug: 219783146
Test: make tidy-soong_subset
Change-Id: I82e25ec9678ce998feccf361d69ae66dae0905de
2022-02-15 15:32:57 -08:00
Chih-Hung Hsieh
c74f63eeff Split the clangTidyRE rule
* Add clangTidyDepRE, which is an order-only dependent of
  the new simplified clangTidyRE rule.
* Remove escapeSingleQuotes, used only by the old bash command.
* Remove extra space when TIDY_TIMEOUT is not defined.
* In clang-tidy calls,
  use moduleFlags to match the clang/clang++ commands.

Bug: 218937424
Test: make droid tidy-soong_subset
Change-Id: I162e2318410741ab61fb2bb338725b000a3f148d
2022-02-11 17:21:56 -08:00
Treehugger Robot
f73658bdc6 Merge "[NFCI] Change llvm-ar '-format' to be '--format'." 2022-01-26 00:53:36 +00:00
Mitch Phillips
ed0dd76eaa [NFCI] Change llvm-ar '-format' to be '--format'.
Upcoming versions of the toolchain (at least when I was locally testing)
drop support for the single-dashed argument type. Fixing this ahead of
time as to hopefully avoid the toolchain-release-blocking bug in future
:).

Bug: N/A
Test: Build the platform.
Change-Id: Ia2c6dcb19556f1979f9a6ecfd3a0ec58fb73e36e
2022-01-25 10:35:50 -08:00