This API surface is provided by platform and mainline modules to other
mainline modules. Rename it to module-lib API surface to align it with
the terminology in go/android-api-types
Test: go test ./bp2build
Test: go test ./cc
Change-Id: Ieb9f3214e66366fc2ceb6f47e2d6623acb537827
Currently we document the semantics of these two symbols. I would like
to add some documentation about why this granularity is necessary. The
majority of the details are contained in b/191371676
Test: N/A (documentation change)
Bug: 265485106
Change-Id: I752c921eabceff94f92f24a46c9a16dc28a2af19
* Remove `Bp2buildCcLibraryStaticOnlyList` it is never set
* Remove the rest of the sutff related to it
* Streamline MixedBuildsEnabled
* Rename BazelContext.BazelAllowlisted to BazelContext.NameFilter
to reflect its action
* Rename bazelContext to mixedBuildBazelContext
* Fix minor warnings from Go static analyzer
Test: treehugger
Change-Id: Ie245c992f94bbfd5c7c23dd06917026200a28263
When a cc library has stubs, its static variant shouldn't be included in an apex to ensure the library with stubs isn't statically linked. See https://cs.android.com/android/platform/superproject/+/master:build/soong/apex/apex.go;l=2804;drc=89b01aeaa9e19377ff547baab791277719b8aaf3
This CL modifies bp2build so that it excludes apex_available tag from the static target if the library has stubs. This way, we can ensure that no apex can depend on the static target which results to static linking.
Test: go test
Bug: 255589949
Change-Id: Iedf248994b808436f2440570b094fd06d6284ae9
The developers can apply different configurations to vendor, product,
and platform libraries. In LSDUMP_PATHS_FILE, the vendor and product
variants are tagged with VENDOR and PRODUCT. Their ABI dumps will not be
generated in the directories under prebuilts/abi-dumps.
Test: make libutils.vendor libutils
Bug: 227282691
Change-Id: I747ceb174a070a67d592c5a47fcc848a6129661d
Because when stubs_symbol_file is defined on cc_library_shared, has_stubs is already implied to be true.
Bug: 260771171
Test: go test
Change-Id: I3b9a2cfb9000411d1b5f22da87dc339267775799
The fdo_profile targets are handcrafted in ag/20469925. Bp2build creates fdo_profile attribute on cc_library_shared and references to the fdo_profile target if the profile exists. This works under assumption that all afdo profiles have an associated Bazel fdo_profile target declared in the same folder/package.
As noted in b/253540178, this won't work when we check in the BUILD files (which is likely 6+ months away) because some profiles might only exist internally but not in AOSP. We will implement a long-term solution once we figure out all the requirements we need to support afdo both in Soong and Bazel.
Bug: 253540178
Test: go tests
Change-Id: Iebd5dd7a76583b4b2bf0d9ee56d58f247d313a54
Merged-In: Iebd5dd7a76583b4b2bf0d9ee56d58f247d313a54
The tags will then be read by an aspect applied from apex attributes to
validate that the deps are explicitly opt-in to the appropriate apex.
The semantics of this is the same as the Soong apex_available property.
This also adds the "base_apex_name" attr to override_apex conversion so
that apex_available checks continue to work on the non-Google and non-Go
apex names.
Test: presubmits
Fixes: 218841706
Change-Id: I19b3637da9aa47573b252d74f62b601fbdc3784d
The developers can specify ref_dump_dirs for shared libraries in
Android.bp. Each of the ref_dump_dirs generates a command to diff the
ABI with the reference dumps in the directory. The existing ABI diff for
VNDK, NDK, and Mainline are not changed.
Bug: 227282691
Test: make libutils
Change-Id: I62158393c8804200e96d538bc69c24147cb5caa5
ABI dumps in gzip are no longer supported because they cannot be
reviewed or merged.
Bug: 227282691
Test: make
Change-Id: I9fdf943fb8ae30aeae884d4d361a65034ab6fa94
- 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
When defining a stubs library, allow specifying that the
implementation library does not need to be installed. This allows for
cases where the implementation is deployed in some non-standard way -
e.g. inside a Microdroid virtual machine.
Without this, we get build errors like: "TARGET module
com.android.compos requires non-existent TARGET module: libvm_payload".
Default behavior is unchanged. The change is protected by an allowlist
to limit usage to the immediate use case.
Bug: 243512108
Test: builds; soong tests pass
Test: Remove allowlist, see build failure
Change-Id: Iaae75f2e93b842f5944a7518cc95069d62c5a638
The condition for vendor libraries is inconsistent between
getRefAbiDumpFile and linkSAbiDumpFiles. It causes the ABI check not to
be triggered for vendor libraries. This commit fixes linkSAbiDumpFiles.
The vendor libraries' ABI dumps are placed in the "platform" directory
for now. A follow-up commit will allow configuring the dump directory
paths.
Test: make
Bug: 227282691
Change-Id: Iad8f92145bce6264bf51efb4b8180bb917a1476d
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
Define CcApiLibrary Variants for LLNDK. Each variant will be defined as
below.
cc_api_variant {
name: "libc",
variant: "llndk",
arch: {
x86_64: {
src: "libs/x86_64/libc.so",
},
...
},
}
And CcApiLibrary will be marked to use this variant as below.
cc_api_library {
name: "libc",
...
variants: [
"llndk",
...
]
}
Soong will replace source of libc cc_api_library as src from
cc_api_variant during build time.
Bug: 244244438
Test: cf vendor build succeeded with LLNDK variants
Change-Id: I317ed1f558beb1f82f9f2d70811fa8f765bcad2b
Currently, it skips it for files in out/soong/. This was a valid
assumption since all intermediate artifacts in soong are placed under
out/soong, and soong modules cannot depend on make modules.
However, this might change in multitree, since the headers provided by
build orchestrator will be under out/api_surfaces (next CL in this stack). The good side effect
of this is that we do not retrigger a rebuild of soong/build.ninja if a
new API file (.h/.map.txt) is added to this directory (ctx.GlobWithDeps
adds the files to the deps of out/soong/build.ninja).
Test: TH
Change-Id: I3c3722390d04a50d793b1646df00cdf7acb12b49
The build uses unstripped binary/shared library to extract function
signatures, so for each each target of this kind Bazel should return
its unstripped version, too.
Fixes: 220164721
Test: treehugger
Change-Id: Id5f6143340519bf2ae98791a9e981d1306bb08d1
The module types in scope of this conversion are
1. cc_library and cc_library_shared (non-null llndk or stubs prop)
2. cc_library_headers (all)
For (2), we need some postprocessing on the results of the parser
bp2BuildParseBaseProps. This is necessary because arch and os specific
API exports need to be flattened and added to the generateed API headers
target along NoConfigAxis
e.g.
```
The api equivalent of
cc_library_headers (
name = "lifoo",
deps = select({
"//build/bazel/platforms/arch:arm": ["arm_deps"],
"//build/bazel/platforms/arch:arm64": ["arm64_deps"],
}),
)
should be
cc_api_library_headers (
name = "lifoo",
deps = ["arm_deps", "arm64_deps"],
)
```
For (1), we also need to generate 1:many header api targets so that
arch-specific deps can propagate arch metadata to the top-level
api_domain rule
Test: go test ./bp2build
Test: go test ./cc
Change-Id: Ie40cba1ac8e89f290b3d926c190d5e93abd52859
Currently, tagging a symbol with #apex is not required when the symbol
is in a non-NDK library. However, this is considered dangerous because
such a symbol will automatically be promoted to NDK APIs when the
library is promoted to an NDK library. When that happens, the native API
council won't be able to notice the promotion because promoting a
non-NDK library into an NDK library doesn't require an update of the
map.txt file, but Android.bp only.
To prevent that, we should mandate #apex (or #systemapi if the api is
provided by the system, not apex) tag for Mainline APIs regardless of
whether the library the API belongs to is an NDK library or not.
Bug: 184712170
Test: m
Change-Id: Iad589b606bc6ed06ef1237f4c9f0c22518b0db75
Overrides properties will now be captured in json flag files, which will
be copied to installed vendor snapshot modules.
Bug: 216567575
Test: soong test && manual install
Change-Id: Ife5e84b126e798fba7802b9cff000c9197756cb9
Context
- Android-<target>.mk currently does not contain information about partition for its dependent unembedded jni libraries, but only lists the name of the unembedded jni libraries.
- If an android_app module depends on an unembedded jni library that is located in a different partition, make cannot find the library.
Implementation
- Create a string field partition in jniLib struct.
- Add variable "LOCAL_SOONG_JNI_LIBS_PARTITION_<target>", an array of mappings of the name of the jni library to its partition.
Bug: 154162945
Test: m
Change-Id: I6b8e1272ff59dc70e3dd6ce8c6c8e4686dad76df
In Soong, aidl cc binding code is built with all the libs defined in the cc modules. In Bazel, because cc_aidl_library creates a cc_library_static target with the generated .h and .cpp files, it needs to depend on the libs from the parent cc modules in order to build successfully.
We can also consider including static libs but that requires a larger change to cc_aidl_library macro (e.g. renaming deps to aidl_libraries and preserving deps for static libs to be consistent with cc lirary macros).
This CL only adds shared libs (e.g. (implementation_)dynamic_deps) and ignore static libs for now since they're not needed for the modules currently allowlisted.
This fix is similar to https://android-review.googlesource.com/c/platform/build/soong/+/2219103/4/android/proto.go#207 for proto.
We can follow-up with adding static libs to cc_aidl_library later if needed.
Bug: 247151591
Test: presubmit is able to build allowlisted modules successfully
Change-Id: I40f14297f8c8f4c2a36b1e972d009824398b59cd
* changes:
Move function PathForVndkRefAbiDump to Prevent unnecessary exports in paths.go
Change the type of parameter prevVersion to int in sourceAbiDump
Support this in cc_{binary,library{,_shared}}
Bug: 204811222
Test: Suffix additions to cc_{binary,library{,_shared}}_conversion_test.go
Test: mixed_{libc,droid}.sh also builds newly allowlisted
Change-Id: I596694794b01b04c542cbcd7d54baeb7d914ba50
This CL moves function PathForVndkRefAbiDump from android/paths.go to
cc/library.go to prevent unnecessary exports.
Test: make libz
Bug: 239915696
Change-Id: I1270e8d07edb09d93621c049acab9196757d356b
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
Bug: 231322789
Test: with this CL on internal master,
1) b build --verbose_failures //vendor/google/modules/AdbdGoogle:com.google.android.adbd --config=android_x86_64
2) adb install bazel-bin/vendor/google/modules/AdbdGoogle/com.google.android.adbd.apex, and adbd is activated successfully on cuttlefish device.
3) m mts && mts-tradefed run mts-adbd, and there is no failure with cuttlefish device
4) packages/modules/adb/test_device.py, and there is no failure with cuttlefish device.
Change-Id: I81b6f5336cacf35c68957ae2dac65f985b6eafb9
This refactoring prepares for introduction of bazel prod mode, an
alternative mechanism for mixed builds allowlist handling.
* Decide bazel-mode as close to soong_build main as possible
* BazelContext itself decides whether a module is allowlisted
* Separate bp2build and mixed build allowlist
Test: m nothing, manually verified all modules are mixed build disabled
(via metrics)
Test: USE_BAZEL_ANALYSIS=1 m nothing, manually verified that mixed build
disabled/enabled modules are identical before and after change.
Change-Id: I0f55d8b85000cb4a871a099edc6d7d868d7df509
Bug: 213201180
Test: Updated the minimal apex in the build/bazel cl to include runtime_libs so the apex diff test will test it
Change-Id: I10add1895cfa122a370d24196a33ec2dcfafccfc
A new module libcrypto_for_testing was added that uses the
inject_bssl_hash property, but this property is currently only available
for the libcrypto module specifically.
Test: CI
Change-Id: I1b83de02a2990b7503980bf6a85611683427baf9
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
In the newly proposed Cross-Verison ABI Check, the path of dump that
LLNDK, NDK and mainline reference to is changed to:
Before finalization: current/
After finalization: {PLATFORM_SDK_VERSION}/
In addition, a related CL(aosp/2147882) modifies the script to create
dump to folders that match the current finalization stage.
Test: make libbinder_ndk
Bug: 238387082
Change-Id: I92a4a52c26c85cf4c866b441e54291c6a624fbf4
Previously, the symbol tag `# apex` was treated the same as `#
systemapi`. With this CL, they have different meanings.
`# systemapi`: APIs that are defined in the platform (the non-updatable
part), and are exposed to unbundled system components like APEX
`# apex`: APIs that are defined in the APEX and are exposed to the
platform or other APEXes
Bug: 239274367
Test: m
Change-Id: I0484ea349656dbbd337e5fe3a5970f0ad275b807
Since vndk libraries don't need to maintain Cross-Version abi
compatibility. The newly proposed Cross-Version ABi checking mechanism
is applied to only ndk/ and platform/. The reference dumps of LLNDK
libraries should get from platform/ to be benefited from this checking
mechanism.
Test: mkdir -p prebuilts/abi-dumps/platform/UpsideDownCake/64/x86_64/source-based/ && cp prebuilts/abi-dumps/vndk/32/64/x86_64/source-based/libvndksupport.so.lsdump "$_"
make libvndksupport -j
Bug: 238383845
Change-Id: I663511d60623cd23619166d8d63fd26220a930e2
man ld:
> -single_module
> This is now the default so does not need to be specified.
Bug: 236924555
Test: m adb
Change-Id: If33a5c955deca4548c57703b232a3b9c0eaa3563
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)
This is a far better approach for ensuring that bazel handlers implement
the BazelHandler interface, as it causes a compile error if they do not
implement the appropriate interface methods.
Test: Manually verified no change in ninja file
Change-Id: I63a4f8b57e3aedd4c0915c2fd2eb7029e9a993aa
This large refactoring has both immense performance implications and
improves mixed builds complexity / usability. Summary:
1. Queueing calls to Bazel is done in a new mutator instead of a full
soong_build pass. Normal soong_build flow is interrupted (via a
functional hook in blueprint) to invoke bazel and parse its response.
2. Implementing mixed build support for additional modules is as simple
as implementing MixedBuildsBuildable. In this interface, define the
request that must be queued to Bazel, and then subsequently define
how to handle the returned bazel cquery metadata.
3. Mixed builds consists of only a single pass. This greatly
improves mixed build performance.
Result:
A 33% runtime improvement on soong analysis phase with mixed builds.
Caveats:
C++ BazelHandler handling still remains a bit of a mess; I did what
I could within this CL's scope, but this may require additional cleanup.
Test: Treehugger
Test: Verified that aosp_arm ninja file is bit-for-bit identical with or
without this change.
Change-Id: I412d9c94d429105f4ebfafc84100d546069e6621
Flag removed upstream, all platforms now use SHA-256
for libcrypto integrity hash.
Test: m && flashall
Change-Id: I453edebb80ec2a853d54ce5c3f055b6456010524
It is unused and removing it allows us to use the same function for
prebuilt/not libraries.
Test: bp2build.sh
Change-Id: I92ac56496cff2c2e55d6eb9f261fe75a1b232856
This mutator simply set a mutated property immediately before a separate
mutator used the value in the property. Instead of a separate mutator,
condense the two into a single mutator pass.
Test: CI
Change-Id: I26c392cdb96f6182a19fbcf0cf3f88a8fc72f81c
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
whole_static_libs on static library usually uses the .o files from
the dependency, but on a prebuilt static library has to use the .a file.
whole_static_libs on a static library that itself has whole_static_libs
on a prebuilt static library also needs to use the .a file transitively.
Test: TestWholeStaticLibPrebuilts
Change-Id: I9d4aabf72be0941b461a72e610f2b28287251cb2
Bug: 215541108
Test: Build libcrypto with Bazel and verify the hash injected, add unit
test
Change-Id: I0375307aab0b1e60a8be298d680e1e0af1ebb454
Change-Id: I9133ce398e2024fe7834a292bf2f5ba3222d630b
Currently error messages appear like:
&fs.PathError{Op:"open", Path:"..." Err:0x18}
which make them difficult to parse.
Test: CI
Change-Id: I18da18abc43230d0ea37d166179d07e585077f51
This CL turns the stubs.symbol_file and stubs.versions properties into
stubs_symbol_file and stubs_version attributes on the cc_shared_library
target. See associated build/bazel change on how these attributes are
used to generate stub libraries.
Bug: 207812332
Test: New tests
Test: CI
Change-Id: Ie23eafb9903a131d92ff4e251215e998cea0a763
* make tidy-soong_subset, or make tidy-<any_directory>,
should trigger the same clang-tidy compilations
with or without global WITH_TIDY=1.
* Normal make should not trigger clang-tidy compilations
unless global WITH_TIDY=1 or a module has set tidy:true.
Bug: 213918926
Test: NINJA_ARGS="-n" make tidy-soong_subset
Test: NINJA_ARGS="-n" make <some-library>
Change-Id: Iafffd3894abe137c9584c2c01830898422f9a677
Also fix some bugs pertaining to configurable attribute handling of bool
attributes and label sttributes, so that they may support values across
multiple different axes at the same time.
Test: unit tests for bp2build
Test: mixed_droid
Change-Id: I411efcfddf02d55dbc0775962068a11348a8bb2c
java_library_host, java_binary_host and cc_library_host_shared so
signapk tool can be built with Bazel.
Test: b build //build/bazel/examples/apex/minimal:build.bazel.examples.apex.minimal
Test: jarsigner -verify -verbose build.bazel.examples.apex.minimal.apex
Bug: 209876137
Bug: 196204358
Bug: 210158864
Bug: 210159074
Bug: 210158872
Change-Id: I855884159d25e69d8f9623792c376da820a1eb4c
Each conversion required defining a separate mutator, which will each
operate on _all_ modules and requires each to repeat checks whether the
mutator should operator. Instead, we introduce a single mutator and
modules can define a ConvertWithBp2build to implement bp2build
conversion for that module.
Test: bp2build.sh
Bug: 183079158
Change-Id: I99d4b51f441c2903879092c5b56313d606d4338d
For generated headers, Soong introduces the package to the includes (and
re-exports as necessary).
Test: bp2build.sh
Change-Id: Iea9cda859ddaa3e5393f0f4533c15fc60222c408
Test: Resolves build error for BP2BUILD_VERBOSE=1 b build //packages/modules/adb:libadbd_core
Test: Added unit test
Bug: 208481704
Change-Id: I4022c686c7baf050de3f97295fe4654515622a66
This is configured from Make by setting up Darwin+Arm64 as a HOST_CROSS
target (which is largely true, as binaries can't be executed on X86_64
machines). On the Soong side, it's a bit blurier, as we don't current
have any other users that are the same OS but not natively executable
(Linux/musl is executable, Windows/x86 is a different OS).
Instead of requiring cc_binary/etc to become multi-architecture-aware
and using something like common_first/MultiTarget, this defaults all
non-multi-architecture-aware modules to be built with both
architectures. It then adds a dependency with the
DarwinUniversalVariantTag so that supporting modules can get the outputs
of the other variant.
Cc uses that dependency tag to run lipo on shared libraries and binaries
so that the output of the x86_64 variant is actually a fat binary
including both architectures.
Bug: 203607969
Test: build sdk-repo targets on a Mac
Change-Id: Icbddb0a177c0ba19d3e0d11f8cf568e0d1ea3245
* 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