Commit graph

3420 commits

Author SHA1 Message Date
Treehugger Robot
1065ed8fbd Merge "java_sdk_library: Use WriteFileRule for writing permissions.xml" into main 2024-04-11 20:55:30 +00:00
Jihoon Kang
033ffb9533 Merge "Collect aconfig_declarations of the dependent java_aconfig_library modules" into main 2024-04-11 17:37:58 +00:00
Paul Duffin
1816cde8ce java_sdk_library: Use WriteFileRule for writing permissions.xml
Use the `WriteFileRule` to write the permissions file for shared
libraries instead of generating a custom bash rule.

Test: TH
Change-Id: I904cf0742bfec46ed45ec7801bb9bd3dc3047185
2024-04-10 13:21:28 +01:00
Jiyong Park
39011ef40c Merge "APEX can depend on non-APEX module and vice versa" into main 2024-04-08 22:28:26 +00:00
Treehugger Robot
ed2adb879f Merge "Remove Device VNDK version usage from Soong" into main 2024-04-08 19:24:36 +00:00
Jiyong Park
fc095e6796 APEX can depend on non-APEX module and vice versa
Previously, an APEX module (also called apexBundle inside of Soong) had
only one "apex" variant which has the same name as the module. This
prevented an APEX from depending on another module which is outside of
the APEX (ex: another APEX). Similarily, a module outside of an APEX
(ex: a shared lib or a test) couldn't depend on an APEX.

This CL fixes the issue by creating the "" variant as the alias of the
"<apex_name>" variant, and also by setting the "" variant as the default
dependency variant.

Bug: 321626681
Test: m
Change-Id: Ie3e57a96530c25e966cfd551676d819c442bb0d5
2024-04-05 14:39:23 +09:00
Treehugger Robot
fe66e13714 Merge "Deprecate Snapshot build" into main 2024-04-05 04:59:43 +00:00
Treehugger Robot
133a6d9e6f Merge "Return the header jar of the implementation library in SdkHeaderJars()" into main 2024-04-05 03:23:34 +00:00
Kiyoung Kim
4e765b1bfc Remove Device VNDK version usage from Soong
As of VNDK deprecation, Device VNDK version should no longer be used
from build. This change removes all references on Device VNDK version
and related logic with it.

Bug: 330100430
Test: AOSP CF build succeeded
Change-Id: Ibc290f0b41e8321f80c75c69f810223989af68dc
2024-04-05 01:57:32 +00:00
Kiyoung Kim
37693d0a27 Deprecate Snapshot build
Existing snapshot code will no longer work from VNDK deprecation, but it
can give confusion to users if we keep code for the snapshot - and it
adds complexity on existing code while it is not in use. This change
removes all snapshot definition except host snapshot and its usage.

Bug: 330100430
Bug: 332986564
Test: AOSP CF build succeeded
Change-Id: Ieb6fa43d5e38315c662ce997bc305b744b367c24
2024-04-05 01:56:56 +00:00
Jihoon Kang
8479dea802 Return the header jar of the implementation library in SdkHeaderJars()
As part of the process to remove the compilation action in the top level
java sdk library, this change modifies SdkHeaderJars(...) (i.e. the
"magic") to return the header jar of the implementation library instead
of the header jar of the top level java sdk library when the
implementation jar is returned from the "magic".

This change also removes `SdkImplementationJars()` from the
SdkLibraryDependency interface, as it is not currently used anywhere
else.

Test: m nothing --no-skip-soong-tests
Bug: 332785297
Change-Id: Icc00af4b1485dc2b1b0981a3e56758d0306dea69
2024-04-05 00:37:37 +00:00
Kiyoung Kim
6954bd2337 Merge "Remove PlatformVndkVersion property" into main 2024-04-03 00:48:04 +00:00
Jesse Melhuish
219ce55481 Merge "Allow Multilib in override_apex" into main 2024-04-01 14:01:59 +00:00
Kiyoung Kim
fa13ff194c Remove PlatformVndkVersion property
Platform VNDK version is no longer available based on VNDK deprecation.
Remove all code using Platform VNDK version.

Bug: 330100430
Test: AOSP CF build succeeded
Change-Id: I7d0f7e23eff5d153346890f242a94b78bad6736b
2024-04-01 16:37:20 +09:00
Jesse Melhuish
ec60e25a1c Allow Multilib in override_apex
Test: m nothing --no-skip-soong-tests
Test: go test apex_text.go
Bug: 246854990
Change-Id: Id6e31c63acd87466a4436288d550ce6b298c677d
2024-03-29 21:13:57 +00:00
Ted Bauer
6ef40dbce6 Add logging dependencies to Rust aconfig APIs
Test: go test
Change-Id: I17c098f6b83c442554e49b6b802f11c97f94ec76
2024-03-29 14:05:05 +00:00
Kiyoung Kim
82488ca457 Merge "Remove VNDK information from CC and APEX tests" into main 2024-03-29 04:37:25 +00:00
Jooyung Han
3520b9488e Merge "VINTF manifests in apex don't require extension" into main 2024-03-29 02:37:19 +00:00
Jihoon Kang
3921f0b356 Collect aconfig_declarations of the dependent java_aconfig_library modules
droidstubs module require aconfig_declarations modules to be specified
when the module depends on the java_aconfig_library module in order to
generate the "exportable" stubs. This adds burden to the droidstubs or
java_sdk_library module owners, as module should specify both the
java_aconfig_library and aconfig_declarations modules to genreate the
"exportable" stubs, although the necessary information from the
aconfig_declarations module can be provided from the
java_aconfig_library modules.

In order to resolve such burden, this change enables the intermediate
cache files from the associated aconfig_declarations module of a
java_aconfig_library module to be propagated to its reverse dependencies
without having the specify the aconfig_declarations modules in the
droidstubs or java_sdk_library modules definitions.

This does not mean that the intermediate cache files of every transitive
dependencies of the java_sdk_library or the droidstubs will be passed to
aconfig to retrieve the state of the aconfig flags.

Specifically, only the java_aconfig_library modules or the java_library
modules that have static dependency on java_aconfig_library modules that
are passed to droidstubs via `libs` or `srcs` (using
":module_name{.tag}" syntax) will provide the intermediate cache files
to generate the "exportable" stubs. For java_sdk_library, all modules
listed as `libs`, `static_libs`, `stub_only_libs`, and `apiScope.libs`
are passed as `libs` and all modules listed as `api_srcs` and `srcs` are
passed as `srcs` to the droidstubs modules dynamically generated in
java_sdk_library module per api scope, thus these properties will be
affected.

Note that the test is being added in the apex package. This is because
trying to register the codegen package build components in the java
package leads to circular dependency between the codegen and the java
package, as codegen package imports the java package.

Test: m nothing --no-skip-soong-tests
Bug: 329284345
Change-Id: I7953ab64776f6947808321ce8a3598154501bcfe
2024-03-29 01:11:32 +00:00
Ted Bauer
02d475c3d8 Add storage API as dependency to Rust codegen
Test: m
Bug: 328444881
Change-Id: Id1ef9276adb9f9b990a05b910937e96ab0a5ac50
2024-03-28 18:38:32 +00:00
Kiyoung Kim
0d1c1e6aef Remove VNDK information from CC and APEX tests
VNDK is deprecated in 24Q2, so soong should be tested with no device and
platform vndk versions. This change removes all VNDK related tests and
VNDK versions from soong-cc and soong-apex tests.

Bug: 330100430
Test: m nothing --no-skip-soong-tests passed
Change-Id: I45e6c13e6c0a6bc9710b120e8d5b167e2051631e
2024-03-28 15:15:01 +09:00
Jooyung Han
262f73c831 VINTF manifests in apex don't require extension
libvintf reads all entries from vintf directory. The apex build rule
should match with it.

Bug: 331474817
Test: build with aosp/3017012/1
Change-Id: Ida5fce2436ec5985e2fb4c2a3608bf20f4933582
2024-03-28 11:29:47 +09:00
Treehugger Robot
e58af3da5a Merge "Add required, host_required, and target_required as dependencies" into main 2024-03-25 04:10:50 +00:00
Thiébaud Weksteen
d3348dbaaa Merge "Support multiple sources for prebuilt_etc" into main 2024-03-21 23:14:48 +00:00
Thiébaud Weksteen
00e8b31ee6 Support multiple sources for prebuilt_etc
Keep the Src attribute for compatibility. The new attribute (Srcs) is
mutually exclusive with Src.

Keep SourceFilePath and OutputFile for compatibility with other modules.
These can be removed in a follow up change.

Bug: 328313691
Test: presubmit
Test: m blueprint_tests
Test: prebuilts/build-tools/build-prebuilts.sh (on build-tools branch)
Change-Id: I5d5b2657715a7180a829c7ed0f501872d561b662
2024-03-21 11:30:15 +11:00
Jiyong Park
8bcf3c64f1 Add required, host_required, and target_required as dependencies
So far, the installation of required modules were handled by Make. This
prevents us from implementing the module installation and packaging
entirely in Soong.

This CL is the first step towards that goal. Soong now correctly tracks
the dependencies and they are correctly returned by
TransitivePackagingSpecs(), which is used by packaging modules like
android_system_image.

Bug: 321626681
Test: build
Change-Id: I9192b5333ceaa0b7d1c5c4abeec2af62febcd976
2024-03-20 17:05:17 +09:00
Yu Liu
c888460e5d Support rust in aconfig mode validation.
Bug: 323071835
Test: Unit tests
Change-Id: I6de2a6fe1618e21c9aab728e6d77c6b0c6ce33df
2024-03-15 18:48:38 +00:00
Cole Faust
b9ae285b55 Merge changes from topic "import_make_staging_dir" into main
* changes:
  Add include_make_built_files
  Don't use zip files when creating filesystems
2024-03-15 17:34:26 +00:00
Cole Faust
3b806d3b88 Don't use zip files when creating filesystems
The end result is a directory that's passed to build_image, so zipping
and then unzipping image contents will unnecessarily slow things down.

Bug: 329146343
Test: m microdroid --no-skip-soong-tests
Change-Id: I98223c60e8144d6c707832fcc03ba8fe94467e7b
2024-03-14 16:40:30 -07:00
Treehugger Robot
4e4939665e Merge "Generate info about the selected app variant in platform builds" into main 2024-03-14 22:05:43 +00:00
Yu Liu
f509eba41d Merge "Validate aconfig libs are built with the correct modes." into main 2024-03-14 18:39:12 +00:00
Spandan Das
3490dfd23f Generate info about the selected app variant in platform builds
This is a followup to aosp/2999198 and adds information about apps.

Each app will have an entry in this file with the following properties
- Name, mandatory
- Is_prebuilt, mandatory
- Prebuilt_info_file_path, optional

Implementation details
- Move prebuiltInfoProvider out of build/soong/apex to
  build/soong/android. This allows build/soong/java to use it.
- Introduce a new `prebuilt_info` prop to `android_app_set` and
  `android_app_import`
- All app module types will set a prebuiltInfoProvider in
  GenerateAndroidBuildActions, including the source app module types

Test: m nothing --no-skip-soong-tests
Test: m out/soong/prebuilt_info.json
Test: ls -l out/soong/prebuilt_info.json --human-readable
-rw------- 1 spandandas primarygroup 317K Mar 11 23:46 out/soong/prebuilt_info.json

Test: #modified trunk_staging.locally to select prebuilts of some
mainline apps. Spot-checked that `is_prebuilt` and
`prebuilt_info_file_path` get populated appropriately

Bug: 327480225
Change-Id: I5078e0ec26c9568194550909962b90111a5223f7
2024-03-14 18:12:30 +00:00
Jooyung Han
ed9005b556 Merge "Clean up LLNDK stubs" into main 2024-03-14 03:58:14 +00:00
Spandan Das
a747d2ec48 Generate info about the selected apex variant in platform builds
out/soong/prebuilt_info.json will contain information about whether
source or prebuilt of an apex was used. If prebuilt is used, it will
print the path to its prebuilt_info file. This file will be
used to pick a matching set of MTS test prebuilts.

Each apex will have an entry in this file with the following properties
- Name, mandatory
- Is_prebuilt, mandatory
- Prebuilt_info_file_path, optional

Implementation details
- Introduce a new `prebuilt_info` prop to `apex_set` and `prebuilt_apex`
- All apex module types will set a prebuiltInfoProvider in
  GenerateAndroidBuildActions, including the source apex module types
- Create a `apex_prebuiltinfo_singleton` that visits all apex modules.
  It uses `IsHideFromMake` to filter out the unselected variants of a
  specific apex. This new singleton will create prebuilt_info.json
- Dist prebuilt_info.json for droidcore

Test: m nothing --no-skip-soong-tests
Test: m out/soong/prebuilt_info.json
Test: ls -l out/soong/prebuilt_info.json --human-readable
-rw------- 1 spandandas primarygroup 25K Mar 11 23:46 out/soong/prebuilt_info.json

Test: #modified trunk_staging.locally to select prebuilts of some
mainline modules. Spot-checked that `is_prebuilt` and
`prebuilt_info_file_path` get populated appropriately

Bug: 327480225

Change-Id: I65c73010142b034ad1d2b3d05ef493be034e8d74
2024-03-12 18:04:55 +00:00
Jooyung Han
5e8994e5ed Clean up LLNDK stubs
So far we created {"", "current"} stubs for LLNDK modules. But we don't
need "current" because "" itself is a stub.

This change only removes unused LLNDK stub modules with "current"
version, which aren't used at all.

Bug: 329183083
Test: m blueprint_tests
Change-Id: Ib8e880b6d88952b489657ea1ac557a48afe562a4
2024-03-12 16:26:18 +09:00
Yu Liu
67a28425a7 Validate aconfig libs are built with the correct modes.
Bug: 323071835
Test: Unit tests and manual tests.
Change-Id: I32de90826c7c8bb4d8495608e959d554820ab9a2
2024-03-07 18:51:16 +00:00
Spandan Das
f2c1057586 Fix non-determinism in prebuilt selection
This relands aosp/2978137 with acknowledgement of soong namespaces.

If multiple versions of the prebuilt module sdk share the same soong
config namespace, then PrebuiltPostDepsMutator rewrites rdeps to one of
those prebuilts in a non-deterministic way.

This CL uses apex_contributions to make this deterministic. Multiple
prebuilts will not be allowed to have their prefer evaluate to true. If
this happens, one of the prebuilts must be explicitly declared in
apex_contributions.

This CL also fixes the special-casing of the top-level
java_sdk_library_import in ReplaceDirectDependencies. For
framework-foo.v2, it will use BaseModuleName framework-foo instead of
SdkLibraryName framework-foo.v2 to determine if the source module has
been selected.

Test: ran the previously failing cmd of b/327552112
Test: Added a unit test
Test: aninja -t query
    out/soong/.intermediates/packages/modules/Permission/SafetyCenter/Config/safety-center-config/android_common/javac/safety-center-config.jar
    | grep module_sdk is empty (should not cause a regression for
    323454855)
Change-Id: Id484a41192085c50b7e34ad415c6e195edb0d006
2024-03-04 07:59:34 +00:00
Yu Liu
ab31c828d7 Some tweaks to the aconfig flag collection logic
1. Output the aconfig flags pb and storage files to /etc
2. Fix a bug where aconfig flags were not collected for java_sdk_library

Bug: None
Test: manual and unit tests.
Change-Id: I0896e91918c1b53c98ac9dc0f4a636f158200891
2024-02-28 22:21:31 +00:00
Riya Thakur
654461cde9 Add sh_binary dependencies to primary abi of the target
If compile_multilib is set to 'both' for an apex having a sh_binary
dependency for which compile_multilib is not set, then the sh_binary
dependency should be added for the primary ABI of the target

Bug: 325628733,326985291
Test: m
Change-Id: Ie9cd12d49f6854c33af3724cb8e2fc3d8b7627a0
2024-02-27 07:23:45 +00:00
Yu Liu
bba555ee31 Support aconfig stoage files for apex.
Bug: 323071835
Test: unit tests and manual build test.
Change-Id: I4a1a05b3afdf88058a970040b3f176f36c5c8037
2024-02-17 00:36:42 +00:00
Yisroel Forta
154796c0e2 Add profiling to skip strict updatability allowlist
Test: presubmit
Bug: b/293957254
Change-Id: I9d53f3237ff5f076b8299138e02d991f8881e06f
2024-02-13 14:12:11 +00:00
Spandan Das
2dc86ebd3e Merge "Restrict verify_overlaps to pre S modules" into main 2024-02-13 10:53:23 +00:00
Jihoon Kang
a0ccab683b Merge "Add environment variable UNBUNDLED_BUILD_TARGET_SDK_WITH_DESSERT_SHA" into main 2024-02-13 04:27:21 +00:00
Spandan Das
38c64f62cf Restrict verify_overlaps to pre S modules
The runtime in S and above does not have the same constraints that
require the hiddenapi flags to be generated in a monolithic manner.
This CL restricts the verify_overlaps to pre S modules. This will
filter out hiddenapi signature discrepancies that do not require
any action.

Test: verify_overlaps diff with this change https://diff.googleplex.com/#key=xxB0ky93hZRn
Test: presubmits
Bug: 313672880

Change-Id: Ie626a6779fc924563bec90b6c1ab0c7e8b4b23c2
2024-02-13 02:33:12 +00:00
Jihoon Kang
842b999a53 Add environment variable UNBUNDLED_BUILD_TARGET_SDK_WITH_DESSERT_SHA
UNBUNDLED_BUILD_TARGET_SDK_WITH_DESSERT_SHA enables user to specify
${codename}.${sha} as min_sdk_version and target_sdk_version in order to
support mainline train building into android build.

Test: TH
Bug: 295905124
Change-Id: I032d464aaa7314520f98b8eafa53d962940075ce
2024-02-12 21:12:58 +00:00
Jooyung Han
1f4531e768 apex: skip apex_sepolicy_tests for test apex
Test apexes are often configured incorrectly intentionally.

Bug: 324005965
Test: m
Change-Id: Ifddbca71b46a42cffa9923b0dd66cd5e2d8024e4
2024-02-07 16:27:57 +09:00
Spandan Das
161e468774 Use source_module_name to determine the contents of prebuilt apexes
There are a couple of instances in apex/ and java/ that rely on the naming
convention that the jars exported by prebuilt apexes follow the name of
the java_sdk_library_import, minus the prebuilt_ prefix. With muliple
module sdk prebuilts in trunk stable, this naming convention might not
be valid. Use `source_module_name` instead.

```
prebuilt_sscp_fragment {name: "", contents: ["service-foo.v2"]}
java_import {name: "service-foo.v2", source_module_name: "service-foo"},
```

We should use service-foo and not service-foo.v2 because
1. The prebuilt apex contains service-foo.dex
2. PRODUCT_*JARS will contain service-foo and not service-foo.v2

For clarity, this CL does not drop the current mechanism where prebuilt bcp
fragments create a dependency edge to prebuilt java or java_sdk_library
imports. There is still some discussion around whether we can remove
that completely (b/320711431). If we were to do that, then the
Android.bp files will become

```
prebuilt_sscp_fragment {name: "", contents: ["service-foo"]}
```

Bug: 322175508

Test: Added a unit test

Test: In internal, lunch cf_x86_64_only_phone-next-userdebug && m
nothing # .ninja files identical

Test: In internal, created a parallel set of v2 prebuilts of
java_sdk_library_import and prebuilt_bcp_fragments for adservices && m
nothing # build passes

Change-Id: Ia899d75e826fa1a559368d706eaa65835f748d40
2024-02-06 21:56:05 +00:00
Treehugger Robot
d8cb9505f8 Merge "Determine GC type based on BUILT_KERNEL_VERSION_FILE." into main 2024-02-02 03:01:57 +00:00
Jiakai Zhang
7d292228c1 Determine GC type based on BUILT_KERNEL_VERSION_FILE.
How it works:
1. build/make/core/Makefile generates a txt file with the kernel
   version, which is taken from an explicit BOARD_KERNEL_VERSION value,
   or extracted from the kernel image on the source tree, or extracted
   from the kernel image extracted from the prebuilt boot.img.
   The file is saved at
   $ANDROID_PRODUCT_OUT/obj/PACKAGING/check_vintf_all_intermediates/kernel_version.txt.
2. If PRODUCT_ENABLE_UFFD_GC is "default", meaning the GC type needs to
   be determined by the kernel version, build/make/core/Makefile copies
   kernel_version.txt to
   out/soong/dexpreopt/kernel_version_for_uffd_gc.txt.
3. build/soong/dexpreopt/config.go writes the the UFFD GC flag to
   out/soong/dexpreopt/uffd_gc_flag.txt. The flag is determined by an
   explicit PRODUCT_ENABLE_UFFD_GC value or by contruct_uffd_gc_flag.py,
   which reads kernel_version_for_uffd_gc.txt and determines the flag
   accordingly.
4. dex2oat takes the UFFD GC flag from uffd_gc_flag.txt.
5. post_process_props.py mangles ro.dalvik.vm.enable_uffd_gc based on
   the same logic.

Bug: 321751629
Bug: 319554951
Bug: 318763448
Bug: 319648491
Test: m --no-skip-soong-tests nothing
Test: atest uffd_gc_utils_test
Test: Build with `OVERRIDE_ENABLE_UFFD_GC=default m` for device with no
  UFFD support -
  1. Check the existence of `-Xgc:CMC` in
     out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot.invocation
     (dex2oat invocation for a boot image)
  2. Check the existence of `-Xgc:CMC` in
     out/soong/.intermediates/packages/apps/Settings/Settings/android_common/dexpreopt/Settings/oat/arm64/package.invocation
     (dex2oat invocation for an app defined in .bp)
  3. Check the existence of `-Xgc:CMC` in
     $ANDROID_PRODUCT_OUT/obj/APPS/Dialer_intermediates/oat/arm64/package.invocation
     (dex2oat invocation for an app defined in .mk)
  4. Check the value of ro.dalvik.vm.enable_uffd_gc in
     $ANDROID_PRODUCT_OUT/product/etc/build.prop
Test: Build with `OVERRIDE_ENABLE_UFFD_GC=default m` for device with
  UFFD support, and do the steps above.
Test: Build with `OVERRIDE_ENABLE_UFFD_GC=true m`, and do the steps
  above.
Test: Build with `OVERRIDE_ENABLE_UFFD_GC=false m`, and do the steps
  above.

Change-Id: I035ad32233e49e2a30ce11f6c7c318a648511ef8
2024-02-02 09:23:37 +08:00
Treehugger Robot
b370adbdcc Merge "Build VNDK with VNDK prebuilts without BOARD_VNDK_VERSION" into main 2024-02-02 01:06:37 +00:00