Commit graph

7861 commits

Author SHA1 Message Date
Inseob Kim
83c08b0224 Merge "Remove unused ToTSepolicyVersion" into main am: 5712af4792
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2912750

Change-Id: I9c7481e673960cbcb32ac1a22a1c1182b556d899
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-08 01:22:38 +00:00
Inseob Kim
5712af4792 Merge "Remove unused ToTSepolicyVersion" into main 2024-02-08 01:12:47 +00: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
Cole Faust
d53e91ade8 Merge "Revert^2 "Enforce that soong config variables are identifiers"" into main am: c99c52f977
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2954688

Change-Id: I0abe6f81265ac37c38d4d9e7b4a0d9c09163c7b3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-07 21:03:10 +00:00
Cole Faust
c99c52f977 Merge "Revert^2 "Enforce that soong config variables are identifiers"" into main 2024-02-07 20:25:00 +00:00
Cole Faust
894bb3b530 Add //visibility:any_partition
When we convert the partitions to be built with soong, there will
likely be separate partition modules per product. This means that a
lot of installable modules will have to be visible to a lot of
partitions. To make this easier, add the //visibility:any_partition
visibility spec, which allows the module to be used from any module
of type android_filesystem or android_system_image.

Fixes: 321000103
Test: go test
Change-Id: Iea1f1ab7d88dfdb1fd00f19eb8c9941693a2375f
2024-02-07 12:03:32 -08:00
Hsin-Yi Chen
2c4a9779cd Version LLNDK ABI dumps with VendorApiLevel
LLNDK version will be decoupled from SDK version. The ABI checker
loads the reference ABI dumps from
prebuilts/abi-dumps/vndk/<VendorApiLevel>.

Test: m libnativewindow
Bug: 314010764
Change-Id: I3e9f2cab58db0d1cc42f8c1abc13968617dacf14
2024-02-07 17:32:00 +08:00
Jihoon Kang
5919815f80 Enable exportable stubs to include READ_WRITE aconfig flagged apis
Currently in SDK build, "exportable" stubs are used to generate the
android.jar and the corresponding build artifacts, as well as the
hiddenapi flags. "exportable" stubs only include the flagged apis that
are "enabled" and "read only", and exclude all other flagged apis. This
will be replaced with "runtime" stubs in the long run, which include
"read_write" flagged apis on top of the "enabled" and "read only" flags.

Prior to Trunk Stable, the SDK build did not distinguish the target
audience of the SDK. That is, the identical build target was used to
generate the SDK targeted toward the Google3 developers (i.e. Google3
SDK drop) and the SDK targeted toward the public (i.e. Developer
Preview). However, given that we now have "experimental" apis with Trunk
Stable, there are demands to differentiate the SDK based on the target
audience, so that the "experimental" APIs are included in the SDK
targeted toward Google3 while they are excluded in the public facing
SDK.

The long term solution to achieve this is to generate the hiddenapi
flags and (conditionally) the SDKs using the runtime stubs. However, as
this is high priority, this change resolves the problem by modifying the
filter condition of the "exportable" stubs to include the "read_write"
flagged apis on top of the "enabled" and "read only" flagged apis when
the value of the default-false build flag "RELEASE_EXPORT_RUNTIME_APIS"
is set to true.

Note that this is a temporary solution; However, we might need to keep
the "RELEASE_EXPORT_RUNTIME_APIS" build flag even in the long run to
determine what set of apis are included in the generated SDK, based on
the target audience of the SDK.

Test: m nothing --no-skip-soong-tests
Bug: 323188988
Change-Id: If0d5fa74b3ba6f4a57c86aade8d340f149a657a2
2024-02-07 01:17:59 +00:00
Cole Faust
d92430e569 Revert^2 "Enforce that soong config variables are identifiers"
This reverts commit 149b5d003a.

Reason for revert: The variable that was causing issues before has been renamed

Change-Id: Ie0ffe9bf978332a2c921d21ccdf639b603fae39c
2024-02-07 01:02:04 +00:00
Jihoon Kang
0ea8cc9393 Merge "Introduce make var ANDROID_PUBLIC_EXPORTABLE_STUBS" into main am: d2e49a9261
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2950471

Change-Id: I54027149d4c08c02fa604ac6fa1825cc2d7fe6f5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-06 22:50:59 +00:00
Jihoon Kang
d2e49a9261 Merge "Introduce make var ANDROID_PUBLIC_EXPORTABLE_STUBS" into main 2024-02-06 21:59:11 +00:00
Jihoon Kang
7cf2c0cce7 Introduce make var ANDROID_PUBLIC_EXPORTABLE_STUBS
ANDROID_PUBLIC_STUBS currently has multiple usages in the build, in
multiple .mk files.

Instead of modifying the current functionality of ANDROID_PUBLIC_STUBS
by replacing its value from "android_stubs_current" to
"android_stubs_current_exportable", this change introduces
ANDROID_PUBLIC_EXPORTABLE_STUBS, which evaluates to
"android_stubs_current_exportable" and used only when generating the
`full_target` in `development/build/Android.mk`.

Test: patch in git_main, lunch aosp_arm-ap31-eng && m sdk dist && inspect android.jar outputs
Bug: 323261972
Change-Id: Ic2b03a5a4afdefb459d89f8104916446599eaf31
2024-02-06 18:51:19 +00:00
Spandan Das
a75bd883f4 Merge "Mechanism to select a specific version of java_sdk_library_import" into main am: 7870d329a5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2938840

Change-Id: Ida9a55976952aa264763cde8acd813e7a3154f83
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-06 18:38:56 +00:00
Spandan Das
7870d329a5 Merge "Mechanism to select a specific version of java_sdk_library_import" into main 2024-02-06 17:54:58 +00:00
Treehugger Robot
4cf995fc91 Merge "Revert "Enforce that soong config variables are identifiers"" into main am: d7e6bd8a04
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2950473

Change-Id: Ib01f0842cf3408e7e059f66ec11f0cc2a4e06fc1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-06 11:43:09 +00:00
Treehugger Robot
d7e6bd8a04 Merge "Revert "Enforce that soong config variables are identifiers"" into main 2024-02-06 10:50:10 +00:00
Almaz Mingaleev
149b5d003a Revert "Enforce that soong config variables are identifiers"
This reverts commit d7c32db93d.

Reason for revert: breaks builds b/323989166

Change-Id: I6937f2cbecbde39fcfe605937861510329ba44c3
2024-02-06 09:13:50 +00:00
Ke-Yu Lu
5fd9281788 Merge changes from topic "revert-2925209-KVPWEBRQHT" into main am: 196d9493c4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2952266

Change-Id: I9b40a85caed57dfe16bd28e195175202a1872849
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-06 06:18:47 +00: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
Spandan Das
23956d12ab Mechanism to select a specific version of java_sdk_library_import
This CL is the java_sdk_library_import equivalent of aosp/2928483.

With trunk stable, we will have multiple apex prebuilts in the tree.
Each apex prebuilt will have its own module sdk. This means that it is
possible to have mutliple versions of `framework-foo` in the tree. This
CL introduces a mechanism to select a specific versioned
java_sdk_library prebuilt.

Implementation details
- Add a `source_module_name` property to java_sdk_library_import. This
  will identify the source equivalent of the jsl in packages/modules.
  This used to be implicit - i.e. the name without the prebuilt_ prefix.
  With multiple prebuilts, this has to become explicit.
- Set appropriate `source_module_name`(s) in the dynamically created
  child modules. e.g. the source_module_name on sdklib.v1.stubs and
  sdklib.v2.stubs will both be sdklib.stubs, assuming
  `source_module_name` on the top-level jsl_import is sdklib
- Add a private Created_by_java_sdk_library_name property to java_import
  and prebuilt_stubs_sources modules. This will be used to idenfity the
  top level java_sdk_library_import that was used to create these child
  modules. This is necessary because java_sdk_library_imoprt is a macro
  that creates 1:many modules. However, to avoid toil, only the
  top-level java_sdk_library_import will be listed in
  `apex_contributions`. This new property will be used for
  source/prebuilt selection in android/prebuuilt.go
- Rename BaseModuleName in commonSdkLibraryAndImportModule to
  RootLibraryName. This is necesssary because the former is now reserved
  to identify the source equivalent of a prebuilt module (maybe we
  should rename it?)

Bug: 322175508

Test: Added a unit test
Change-Id: If6aa6b0e939a07f8263874941413908383c81a78
2024-02-06 04:14:59 +00:00
Cole Faust
d2edc07225 Merge "Enforce that soong config variables are identifiers" into main am: f7757f1246
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2952006

Change-Id: If68bdd3223bbd16654312634e8bfda0de6e5309a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-06 02:43:28 +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
Cole Faust
f7757f1246 Merge "Enforce that soong config variables are identifiers" into main 2024-02-06 02:04:29 +00:00
Zi Wang
292c21ee68 Merge "Automatically propagate jarjar rules for aconfig libraries" into main am: 4f0b9b4289
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2951493

Change-Id: I4a7ffbda0c6326bbb64bedeee4bb8f652cd79243
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-06 00:13:36 +00:00
Zi Wang
4f0b9b4289 Merge "Automatically propagate jarjar rules for aconfig libraries" into main 2024-02-06 00:04:07 +00:00
Cole Faust
d7c32db93d Enforce that soong config variables are identifiers
I want to be able to use certain characters to separate a namespace
from a variable, but currently it's possible for soong config namespaces
and variables to have any character in them.

Restrict them to just identifiers, which should cover all of our
existing usages.

Bug: 323382414
Test: Presubmits
Change-Id: I6d55dd3378ac4d257efde450189b81a4aa3932c3
2024-02-05 16:01:18 -08:00
Treehugger Robot
323f6f8a3e Merge "Fix non-determinism in all_teams.pb" into main am: 87177f21b4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2951492

Change-Id: I3e45256a7d942ef76da9b1c2618f55df43650791
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-05 23:54:31 +00:00
Colin Cross
0c7d35b0ed Merge changes Ied8fd7b5,Ib0584545 into main am: 6c392749d5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2925209

Change-Id: Idad1a222c801795e19a99689f22116080bf04728
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-05 23:53:52 +00:00
Treehugger Robot
87177f21b4 Merge "Fix non-determinism in all_teams.pb" into main 2024-02-05 23:29:14 +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
Joe Onorato
349ae8dd6b Automatically propagate jarjar rules for aconfig libraries
Test: treehugger
Bug: 310504781
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:97c03a6dc659102ff40793759fb3f0f18164a85b)
Merged-In: I639d12ff33175b7bed7e7d0595a40dd9b0d99367
Change-Id: I639d12ff33175b7bed7e7d0595a40dd9b0d99367
2024-02-05 22:46:00 +00:00
Spandan Das
2268cd8b8b Fix non-determinism in all_teams.pb
this.teams_for_mods uses a dictionary and `range` yields a
non-deterministic ordering. This would cause all_teams.pb to be
non-determinisitic. Since this file is created during Soong analysis, it
would cause the .ninja file to also be non-deterministic.

Use SortedKeys to do the iteration instead.

Test: go build ./android
Test: m nothing a couple of times and checked that the .ninja files are
identical

Change-Id: Ife2d2520d118ef25639f86390912d98b5f057655
2024-02-05 22:11:28 +00:00
Spandan Das
a27655f5f8 Merge "Sort the inputs to mergedAconfigFilesRule" into main am: bb0d5866c5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2951486

Change-Id: Idc0672a97f069a3fa673db9ff5b64a01cc8e5b7f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-05 21:23:50 +00:00
Colin Cross
0f01d9efff Merge "Follow signature update to ExtendMatchingProperties" into main am: 6b2b493bf3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2947429

Change-Id: I52228441e1ab61c0a1e3f577c9479aa51c226551
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-05 21:23:33 +00:00
Spandan Das
bb0d5866c5 Merge "Sort the inputs to mergedAconfigFilesRule" into main 2024-02-05 21:16:54 +00:00
Colin Cross
6b2b493bf3 Merge "Follow signature update to ExtendMatchingProperties" into main 2024-02-05 21:02:02 +00:00
Colin Cross
9f56d98f9a Merge changes I64a5f3c9,I1ed0a380 into main am: 2a28cd3c5e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2947428

Change-Id: I214abe70d6f4d312a490a93cab1cdbe570b37d0b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-05 21:01:01 +00:00
Colin Cross
2a28cd3c5e Merge changes I64a5f3c9,I1ed0a380 into main
* changes:
  Optimize mutator contexts
  Optimize InstallPath.String()
2024-02-05 20:22:20 +00:00
Spandan Das
4d4edfb8d8 Sort the inputs to mergedAconfigFilesRule
The aconfig files are collected by visiting the direct deps of the
module. VisitDirectDeps does not guarantee ordered traversal. To prevent
non-determinism in the generated ninja file, sort the inputs.

Test: go build ./android
Change-Id: Ic67fc0859bf18de62b6297ed502d1d495cc3a780
2024-02-05 19:34:48 +00:00
Spandan Das
7f606c16ef Merge "Do not replace the direct edge between rdeps and java_sdk_library" into main am: b01db714e3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2944724

Change-Id: Idba2adcc019825991b35da9c5da6b7b7556cba4d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-05 18:51:26 +00:00
Spandan Das
81d95c5824 Do not replace the direct edge between rdeps and java_sdk_library
android/prebuilt.go#isSelected has a special-case inside it to ignore
apex_contributions contents for the top-level java_sdk_library hook.
This was necessary because even though we might want source stubs in
next builds, we still needed the top-level prebuilt hook to be active to
emit the dexpreopt rules to .mk.

This worked fine for rdeps that create a dependency edge on the child
stub modules of java_sdk_library. Notable examples include the full
android api stubs created by f/b/api.go. In postdeps mutator, these
expanded deps get rewritten to source/prebuilt if necesssry.

The exception to this are workflows which depend on the top-level hook
directly via `libs`. We resolve these rdeps to an appropriate provider
during GenerateAndroidBuildActions stage. This meant that rdeps were
getting prebuilt stubs of these even in next builds.

Bug: 323454855

Test: Added a unit test

Test: lunch cf_x86_64_only_phone-next-userdebug
Test: aninja -t query
out/soong/.intermediates/packages/modules/Permission/SafetyCenter/Config/safety-center-config/android_common/javac/safety-center-config.jar
| grep prebilts/module_sdk # empty now

Change-Id: Id91333d88055519f3c58ab40466f9628085f5180
2024-02-03 00:17:16 +00:00
Colin Cross
1e7e0432fa Follow signature update to ExtendMatchingProperties
The order function passed to ExtendMatchingProperites no longer takes
a property, dstValue or srcValue parameter.

Test: builds
Change-Id: I19fc554f705fbf42100f0a38df87e2d1fb2454ec
2024-02-02 15:56:32 -08:00
Colin Cross
984223fd04 Optimize mutator contexts
Mutator contexts are created for every module, and in the case of
transition mutator contexts for every dependency of every module.
Unlike the Blueprint mutator contexts that they wrap, the Soong
mutator contexts can be relatively large.  Add global pools for all
of them that can avoid the repeated allocations.

Test: SOONG_PROFILE_MEM=/tmp/mem.pprof m nothing
Change-Id: I64a5f3c91292cff6352300f99c11ac50c713f96d
2024-02-02 15:56:32 -08:00
Colin Cross
c0e42d5dfc Optimize InstallPath.String()
Every InstallPath will have String() called on it eventually, often
more than once if it is in a slice that is sorted.  Precompute the
full path so it can be returned from InstallPath.String() without
recomputing every time.

Test: paths_test.go
Change-Id: I1ed0a3801806854356865c0a5fc35d5cf6d349fe
2024-02-02 15:56:32 -08:00
Treehugger Robot
60bb72a387 Merge "Use ordered interface from cmp package" into main am: 73b1b48d9b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2937805

Change-Id: I316ffda88ce0d8ec1d7e4328c72b6d31630eb551
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-31 00:22:48 +00:00
Treehugger Robot
73b1b48d9b Merge "Use ordered interface from cmp package" into main 2024-01-30 23:45:39 +00:00
Spandan Das
e0d8cb2569 Merge "Propagate profile_guided requirement of imports to top-level apex" into main am: f3c63e6743
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2929189

Change-Id: I8f2014dd08b273f0fc3f3c3bff849078abf7914f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-30 22:56:21 +00:00
Spandan Das
f3c63e6743 Merge "Propagate profile_guided requirement of imports to top-level apex" into main 2024-01-30 22:50:38 +00:00
Cole Faust
efc70122af Use ordered interface from cmp package
I just learned this exists.

Test: m nothing --no-skip-soong-tests
Change-Id: Ic6f0d11c24b41b394b1760fcca9e0da53243e6d9
2024-01-30 14:42:12 -08:00
Xin Li
14a55a9b82 Merge Android 24Q1 Release (ab/11220357)
Bug: 319669529
Merged-In: I763b033f0f5f275091db45ab62df6af48dcddc66
Change-Id: I65077e51b4a073f2628fb0995e80ad64368def26
2024-01-30 10:34:06 -08:00
Spandan Das
2ea84dd0dc Propagate profile_guided requirement of imports to top-level apex
For prebuilts, the dexpreopt rules of system server jars are now
generated from the context of the top-level prebuilt apex and not in the
context of the shim java_import modules. Since
`dex_preopt.profile_guided` property is defined in java_import, this
needs to be bubbled up to the top-level apex. This will be done using
deapxerInfo. If profile_guided of a transitive java_import is true, the deapexed .prof file will be
set as dexreopter.inputProfilePathOnHost before invoking
dexpreopter.dexpreopt. This ensures that only that java_import undergoes
profile guided dexpreopt, and not every other transitive java_import

Test: go test ./apex -run TestPrebuiltStandaloneSystemserverclasspathFragmentContents
Test: lunch cf_x86_64_only_phone-next-userdebug && m
$ANDROID_PRODUCT_OUT/system/framework/oat/x86_64/apex@com.android.art@javalib@service-art.jar@classes.odex
Test: du -sh
$ANDROID_PRODUCT_OUT/system/framework/oat/x86_64/apex@com.android.art@javalib@service-art.jar@classes.odex
24K

Bug: 308790457
Change-Id: Ibf46ecb400b3f126b243fc8d27b08d9a1aa4cc97
2024-01-30 18:04:52 +00:00
Colin Cross
69a680feec Prevent defaults modules from expanding path property dependencies
Defaults modules should not have dependencies added to them for
path properties, the properties will already have been squashed
into other modules that depend on the defaults modules, and the
path dependencies will be added to those modules.

Fixes: 321056451
Test: TestDefaultsPathProperties
Change-Id: I59049f94b7a0924a7b1d997d15723901b0d522ee
2024-01-29 21:21:30 +00:00
Inseob Kim
e9aa063b82 Remove unused ToTSepolicyVersion
Bug: 314010177
Test: build and boot
Change-Id: I31ff0135d71bc3a38a8ca057c27ae32f41997b2d
2024-01-29 17:30:38 +09:00
Yi-Yo Chiang
c21f548fd4 Merge "cc: Vendor modules should NOT derive its "SDK" level from VNDK" into main 2024-01-29 03:14:22 +00: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
Treehugger Robot
99ed03f4fe Merge "Add build flag to enable ResourceProcessorBusyBox by default" into main 2024-01-26 19:07:25 +00:00
Ronald Braunstein
92eb74475b Merge "Add rule for proto file so we can write python to use it." into main 2024-01-26 18:56:24 +00:00
Colin Cross
8f1b033cf7 Add build flag to enable ResourceProcessorBusyBox by default
Setting the RELEASE_USE_RESOURCE_PROCESSOR_BY_DEFAULT build flag will
change the default for use_resource_processor from false to true.

Bug: 294256649
Test: builds
Change-Id: If643bf8db9e2e039200f63f4aac226ed5b44d9e0
2024-01-26 09:09:42 -08:00
Ronald Braunstein
1228b0baef Add rule for proto file so we can write python to use it.
I wrote another tool filter and augment the proto files, but these proto
files need to have a python library for that tool.

Test: m filter_teams && out/host/linux-x86/bin/filter_teams  --filter_teams

Change-Id: I6b259ddda2b6c09d55a9c6d445b96e5b77741f09
2024-01-25 21:10:04 -08:00
Spandan Das
f5e03f1c1a Move ApexBundleInfoProvider from apex/ to android/
This provider contains information about the contents of an apex and is
set during the post deps phase of top-level source and prebuilt apexes.

java.dexpreoptDisabled needs to distinguish between platform and apex
variants of a library to prevent creating duplicate ninja rules. It does
so by looking at ApexInfoProvider. This provider gets set on the ctx of
the java_library being dexpreopted.

In case of prebuilts, these rules are being moved to the top-level
prebuilt apexes. Move ApexInfoBundleProvider from apex to android so
that java.dexpreoptDisabled can consume this provider without running
into a golang circular dependency. (java.dexpreoptDisabled will use this
provider in the next CL of this stack).

Test: go build ./android ./apex
Change-Id: I665abd9d0591eeb17b273cc822beb20690e6af09
2024-01-25 22:35:54 +00:00
Treehugger Robot
471e181f92 Merge "Replace goldmont-without-xsaves build with goldmont-without-sha-xsaves" into main 2024-01-25 08:11:40 +00:00
LaMont Jones
b509938e4f Propagate AconfigFiles in ModuleBase.
Aconfig file dependencies are module-independent, and properly part of
ModuleBase.

Bug: b/308625757
Test: manual

Change-Id: I38c5907d1671cc69bb198345201316ae781fdc9f
2024-01-24 23:45:12 +00:00
Colin Cross
c50999eb0a Merge changes from topic "transition-mutator-config" into main
* changes:
  Add ArchModuleContext to TransitionMutator contexts
  Split ArchMutatorContext out of BaseMutatorContext
2024-01-24 20:03:46 +00:00
Colin Cross
4aa3e0ab81 Add ArchModuleContext to TransitionMutator contexts
Converting coverageMutator to a TransitionMutator requires adding
the ctx.Device() and ctx.DeviceConfig() methods.

Bug: 319288033
Test: builds
Change-Id: I697b48eb89bc23800d2d3c62d68358769f0d1075
2024-01-24 10:17:10 -08:00
Colin Cross
1d3d9f13b8 Split ArchMutatorContext out of BaseMutatorContext
Split the context methods that are useful on anything visiting a
module that has arch variants into a separate ArchMutatorContext
for reuse by TranstitionMutators.

Bug: 319288033
Test: builds
Change-Id: Ifdc21983c6c79f22965a49f169812a8cc3ad975b
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
Ronald Braunstein
43f3b601e2 Merge "Add team property to all modules." into main 2024-01-23 16:00:58 +00:00
Yi-Yo Chiang
88960aa827 cc: Vendor modules should NOT derive its "SDK" level from VNDK
Although vendor modules can be built bundled, they are technially not
part of the "platform", as it cannot access platform libraries (system
partition) directly.
They can only link to a restricted set of platform libraries (LLNDK),
and access restricted set of APIs.
We used to derive the LLNDK API level from the VNDK version. However
after VNDK deprecation, there is no "VNDK version" anymore.
Instead we would just derive the value from platform SDK version:
* If building an in-development build, build vendor modules against the
  in-development "current" API level.
* If building a REL / Final build, vendor should target the latest
  stable API.

Bug: 320423828
Test: go test
Test: presubmit
Test: build and boot
Change-Id: I2c5ef6530e9046b2dcc282bc1f020d8a505eab15
2024-01-23 12:43:38 +08:00
LaMont Jones
34314b7d15 Add VisitDirectDepsIgnoreBlueprint
This method allows dependencies on non-Android modules, which it ignores
in strict mode, rather than flagging the dependency as an error.

Bug: none
Test: manual
Change-Id: I9575e46638fa8ffc69c8935b1b65aab37ceab3c3
2024-01-19 20:22:10 +00:00
Cole Faust
b64c070edf Merge "Remove SymlinkOutputs" into main 2024-01-19 19:38:55 +00:00
Paul Duffin
169cffe526 Merge "Pretty print SBox manifest files to make them easier to read" into main 2024-01-19 10:09:11 +00:00
Paul Duffin
4a3a0a5412 Pretty print SBox manifest files to make them easier to read
When debugging problems with, or just modifying a ninja rule that uses
the SBox it is often necessary to read the manifest file. This change
makes them easier to read by pretty printing them onto multiple lines
with a small but clear indent.

This increased the size of the following file by abot 6% from 66K to
70K bytes:
    out/soong/.intermediates/packages/modules/Wifi/framework/framework-wifi.stubs.source.system/android_common/metalava.sbox.textproto

Test: m out/soong/.intermediates/packages/modules/Wifi/framework/framework-wifi.stubs.source.system/android_common/metalava.sbox.textproto
      less out/soong/.intermediates/packages/modules/Wifi/framework/framework-wifi.stubs.source.system/android_common/metalava.sbox.textproto
Change-Id: Icfadeaad1c6334bd0010128f4437669f35822850
2024-01-19 00:57:16 +00:00
Colin Cross
1b1b9a937b Merge changes from topic "soong-tests-presubmit" into main
* changes:
  Add script to run Soong tests with go tools
  Disable TestVariantSingletonModule when go test -short is used
  Fix data race in propagateRROEnforcementMutator
  Fix data race in finder_test.go
  Fix data race in dex_bootjars
  Fix race CommonGlobalCflags when running tests in parallel.
  Fix data race in snapshot singletons when running parallel tests
2024-01-18 23:58:45 +00:00
Ronald Braunstein
73b08ffd0d Add team property to all modules.
This allows vendors (like google) to specify which team owns the test
module and code.

Team is a commonProperty on modules and points to the designate "team"
module.  The DepsMutator adds the dependency on the "team" module and
"GenerateBuildActions" write the team data to intermediate files.

A new singleton rule, all_teams visits all modules and writes out
the proto containing the team for each module.
If a module doesn't have a team, then it finds the package in the
blueprint file and parent directory blueprint files that have a
default_team and uses that team.

Test: m all_teams
Test: go test ./python ./java ./cc ./rust ./android
Test: added team to HelloWorldHostTest and built the new asciiproto target
Test: added package default_team and checkout output proto.
Change-Id: I5c07bf489de460a04fc540f5fff0394f39f574a7
2024-01-18 14:16:06 -08:00
Colin Cross
74dc598a71 Disable TestVariantSingletonModule when go test -short is used
TestVariantSingletonModule tests that an error is produced when a
mutator creates variants of a SingletonModule.  It also triggers
a data race when cloneLogicModules copies the properties, as the
ModuleFactory of a SingletonModule always returns the same module
with the same property structs.  The build is about to fail with an
error anyways, so hopefully the data race isn't a problem.  There
is no way to disable the test when the data race detector is enabled,
so disable it when -short is enabled, which is the case for all of
our CI testing.

Test: go test -race -short ./...
Change-Id: I944a4901acb60df8e590270f178961d95095a7e9
2024-01-18 13:23:06 -08:00
Cole Faust
9a346f6da3 Remove SymlinkOutputs
symlink_outputs was added so bazel could run ninja files, but we
abanoned that approach in roboleaf, and then roboleaf was cancelled
entirely. Remove this feature so we're more compatible with upstream
ninja / n2.

Bug: 160568334
Test: Presubmits
Change-Id: Ic368c48dd01b68e51c471c3fe90d0c02c55956e9
2024-01-18 12:43:24 -08:00
Treehugger Robot
2f08cfc77e Merge "Allow to change static_libs for variant" into main 2024-01-17 02:54:48 +00:00
Florian Mayer
ca2854e708 Allow to change static_libs for variant
This will be used to have different static_libs if we build with scudo.

Bug: 309446525
Change-Id: I5f755dd768975a1dff403bffa92cd5dbc3b9f573
2024-01-16 16:42:34 -08:00
Treehugger Robot
c0412f5d31 Merge "Remove HideFlaggedApi() related logic and the related product variables" into main 2024-01-17 00:20:54 +00:00
Jihoon Kang
78b6b30aec Remove HideFlaggedApi() related logic and the related product variables
With the recent build changes to support generating mainlin module sdk
with flagged apis, the build no longer depends on the values of these
product variables in exposing the flagged apis, but these are determined
by the aconfig flags. Given that these variables are no longer used,
this change removes these variables and the variables dependent code.

Test: m nothing --no-skip-soong-tests
Bug: 320515715
Change-Id: I6af94da73cc7fc7ffce670928aad81cec5d383b4
2024-01-16 20:20:27 +00:00
Treehugger Robot
535f739153 Merge "Disable prebuilt apps without an apk later" into main 2024-01-16 18:25:30 +00:00
Cole Faust
97494b197e Disable prebuilt apps without an apk later
Currently, android_app_import modules get disabled during their load
hook if they don't have a set `apk` property. This causes them to be
disabled before soong config variables can be applied, which would've
set the apk property.

Move the disabling into a DefaultableHook, which will run after the
soong config variables.

Bug: 319897584
Test: m nothing --no-skip-soong-tests
Change-Id: Ia0f6a39c35b3b11249bfa74ad532858189be24b1
2024-01-12 17:02:58 -08:00
Jihoon Kang
7e9343b889 Merge changes from topic "hiddenapi_exportable" into main
* changes:
  Copy exportable artifacts to module sdk snapshot
  Enable hiddenapi check for exportable stubs
  Add defaults support for bootclasspath_fragment module type
2024-01-12 23:50:37 +00:00
Cole Faust
a03ac3a75a Allow value variables to set pointer properties
Non-null pointers were always leading to an "unsupported property type"
error due to not updating the kind field.

Bug: 319897584
Test: Presubmits
Change-Id: I058ab8d153d9507f9037d699acf6e1fe4f08f538
2024-01-12 14:28:53 -08:00
Jihoon Kang
bd093457e2 Enable hiddenapi check for exportable stubs
This change modifies the dependencies of the hiddenapi to always depend
on the exportable stubs, instead of the currently utilized everything
stubs.

To support this, the full api surface exportable stubs are defined in a
separate change at the `frameworks/base` project. Note that the full api
surface exportable stubs are only used for the hiddenapi purpose, and
`sdk_version` continues to utilize the currently existing everything
stubs.

Currently, this feature is hidden behind the build flag
"RELEASE_HIDDEN_API_EXPORTABLE_STUBS". This feature will be fully
enabled once metalava fully supports handling of the flagged apis.

Test: ENABLE_HIDDENAPI_FLAGS=true m
Bug: 317426356
Change-Id: I109b7cd27b20ceffcdf1766ab8106b0c276be2b3
2024-01-12 01:03:10 +00:00
Treehugger Robot
744a2a6b7d Merge "Handle installation rules for co-existing prebuilts" into main 2024-01-11 18:46:58 +00:00
Spandan Das
3576e769a4 Handle installation rules for co-existing prebuilts
Every module belonging to a single mainline module family will be
hidden from make, except the one which has been flagged using
apex_contributions

Details
- Introduce a new `source_apex_name` property to prebuilt_apex and
  override_apex. This property will be used to identify the source
  equivalent of a prebuilt soong apex module.
- Create an N-ary tree from source to prebuilt(s). The tree wil be
  rooted at the source module.
- In a subsequent mutator, visit every node in the tree(s). Query
  apex_contributions and store the handle of the node which is "active"
  (if any)
- In the same mutator, do another pass over the tree. Invoke
  `HideFromMake` on every node which is not "active". The two-pass
  approach is needed PrebuiltSelectionInfoProvider does not know about
  the inter source-prebuilt dependency, this dependency can only be
  known by doing a graph walk of the N-ary tree.

Some tangential implementation details
- Each prebuilt apex has an internal deapxer module that is responsible
  for generating the deapex ninja rules. The name of this internal
  module uses the BaseModuleName (without the prebuilt_ prefix). Since
  we can have multiple prebuilt soong modules in trunk stable, change
  this to follow the name of the prebuilt module in order to avoid name
  collisions. Update existing unit tests accordingly

Bug: 316179314
Test: go test ./apex -run TestInstallationRulesForMultipleApexPrebuilts
Test: m nothing --no-skip-soong-tests
Test: presubmits

Change-Id: I58aa99d5e6a9859954614e6db9a8e9e2e581642d
2024-01-11 02:02:59 +00:00
Yu Liu
edeadbfdcf Add container to the path of the merged aconfig files.
Bug: 312769710
Test: CI
Change-Id: I4b8a71cf86a3bcefc4a41360a241aa14b798f6e8
2024-01-10 23:38:09 +00:00
LaMont Jones
afe7baf47d Propagate aconfig providers for more modules.
Bug: 308625757
Test: manual
Change-Id: Iaf6d45a4259f1c6c34476c34c431344283ae2830
2024-01-10 14:03:30 +00: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
LaMont Jones
1e0a69a02e aconfig: harden dependency collection
To prevent errors, when we collect dependencies for a module, walk the
blueprint modules, and ignore blueprint and disabled modules.

This avoids errors in validateAndroidModule when a android.Module (such
as a genrule) depends on a blueprint.Module, and strict checking is
enabled.

Bug: 308625757
Test: manual

Change-Id: I11f0a0b504aa18d6d786cc91319b9d1d9497c04f
2024-01-10 14:02:47 +00:00
Treehugger Robot
ec3887ad2f Merge "Replace panic with ModuleErrorf" into main 2024-01-10 00:16:52 +00:00
Spandan Das
59a4a2b8d2 Replace panic with ModuleErrorf
This is a followup cleanup for aosp/2876754 and replaces panic with
ctx.ModuleErrorf. The latter creates a more expressive build error.

Implementation details
- export moduleErrorf interface from build/soong/android. This minimal
  interface will be used as a parameter for `DexJarBuildPath`
- Add ModuleErrorf to the function signature of DexJarBuildPath. This
  parameter only gets used for Import and SdkLibraryImport structs.
  These two can have duplicate deapexer definitions, and ModuleErrorf
  will be used to report that error
- Create a minimal implementation of `ModuleErrorf` in tests of java and
  apex

Test: m nothing --no-skip-soong-tests
Change-Id: I0febec651f40c3f04deb957e64133c94b80fbd78
2024-01-09 22:53:52 +00:00
Elliott Hughes
10363161e7 "master" was renamed "main".
Test: N/A
Change-Id: I86d5578eaac260e55a9583db7ab49812b4ba1f5d
2024-01-09 22:09:07 +00:00
Colin Cross
8460fab92d Merge "Remove more bp2build" into main 2024-01-08 20:26:14 +00:00
Treehugger Robot
208444ce5d Merge changes from topics "revert-2897484-revert-2897682-dont_limit_systemsdk-JCOOOXGAIF-BSJGJAJAWC", "revert-2897568-revert-2894701-limit_systemsdk-WNEMOTGMRS-ROJNXPXKUV" into main
* changes:
  Revert^2 "Add BUILD_BROKEN_DONT_CHECK_SYSTEMSDK"
  Revert "Revert "Limit System SDK to 34 for Java modules in the v..."
2024-01-06 17:53:41 +00:00
Colin Cross
3cc3154d33 Remove more bp2build
Bug: 315353489
Test: m blueprint_tests
Change-Id: Ib854fe1a448c258fe086691a6e5ed2d98537f5e4
2024-01-05 09:54:09 -08: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
Tongbo Liu
1ce76dfb4c Merge "Enable building whole MCTS and partial MCTS test suites." into main 2024-01-05 05:55:10 +00:00
Zi Wang
c6837a2a8c Merge "Update TestNonExistentPropertyInSoongConfigModule" into main 2024-01-04 23:35:05 +00:00
Jiyong Park
3bb9924c87 Revert^2 "Add BUILD_BROKEN_DONT_CHECK_SYSTEMSDK"
fbf1b5e7f1

Change-Id: I2b6c7866eac24b217197d5f659b37b2ae6b4207d
2024-01-04 23:22:41 +00:00
Jiyong Park
7416d67f28 Revert "Revert "Limit System SDK to 34 for Java modules in the v..."
Revert submission 2897568-revert-2894701-limit_systemsdk-WNEMOTGMRS

Reason for revert: Forward fix was merged

Reverted changes: /q/submissionid:2897568-revert-2894701-limit_systemsdk-WNEMOTGMRS

Change-Id: Id857406513fbf33a20e5d3836742ebd8a0105516
2024-01-04 23:20:42 +00:00
Sebastian Pickl
1f1662217a Revert "Limit System SDK to 34 for Java modules in the vendor pa..."
Revert submission 2894701-limit_systemsdk

Reason for revert: might be breaking builds at 318695834

Bug: 318695834

Reverted changes: /q/submissionid:2894701-limit_systemsdk

Change-Id: I71a87d0a026a444ea9d26f889b3421162e13fea9
2024-01-04 19:28:16 +00:00
Sebastian Pickl
13c52b9963 Merge "Revert "Add BUILD_BROKEN_DONT_CHECK_SYSTEMSDK"" into main 2024-01-04 19:27:24 +00:00
Sebastian Pickl
fbf1b5e7f1 Revert "Add BUILD_BROKEN_DONT_CHECK_SYSTEMSDK"
Revert submission 2897682-dont_limit_systemsdk

Reason for revert: blocking revert for 318695834

Bug:318695834

Reverted changes: /q/submissionid:2897682-dont_limit_systemsdk

Change-Id: I4cf7268cba21c7b81b406c91240bb98190fa4ebc
2024-01-04 19:01:27 +00:00
Joe Onorato
7a0823fb77 Merge "Add BUILD_BROKEN_DONT_CHECK_SYSTEMSDK" into main 2024-01-04 17:40:49 +00:00
Jiyong Park
87312a2fac Add BUILD_BROKEN_DONT_CHECK_SYSTEMSDK
https://android-review.git.corp.google.com/q/topic:limit_systemsdk
introduced a new check for preventing the use of system SDKs above 34
from Java modules in the vendor partition.

As this may break some unprepared targets, introduce
BUILD_BROKEN_DONT_CHECK_SYSTEMSDK as a temporary escape hatch.

This flag will be deleted eventually.

Bug: 314011075
Test: Add BUILD_BROKEN_DONT_CHECK_SYSTEMSDK := true to BoardConfig.mk
Change-Id: Id7901f85c221bc03fa1c15ef15dbec14b783a79a
2024-01-04 22:33:27 +09:00
Jiyong Park
77e105628f Merge "Limit System SDK to 34 for Java modules in the vendor partition" into main 2024-01-04 09:37:36 +00:00
Tongbo Liu
c5f7b96ab5 Enable building whole MCTS and partial MCTS test suites.
Bug: 318608673
Test: m mcts
Change-Id: I2af74e319c40b0e36d8a71e1da3c6934f66a51be
2024-01-04 09:04:18 +00:00
Jiyong Park
ec47e99b4d Limit System SDK to 34 for Java modules in the vendor partition
This change disallows Java modules in the vendor partition to use System
SDK that is newer than API level 34; 34 is the latest allowed.

Background 1: with Trunk Stable, the system/vendor interface is released
at Q2 whereas the system/app interface is released at Q3. In other
words, at Q2, the APIs which will be added to the system SDK at Q3 are
not available. Since the system/vendor interface (which is fronzen at
Q2) is what the modules in the vendor partition will be building
against, they can't and shouldn't use those new APIs that will be added
in the future (Q3). Using those APIs is risky because there's a chance
that those APIs get removed or changed between Q2 and Q3. For example,
2024 Q2 is technically still Android U, not Android V.

Background 2: The use of Java APIs in the vendor partition had many
issues. Most significantly, those "vendor" Java apps are categorized as
part of the system partition because all Java app processes require
access to platform internal libraries that are prohibited to vendor
processes. Furthermore, since the Project Treble, the vendor partition
was re-purposed to a partition to host SoC-dependent bits - usually
HALs. Implementing HALs in Java has never been officially supported and
has had many loop holes.

We'd like to use both background 1 and 2 as a chance to disallow any
Java code in the vendor partition. However, since there are already some
Java modules in the partition, we can't suddenly ban it. The deprecation
will be made gradually, and this CL is the start.

Note that sdk_version: "current" or "system_current" is automatically
overridden into 34 or system_34. This is to prevent sudden breakage of
vendor modules that have been targetting the latest (i.e. current) API
level. They will however fail if they use APIs newer than API level 34.

Bug: 314011075
Test: m blueprint_tests
Change-Id: I59f5ac15ce9ac2ff7cc89e9c110169359077c37c
2024-01-04 13:29:04 +09:00
Cole Faust
3b3a011408 Check for errors in preparer.sh
In case any of the commands fail.

Also skip writing out empty preparer.sh files.

Bug: 314933937
Test: Presubmits
Change-Id: Ia94d032bc4800379608d8a3cf594f25951a3ab32
2024-01-03 15:22:32 -08:00
Colin Cross
138d37dd6c Merge "Support generating module_info.json in Soong" into main 2024-01-03 17:55:47 +00:00
Colin Cross
c67cef48ee Merge "Install vintf fragments and init.rc files in Soong" into main 2024-01-03 16:53:45 +00:00
Treehugger Robot
202bc5b689 Merge "Extract zip_deps preparation work as a script" into main 2024-01-03 05:24:04 +00:00
Jeongik Cha
76e677f93e Extract zip_deps preparation work as a script
If there are lots of files to be packaged, it causes `Argument list too
long` error. So I extracted that as a separate script with
WriteExecutableFileRuleVerbatim, and the method do sharding for long input.

Bug: 314933937
Test: define large system_image definition
Change-Id: Ibf692d4db6da6b7a536cb5b53b15c545e07ff262
2024-01-03 03:58:12 +00:00
Treehugger Robot
5181d0ebfa Merge "Enable Soong to correctly add dependencies to .PHONY targets." into main 2024-01-03 02:58:01 +00:00
Nelson Li
f3c706868a Enable Soong to correctly add dependencies to .PHONY targets.
Previously, Soong's phony simply added "required" or "host_required"
to LOCAL_REQUIRED_MODULES and `include BUILD_PHONY_PACKAGE` without
correctly adding them to the dependency list.

This change add a new `phony_rule` module type to Soong that acts like
`.PHONY` instead of `BUILD_PHONY_PACKAGE`

Bug: 316838256
Bug: 309730110
Test: 1. Use `phony_rule` and adding "phony_deps: [dep_modules]" to
         Android.bp.
      2. make target and check the dep_modules be built.
Change-Id: I3e9e9ac26ecc456668f1b6baf5c08f9c9139b3b2
2024-01-03 02:01:36 +00:00
Colin Cross
d6fd013394 Support generating module_info.json in Soong
Generate module_info.json for some Soong modules in Soong in order to
pass fewer properties to Kati, which can prevent Kati reanalysis when
some Android.bp changes are made.

Soong modules can export a ModuleInfoJSONProvider containing the
data that should be included in module-info.json.  During the androidmk
singleton the providers are collected and written to a single JSON
file.  Make then merges the Soong modules into its own modules.

For now, to keep the result as similar as possible to the
module-info.json currently being generated by Make, only modules that
are exported to Make are written to the Soong module-info.json.

Bug: 309006256
Test: Compare module-info.json
Change-Id: I996520eb48e04743d43ac11c9aba0f3ada7745de
2024-01-02 16:03:43 -08:00
Colin Cross
d9bbf4b424 Install vintf fragments and init.rc files in Soong
Determine the install location of vintf fragments and init.rc files
in Soong so that they are available to Soong-generated module-info.json
entries.  Collect the vintf fragment and init.rc files requested by all Soong
modules, deduplicate the list, and install them in Soong.

Bug: 309006256
Test: Compare module-info.json
Change-Id: I491dc05a773d1a82e485475834d2669fc95cfa1e
2024-01-02 16:01:56 -08:00
Colin Cross
a3759f98a6 Merge "Write raw files to disk instead of the ninja file" into main 2024-01-02 19:44:52 +00:00
Colin Cross
24c1cbe63e Reland "Remove non-generic provider APIs"
There are no more callers to the non-generic provider APIs, remove them.

This reapplies I4d336340e630643f98531787a81e0f1f18ec108d after
I79736e44d85bc6e8c97f08ebf783b40533a3e6ae removed a newly introduced
usage.

Bug: 316410648
Change-Id: I152f8e5ef8330b811d3f42f8c2c73943ac0979bb
Test: builds
2023-12-22 00:06:05 +00:00
Spandan Das
412b33a6e7 Merge "Use the correct bootjars when multiple prebuilt apexes exist" into main 2023-12-20 19:00:49 +00:00
Spandan Das
5be6333692 Use the correct bootjars when multiple prebuilt apexes exist
hiddenapi and dexpreopt require boot and system server jars from apexes.
When building with prebuilts, this comes via
java_import/java_sdk_library_import, which acts as a hook for
prebuilt_apex/apex_set. If we have multiple apexes in the tree, this
hook becomes 1:many. This CL prepares dex_bootjars to select the right
deapexerd .jar files when mutliple prebuilts exist.

Implementation details
- Update prebuilt module types (prebuilt_apex/apex_set) and source
  apexes to set a map of
  library name to dex jar path on host.
- dex_bootjars will access the path of the .dex jar on host via the
  provider. These then
  copied/installed to the right locations.

This CL does not drop the old mechanism to get the dex file (i.e. by
creating a dep on java_library). Once all mainline
modules have been flagged using apex_contributions, the old mechanism
will be dropped

Bug: 308790457
Test: git_master-art-host:art-gtest https://android-build.corp.google.com/builds/abtd/run/L21500030000926533
Test: git_main:art_standalone_dexpreopt_tests https://android-build.corp.google.com/builds/abtd/run/L99000030000891212
Test: Added a unit test that checks that the right .jar is selected
when multiple prebuilts exists

Change-Id: I6ef94135b9303a35135810930af4b641df13a583
2023-12-20 16:43:01 +00:00
Cole Faust
30e32f67fc Merge changes I8b352305,Iadf9e324 into main
* changes:
  Sandbox CtsApkVerityTestDebugFiles
  Include "soong" in sandboxed out paths
2023-12-20 01:35:40 +00:00
Colin Cross
a4cca85eea Merge "Revert "Remove non-generic provider APIs"" into main 2023-12-20 01:00:27 +00:00
Colin Cross
84b68c90ae Revert "Remove non-generic provider APIs"
This reverts commit ad50aca6ab.

Reason for revert: Broke builds when combined with aosp/2876755

Change-Id: I3bfbcb05d8c695b9315b7e8e3f63c6bd5c9dbe36
2023-12-20 00:59:28 +00:00
Colin Cross
e87e278086 Merge "Remove non-generic provider APIs" into main 2023-12-20 00:42:38 +00:00
Colin Cross
31a674571e Write raw files to disk instead of the ninja file
Writing raw files as rules in the ninja file unnecessarily bloats
the ninja file.  Write files immediately to disk instead to files
based on the hash of the contents, and then emit ninja rules to
copy the files into place during the build.  Delete obsolete files
in a singleton at the end of analysis.

Bug: 306029038
Test: Run: m libc_musl_version.h
           touch build/soong/Android.bp
           m libc_musl_version.h
      libc_musl_version.h/genrule.sbox.textproto is not recopied.
Test: Run: lunch aosp_cf_x86_64_phone-userdebug
           m libc_musl_version.h
	   lunch aosp_x86_64-userdebug
	   m libc_musl_version.h
	   lunch aosp_cf_x86_64_phone-userdebug
	   m libc_musl_version.h
      libc_musl_version.h/genrule.sbox.textproto is recopied but restat prevents rerunning the genrule.
Test: Run: touch out/soong/raw-aosp_cf_x86_64_phone/00/foo
           touch build/soong/Android.bp
	   m nothing
      out/soong/raw-aosp_cf_x86_64_phone/00/foo is removed.
Change-Id: I172869c4d49565504794c051e2e8c1f7cf46486e
2023-12-19 16:33:46 -08:00
Spandan Das
96feedc555 Merge "Use the correct prof file when multiple prebuilt apexes exist" into main 2023-12-20 00:02:20 +00:00
Colin Cross
225ad7e8b2 Merge "Remove cc.moduleContext override of android.ModuleContext.*Specific" into main 2023-12-19 23:39:54 +00:00
Spandan Das
da739a30a6 Use the correct prof file when multiple prebuilt apexes exist
Generating boot image requires a .prof file provided by the ART apex.
When building with prebuilts, this comes via the
prebuilt_bootclasspath_fragment module, which acts as a shim for
prebuilt_apex/apex_set. If we have multiple prebuilt apexes in the tree,
this shim becomes 1:many. This CL prepares dex_bootjars to select the
right .prof file when multiple prebuilts exist.

Implementation details
- Update deps mutator of dex_bootjars to create a dep on
  all_apex_contributions. The latter contains information about which
  apex is selected in a specific release configuration. dex_bootjars
  will create a dependency on the selected apex in a postdeps phase
  mutator.
- All apex module types (apex, prebuilt_apex and apex_set) will set a
  provider that contains info about the location of the .prof file on
  host
- dex_bootjars will access the provider of the selected apex to get the
  location of the .prof file

This CL does not drop the old mechanism to get the .prof file (i.e. by
creating a dep on {prebuilt_}bootclasspath_fragment). Once all mainline
modules have been flagged using apex_contributions, the old mechanism
will be dropped

Bug: 308790457
Test: Added a unit test that checks that the right .prof is selected
when multiple prebuilts exists

Change-Id: I40fdb21416c46bed32f6ff187ce5153711ec2c69
2023-12-19 22:37:29 +00:00
Cole Faust
e8561c6108 Include "soong" in sandboxed out paths
Previously, the path to built files in the sandbox would be
out/.intermediates/... instead of out/soong/.intermediates/....

After this cl, it will be out/soong/.intermediates/.... This makes
it more consistent with the non-sandboxed paths, which is easier for
developers.

CtsApkVerityTestDebugFiles is a genrule that's used to find the paths
to other modules. Developers were expected to build it, then copy all
the files listed in its output file to a temporary directory. Those
paths would be wrong before this change.

Bug: 307824623
Test: ./build/soong/tests/genrule_sandbox_test.py CtsApkVerityTestDebugFiles
Change-Id: Iadf9e3240a2c828567e46b6b02cc14004f30e8bf
2023-12-19 12:14:01 -08: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
Spandan Das
fae468ef14 Move validation from FindDeapexerProviderForModule to rdeps
FindDeapexerProviderForModule raises an exception if multiple apexes in
the tree has an export dep on the java module. In prepartation to
support multiple prebuilts, move this error check out of
FindDeapexerProviderForModule and into rdeps. i.e. raise an exception
only if an rdep calls DexJarBuildPath

- This should be a no-op for now.
- In the short-term future, a java import module will be allowed to have
  multiple deapexers. An error will be raised if anyone actually tries
  to depend on the dexjar
- In the long-term future, this function will be removed. All processing
  will be done at the prebuilt apex level and not at the prebuilt java
  library level

Since this check now happens in the moduleCtx of rdeps, add some
additional props to unit tests to ensure that it does not exit early on
unrelated validation checks (e.g. hidden_api prop is not set)

Test: go test ./apex ./java
Bug: 308790457

Change-Id: I3323d993c1ea8f43305834cae8e65b6fe41dfefd
2023-12-18 23:19:47 +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
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
ad50aca6ab Remove non-generic provider APIs
There are no more callers to the non-generic provider APIs, remove them.

Bug: 316410648
Test: builds
Change-Id: I4d336340e630643f98531787a81e0f1f18ec108d
2023-12-14 16:12:22 -08:00
Colin Cross
5a37718c95 Convert ModuleProvder to generic providers API
Convert all of the callers of ModuleProvider/ModuleHasProvider to use the
type-safe android.SingletonModuleProvider API.

Bug: 316410648
Test: builds
Change-Id: I6f11638546b64749e451cebbf33140248dc1d193
2023-12-14 16:12:22 -08: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
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
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
3c0a83d19f Use generics for providers API
Using generics for the providers API allows a type to be associated
with a ProviderKey, resulting in a type-safe API without that doesn't
require runtime type assertions by every caller.

Unfortunately, Go does not allow generic types in methods, only in
functions [1].  This prevents a type-safe API on ModuleContext, and
requires moving the API to be functions that take a ModuleContext as
a parameter.

This CL creates the new API, but doesn't convert all of the callers.

[1] https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#no-parameterized-methods)

Bug: 316410648
Test: builds
Change-Id: I3e30d68b966b730efd968166a38a25cc144bd6de
2023-12-14 16:12:20 -08:00
Cole Faust
8fc38f3761 Add sdk_genrule
Some users want to repackage the results of an sdk module.
Genrules have 3 variants: linux, android, and common_os. The common_os
one produces a snapshot zip file that users want. In order to get
access to it, we need a genrule in the same variant, so create
an sdk_genrule for that.

The sdk_genrule shouldn't have linux/android variants either, because
those other variants would get errors when trying to depend on the
sdk modules because the snapshot zip doesn't exist in those other
variants. The code in arch.go needs to be tweaked to allow a common_os
variant without the other variants.

Bug: 315962165
Test: m dist out/dist/art_release.zip
Change-Id: Idc9b3cae7a525d71aed6bafa0f8724a89f75a94b
2023-12-13 14:11:24 -08:00
Treehugger Robot
392a56e26b Merge "Remove infrastructure to run bp2build" into main am: fa6995f75e am: 1fbc110ba7 am: d9c2df9601
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2864664

Change-Id: I08fa8b09285278381da817ee8283ede481376315
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-12 21:49:13 +00:00
Treehugger Robot
fa6995f75e Merge "Remove infrastructure to run bp2build" into main 2023-12-12 20:03:58 +00:00
Colin Cross
5c298e2c36 Merge "Remove ConvertWithBp2build implementations" into main am: a72573a727 am: cd4b2f21cd am: 8bb537ba9c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2864663

Change-Id: I86ea781dcc4761078a49ee825c47d11fde9d91be
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-12 00:29:45 +00:00
Colin Cross
a72573a727 Merge "Remove ConvertWithBp2build implementations" into main 2023-12-11 23:12:53 +00:00
Yu Liu
3d9c6e9169 Merge "Remove the code for bazel when reading ReleaseAconfigValueSets." into main am: 65287d5dc2 am: 1a91da57f8 am: bac244d6cb
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2864661

Change-Id: Ie6a3fe572b010c918dcb75a2d12d50a56daa3c3a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-08 23:17:17 +00:00
Colin Cross
b63d7b3af7 Remove infrastructure to run bp2build
Bug: 315353489
Test: m blueprint_tests
Change-Id: Idcf6377d389b94c39e4e6ff4b8efa8a9f9e78b17
2023-12-08 13:51:07 -08:00