Commit graph

1112 commits

Author SHA1 Message Date
Andrew Walbran
e38e2c0071 Merge "Revert^2 "Integrate Rust-specific System Properties into rules generation."" into main 2024-02-15 10:31:49 +00:00
Andrew Walbran
ac0c87311d Revert^2 "Integrate Rust-specific System Properties into rules generation."
This reverts commit be3ea4f149.

Reason for revert: Reland

Change-Id: Ic003c52a1477da9a6a70b82e4d4ae4a55edc584f
2024-02-14 10:25:55 +00:00
Ivan Lozano
c2d4959bb4 Merge "rust: Re-enable host address sanitizer." into main 2024-02-13 16:34:42 +00:00
Colin Cross
a82de712b3 Merge changes from topic "revert-2952265-revert-2925209-KVPWEBRQHT-BBCOVJBOVF" into main
* changes:
  Remove fdoProfileMutator
  Convert AFDO mutators to TransitionMutator
2024-02-12 19:31:00 +00:00
Ivan Lozano
357433ae73 rust: Re-enable host address sanitizer.
Our toolchain supports a flag "-Z external-clangrt=true" which prevents
rustc from emitting a missing dependency to librust-dev_rt. Instead, we
link in libclang_rt.

Bug: 304507701
Bug: 324826914
Test: SANITIZE_HOST=address m aconfig
Change-Id: I8020c550b7a922c80620f61c22e01848a4f4a349
2024-02-12 14:16:26 -05:00
Stephen Hines
f8ffb6d4c2 Allow clippy::unnecessary_fallible_conversions
This lint is part of Rust 1.75.0, but has a lot of problems with FFI
data types that change size between 32-bit and 64-bit targets. This
makes the lint check far less useful, so we are just globally
suppressing it for now.

Bug: http://b/321303117
Test: m
Change-Id: I39531c961a26f533451d73b025caca02e593a269
2024-02-09 15:36:35 -08:00
Colin Cross
d38feb0d4a Convert AFDO mutators to TransitionMutator
Convert afdoDepsMutator and afdoMutator to a TransitionMutator as a
step towards variants-on-demand.

This relands Ib05845455ccf43a07b3915a0d7b0a95896062f13 with a fix
to maintain the current behavior of not using AFDO variants for
dependencies of the linker static binary.

Bug: 319288033
Bug: 324141705
Test: afdo_test.go
Change-Id: I76e30021173fc5b7e9e1fa826039776eb3dc7b6e
2024-02-07 15:51:40 -08:00
Ke-Yu Lu
196d9493c4 Merge changes from topic "revert-2925209-KVPWEBRQHT" into main
* changes:
  Revert "Convert AFDO mutators to TransitionMutator"
  Revert "Remove fdoProfileMutator"
2024-02-06 05:46:07 +00:00
Ke-Yu Lu
0be9d6034e Revert "Convert AFDO mutators to TransitionMutator"
Revert submission 2925209

Reason for revert: b/323975183

Reverted changes: /q/submissionid:2925209

Change-Id: Ie907d23081817d601a1a2083347b5f683829a36c
2024-02-06 02:15:03 +00:00
Kiyoung Kim
e5b8b97322 Merge "Reapply "Rename LOCAL_USE_VNDK"" into main 2024-02-06 00:57:21 +00:00
Colin Cross
6c392749d5 Merge changes Ied8fd7b5,Ib0584545 into main
* changes:
  Remove fdoProfileMutator
  Convert AFDO mutators to TransitionMutator
2024-02-05 23:03:49 +00:00
Rico Wind
444d6b68ae Merge "Revert "Integrate Rust-specific System Properties into rules generation."" into main 2024-02-05 14:41:56 +00:00
Rico Wind
be3ea4f149 Revert "Integrate Rust-specific System Properties into rules generation."
This reverts commit 65374edd0e.

Reason for revert: b/323833345

Change-Id: Ia722b68923617b4abfe3fd96b54b3fe108e9de74
2024-02-05 14:02:56 +00:00
Andrew Walbran
4b8e361b4c Merge "Integrate Rust-specific System Properties into rules generation." into main 2024-02-05 10:50:59 +00:00
Kiyoung Kim
84b6508604 Reapply "Rename LOCAL_USE_VNDK"
Similar with aosp/2897612, rename LOCAL_USE_VNDK into
LOCAL_IN_VENDOR or LOCAL_IN_PRODUCT to make variable useful from
VNDK deprecation.

Bug: 316829758
Test: AOSP CF build succeeded
Change-Id: If7bead24add014ed9e0e9e1d265b0199b911be89
2024-02-05 10:31:23 +09:00
Aditya Kumar
b2a56627a2 Merge "Revert^2 "Update clang version to clang-r510928"" into main 2024-02-03 12:54:13 +00:00
Aditya Kumar
ef7c121a6b Revert^2 "Update clang version to clang-r510928"
22686bab04

Change-Id: I1117546bb71548e1146c6ae43419b6aef772f812
2024-02-02 14:32:47 -08:00
Treehugger Robot
0e5f6e4e9f Merge "Revert "Rename LOCAL_USE_VNDK"" into main 2024-02-02 10:38:49 +00:00
Kiyoung Kim
ed63c02e9b Revert "Rename LOCAL_USE_VNDK"
Revert submission 2931430-local_use_vndk

Reason for revert: build fails with barbet targets

Reverted changes: /q/submissionid:2931430-local_use_vndk

Change-Id: Ic5b850e2905d1b93e8b4d08921106940991587b8
2024-02-02 08:06:52 +00:00
Treehugger Robot
838b29ebc7 Merge "Rename LOCAL_USE_VNDK" into main 2024-02-02 02:48:35 +00:00
Kalesh Singh
f4ffe0a026 soong: Add crt_pad_segment to .so's
crt_pad_segment adds a NOTE to the ELF which is used by the binoic
loader to determine whether it should pad segments when mapping them
into the virtual address space, such that there are no gaps between
mappings of consecutive segments. This avoids an increase in
unreclaimable kernel slab memory usage for VMAs on devices where the
runtime-page-size > elf-segment-p_align.

Since -fandroid-pad-segment [1] respects -nostdlib used in android
platform builds, soong must link in crt_pad_segment to platform shared
libraries.

For simplicity, link crt_pad_segment everywhere that crtend_so is
applicable, ignoring nocrt property, as there is no other reason
to track these separately.

Example:

❯ readelf -WS /system/lib64/libc++.so [Output simplified]

...
Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
...
  [ 2] .note.android.pad_segment NOTE            0000000000000288 000288 000018 00   A  0   0  4
...

[1] https://github.com/llvm/llvm-project/pull/77244

Bug: 316403210
Test: readelf -WS <lib>.so
Change-Id: Icc06611376cfd5ee4de7281b4134f9f8ffe7ca60
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2024-01-31 19:42:31 -08:00
Pirama Arumuga Nainar
22686bab04 Revert "Update clang version to clang-r510928"
Revert submission 2804373-clang_r510928

Bug: http://b/301328082

Reason for revert: Broke aosp-main/aosp_x86-next-userdebug

Reverted changes: /q/submissionid:2804373-clang_r510928

Change-Id: I6802b329e8dbd9dce5a75aab76c43960765a8594
2024-01-31 06:51:49 +00:00
AdityaK
0790ce2e56 Update clang version to clang-r510928
Bug: b/301328082
Test: N/A
Change-Id: Ied250c42c33d9e2d8bd9b9161b9028874540addb
2024-01-30 15:09:29 -08:00
Kiyoung Kim
1132b8cdaa Rename LOCAL_USE_VNDK
Similar with aosp/2897612, rename LOCAL_USE_VNDK into
LOCAL_IN_VENDOR or LOCAL_IN_PRODUCT to make variable useful from
VNDK deprecation.

Bug: 316829758
Test: AOSP CF build succeeded
Change-Id: I76741e45a2d80000adec6abfd8e9d6ee97c4ea23
2024-01-30 16:52:10 +09:00
Colin Cross
a6b407fbf5 Convert AFDO mutators to TransitionMutator
Convert afdoDepsMutator and afdoMutator to a TransitionMutator as a
step towards variants-on-demand.

Bug: 319288033
Test: afdo_test.go
Change-Id: Ib05845455ccf43a07b3915a0d7b0a95896062f13
2024-01-26 11:08:32 -08:00
Colin Cross
e28cdf362e Merge "Convert coverageMutator to a TransitionMutator" into main 2024-01-25 23:19:29 +00:00
Colin Cross
f5f4ad3db6 Convert coverageMutator to a TransitionMutator
Convert coverageMutator to a TransitionMutator as a step towards
variants-on-demand.

Bug: 319288033
Test: coverage_test.go
Test: treehugger coverage builds
Change-Id: Ic50c0040dea8b42c36b5d784221daa00b7b0d379
2024-01-24 10:17:10 -08:00
Satoshi Niwa
b6d818dbf0 Replace goldmont-without-xsaves build with goldmont-without-sha-xsaves
For chromebooks, we need a new build variant whose target arch is
goldmont, but without SHA and XSAVES support (b/314243939#comment21)

Bug: 314243939
Test: Build an image with TARGET_ARCH_VARIANT:=goldmont-without-sha-xsaves
Change-Id: If73660b515b443d5c138ca367fa3d1c6f18485b5
2024-01-24 16:27:56 +09:00
Chris Wailes
c0f587029a rustc-1.74.1 Build 11331546
Bug: https://issuetracker.google.com/issues/310977762
Test: m rust
Change-Id: Ia3a5bcd1c63e09d1fd4e399598d4ab25245b7af4
2024-01-19 01:40:19 -08:00
LaMont Jones
acae2d7656 move SetAconfigFileMkEntries to android
This will need to be called by some modules handled in android.

Bug: 308625757
Test: manual
Change-Id: Ic56e8ef3a453c59866aab6d39a21108cf8536b56
2024-01-10 14:03:29 +00:00
Kiyoung Kim
aa39480d21 Split usage of UseVndk
UseVndk is a function to check if the module can use VNDK libraries, but
this function was also used to check if the module is installed in the
treblelized partition (vendor or product). As of VNDK deprecation,
UseVndk funtion will return false even when the module is installed in
vendor / product partition, so we need a separated function to check
this. This change introduces a new function 'InVendorOrProduct' which
replaces UseVndk based on its usage.

Bug: 316829758
Test: m nothing --no-skip-soong-tests passed
Change-Id: Ic61fcd16c4554c355f6005894a4519b044b27fe5
2024-01-09 11:37:14 +09:00
Vladimír Marko
80abaa85e8 Merge "Add a new x86(_64) arch variant "goldmont-without-xsaves"" into main 2024-01-05 12:29:33 +00:00
Kiyoung Kim
6284e0a935 Merge "Generate image variation without version" into main 2024-01-05 04:57:26 +00:00
Kiyoung Kim
b5fdb2e966 Generate image variation without version
Current CC/Rust Image variations are generated with target VNDK version.
However, this is no longer valid if VNDK is deprecated. This change
generates image variation without version ("vendor", "product") if VNDK
is deprecated.

Bug: 316829758
Test: m nothing --no-skip-soong-tests passed
Test: aosp_cf_x86_64_phone build succeeded
Change-Id: I2387ed8a2632bfd9462621f882a947695ae1653d
2024-01-05 11:15:23 +09:00
Steven Moreland
62d10495eb Merge "fuzz packaging: implement system/vendor split" into main 2024-01-03 22:14:24 +00:00
Steven Moreland
d86fec5495 fuzz packaging: implement system/vendor split
This wasn't needed when fuzzers had their own
lib directories, but because the lib directories
were combined, this caused interactions because
system and vendor libraries were mixed in the
same folder, sometimes overriding each other.

Comments are left with some details about
future issues. Bug has a series of recommendations
to prevent issue again.

The main goal of this patch is to get the fuzzers
working, not fix every issue here.

Bug: 307611931
Test: run vendor fuzzer and check lsof:

    android.hardwar 22719       root  txt       REG             254,94   4350056       3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
    android.hardwar 22719       root  mem       REG             254,94   4350056       3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
    android.hardwar 22719       root  mem       REG             254,94   1047232       3464 /data/fuzz/x86_64/lib/vendor/libbase.so
    android.hardwar 22719       root  mem       REG             254,94   4027304       3460 /data/fuzz/x86_64/lib/vendor/libcrypto.so
    android.hardwar 22719       root  mem       REG             254,94   4021632       3467 /data/fuzz/x86_64/lib/vendor/libbinder.so
    android.hardwar 22719       root  mem       REG             254,94    329408       3466 /data/fuzz/x86_64/lib/vendor/libcutils.so
    android.hardwar 22719       root  mem       REG             254,94    508968       3463 /data/fuzz/x86_64/lib/vendor/libutils.so
    android.hardwar 22719       root  mem       REG             254,94    592944       3465 /data/fuzz/x86_64/lib/vendor/libclang_rt.ubsan_standalone-x86_64-android.so
    android.hardwar 22719       root  mem       REG             254,94   2328616       3462 /data/fuzz/x86_64/lib/vendor/libc++.so

and run a system fuzzer

    servicemanager_ 27878       root  txt       REG             254,94    609736      67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
    servicemanager_ 27878       root  mem       REG             254,94    609736      67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
    servicemanager_ 27878       root  mem       REG             254,94   4390560       4074 /data/fuzz/x86_64/lib/libvintf.so
    servicemanager_ 27878       root  mem       REG             254,94     13872       4077 /data/fuzz/x86_64/lib/libvndksupport.so
    servicemanager_ 27878       root  mem       REG             254,94     13872       4077 /data/fuzz/x86_64/lib/libvndksupport.so
    servicemanager_ 27878       root  mem       REG             254,94     13872       4077 /data/fuzz/x86_64/lib/libvndksupport.so
    servicemanager_ 27878       root  mem       REG             254,94     11584       4086 /data/fuzz/x86_64/lib/libdl.so

and run a system fuzzer

    servicemanager_ 27878       root  txt       REG             254,94    609736      67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
    servicemanager_ 27878       root  mem       REG             254,94    609736      67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
    servicemanager_ 27878       root  mem       REG             254,94   4390560       4074 /data/fuzz/x86_64/lib/libvintf.so
    servicemanager_ 27878       root  mem       REG             254,94     13872       4077 /data/fuzz/x86_64/lib/libvndksupport.so
    servicemanager_ 27878       root  mem       REG             254,94     13872       4077 /data/fuzz/x86_64/lib/libvndksupport.so
    servicemanager_ 27878       root  mem       REG             254,94     13872       4077 /data/fuzz/x86_64/lib/libvndksupport.so
    servicemanager_ 27878       root  mem       REG             254,94     11584       4086 /data/fuzz/x86_64/lib/libdl.so

Change-Id: I91a51d2f1cb537cfaae8379998078188f2b10a98
2023-12-28 03:04:20 +00:00
Ludovic Barman
78b2519e19 Remove unused use_protobuf3 flag
This is a No-op.
Protobuf3 is used regardless of this flag since https://android-review.git.corp.google.com/c/platform/build/soong/+/2817733

Test: m rust

Bug: 308790516
Change-Id: I1bfbca5d8a30e4e10f03e4e045d6c6ceddb30c87
2023-12-21 17:53:51 +00:00
Colin Cross
225ad7e8b2 Merge "Remove cc.moduleContext override of android.ModuleContext.*Specific" into main 2023-12-19 23:39:54 +00:00
LaMont Jones
aa005ae080 move CollectDependencyAconfigFiles to android
This needs to be called by some modules in android.

Bug: 308625757
Test: manual
Change-Id: I389fcfd88a3f4bd85a9218fdd4dd66d8a239bb67
2023-12-19 19:34:00 +00:00
Colin Cross
ea30d85a65 Remove cc.moduleContext override of android.ModuleContext.*Specific
Overriding android.ModuleContext's implementations of *Specific()
methods in cc.moduleContext and then passing that back to
android.PathForModuleInstall to affect the install path causes
problems if android.ModuleBase.GenerateBuildActions also tries
to call android.PathForModuleInstall directly with the
android.ModuleContext as it gets a different result.

Add InstallIn* methods to the android.Module interface, implement
default versions in android.ModuleBase, and override them in
cc.Module and rust.Module.  Use them in android.PathsForModuleInstall
to allow the module to customize the behavior directly.

Test: TestInstallPartition
Change-Id: I7840e07eae34ac4f4d3490b021143d5f33a83626
2023-12-18 15:07:05 -08:00
Colin Cross
51428c451a Merge changes I6f116385,Id77f514d,I73479de1,If58f4b53 into main
* changes:
  Convert ModuleProvder to generic providers API
  Convert OtherModuleProvider to generic providers API
  Convert Provider to generic providers API
  Convert SetProvider to generic providers API
2023-12-18 22:43:45 +00:00
Colin Cross
b2c65a26d6 Merge changes from topic "provider_generics" into main
* changes:
  Convert NewProvider/NewMutatorProvider to generic providers API
  Use generics for providers API
  Fix TestAarImportProducesJniPackages/aar-no-jni
2023-12-18 19:15:39 +00:00
Ludovic Barman
19739bf6a5 Rust protobuf 2->3: Update build system
tldr: remove protobuf2 from Android Rust and upgrade everything to pb3.

These commits update:
- The grpcio rust crate to use protobuf 3
- The build system to always use the new libprotobuf (pb3) instead of the _deprecated variant (for pb2); they also force-enable libprotobuf everywhere, ignoring the use_protobuf3 flag, removes the tests related to pb2
- The following modules, which required syntax changes:
-- packages/modules/Bluetooth
-- device/google/cuttlefish
-- vendor/auto

Bug: 308790516
Test: m rust
Ignore-AOSP-First: must be done in main to upgrade cuttlefish+vendor with the rest all at once
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:7d0783ce22b3d7d369786d4b16067c79c033185b)
Merged-In: I1d07c433aca41ccfe2e710821cf930c413dc12d6

Change-Id: I1d07c433aca41ccfe2e710821cf930c413dc12d6
2023-12-15 13:23:33 +00:00
Satoshi Niwa
c41f21121c Add a new x86(_64) arch variant "goldmont-without-xsaves"
Its target arch is goldmont, but without xsaves support.
This ensures efficient execution on a broad range of Intel/AMD CPUs used
in Chromebooks, including those lacking xsaves support.
(e.g. Kaby Lake, Gemini Lake, Alder Lake and AMD Zen series)

Bug: 314243939
Test: Build an image with TARGET_ARCH_VARIANT:=goldmont-without-xsaves
Change-Id: I9963cc3356394815f068fc998a9708bdb30c8266
2023-12-15 14:25:55 +09:00
Colin Cross
313aa5475f Convert OtherModuleProvider to generic providers API
Convert all of the callers of OtherModuleProvider/OtherModuleHasProvider
to use the type-safe android.OtherModuleProvider API.

Bug: 316410648
Test: builds
Change-Id: Id77f514d68761a262d9ea830a601dbed804bbbe5
2023-12-14 16:12:22 -08:00
Colin Cross
ff694a8c88 Convert Provider to generic providers API
Convert all of the callers of Provider/HasProvider to use the type-safe
android.ModuleProvider API.

Bug: 316410648
Test: builds

Change-Id: I73479de1625fa2865b6c73444cd477e50d56dc5a
2023-12-14 16:12:21 -08:00
Colin Cross
bc7d76cca2 Convert NewProvider/NewMutatorProvider to generic providers API
Convert all of the callers to NewProvider and NewMutatorProvider
to use a generic type parameter instead of an example object.

Bug: 316410648
Test: builds
Change-Id: Ic9cdafc87336e26730d3fd596df05de0e7267542
2023-12-14 16:12:20 -08:00
Colin Cross
402130276c Convert SetProvider to generic providers API
Convert all of the callers of SetProvider to use the type-safe
android.SetProvider API.

Bug: 316410648
Test: builds
Change-Id: If58f4b5355264ddab2045bc3591a4eac19cd58fc
2023-12-14 16:12:20 -08:00
Yu Liu
6dc93f9a09 Properly package aconfig files for vendor partition
Bug: 311173471
Test: Unit tests
Change-Id: Ibb857b69c3f83326a9ff5732e11dd09887e4ba6e
2023-12-14 01:19:35 +00:00
Colin Cross
8ff105860d Remove ConvertWithBp2build implementations
Remove the ConvertWithBp2build implementations from all the module
types, along with the related code.

Bug: 315353489
Test: m blueprint_tests
Change-Id: I212672286686a318893bc7348ddd5a5ec51e77a7
2023-12-08 13:51:05 -08:00
LaMont Jones
0c97185450 rust: add aconfig_flag support
Bug: b/308625757
Test: manual
Change-Id: Ifd98cd0ad4e2525b08f5766e9332991c049162ea
2023-12-07 21:56:59 +00:00
Aditya Choudhary
26df39fe44 Add source file provider for genrule/srcs, python libraries and rust libraries.
Change-Id: I2d7d4684a10c15aeecc27b8db800ab27a807d2e2
2023-12-05 19:56:26 +00:00
Treehugger Robot
e0a5c5ae1d Merge "Define __ANDROID_VENDOR_API__" into main 2023-12-05 03:48:26 +00:00
Colin Cross
0d5dd390c6 Merge "Move test data installation to Soong" into main 2023-12-01 18:56:01 +00:00
Chris Wailes
6146cf4b98 Make building Rust targets faster in eng builds
This CL makes the following changes when building an eng variant to
speed up compilation, possibly at the expense of the performance of the
generated binary:
* Disables LTO
* Enables incremental compilation
* Sets codegen units to 256 to increase parallelism (default set when
  enabling incremental compilation)

These changes reduce the time taken to compile all of Android's Rust
code from 16m20s to 12m10s.

Test: lunch aosp_oriole-eng && m clean && m rust
Bug: https://b.corp.google.com/issues/289094772
Change-Id: I97f1675c67ded69120b0c0e0fb5608aa9314a866
2023-12-01 10:34:01 -08:00
Matthew Maurer
15675d5936 rust: Enable ELF TLS by default in platform Rust
Upstream currently uses pthread keys to emulate TLS on Android because
it historically did not have it, and is going to move to LLVM emulated
TLS, which is needed to target L. Since we know the platform is Q+, we
can just use the new features.

Test: Treehugger
Change-Id: I7c7747d89cba736377cfeb4080573a89b801e8fe
2023-11-30 23:12:55 +00:00
Colin Cross
5c1d5fb21b Move test data installation to Soong
To generate module-info.json in Soong for b/309006256 Soong needs to
know the test data paths. Moving test data installation into Soong will
also help later for test suite packaging.

Add ModuleContext.InstallTestData that installs the files listed in a
[]DataPath alongside the test.  The files will also be passed to Make
to allow it to continue packaging them into the test suites for now.

Update the module types that are producing LOCAL_TEST_DATA entries
in their Android.mk files to go through InstallTestData instead.

Bug: 311428265
Test: atest --host toybox-gtests --test-timeout=120000
Change-Id: Ia8b964f86e584ea464667fd86a48d754d118bead
2023-11-30 13:38:49 -08:00
Justin Yun
41cbb5e9b5 Define __ANDROID_VENDOR_API__
cc modules can use __ANDROID_VENDOR_API__ to read BOARD_API_LEVEL
that is the API level of the vendor surface.

Bug: 313822931
Test: check ninja commands to have -D__ANDROID_VENDOR_API__=<version>
Change-Id: Iceb5918cbfce0f24929d02d7e3caf1e9942b88e8
2023-11-30 05:26:12 +00:00
Charisee
67b2923cd0 rustc-1.73.0 Build 11110309
bug: http://b/303252546
Test: m rust
Change-Id: Ic8f99af411665b7eaef81d9ca15342e1ea396fc3
2023-11-27 22:30:13 +00:00
Treehugger Robot
359611c1df Merge "rust: rust-project.json: Skip disabled modules" into main 2023-11-27 21:12:11 +00:00
Matthew Maurer
5a3c71c1aa rust: rust-project.json: Skip disabled modules
Disabled modules may not have a valid root path.

Bug: 313410568
Test: SOONG_GEN_RUST_PROJECT=1 m nothing
Change-Id: I253cca18493193245aa198adfce5fd75cf27cefb
2023-11-27 17:54:03 +00:00
Matthew Maurer
b103659c0b Merge changes I0caddbf6,Iee20b060,I6c92580b,I45028945,Ia7dd5220, ... into main
* changes:
  rust: Resolve crate roots outside rust-project
  rust: Cache crateRootPath to avoid ctx
  rust: internalize srcPathFromModuleSrcs
  rust: move crateRootPath to compiler
  rust: Privatize Cargo* methods on compiler
  rust: Move compiler interface to compiler.go
2023-11-22 20:37:27 +00:00
Matthew Maurer
db72f7ed80 rust: Resolve crate roots outside rust-project
Previously, we manually re-computed crate roots inside project_json for
rendering rust-project.json. In addition to added complexity, this meant
that generated sources and glob sources would not render correctly - it
would select e.g. `src/**.rs` or `:foo` as a crate root.

Use a centralized computation of crate roots instead.

Bug: 309943184
Test: SOONG_GEN_RUST_PROJECT=1 m nothing, compare rust-project.json
Change-Id: I0caddbf600d025a0041f45e69812cdd6f1761234
2023-11-22 00:52:34 +00:00
Matthew Maurer
a28404a7b0 rust: Cache crateRootPath to avoid ctx
This makes it possible to call crateRootPath in situations where a
ModuleContext is unavailable.

Test: m nothing
Bug: 309943184
Change-Id: Iee20b0606954a18ca516cdac40917d0016f94a05
2023-11-22 00:52:14 +00:00
Matthew Maurer
1d8e20d744 rust: internalize srcPathFromModuleSrcs
This was frequently misused (for example, in the prebuilts module, it
was used as a complex "assert(len(srcs))==1"), and can be superceded by
getCrateRoot anywhere it was used. It's now only called from
compiler.go, and can drop the second return parameter, as it was only
actually used by the prebuilt assert misuse.

Bug: 309943184
Test: m nothing
Change-Id: I6c92580bc8f0ecb7586c544056b5409e6dd280e7
2023-11-22 00:52:10 +00:00
Aditya Choudhary
87b2ab28a8 Add test spec provider to test modules.
Provider added for the following test modules in this change: art_cc_test, cc_benchmark, cc_fuzz, cc_test, cc_test_host, rust_test,and rust_test_host.

Bug: 296873595
Test: Manual test
Change-Id: I815680529bcbecacb3a2bdb8f3746053afdee48c
2023-11-20 21:52:56 +00:00
Matthew Maurer
d221d31534 rust: move crateRootPath to compiler
Test: m nothing
Bug: 309943184
Change-Id: I45028945357c394301d93ca7995a4f9adf281931
2023-11-20 21:02:40 +00:00
Matthew Maurer
cd41653b96 rust: Privatize Cargo* methods on compiler
These methods aren't used outside, and probably shouldn't be.

Bug: 309943184
Test: m nothing
Change-Id: Ia7dd5220ccd10c0136aa16f5e21149eaf7a03ea1
2023-11-20 20:25:27 +00:00
Matthew Maurer
689d6f63e4 rust: Move compiler interface to compiler.go
Refactor cleanup

Bug: 309943184
Test: m nothing
Change-Id: I7dcb0af64a4db71fdc46c0876b22e5015c02438e
2023-11-20 17:49:25 +00:00
Colin Cross
7e2e794333 Fix soong for go test ./...
Fix various issues that prevent building or running tests with the
Go tools:

Remove testing/test_spec_proto/go.mod.  There's already a go.mod at
the top level, and adding testing/test_spec_proto/go.mod breaks
compiling with the Go tools in IntelliJ or from the command line.

Fix go vet issues when trying to print []DataPath.

Fix aconfig_conversion_test.go and add it to Android.bp so it runs
in presubmit.

Test: go test ./...
Change-Id: I18af2f05631446fe507744a2951e4b02c7ab59be
2023-11-17 21:28:39 +00:00
Ivan Lozano
c518202e28 rust: Allow no_stdlibs per-target variants.
stdlibs can be set per-target, it makes to sense to allow no_stdlibs to
be set per-target as well.

Bug: 310924208
Test: Android.bp with per-target no_stdlibs builds.
Change-Id: I1c3a458a849367d2c363bd5f65af77b8cce8c0e0
2023-11-14 10:40:08 -05: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
Treehugger Robot
9301b11e06 Merge "fix some moved code from revert of aosp/2518976" into main 2023-10-31 23:25:01 +00:00
Chris Wailes
d6c5839be2 rustc-1.72.1 Build 11023353
Bug: https://issuetracker.google.com/issues/307308192
Test: m rust
Change-Id: Iadcb2d74b5e90d3488bdf6e156345d358d6c4a82
2023-10-30 14:15:31 -07:00
Sam Delmerico
c5cf990797 fix some moved code from revert of aosp/2518976
aosp/2768553 reverted aosp/2518976, but there was some code that was
moved in between these two commits. This commit removes a code block
for some envvars that were moved in aosp/2638675, and adds back the code
for the ANDROID_RUST_DARWIN envvar.

Change-Id: I9ac09c608fe64340535ac493ab7f07ecb9b9c335
2023-10-25 17:29:46 +00:00
Eric Rahm
25acde2f56 Reapply "Use zstd to compress debug info in rust libraries"
This reverts commit 99d682ad4a.

Test: m
Bug: 305277519
Change-Id: I33c951265229d9f65670760c2255625ef3226707
2023-10-20 16:01:14 +00:00
Matías Hernández
a76ea9ac49 Merge changes from topic "revert-2788316-JFVDBRFDKA" into main
* changes:
  Revert "Decompress debug sections when creating debug info"
  Revert "Compress debug info in clang builds with zstd"
  Revert "Use zstd to compress debug info in cc libraries"
  Revert "Use zstd to compress debug info in rust libraries"
2023-10-20 15:48:28 +00:00
Matías Hernández
99d682ad4a Revert "Use zstd to compress debug info in rust libraries"
Revert submission 2788316

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.corp.google.com/builds/quarterdeck?branch=git_main&target=panther-next-userdebug&lkgb=10981485&lkbb=10981536&fkbb=10981536, bug b/306625613

Reverted changes: /q/submissionid:2788316

Change-Id: I78830209e04e5cd8872d75ec3a0faa46acd47ac6
BUG: 306625613
2023-10-20 13:07:14 +00:00
Eric Rahm
b60cd11bc7 Merge changes Ia85d8dc0,I4ab3d47f,Ieeaa6554,I0b3c1f08 into main
* changes:
  Use zstd to compress debug info in rust libraries
  Use zstd to compress debug info in cc libraries
  Compress debug info in clang builds with zstd
  Decompress debug sections when creating debug info
2023-10-20 10:32:13 +00:00
Eric Rahm
a806f9dc44 Use zstd to compress debug info in rust libraries
We can save a significant amount of disk space by compressing debug info
in rust builds. This adds a flag that configures compressing debug info
at the link stage for rust binaries.

Test: m
Bug: 305277519
Change-Id: Ia85d8dc0e7bea35d9f9abfeae27a4610b3113e78
2023-10-19 22:47:44 +00:00
Vinh Tran
7515994523 Add bp2build converter for rust_ffi_static
Test: go test
Change-Id: Ibf0bb2687073f8650da4ca27c1f57e68a93025d4
2023-10-19 11:22:51 -04:00
Vinh Tran
59aa97a594 Merge "Remove restriction on android config in generated rust_library targets" into main 2023-10-16 19:08:35 +00:00
Chris Wailes
ed75eef953 Merge "Set incremental or codegen-units, not both" into main 2023-10-13 21:19:17 +00:00
Vinh Tran
fb8c5a54ea Remove restriction on android config in generated rust_library targets
Bug: b/290790800
Test: b build //external/rust/crates/... --config=android
Change-Id: Id06dc94f8bff519c09de7a0de0f1999cf310f599
2023-10-13 11:51:18 -04:00
Vinh Tran
308096475b Export rust flags for arm, x86, and x86_64 to Bazel
Test: b build //build/bazel/examples/rust:all --config=android
Bug: 295918553
Change-Id: I53d393f4cc5cd99ccd17d37e32211adaaba5bd0a
2023-10-12 14:59:50 -04:00
Chris Wailes
7c1b29c9a4 Set incremental or codegen-units, not both
This CL changes the handling of Rust flags to only pass one of either
incremental or codegen-units.  This is necessary because incremental
implies a codegen-units value of 128 and it may be overridden by the
separate codegen-units argument.

Test: TH
Change-Id: Ia474e4f9fc071d5054cb479ec9de550fa886677e
2023-10-12 10:56:34 -07:00
Ivan Lozano
839b5f9ac5 rust: Temporarily disable ASAN builds for Host
This is breaking sanitized host builds. Disable the sanitizer in Rust
for host targets until this can be resolved.

Bug: 304507701
Test: SANITIZE_HOST=address m rust
Change-Id: I12b0c3e217717de7a89b32198f4c4729709e99b3
2023-10-11 13:18:37 -04:00
Ivan Lozano
829e1e9378 rust: Emit -x c++ for bindgen modules with cpp_std
rust_bindgen modules which defined cpp_std with a .h file were not
correctly emitting the `-x c++` flag. This CL addresses that, and
ensures that if either cpp_std or c_std is set then the appropriate
behavior occurs no matter the file extension.

Bug: 304269101
Test: Soong tests
Change-Id: I71a8ae30ac0ed502d9d3fbf2f3039b0c56529d39
2023-10-09 11:52:18 -04:00
Vinh Tran
8321763764 Export device arm64 rust flags to Bazel
Test: b build //build/bazel/examples/rust:all --config=android
Change-Id: I2656dc963cc4fe0c42da52a0d2a235b5cd86fa13
2023-10-04 18:26:13 -04:00
Vinh Tran
50de8becd1 Export rust flags to bazel
Bug: 290790800
Test: Inspect out/soong/soong_inspection folder after running `m bp2build`
Change-Id: Iffc43a540f67e5f07d109a0a87f3248fae035267
2023-10-04 13:14:32 -04:00
Colin Cross
ff4d5b40ca Merge "Don't pass -lrt or -lgcc_s to darwin rust compiles" into main 2023-10-04 16:36:03 +00:00
Justin Yun
ce12ea8f95 Merge "Generate product variants by default" into main 2023-10-04 06:29:31 +00:00
Colin Cross
e18bd2097b Don't pass -lrt or -lgcc_s to darwin rust compiles
Fix mac builds by removing the -lrt and -lgcc_s flags from darwin
rust compiles.

Bug: 293349612
Test: builds
Change-Id: I99a9fea963761730efc4d3236135ee6d83dbca57
2023-10-03 21:45:33 -07:00
Colin Cross
004bd3f526 Revert "Split Rust crate builds into compile and link phases."
This reverts commit e7c71c344d.
The intermediates created by the separated rust compile steps are very
large, on the order of 60GB.  This is more than CI can support for now,
revert the split into compile and link phases.  This comes at the expense
of incremental build time, especially when modifying C/C++ sources that
are dependencies of rust modules.

Bug: 293349612
Test: builds
Change-Id: I81169e7d0727330c8de5e7688dcdc87fe7b8d3b5
2023-10-02 22:15:55 -07:00
Sam Delmerico
1579a91352 Merge "add testcases for rust output file paths" into main 2023-09-29 08:35:28 +00:00
Sam Delmerico
079a97c778 add testcases for rust output file paths
Prepare for changing rust rules by testing that output file names will
match. A build failure in b/301463284 was partially caused by output paths changing and resulting in old files building up on buildbots which filled the disk. This unit test will ensure that the file paths of rust modules do not change and cause the same failure.

Bug: 301463284
Bug: 286077158
Change-Id: I1baba2c63ad29a2c98e378fce0a2ed32bc319c1e
2023-09-29 08:35:04 +00:00
Ivan Lozano
a0d741edef Merge "rust: Import protos from dependent rust_protobuf" into main 2023-09-28 15:58:48 +00:00
Ivan Lozano
d106efe76d rust: Import protos from dependent rust_protobuf
rust_protobuf were unable to import protos from other rust_protobuf
modules. This CL adds support for that. rust_protobuf modules which are
listed in rustlibs will have their modules imported into the generated
protobuf stub. Additionally, rust_protobuf modules which define
"exported_include_dirs" will export those include paths to dependent
rust_protobuf modules.

Bug: 301266700
Test: m rust
Change-Id: I132edffa4d77e0ac80a7ac934f873374c8e94c1b
2023-09-27 20:53:54 -04:00
Sam Delmerico
7a346cdaa0 Revert^2 "rustSetToolchainSource to use linux-x86 srcs"
7ba7e8232b

Change-Id: Ia10aede6a8b7422848146500506458ae495f7b9a
2023-09-27 20:45:48 +00:00
Sam Delmerico
ec59517f6a Merge changes from topic "reland-rust-sbox-1" into main
* changes:
  Revert^2 "conditionally escape rule builder command"
  Revert^4 "allow Ninja variables in RuleBuilder API"
  Revert^4 "add crate_root property to rust modules"
  Revert^4 "add rust_toolchain_rustc_prebuilt module type"
2023-09-27 08:10:26 +00:00