Commit Graph

1142 Commits

Author SHA1 Message Date
Yu Liu
8975548e9c Merge "Only add darwin specific rules/variables when building on mac." into main 2024-07-30 22:18:01 +00:00
Yu Liu
2c0327695c Only add darwin specific rules/variables when building on mac.
To support skipping ninja file writing during incremental build, we
add all the global rules/variable/pools from static sources because
when we restore from cache we don't have the build defs available to
build the globals. This means all the global rules and variables are
added blindly, so we need to exclude these darwin specific ones since
they will fail due to they depends on the tool that only exists on MAC.

Bug: 335718784
Test: local tests and CI
Change-Id: Ife835545f0f76ffaec77e48bdd89ab7384a1b995
2024-07-30 18:22:43 +00:00
Aleks Todorov
0384c97337 cc: Enable select syntax for cppflags
Bug: 325444956
Test: m
Test: m [custom build target with select in cppflags]
Change-Id: I7d27096526ce5b37afe447f900613a6fbb639986
2024-07-26 17:20:23 +01:00
Yabin Cui
aca752647e Update Bindgen clang to clang-r530567
Bug: 342023558
Test: presubmit
Change-Id: I9ff1ee32f99728a982f4982121f86e94d4d98f91
2024-07-22 13:45:46 -07:00
Colin Cross
ea1b3b78b8 Merge changes from topic "elide_empty_variants" into main
* changes:
  Convert sdk mutator to TransitionMutator
  Convert link mutator to TransitionMutator
  Convert version mutator to TransitionMutator
  Convert python_version mutator to TransitionMutator
  Convert rust_libraries and rust_stdlinkage mutators to TransitionMutators
2024-07-18 17:37:38 +00:00
Colin Cross
8a49a3dd76 Convert rust_libraries and rust_stdlinkage mutators to TransitionMutators
Replace rust.LibraryMutator and rust.LibstdMutator with
TransitionMutators.

Bug: 319288033
Flag: EXEMPT refactor
Test: all soong tests pass
Test: no change to build.ninja
Change-Id: Ia24a582119d39889279d7b93bac9259685153619
2024-07-17 15:50:36 -07:00
Nikita Putikhin
5f23bc98ed Switch rust test install base to /data/local/tmp for consistency with cc
Previously this code was not doing anything because the template used
for rust did not use the template string that gets replaced with the
folder coming from this code. So all tests were getting deployed into
/data/local/tmp regardless of being vendor tests.

The other change in the chain adds the template string, so this code
starts working and system and vendor tests start being deployed into
different folders.

We want to keep the system test folder as before to avoid potential
problems with tests (see b/350479879#comment9).

Bug: 347370677
Test: presubmit
Change-Id: I93d5a8db3470d1603e26f9cf5d12249f29141a19
2024-07-16 13:29:31 +02:00
Colin Cross
17f9dc5f76 Remove obsolete rust VariantIsStatic
Rust modules no longer have static variants after
I2925f67f6dc9329dae3dcccafb8560900ac8a6fc, remove the VariantIsStatic
field.

Bug: 254469782
Test: m
Test: m blueprint_tests
Change-Id: Ic63412a27c3a09dec43c4a9064a3e1f4181147db
2024-07-11 16:59:34 -07:00
Colin Cross
e1a8555581 Add IsAddingDependency to IncomingTransitionContext
Add an IsAddingDependency method to IncomingTransitionContext that
returns true if IncomingTransition is called after the transition
has already won while adding a new dependency.  This will be used
as part of the transition mutators to support an apex use case where
incoming dependencies during the initial apex mutator need to be
rewritten onto the platform variant for modules that don't support
the apex, but a later call to OtherModuleDependencyVariantExists
must not rewrite the requested apex variation onto the platform
variant.

This should be used sparingly, all uses will have to be removed in
order to support creating variants on demand.

Bug: 319288033
Test: TestIsAddingDependency
Flag: EXEMPT refactor
Change-Id: Ib8e419d35ff8f7cbff9667c1cd40d05ccfacab8b
2024-07-11 16:59:34 -07:00
Treehugger Robot
e7485b871a Merge "Pass the --cfg soong flag when building rustdoc" into main 2024-07-11 22:19:19 +00:00
Colin Cross
088123934b Merge "Remove test_per_src" into main 2024-07-11 20:32:23 +00:00
Chris Wailes
3d211a0567 Pass the --cfg soong flag when building rustdoc
This CL modifies Soong to pass the `--cfg soong` flag to the rustdoc
tool.

Test: m rustdoc
Bug: 303116432
Change-Id: I089edebe3c0450b9f9d4f97404bafb7e90ed1f8a
2024-07-11 11:33:11 -07:00
Ivan Lozano
b31d8e8067 Disable dsymutil usage on Darwin host
dsymutil is not available during builds. This is disabled by turning off
split-debuginfo.

Bug: 349612831
Bug: 351760165
Test: Pre/post submit
Change-Id: Idd6f00519e303fe02b35ec8c18682afa799f4df4
2024-07-08 14:56:44 +00:00
Colin Cross
3a02c7ba1a Remove test_per_src
Remove test_per_src, it never worked well and is incompatible
with all of the test infrastructure.  Uses in the platform have
been removed, generally by replacing them with individual cc_test
modules.

Test: builds
Flag: TEST_ONLY
Change-Id: I257c035da35ca8358ae9423b46453878f54efeb1
2024-06-28 10:31:05 -07:00
Ivan Lozano
fd47b1ab6a cc/rust: Alias ffi rlib variant for static_libs
Alias the rlib variant to "link: static". This allows declaring
rust_ffi_rlib modules in static_libs. This effectively removes any
distinction between rust_ffi_static and rust_ffi_rlib. Removing the
functionality for building Rust staticlib modules will be cleaned up in
a follow-on CL.

This should have the effect of changing the default linkage for all rust
modules in static_libs from linking individual staticlibs to building a
single staticlib that includes all rust_ffi rlib dependencies.

This removes the static_rlibs property, as we're now handling
the choice dynamically. This also makes rlibs only propagate through
cc_library_static modules if the rlib is included in
whole_static_lib. This both mirrors the expected behavior of
cc libraries and helps control which version of a crate ends up in the
final link (e.g. libdoh_ffi vs libdoh_ffi_for_test).

Bug: 254469782
Test: m
Test: m blueprint_tests
Change-Id: I2925f67f6dc9329dae3dcccafb8560900ac8a6fc
2024-06-26 01:35:41 +00:00
Wei Li
a1aa297518 Export Soong modules and build a database from metadata from Make and Soong.
Bug: 324465531
Test: CIs
Test: m compliance-metadata.db
Change-Id: Ia1c9ab0ae874dd47969555ddbfb93405b57a651f
2024-06-24 17:20:59 -07:00
Zi Wang
b651aaaf9e Merge "Add OutputFilesProvider support for singleton" into main 2024-06-24 22:13:42 +00:00
mrziwang
0cbd3b0e79 Add OutputFilesProvider support for singleton
This CL also changes to use OutputFilesProvider on rust module, which
has singleton involved.

Test: CI
Bug: 339477385
Bug: 348494466
Change-Id: Idc5c0fb9f8425f09184d5b73531ee3052e5a076c
2024-06-24 11:55:47 -07:00
Jihoon Kang
79b0eef5a1 Merge "Move vendor and product variant generation logic from cc package to android package" into main 2024-06-21 18:16:31 +00:00
Jihoon Kang
47e918450f Move vendor and product variant generation logic from cc package to android package
Although image variation generation logic has moved out of cc package to
the android package, the vendor and product partition variants
generation logic is still specific to cc package. Therefore, in order to
create a product or vendor variant, they have to specified in
`ExtraImageVariants`. In order to avoid such confusing behaviors and
enforce modules to specify product and vendor installation rules, this
change moves the vendor and product variant generation logic to
android.ImageInterface.

Test: m nothing --no-skip-soong-tests && diff contents of out/soong/Android-{product}.mk
Change-Id: I9e14f3739d9dea94167ee6a91e92b2f942055aba
2024-06-21 07:45:09 +00:00
Treehugger Robot
d3b519fc30 Merge "Update Bindgen Clang to clang-r522817" into main 2024-06-19 03:14:00 +00:00
Treehugger Robot
d3ba5a3f6e Merge "Cleanup ImageInterface.SetImageVariation" into main am: 77858402e4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3131759

Change-Id: I4504623d0978356eb7f3b526d01ffb99abd0da12
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-14 04:29:12 +00:00
Treehugger Robot
77858402e4 Merge "Cleanup ImageInterface.SetImageVariation" into main 2024-06-14 04:26:52 +00:00
Cole Faust
0f81d85278 Merge "Make the cflags property configurable" into main am: 1b0d92919d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3131289

Change-Id: I56760a2763d6d41d82696d0286085c95d09dfa8d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-14 03:08:08 +00:00
Jihoon Kang
7583e835f7 Cleanup ImageInterface.SetImageVariation
This change modifies the interface method of
ImageInterface.SetImageVariation so that the image variation is set
directly at the caller image variation module, instead of passing the
pointer to set the image variation.

Test: m nothing
Change-Id: I8eadb5149365530243e19a8cd37eb49d335fbeef
2024-06-13 21:56:23 +00:00
Cole Faust
e96c16a806 Make the cflags property configurable
So that you can use select statements on it. The current modivation
is to convert a module from make to bp with minimal soong config
variable boilerplate.

Bug: 342006386
Bug: 346922064
Test: m nothing --no-skip-soong-tests
Change-Id: I48d5a11ad3aa65c24cc199458634a5fdbeab2f64
2024-06-13 14:51:14 -07:00
Yi Kong
fb0fb891df Update Bindgen Clang to clang-r522817
Test: presubmit
Bug: 322868540
Change-Id: I98d614cc8b594d53a028780a1ab8160307179f37
2024-06-12 02:53:52 +09:00
Pirama Arumuga Nainar
812d8de86c Merge "Revert^2 "rustc-1.78.0 Build 11910258"" into main am: 44755fa745
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3122592

Change-Id: I2e327e174f5265c20217e77cb9a5e9a67e80f71f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-11 16:27:18 +00:00
Chris Wailes
c8a44e32cf Revert^2 "rustc-1.78.0 Build 11910258"
This reverts commit 8517b8cd87.

Reason for revert: Re-land the Rust 1.78.0 and Clang r522817 updates

Change-Id: Icd3f4554b0e27ed8543a7c1b0301d4dd8ed4a82b
2024-06-10 18:06:27 +00:00
Dmitrii Ishcheikin
8517b8cd87 Revert "rustc-1.78.0 Build 11910258"
Revert submission 3108411-rust-update-prebuilts-1.78.0

Reason for revert: b/345708905

Reverted changes: /q/submissionid:3108411-rust-update-prebuilts-1.78.0

Change-Id: I66b95447ddfcb3d35e5f4305a6d9feb2896fbdf7
2024-06-07 13:06:19 +00:00
Kiyoung Kim
9f26fcf88c Remove VNDK related code from Soong
As VNDK definition is fully removed from Android.bp, VNDK related code
can be removed from Soong. This change removes VNDK related code except
VNDK prebuilt which is required to build former versions of VNDK APEX
with prebuilts.

Bug: 330100430
Test: AOSP CF build succeeded
Ignore-AOSP-First: Resolve Conflict
Change-Id: Id9c8993343221c8464c97296bde0ff40b14b9b0b
2024-06-05 01:22:58 +00:00
Chris Wailes
adb4cb0ca1 rustc-1.78.0 Build 11910258
Bug: https://issuetracker.google.com/issues/333887339
Test: m rust
Change-Id: Ia90ba0d805e2319b3142a16d69914d9ee036810c
2024-05-31 00:10:03 -07:00
Kiyoung Kim
60cec95e01 Merge "Remove VndkUseCoreVariant related code from build" into main 2024-05-27 00:59:37 +00:00
Kiyoung Kim
22152f6cda Remove VndkUseCoreVariant related code from build
VndkUseCoreVariant feature is deprecated along with VNDK. This change
removes related code from Soong.

Bug: 330100430
Test: AOSP CF build succeeded
Change-Id: Ie182c9e4dc9cf0a4fe9d5fddf5b36754ddb53d18
2024-05-24 10:45:28 +09:00
Cole Faust
fdec8723d5 Convert some properties to Configurable properties
Focusing on the properties needed to remove soong config modules from
packages/modules/Virtualization.

- prebuilt_etc's src and srcs
- filegroup's srcs and exclude_srcs
- rust's cfgs

Bug: 342006386
Test: m nothing --no-skip-soong-tests
Change-Id: I6971da744a17955f98104948e6f9614776955782
2024-05-22 13:33:42 -07:00
Ivan Lozano
ab58647b2e rust: Add an option to disable LTO for Rust
This adds an option to disable LTO when building a Rust module. This is
mostly intended to speedu p local prototyping, and LTO should not
normally be disabled for production builds.

Bug: 339628497
Test: m blueprint_tests && m rust
Change-Id: I21d5d4513a259a56f101ce8906e2bef7404e4efb
2024-05-17 10:11:57 -04: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
28ed8f4f83 rust: refactored transformSrctoCrate
Refactor transformSrctoCrate and the functions it calls to not rely
on rust.ModuleContext, preparing it to be callable from soong-cc
context to build a Rust staticlib.

This also refactors out common default flags used when building
libraries, again to prepare for building a Rust staticlib from
a soong-cc context.

Bug: 254469782
Test: m blueprint_tests && m
Change-Id: I678f6fee989c61bb15c340b9887e4d1934991907
2024-05-16 10:32:08 -04:00
Justin Yun
40182b6ff3 Remove duplicated CollectDependencyAconfigFiles()
android.ModuleBase already calls aconfigUpdateAndroidBuildActions()
that is the same with CollectDependencyAconfigFiles(). Remove the
CollectDependencyAconfigFiles() to avoid duplication with
aconfigUpdateAndroidBuildActions().

To make the aconfig information available in
GenerateAndroidBuildActions() of all modules, call
aconfigUpdateAndroidBuildActions() before calling
GenerateAndroidBuildActions() of each module.

Also, we don't need SetAconfigFileMkEntries(), which is a duplicate
of aconfigUpdateAndroidMkData()

Bug: 335363964
Test: diff `adb shell printflags` before and after the change.
Change-Id: I52808e442e9fed7db1eae7b7c5ed0b1c5ba74f5d
2024-05-10 10:00:14 +09:00
Cole Faust
3f01580c04 Merge "Make the enabled property configurable" into main 2024-05-07 17:49:10 +00:00
Charisee
cd3ac91bdc rustc-1.77.1.p1 Build 11801116
Bug: http://b/331848727
Test: m rust
Change-Id: I68cb748f0de97cc92dbfbfff79d641a64dd51d8e
2024-05-06 21:30:12 +00: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
Cole Faust
a963b94cde Make the enabled property configurable
This allows using select statements with it.

Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: I6f3efaaa3d82505e38a91ee4ba0e18e404360191
Merged-In: If355d24506e3f117d27b21442a6c02bca3402dc7
2024-05-02 15:41:24 -07:00
Ivan Lozano
ec6dc938c9 Merge "rust: Add a default cfg indicating an AOSP build" into main 2024-05-01 17:53:47 +00:00
Ivan Lozano
07fd7e32fd rust: Add a default cfg indicating an AOSP build
This adds a cfg flag `android_platform` which can be used
to indicate there's some conditional compilation need specific to
AOSP.

Test: New flag is emitted on builds
Change-Id: I833a7d68db2dad7ab2d32a5eb51d764f0d66b849
2024-05-01 10:41:35 -04:00
Matthew Maurer
c1e0cb695b rust: Don't suppress adding deps for rust-project.json device override
When switching from an initially found host module to a later found
device module, we passed `cInfo.Deps` through. This actually suppresses
addition of some modules, which was not the intention.

Bug: 336695421
Test: SOONG_GEN_RUST_PROJECT=1 m blueprint_tests
Test: check rust-projects.json manually afterwards for deps
Change-Id: Ib90f9c755e07f88e85a3b3cbd9bc698cce8af038
2024-04-30 23:26:29 +00:00
Yu Liu
24cd8c3756 Merge "Only link the profile extras lib for device variant for rust." into main 2024-04-25 22:45:57 +00:00
Treehugger Robot
c66702491f Merge "Shard rust protobuf sources" into main 2024-04-24 23:02:54 +00:00
Colin Cross
f526863a40 Shard rust protobuf sources
Shorten the command line for generating rust protobuf sources
by sharding the sources into groups of 50 source files.

Bug: 322564768
Bug: 336323108
Test: builds
Change-Id: Ia8069cdaf49f9a42d14a83139545ba61277418e0
2024-04-23 10:47:00 -07:00