Commit graph

82041 commits

Author SHA1 Message Date
Yi Kong
aac481527e Merge "Revert^4 "Upgrade to clang-r522817"" into main 2024-05-16 18:07:51 +00:00
Aditya Kumar
4412723f63 Enable -Wfortify-source
This reverts commit 9b7e07c7aa.
Workaround for the post-submit failure in b/339523786 has been merged.

Fixes: 315245071
Change-Id: I517f13334ad169429daaa68bda7d5f600f653977
2024-05-16 17:00:53 +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
LaMont Jones
c77d6259cb Merge "sort release configs when creating artifacts" into main 2024-05-16 16:10:08 +00: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
Jiyong Park
cf68460114 Refactor how jni_libs dependencies are added
This CL brings three changes in how jni_libs are depended on.

1. SDK variants of the jni_libs are depended on only when they can be
   embedded. This is because SDK variants are not installable.
Previously, app could depend on SDK variants without embedding them, but
this didn't cause a problem because the installation of the jni libs was
done in Make. However, as it's done in Soong, we need to depend on a
correct variant.

2. Non-SDK variants of the jni_libs are now tagged with jniInstallTag.
   This automatically installs the libraries along with the app. The
installation of the jni libs is no longer done in app.

3. checking of the sdk version of the jni libs is done only when they
   are embedded. Doing the check even when the libs are not embedded
triggers a lot of false alarms. Note that with #1, many platform apps
have started depending on non-SDK variants.

Bug: 330276359
Test: m
Change-Id: I1bc9ceb8f79b102caeb23476c3fb03989e184a91
2024-05-16 23:31:55 +09:00
Jiyong Park
4384d294c3 Add make java.dependencyTag installable or not
java.dependencyTag now has a new field installable which contols whether
the dependency should be added as the install dep of the app or not.

This allows us to model all the dependency tags for Java using the same
struct.

Bug: N/A
Test: m
Change-Id: I9b1c7809a0bde3f15579aefd9bb34d828764b84b
2024-05-16 19:40:01 +09:00
Jiyong Park
5f0943f33f APK-in-APEX should set use_embedded_native_libs: true
So far, we automatically have embedded JNI libs for APKs in APEX, even
if use_embedded_native_libs was not set or set to false.

With this change, such APKs should explicitly set the property.

This is in preparation for an upcoming change for using different
dependency tags to JNI deps depending on whether they are embedded (thus
no install is needed), or not (thus installation to the partition is
needed).

shouldEmbedJni function now doesn't make use of the ApexInfoProvider
which is not available during deps mutator.

Bug: N/A
Test: m
Change-Id: I836171aacba19dbfa0e09f16a773ae498c56d60b
2024-05-16 19:40:00 +09:00
Jiyong Park
4f487c5b56 Install jni symlinks in Soong
The installation of the symlink
(<partition>/app/MyApp/lib/<arch>/libfoo.so) and its target
(/system/lib64/libfoo.so) are now done int Soong.

I gave up the idea of always embedding jni libs to apps, due to a
hard-to-fix regression in storage usage. Specifically, consider this
case.

app --(jni_lib)--> libfoo
    --(jni_lib)--> libbar

libfoo --(shared_lib)--> libbar

Ideally, with the embedding idea, both libfoo and libbar should be
embedded into the app and there should be no libfoo or libbar outside of
the apk, unless there's no dependency to any of them from outside of the
apk.

However, the previous implementation installed libbar to /system/lib64,
leading two copies of the lib; one in /system/lib64, the other in the
apk.

This was happening because libbar was also considered as a transitive
dep of libfoo, and therefore a dependency to its installation path is
added to the apk. The problem here is that the app doesn't know that
libfoo depends on libbar. We in theory can write a very delicate
dependency traverse routine which filters libbar out of the transitive
deps, but that looked too complicated.

Bug: 339923078
Bug: 330276359
Test: Build and watch any bloatbuster warning
Test: m aosp_cf_system_x86_64
The following three files are found
* system/lib64/libnfc_nci_jni.so
* system/etc/libnfc-nci.conf
* system/priv-app/NfcNci/lib/arm64/libnfc_nci_jni.so

Change-Id: I0930cb1ebb8ca8a6efd64b1ce2cdfd1c47fe19ef
2024-05-16 19:40:00 +09:00
Jiyong Park
3ea9b65990 filesystem modules gathers first target only
With this change, the deps property in filesystem modules gather the
first target of the filesystem module only.

To gather dependencies across both targets, use multilib.both.deps
instead.

Bug: N/A
Test: go test ./...
Change-Id: Ie2ff0c48f08c61c8b219fc2c1540476ff8e4b1fc
2024-05-16 18:23:20 +09:00
Kevin
93f7cd8528 Add support for prebuilt_overlay module type in soong
In Android 11 or higher, you can use OverlayConfig
to configure the mutability, default state, and priority
of overlays.

To configure an overlay, you need to create a config.xml
in partition/overlay/config/. Since there is no module type
in soong to install prebuilt artifacts on that location
(like prebuilt_etc for example) we need to manually create
and move that file using Make duing the build process.

This commit adds support to instead create that file
using soong. Then we can instead do something along the
lines of:

prebuilt_overlay {
    name: "test-overlay",
    src: ":generate-test-overlay",
    sub_dir: "config",
    filename: "config.xml",
    product_specific: true,
}

which would create a config.xml file at the overlay/
directory of the partion in which the overlay is configured,
product/ in this example.

Test: cd build/soong/etc ; go test -run \
      TestPrebuiltOverlayInstallDirPath

Bug: 340833016

Change-Id: Iaecae7784683fb9c4306a6834b3ee705c9c20806
2024-05-16 11:00:32 +02:00
Hsin-Yi Chen
d5919c1636 Add --release and --lib-variant to the instructions to update ABI dumps
The ABI dumps depend on the LLNDK API level and SDK version defined
in the release configurations. The error messages shows additional
parameters for the user to select the right version and variant.

Test: make libvulkan
Bug: 323447559
Change-Id: If12f3f74be49c3036516f42fb5d91979b610fafe
2024-05-16 15:32:06 +08:00
Justin Yun
162098358c Build aconfig storage files from soong filesystem
`gen_aconfig_flags_pb: true` additionally generates, aconfig storage
files in `etc/aconfig` directory. That includes, package.map,
flag.map and flag.val files.

Bug: 329187549
Test: m aosp_cf_system_x86_64
Change-Id: Ibbfde390cd84ca06bdd345ce0d0b4baa30a60773
2024-05-16 13:25:37 +09:00
Cole Faust
741f0e7115 Merge "Restrict visibility of EXTRA_INSTALL_ZIPS" into main 2024-05-16 00:36:16 +00:00
Spandan Das
3d0d31a8c6 Align boot jar exclusion with apex_contributions
During trunk stable development, it is possible that a new boot jar is
added to the source apex, but not available in prebuilt apex yet.
Thefore we need to conditionally check the `contents` of the respective
bootclasspath_fragment modules. https://r.android.com/2822393 did this
using isActiveModule. This function relies on soong config namespaces to
"hide" the source bootclasspath_fragment module when
<module>.source_build is false.

Soong config namespaces for mainline source vs prebuilt selection is no
longer in use, so this CL replaces `isActiveModule`. The CL cleaves the
implementation
1. For source builds, the check will run in the context of the
   bootclasspath_fragment module. `disableSourceApexVariant` will be
used to skip the check if prebuilts are selected.
2. For prebuilt builds, the prebuilt bootclasspath_fragment module sets
   a provider, and the top-level apex will do the check.

(2) is necessary to handle the edge case of multiple versioned mainline
prebuilts and possible skew in apex boot jars across them. In case of
prebuilt builds, the unselected mainline prebuilts will have
HideFromMake called on them, so the check will only run on the apex that
is actually used during the build.

Bug: 328578801
Test: go test ./apex

Change-Id: I6eec603397eea926f3a481b79ca938245064d809
Merged-In: I6eec603397eea926f3a481b79ca938245064d809
2024-05-16 00:35:28 +00:00
Treehugger Robot
c6541077de Merge "Filter-out deps of unsupported arch" into main 2024-05-16 00:33:24 +00:00
LaMont Jones
ce599ef878 sort release configs when creating artifacts
Bug: 328495189
Test: manual
Change-Id: I0b579c6fdbee5bb09826854dadb9f89955980ca8
2024-05-15 15:48:35 -07:00
Cole Faust
b23bae72c3 Restrict visibility of EXTRA_INSTALL_ZIPS
After aosp/3089654, Android.mk files will be able to read
EXTRA_INSTALL_ZIPS, which we don't want. Use the new
$(KATI_visibility_prefix) to restrict its usage.

Test: m nothing passes, adding $(warning $(EXTRA_INSTALL_ZIPS)) in build/make/core/main.mk produces an error
Change-Id: Ib3c0079efd534e580a176fc69f746852b66297af
2024-05-15 15:44:21 -07:00
Spandan Das
81fe4d1d74 Disable monolithic hiddenapi flags generation for non java devices.
platform-bootclasspath constructs the monotlithic hiddenapi flags by
looking at PRODUCT_BOOT_JARS which are not included in another
bootclasspath fragment. PRODUCT_BOOT_JARS is a product specific
property, and non java devices like minidroid have an empty value for
this. For such devices, the monolithic flag generation runs into an
error because there are no jars to run this on.

This CL disables the generation of monolithic specific hiddenapi flags
when there are no monolithic boot jars in the build.

Bug: 338363444
Test: lunch aosp_cf_x86_64_minidroid-trunk_staging-userdebug && mmma
frameworks/base

Change-Id: I093690786bcf85b2aa6f01d0c689fc2a35861b5c
2024-05-15 22:41:43 +00:00
Cole Faust
277e444cb3 Merge "Qualify prebuilt_etc apex module name by relative paths" into main 2024-05-15 21:21:04 +00:00
Colin Cross
98cea0e0d1 Reapply "Convert overrides to a TransitionMutator"
Replace the performOverrideMutator with a TransitionMutator.

This relands I358f260f1bcd894d7803036ce77ba666c0429355, which was
reverted due to a subtle behavior change when converting AliasVariation
into an IncomingTransition.  AliasVariation is temporary, losing its
effect after the next call to CreateVariations that doesn't also call
AliasVariation.  dexpreopt_bootjar.go was checking if a variant existed
after the apex mutator had run and obsoleted the alias created by the
perform_override mutator.  When the alias was replaced by
IncomingTransition it wasn't obsoleted and dexpreopt_bootjar.go found
extra dependencies.  The extra dependencies were picked up by the
core licensing code walking dependencies, and caused a significant
increase to the size of system/etc/NOTICE.xml.gz.

ag/27324277 removed flags that triggered the extra dependencies,
which prevents the system/etc/NOTICE.xml.gz increase for now.
b/340911730 tracks avoiding the unnecessary dependencies if the
flags are re-enabled.

Bug: 319288033
Flag: NONE
Test: all soong tests pass
Test: no change to build.ninja
Change-Id: I46171ba69f24482414a20d63a131941a162f025c
2024-05-15 12:01:23 -07:00
Joe Onorato
6e2d36dacb Merge "Move aninja and overrideflags from shell functions to real scripts" into main 2024-05-15 18:40:12 +00:00
Cole Faust
7c991b4e33 Qualify prebuilt_etc apex module name by relative paths
Currently, you can't have two prebuilt_etcs in one apex with the same
file name, because apexes emit make modules for all the files in the
apex, and the module name for the prebuilt_etc's make representation
is based on the base filename of the installed file. We can change it to
be qualified based on the full relative path of the outputfile so that
you don't hit the conflicts as much.

Fixes: 340207931
Test: Presubmits
Change-Id: I7836fd4661fcaafd91901eba7e0b89506946c3e2
2024-05-15 11:17:55 -07:00
Cole Faust
3ef813bdf2 Merge "Revert "Qualify prebuilt_etc apex module name by relative paths"" into main 2024-05-15 18:09:34 +00:00
Cole Faust
c005ba0fa2 Revert "Qualify prebuilt_etc apex module name by relative paths"
This reverts commit d94cccc523.

Reason for revert: Patchset 2 was wrong, doesn't actually fix the bug

Change-Id: Ie2d931ad3e2277ce1923284b13f50f62ac2f8917
2024-05-15 18:01:43 +00:00
Tomasz Wasilczyk
a910dce1a3 Merge "cc_cmake_snapshot: improve support for AIDL" into main 2024-05-15 17:43:14 +00:00
Cole Faust
e0943e95f4 Merge "Qualify prebuilt_etc apex module name by relative paths" into main 2024-05-15 17:08:56 +00:00
Treehugger Robot
0bcdc1f417 Merge "Don't panic when a map is included twice" into main 2024-05-15 00:20:01 +00:00
Treehugger Robot
ef71f7ad8c Merge "clean up RELEASE_ACONFIG_VALUE_SETS" into main 2024-05-14 23:54:01 +00:00
LaMont Jones
05d59c5905 Don't panic when a map is included twice
If a map was included twice, we had side effects when skipping the extra
inclusion.

Bug: 340659219
Test: manual, TH
Change-Id: I90c55a800ecad932f8f67cf6f9f60dba571f7c48
2024-05-14 15:59:45 -07:00
Joe Onorato
a67e6a7162 Move aninja and overrideflags from shell functions to real scripts
Trying to clean up cruft from envsetup.sh

Shell functions require re-sourcing envsetup.sh, and should be avoided
if possible.

Bug: 340648588
Test: try the scripts
Change-Id: I15ec39b0382d9dd60e290dae633e8730a8d18131
2024-05-14 15:13:27 -07:00
Cole Faust
d94cccc523 Qualify prebuilt_etc apex module name by relative paths
Currently, you can't have two prebuilt_etcs in one apex with the same
file name, because apexes emit make modules for all the files in the
apex, and the module name for the prebuilt_etc's make representation
is based on the base filename of the installed file. We can change it to
be qualified based on the full relative path of the outputfile so that
you don't hit the conflicts as much.

Bug: 340207931
Test: Presubmits
Change-Id: I6708d89c755c31c17cce112fb08a810e51926c76
2024-05-14 14:42:22 -07:00
Tomasz Wasilczyk
1e831bfa87 cc_cmake_snapshot: improve support for AIDL
- link correct libbinder for AIDL modules
- fix building AIDL interfaces with non-empty AidlRoot
- don't silently drop non-existent dependencies

Bug: 302718225
Test: aosp/3081709
      atest binder_sdk_docker_test_clang
Change-Id: I181ef5a994f728f8af19134a6697b065a9aee261
2024-05-14 13:45:34 -07:00
Treehugger Robot
e8cb9178ec Merge changes I5645ddb9,Ib3d50f15,Ib4c5815a,If3b63706 into main
* changes:
  Revert "Revert^2 "Always embed jni libs and store uncompressed""
  Revert "Revert "Revert "Collect transitve deps of jni libs only for bund...""
  Revert "Add SkipToTransitiveDepsTag interface for dependency tags"
  Revert "Install transitive deps of jni libs, but not the jni libs themselves"
2024-05-14 20:16:05 +00:00
Jiyong Park
d044bb40da Revert "Revert^2 "Always embed jni libs and store uncompressed""
This reverts commit 20df11ef2b.

Change-Id: I5645ddb9e0d2c0873916a9192aa3cfbc967fc2cc
2024-05-15 03:32:26 +09:00
Jiyong Park
75ce275025 Revert "Revert "Revert "Collect transitve deps of jni libs only for bund...""
This reverts commit ef5511ff77.

Change-Id: Ib3d50f156c48578743644e99722b70368dd1e26b
2024-05-15 03:32:25 +09:00
Jiyong Park
1d4907e027 Revert "Add SkipToTransitiveDepsTag interface for dependency tags"
This reverts commit 1fb7c35129.

Change-Id: Ib4c5815a06785cd876caa37acc0522adc26bc495
2024-05-15 03:32:23 +09:00
Jiyong Park
cd9dca20a0 Revert "Install transitive deps of jni libs, but not the jni libs themselves"
This reverts commit e716807083.

Change-Id: If3b63706114cb534af359fdac2d80d8a5d02ea6d
2024-05-15 03:32:22 +09:00
LaMont Jones
8e2a6b1fe9 clean up RELEASE_ACONFIG_VALUE_SETS
Only add a repository to the trace when it actually specifies
aconfig_value_sets.

Also default to only generating the release config .mk file for the
current TARGET_RELEASE (rather than all), to reduce kati reruns.

Bug: 340126861
Test: manual, TH
Change-Id: I671d4b5f57c9bdd252d98e048f16aa9c7b3b2ffa
2024-05-14 09:21:10 -07:00
Jiyong Park
c6a773df64 Filter-out deps of unsupported arch
When a common-arch module (ex: phony) has the "required" dependencies on
native modules (ex: cc_library), both 32 and 64-bit variants of the
native modules are added as dependencies. This by itself is fine and
actually is intended, otherwise there's no way for us to install both
arch variants via required deps.

However, this imposes a problem when the common-arch module is depended
on by a filesystem module with compile_multilib: "first". Here, the
expectation is that only the first variant (64-bit) of the native module
is instaled, but in reality both variants are installed.

To handle this situation, make sure that the packaging routine filters
out packaging specs from unsupported architecture.

Bug: N/A
Test: go test ./... under soong/filesyste

Change-Id: Ie1ad5ace2e5d88e00183a115f4a76e5df87a8166
2024-05-14 21:56:42 +09:00
Jiyong Park
635e1218bd Merge "Fix: required deps from native module to phony module is respected" into main 2024-05-14 05:04:27 +00:00
Rico Wind
c3e6594a0d Merge "Don't run resource shrinking for eng builds" into main 2024-05-14 04:04:17 +00:00
Justin Yun
74f3f30ae4 Soong filesystem may install aconfig_flags.pb
By setting aconfig_flags: true, soong filesystem module installs the
aconfig_flags.pb file to its etc directory.

We need to define aconfigFilePaths to ModuleBase to store the list of
aconfig file paths that is generated from the GenerateBuildActions().
The aconfigFilePaths are collected when build the filesystem module
to build the aconfig_flags.pb for the filesystem image.

Bug: 335363964
Test: compare the cache list with those generated from make.
Change-Id: Ia32b566bf43174e94b9e610b9503608c6b583899
2024-05-13 23:14:42 +00:00
Treehugger Robot
82d7cdc547 Merge "Add the primary file to EXTRA_INSTALL_ZIPS" into main 2024-05-13 22:56:45 +00:00
Colin Cross
783fa37807 Merge "Add $ORIGIN to rpath for cc_test modules" into main 2024-05-13 20:59:01 +00:00
Treehugger Robot
77583741b6 Merge "Fix a check for the ninja_log" into main 2024-05-13 20:20:04 +00:00
Cole Faust
6bb2832c15 Fix a check for the ninja_log
soong_build uses / as it's cwd, so we need to specify the top directory
when checkign for files.

Test: add a printf in the if statement; touch out/soong/Android.bp && m nothing; ensure printf doesn't fire
Change-Id: Iba9773765547b22a03dbca33aa6b8c75359cb5ff
2024-05-13 11:57:16 -07:00
Cole Faust
07c4537424 Add the primary file to EXTRA_INSTALL_ZIPS
Make needs to know the primary file, because the zip is only extracted
when the primary file is installed.

Bug: 337869220
Test: m out/target/product/emu64x/obj/PACKAGING/system_intermediates/file_list.txt and checking it for the extra NetworkStackGoogle apks, with a local NetworkStackGoogle android_app_set added into the tree
Change-Id: I5cb7243d214f4730e3f9efb6746793f3bf4b8214
2024-05-13 11:04:18 -07:00
Rico Wind
936754c599 Don't run resource shrinking for eng builds
Since we will not shrink the resources anyway this is a waste of time

Bug: 338429777
Test: m SystemUI
Change-Id: I388f045294131a304920756607792091627921bc
2024-05-13 12:32:33 +02:00
Jiyong Park
c4b1d55707 Fix: required deps from native module to phony module is respected
This change fixes a bug that required deps from native module to phony
module was ignored. It happened because addRequireDeps incorrectly
thought that both are native modules with different bitness (32->64),
which isn't.

Fix this by doing the bitness check only when both the current module
and the required module are native modules.

Bug: N/A
Test: go test ./... under build/soong/filesystem
Change-Id: I494ebc47e29001f174fa44d72809041f8ceffb0b
2024-05-13 16:47:30 +09:00