Commit graph

8133 commits

Author SHA1 Message Date
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
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
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
Rico Wind
c3e6594a0d Merge "Don't run resource shrinking for eng builds" into main 2024-05-14 04:04:17 +00: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
b544a8b9ec Merge changes from topic "reland_embedded_jni" into main
* changes:
  Install transitive deps of jni libs, but not the jni libs themselves
  Add SkipToTransitiveDepsTag interface for dependency tags
  Revert "Revert "Collect transitve deps of jni libs only for bund..."
  Revert^2 "Always embed jni libs and store uncompressed"
2024-05-10 22:53:08 +00:00
Jiyong Park
e716807083 Install transitive deps of jni libs, but not the jni libs themselves
Consider this case:

app --(jni_libs)--> libfoo --(shared_libs)--> libprivate

Only libfoo is embedded into the app. libprivate is not embedded because
libprivate is very likely to be depended on by other components in the
platform, in which case it will anyway be installed to /system/lib.
Embedding libprivate into the app will increase the storage usage as a
whole. Furthermore, if libprivate is not a shared lib but a config file
(of type prebuilt_etc), it can't be embedded and therefore must be
installed outside of the app.

However, a problem occurs when libprivate is not depended on by anyone
else. Then libprivate is not installed to the system partition, causing
an error at runtime.

This CL fixes that by making the jni_libs dependency to implement the
new SKipToTransitiveDepsTag interface. Now, jni_libs themselves are not
installed, but their transitive deps are depended on by the app
containing the jni libs.

Bug: 330276359
Test: m NfcNci and check if libnfc-nci.config is installed.
Test: m CarService and check android.hardware.automotive.evs-V2-ndk.so
is installed as well.
Test: go test ./... under soong/java

Change-Id: I04cc92b7fad768a20ec60a02b3e7534641b1e74d
2024-05-10 14:03:07 +09:00
Justin Yun
40182b6ff3 Remove duplicated CollectDependencyAconfigFiles()
android.ModuleBase already calls aconfigUpdateAndroidBuildActions()
that is the same with CollectDependencyAconfigFiles(). Remove the
CollectDependencyAconfigFiles() to avoid duplication with
aconfigUpdateAndroidBuildActions().

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

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

Bug: 335363964
Test: diff `adb shell printflags` before and after the change.
Change-Id: I52808e442e9fed7db1eae7b7c5ed0b1c5ba74f5d
2024-05-10 10:00:14 +09:00
Jiyong Park
ef5511ff77 Revert "Revert "Collect transitve deps of jni libs only for bund..."
Revert submission 3078746-revert-3075263-MMTOVXSVUO

Reason for revert: relanding with forward fix: aosp/3078748

Reverted changes: /q/submissionid:3078746-revert-3075263-MMTOVXSVUO

Change-Id: I207f6fd83190e258eba8b22c0d6a6f0feea9f87f
2024-05-10 06:12:54 +09:00
Jiyong Park
20df11ef2b Revert^2 "Always embed jni libs and store uncompressed"
a71b90cf81

Change-Id: I1c071c5449fa04adb14d17774f882e6adbff196b
2024-05-10 06:12:54 +09:00
Treehugger Robot
7eaf503cfd Merge "Revert^2 "Remove compilation actions from java sdk library"" into main 2024-05-08 22:28:05 +00:00
Jihoon Kang
a3a05460b4 Revert^2 "Remove compilation actions from java sdk library"
This change modifies the build actions of java_sdk_library module type
so that it does not perform any compilation actions (i.e. does not
create the top level java_sdk_library jar file). Instead, it delegates
the build actions the top level jar file was performing to the
dynamically created ".impl"-suffixed java library module. The build
actions that are delegated to the impl library module include hiddenapi
processing, dexing, and dexpreopt.

This change relands https://r.android.com/3035972. Implementation
changes from the original change:
- "all_apex_contributions" is added as a dependecy to the implementation
  library modules where the parent sdk_library module has a prebuilt
  equivalent. This allows the source apex variant to be hidden from make
  when the prebuilt is active.

Test: patch in internal main, lunch barbet-ap2a-userdebug && m nothing
Test: m nothing --no-skip-soong-tests
Bug: 332785297
Change-Id: I017938e5567aef82e428e7ceb557d9c9090e0257
2024-05-08 17:46:31 +00:00
Treehugger Robot
d02d710570 Merge changes from topic "revert-3075263-MMTOVXSVUO" into main
* changes:
  Revert "Always embed jni libs and store uncompressed"
  Revert "Collect transitve deps of jni libs only for bundled apps"
2024-05-08 09:48:24 +00:00
Sam Chiu
a71b90cf81 Revert "Always embed jni libs and store uncompressed"
Revert submission 3075263

Reason for revert: verifying the test failure b/339332424

Reverted changes: /q/submissionid:3075263

Change-Id: I0e1a526893ee6c591eaefadcee4bbbf321dfc1df
2024-05-08 06:49:33 +00:00
Sam Chiu
4f63dc7904 Revert "Collect transitve deps of jni libs only for bundled apps"
Revert submission 3075263

Reason for revert: verifying the test failure b/339332424

Reverted changes: /q/submissionid:3075263

Change-Id: Id976cba1156b13433d86988eaf41926b7d438433
2024-05-08 06:49:33 +00:00
Jiyong Park
14f7714fb4 Merge changes Ie866b192,I7df993ea into main
* changes:
  Collect transitve deps of jni libs only for bundled apps
  Always embed jni libs and store uncompressed
2024-05-08 01:28:45 +00:00
Cole Faust
3f01580c04 Merge "Make the enabled property configurable" into main 2024-05-07 17:49:10 +00:00
Jihoon Kang
5284ad3b33 Merge "Revert "Remove compilation actions from java sdk library"" into main 2024-05-07 00:03:05 +00:00
Jihoon Kang
8f25d296b5 Revert "Remove compilation actions from java sdk library"
Revert submission 3070882-sdk_lib_remove_compilation

Reason for revert: Potential culprit for build breakage of barbet-ap2a-userdebug in git_main

Reverted changes: /q/submissionid:3070882-sdk_lib_remove_compilation

Change-Id: I5135760e13e0152480c68fe91a3c88564e9bc7cb
2024-05-06 22:40:22 +00:00
Treehugger Robot
f91daab1ab Merge "Remove compilation actions from java sdk library" into main 2024-05-06 21:06:54 +00:00
Jiyong Park
4bc5231f61 Collect transitve deps of jni libs only for bundled apps
We do this because otherwise we will be embedding platform libs in the
bundled apps bloating their size.

Bug: 330276359
Test: Build Galery2 and check if libc++.so is not included there.
Change-Id: Ie866b192e9816bcb71b7ca3d74331d14d85592a4
2024-05-05 10:49:22 +09:00
Jihoon Kang
d831af4267 Remove compilation actions from java sdk library
This change modifies the build actions of java_sdk_library module type
so that it does not perform any compilation actions (i.e. does not
create the top level java_sdk_library jar file). Instead, it delegates
the build actions the top level jar file was performing to the
dynamically created ".impl"-suffixed java library module. The build
actions that are delegated to the impl library module include hiddenapi
processing, dexing, and dexpreopt.

Test: m nothing --no-skip-soong-tests
Bug: 332785297
Change-Id: I7534f9eaacf6d9f72fbf8d540b1e26af84106c20
2024-05-03 20:51:11 +00:00
Treehugger Robot
7a4d748669 Merge "Pass module-lib and system-server extension jars for system-server" into main 2024-05-03 17:54:07 +00:00
Jiyong Park
3eea67d8eb Always embed jni libs and store uncompressed
Previously, unlike unbundled apps, if a platform app depends on a native
library, it is not embedded in the app, but installed to <partition>/lib
and the app is instead provided with a symlink to the lib. This actualy
is a legacy from the original Android where native libraries couldn't be
executed while embedded in the apk. To be executed, the native libs had
to be extracted to a mutable storage, but that had a risk of breaking
the verified boot, so libs couldn't be embedded.

Since API level 23, execute-in-place of native libs has become
possible. But platform apps had to opt-in (use_embedded_native_libs:
true) for the feature for a reason that is unclear today. Perhaps, it
was to save disk space in case when multiple apps share the same native
library, but such cases are found to be very rare, or non-existing.

With this CL, two changes are introduced:

1. jni libs are always embededd for all apps (bundled or unbundled)

2. use_embedded_native_libs is deprecated unless the module type is
   android_test or android_test_helper_app. It is now a
   no-op property. It's left just to not break existing bp files.

This will make unbundled apps bigger, but given that unbundled apps
built using android platform build system are tests, the size increase
should be acceptible.

Bug: 330276359
Test: m
Change-Id: I7df993ea85bce1c0a7222000c403a974818c3362
2024-05-04 01:58:09 +09:00
Oriol Prieto Gascó
a874e94bab Merge "Make container mandatory in aconfig_declarations." into main 2024-05-03 14:09:48 +00:00
Paul Duffin
92efc6107f Pass module-lib and system-server extension jars for system-server
While the `system-server` API surface extends the `module-lib` API
surface a library can only provide one or the other as they appear
in bootclasspath and systemserverclasspath respectively. A library
that is on the bootclasspath cannot provide a `system-server` API
as it would be usable by non-system server code. A library that is
on the systemserverclasspath could provide a `module-lib` API but
there is no point as it would only be usable by the system server
making it effectively a `system-server` API anyway.

As a result the `system-server` extension directories only contain
`service-*` jars for libraries that provide system server APIs.

e.g.
```
$ ls prebuilts/sdk/extensions/11/system-server | cat
api
service-adservices.jar
service-sdksandbox.jar
$ ls prebuilts/sdk/extensions/11/module-lib/ | cat
api
framework-adservices.jar
framework-connectivity.jar
framework-connectivity-t.jar
framework-sdksandbox.jar
framework-tethering.jar
```

So, in order to construct the whole `system-server` API, i.e. the API
visible to the system server, it is necessary to add in the
`module-lib` extension jars too which this change does.

This is necessary to construct an `api-versions.xml` file for the
complete `system-server` API.

Bug: 336993217
Test: TARGETS=$(for i in public system module-lib module-lib-complete system-server-complete; do U=$(echo $i | sed "s|-|_|g"); echo "out/target/common/obj/PACKAGING/api_versions_${U}_generated-api-versions.xml"; done)
      m $TARGETS; mkdir -p before; cp $TARGETS before
      m $TARGETS; mkdir -p after; cp $TARGETS after
      meld before after
      # Review differences.
Change-Id: Ic9652dd28f05e5f569a7a30a84b87f227314d119
2024-05-03 12:21:56 +01:00
Inseob Kim
53507d1559 Merge changes from topic "logtags_filesystem_module" into main
* changes:
  Add logtags support to filesystem module
  Export app's logtags too
2024-05-03 11:20:12 +00:00
Paul Duffin
375acd8def Correct lint error when it cannot find api_versions_* module
Also, fixes the error when it cannot find a module containing the
`annotations.zip` file.

Bug: 336993217
Test: change `apiVersionsModule` setting in `lint.go` to refer to
      a non-existent module and then run `m nothing` to see the
      error message correctly lists the module name.
Change-Id: I84a9e241d1c3bedebc26e119bd4b9861664c43c1
2024-05-03 09:37:42 +01:00
Inseob Kim
364740b4a4 Merge "Merge logtags from cc modules too" into main 2024-05-03 05:10:22 +00:00
Cole Faust
a963b94cde Make the enabled property configurable
This allows using select statements with it.

Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: I6f3efaaa3d82505e38a91ee4ba0e18e404360191
Merged-In: If355d24506e3f117d27b21442a6c02bca3402dc7
2024-05-02 15:41:24 -07:00
Treehugger Robot
a73c4021ec Merge changes I439179a9,I8ad68f0d into main
* changes:
  Add pattern to match android-plus-updatable.jar
  Clean up apiLevelsGenerationFlags deps gathering
2024-05-02 18:17:08 +00:00
Paul Duffin
5a195f40a0 Add pattern to match android-plus-updatable.jar
Change https://r.android.com/3068903 adds some extra
`android-plus-updatable.jar` files in `module-lib` and `system-server`
directories of API versions 30 through 34 in `prebuilts/sdk`. This
change modifies the build to pass those files, along with appropriate
`--android-jar-pattern` options to Metalava so it can use them when
generating `api-versions.xml` files for the different API surfaces.

The extra patterns are only passed when `extension_info_file` is
specified as there is no point in including the updatable modules that
contribute to SDK extensions without providing information about the
SDK extensions as well.

Bug: 337836752
Test: See https://r.android.com/3068903
Change-Id: I439179a9d35a4bb677e3bf87a3aea4a983724534
2024-05-02 17:33:02 +01:00
Paul Duffin
2ced2eb07f Clean up apiLevelsGenerationFlags deps gathering
Restructures the code a little to make it clear that extensions
directories are distinct from dessert release directories.

Bug: 337836752
Test: m --no-skip-soong-tests nothing
Change-Id: I8ad68f0d112e62f8f1ddda1b6718119fe18eb8a9
2024-05-02 08:30:27 +01:00
Inseob Kim
7cadaf6708 Merge "Install classpath protobuf files" into main 2024-05-01 23:58:38 +00:00
Inseob Kim
dd5324938c Install classpath protobuf files
This is to support etc/classpaths for filesystem modules.

Bug: 337993199
Test: m aosp_cf_system_x86_64
Change-Id: I0d5d3dc8af9646a24c8ae97d4d1418ddb0e5f46b
2024-04-30 17:22:58 +09:00
Paul Duffin
6f581637c1 Merge "Pass API surface specific extension jars to Metalava" into main 2024-04-29 19:19:16 +00:00
Inseob Kim
17ce834beb Export app's logtags too
Bug: 336189540
Test: m out/soong/.intermediates/all-event-log-tags.txt
Test: m out/target/common/obj/all-event-log-tags.txt
Change-Id: I3c1f09e57f17e2bea1c79841efc5f8c00c1b4a1c
2024-04-29 17:42:11 +09:00
Inseob Kim
37e0bb0db4 Merge logtags from cc modules too
Merged logtags files will be used for Soong built filesystem images.

Bug: 336189540
Test: m out/soong/.intermediates/all-event-log-tags.txt
Test: m out/target/common/obj/all-event-log-tags.txt
Change-Id: Ib590c2bc8073e9acee6b45ef08092768237cf9d3
2024-04-29 17:40:40 +09:00
Colin Cross
21ed4694c5 Allow overriding android_library_import manifests
Some of the androidx libraries have a transformed manifest
alongside that needs to be used to avoid introducing extra
androidx.startup provider entries.  Add a manifest property
that allows overriding the manifest provided by the aar file.

Bug: 336549758
Test: examine PermissionController.apk
Ignore-AOSP-First: submitting in topic with internal CL
Merged-In: I5c8daf810d2fde9a150cbfe48b4f4216f5d1ba0d
Change-Id: I5c8daf810d2fde9a150cbfe48b4f4216f5d1ba0d
2024-04-25 20:46:22 +00:00
Paul Duffin
58cfc9af9b Pass API surface specific extension jars to Metalava
Previously, it would only pass `public` extension jars. This change
fixes that so it passes the jars for the API surface being generated.

Bug: 336993217
Test: m out/target/common/obj/PACKAGING/api_versions_public_generated-api-versions.xml \
        out/target/common/obj/PACKAGING/api_versions_system_generated-api-versions.xml
      # Compare the following files to make sure that they include public extension
      # APIs and system extension APIs respectively.
      diff \
          out/soong/.intermediates/frameworks/base/api/api_versions_public/android_common/*/metalava_exportable.sbox.textproto \
          out/soong/.intermediates/frameworks/base/api/api_versions_system/android_common/*/metalava_exportable.sbox.textproto
Change-Id: I02e2ec3c8176cfbc3cbd8ac56fb78d12b765eedb
2024-04-25 19:04:32 +01:00
Kevin Liu
cab89b51c3 Added Strict_mode logic catch direct usage of Robolectric reference
When Strict_Mode is true, exclude Robolectric_all-target_upstream from the build pass, instead use the newly added robolectric_all-target_runtime, which compiles the robolectric lib into jar and later being added to final test jar.

Test: atest MyRoboTests
Bug: 334089788
Change-Id: I59291e3cc478e73f65950886853732ff0c5c5db7
2024-04-24 16:54:30 +00:00
Yu Liu
315a53c5cb Make container mandatory in aconfig_declarations.
Bug: 330354107
Test: Unit test and CI.

Ignore-AOSP-First: It is easier to detect all the missing ones in internal
master.
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:e916a2c758d2a95037d1d366e7cd0e10d241d510)
Merged-In: I4ab4271c67a35d0fdcc0b57c27260e29fb7dea56
Change-Id: I4ab4271c67a35d0fdcc0b57c27260e29fb7dea56
2024-04-24 16:41:57 +00:00
Paul Duffin
a4362b937a Merge "Use new --api-lint-previous-api" into main 2024-04-23 13:04:16 +00:00
Rico Wind
8a2427cad2 Merge "Enable non final ids for non BusyBox builds" into main 2024-04-23 04:03:24 +00:00
Treehugger Robot
b0a4e48c15 Merge "PackageFile for permission/*.xml for sdk_library" into main 2024-04-22 23:20:39 +00:00
Treehugger Robot
affbd19c64 Merge "Include stubs type in metalava.rsp filename" into main 2024-04-22 23:15:59 +00:00
Paul Duffin
0a71d7329d Use new --api-lint-previous-api
Bug: 327019023
Test: ./gradlew
Change-Id: Ief4d7380e7242dff4e82df96778af17d56c4fe82
2024-04-22 23:48:19 +01:00
Jihoon Kang
421c1cd796 Include stubs type in metalava.rsp filename
Currently, metalava.rsp filepath for both the everything and the
exportable stubs type are identical, which may lead to incremental build
issues. This change resolves such issue by including the stubs type in
the metalava.rsp filename.

These files cannot be modified as ".../everything/metalava.rsp" and
".../exportable/metalava.rsp" as `FlagWithRspFileInputList(...)`
enforces the rsp filepath to be outside of the outdir, which is
".../everything/" and ".../exportable/", respectively. Thus, this change
continues to generate the rsp file to be generated in the module outdir,
but modifies the name of the rsp files as "everything.metalava.rsp" and
"exportable.metalava.rsp".

This change also simplifies the parameters in metalavaCmd(...) for the
simplicity of the method parameters.

Test: m nothing and inspect output for the everything and the exportable stubs
Bug: 336360490
Change-Id: Ifd4e89ef69808e79ea720199677585f0217f7c1c
2024-04-22 21:29:05 +00:00
Jeongik Cha
00e0991f70 PackageFile for permission/*.xml for sdk_library
Bug: 333311683
Test: build android.bp system image and then check if there is
permission xml file for sdk_library

Change-Id: If5ac1975a7db10d85a1b11c1cd666051e3da546e
2024-04-23 05:49:44 +09:00
Colin Cross
757e88a9df Merge "Convert apex mutator to a TransitionMutator" into main 2024-04-22 18:32:22 +00:00
Rico Wind
7152e82a42 Enable non final ids for non BusyBox builds
Non final ids is a prerequisite for using optimized shrinking and
it will soon be a hard R8 error if you pass final ids in R classes
with optimized shrinking enabled.

Bug: 325905703
Test: SystemUIGo with optimized shrinking
Change-Id: I364edc5a0b22be7b4d737c2aa470a84704d05283
2024-04-22 11:24:36 +00:00
Sorin Basca
db70a80cc7 Merge "Add Java 21 as a known version" into main 2024-04-22 07:08:02 +00:00
Treehugger Robot
40639d7d7a Merge "Support passing multiple last api files to metalava in droidstubs" into main 2024-04-19 20:01:32 +00:00
Jihoon Kang
5623e5425a Support passing multiple last api files to metalava in droidstubs
This change supports passing multiple last api files to metalava,
instead of emitting an error when multiple files are passed as inputs.

The last api file providing modules are filegroups or genrule modules
that output exactly one output file. This change modifies that behavior
so that the filegroups can output multiple api files.

The last api file providing modules are (mostly) generated from the
`prebuilt_apis` sdk module. However, these modules only provide a single
api scope txt files (e.g. system api scope last api file filegroup
would only provide last system api file, not system + public). This
change modifies `prebuilt_apis` by generating "combine" filegroup
modules, that include api files of the subset api scopes as well.

The ordering of the files are handled when generating the combined api
filegroup modules, and droidstubs module does not check whether the
passed api files are in order from the narrowest api scope to the widest
api scope.

Submission of this change will be done once metalava fully supports
handling multiple api files input for api lint and nullness migration.

Test: m nothing
Bug: 321827591
Change-Id: I2066e7ceb7ee7c6d0fd87cd43bfd08db906d4b8f
2024-04-19 10:56:32 +01:00
Sorin Basca
1fe2cc883f Add Java 21 as a known version
Bug: 335612268
Test: Set java_version to 21 in core-all && m
Change-Id: Ie2093187cec75949ae3bb4903edfb6f62aa31f6e
2024-04-19 10:45:55 +01:00
Spandan Das
7e674e69ef Drop use_source_config_var from prebuilt selection
This CL makes this property a no-op from the perspective of prebuilt
selection. The primary user of this was mainline modules, but they have
now switched to RELEASE_APEX_CONTRIBUTIONS_* for prebuilt selection,
both for internal `main` development and in partner drops.

Test: in internal, lunch cf_x86_64_phone-next-userdebug; m nothing; and
verified there was a path to the prebuilt bt apex

Test: in partner workspace, lunch gsi_partner_arm-ap31-userdebug; m
nothing; and verified that there was a path to the prebuilt adservices apex

Bug: 308188211
Change-Id: I124a6dada5c20aca4bdebf70dcbe5bbec28cefbe
2024-04-18 22:35:42 +00:00
Colin Cross
7c035064db Convert apex mutator to a TransitionMutator
Replace the apex mutator with a TransitionMutator.  Requires moving the
base.apexInfo value into a provider so that it is still present for the
Mutate pass.

Test: go test ./...
Test: no change to out/soong/build-${TARGET_PRODUCT}.ninja
Change-Id: I1c898eaf30b4021f0f96f439cc0b3b3173710fc7
2024-04-18 15:08:43 -07:00
Treehugger Robot
17b9a5b8b4 Merge "Allow dexpreopt of source sdklib in prebuilt apex builds" into main 2024-04-18 01:25:15 +00:00
Spandan Das
5ae65ee6e0 Allow dexpreopt of source sdklib in prebuilt apex builds
aosp/2984037 disabled dexperopt of the source apex system server jars
when prebuilts are selected. This was done to prevent duplicate
installation and dex2oat deps.

AOSP art has some additional variants like com.android.art.debug. In
source builds, this apex should contain service-art.jar and
service-art.jar.prof (a dexpeopt artifact). We have a test to check this
(`art_apex_test.py`). If we disable dexpreopt of source sdlib when
prebuilts are selected, this test needs to be disabled. This is the
behavior at ToT.

This CL changes the behavior to enable running this test even when
com.google.android.art prebuilt is active in a specific release
configuraiton. To prevent collisions that prompted aosp/2984037, this CL
special-cases the installation and dex2oat rules instead of disabling
dexpreopt of the source sdklib altogether.

b/331665856 tracks the principled solution to prevent duplicate
dexpreopt rules.

Implementation:
Add a new copyApexSystemServerJarDex arg to GenerateDexpreoptRule API.
If true, the dexjar file will be copied to
out/soong/system_server_jars/. For soong modules, the value of this will
be the inverse of disableSourceApexVariant. Since none of the apex
system server jars are in make, this will be a noop in dexpreopt_gen

Bug: 331665856
Test: modified trunk_staging.scl locally to select
art.google.contributions.prebuilt; mmma art; (with the sibling CL in
topic)

Change-Id: Idb59e424f83d126cdc8b1671dde358745979bd8d
2024-04-17 23:15:20 +00:00
Treehugger Robot
7bfe1377af Merge "Remove extractEncodedDexJarsFromModules" into main 2024-04-17 20:46:34 +00:00
Jihoon Kang
6d6d067c37 Remove extractEncodedDexJarsFromModules
The usages of this function have been removed with
https://r.android.com/2816477 and https://r.android.com/2816578, and
this function is currently unused.

Test: Presubmits
Change-Id: Ic1ae71ade16b930b777fa251febc4d071c0dd65e
2024-04-17 18:19:14 +00:00
Treehugger Robot
9a8255f48e Merge changes from topic "cherrypicker-L27000030003160683:N90900030051335582" into main
* changes:
  Propagate transitive missing optional_uses_libs.
  Refactor the contruction of the manifest check inputs.
2024-04-16 13:35:54 +00:00
Jiakai Zhang
369370818f Propagate transitive missing optional_uses_libs.
Bug: 331528424
Test: m --no-skip-soong-tests
Ignore-AOSP-First: Depends on internal changes. Will cherry-pick once merged.
Merged-In: Ied2821f11b6a5056ecf577e1e25765bc6dd212c0
Change-Id: Ied2821f11b6a5056ecf577e1e25765bc6dd212c0
2024-04-15 12:16:21 +00:00
Jiakai Zhang
f98da19a07 Refactor the contruction of the manifest check inputs.
This is a no-op change for a majority of cases.

Before this change, the contruction of the manifest check inputs is
confusing. It mutates uses_libs properties in place just for the
manifest check, by replacing module names with library names for
direct dependencies and merging library names from CLC for both direct
denpendencies and transitive denpendencies, and then constructs manifest
check inputs from those mutated uses_libs properties. This is
error-prone and leads to insistency: the goal is to check that the CLC
matches the manifest, but the inputs to the check don't reflect the CLC.

After this change, we no longer mutate uses_libs properties in place.
Instead, we maintain a separate list of missing denpendencies, and then
construct manifest check inputs directly from the CLC for all existing
libraries, no matter they are direct or transtive, and from the separate
list of missing libraries. This change makes the logic more
consistent and straightforward, and it also allows us to easily do the
next change, which is to propagate transtive missing denpendencies.

In fact, this change revealed several bugs around library optionality
and order in CLC construction, and fixed them.

Bug: 331528424
Test: m --no-skip-soong-tests
Ignore-AOSP-First: Depends on internal changes. Will cherry-pick once merged.
Merged-In: I0de82e76c47995b54aba9efd41538d950256a95f
Change-Id: I0de82e76c47995b54aba9efd41538d950256a95f
2024-04-15 11:15:41 +00:00
Ronald Braunstein
720146b2f2 Merge "Add "test-only" flag for java modules" into main 2024-04-12 23:13:51 +00:00
Treehugger Robot
c5c54803e6 Merge "Add support for transitive resources to android_library_import" into main 2024-04-12 22:04:27 +00:00
Colin Cross
607bbd64dd Add support for transitive resources to android_library_import
Collect and propagate resource jars from static dependencies of
android_library_import modules.

Bug: 288358614
Test: TestAndroidLibraryOutputFilesRel
Change-Id: I076f3c8e4ce42f71a52b612b77eb0265fa1e974c
2024-04-12 13:45:35 -07:00
Ronald Braunstein
cdc66f4268 Add "test-only" flag for java modules
As part of aosp/3022586 where we added the idea of "test-only" modules
and top_level_test_targets, this CL implements that for java modules.

We let users set "test-only" on java_library, but not on other modules
where the module kind is implicitly test-only, like java_test.
The implementation, not the user decides it is test-only.
We also exclude it from java_defaults.

	% gqui from  "flatten(~/aosp-main-with-phones/out/soong/ownership/all_teams.pb, teams)" proto team.proto:AllTeams 'select teams.kind, count(*) where teams.test_only = true and teams.kind not like "%cc_%" group by teams.kind'
	+--------------------------+----------+
	|        teams.kind        | count(*) |
	+--------------------------+----------+
	| android_test             |     1382 |
	| android_test_helper_app  |     1680 |
	| java_fuzz                |        5 |
	| java_test                |      774 |
	| java_test_helper_library |       29 |
	+--------------------------+----------+

	 % gqui from  "flatten(~/aosp-main-with-phones/out/soong/ownership/all_teams.pb, teams)" proto team.proto:AllTeams 'select teams.kind, count(*) where teams.top_level_target = true and teams.kind not like "%cc_%" group by teams.kind'
	+--------------+----------+
	|  teams.kind  | count(*) |
	+--------------+----------+
	| android_test |     1382 |
	| java_fuzz    |        5 |
	| java_test    |      774 |
	+--------------+----------+

Test: m nothing --no-skip-soong-tests
Test: go test ./java
Test: m all_teams

Bug: b/327280661
Change-Id: I9c3ad947dc3d68d6427abada27449526d69daa6b
2024-04-12 11:42:10 -07:00
Treehugger Robot
80214e550e Merge "Strip relative paths from java_import output files" into main 2024-04-12 01:22:10 +00:00
Colin Cross
5e87f349b8 Strip relative paths from java_import output files
androidx.annotation_annotation is used as a test data file, and
converting it from a java_library to a java_library_import causes
the relative path used in the test data path to change. Clear the
relative path in java_import the same way that other java based
modules do.

Bug: 288358614
Test: TestJavaLibraryOutputFileRel
Change-Id: I1f494110da32e916043ca94ac6ebeeafccc06f9a
2024-04-11 16:51:21 -07:00
Treehugger Robot
0565fdc3cb Merge "Make app.go not executable" into main 2024-04-11 22:26:09 +00:00
Cole Faust
7a51454f5b Make app.go not executable
Test: Presubmits
Change-Id: I983e58980cab2aa58797714c216851a1a7eb7f73
2024-04-11 14:13:20 -07:00
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
Spandan Das
d5b05655bb Merge "Revert "Add the implicit deps of javacRE"" into main 2024-04-11 16:53:12 +00:00
Anna Bauza
d0476e4652 Revert "Add the implicit deps of javacRE"
This reverts commit eaa475107d.

Reason for revert: This cl broke AOSP build, read more b/333846153

Change-Id: I5538a3c78617d7c2db98a11b60cb61269dcec8d3
2024-04-11 09:58:46 +00:00
Spandan Das
fc4d366e38 Merge "Add the implicit deps of javacRE" into main 2024-04-10 20:20:43 +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
Spandan Das
eaa475107d Add the implicit deps of javacRE
This includes
1. the prebuilt javac binary
2. the input .java files
3. the jars that are placed on the classpath during javac

(2) is passed via ${out}.rsp. This rsp file gets populated with the
input java files

For (3), this CL creates a new intermediate file whose content is
comma separated jars available on the classpath (this is the format
expected by rewrapper). This file is then registered in RSPFiles of
javacRE command, so that it gets passed to the rewrapper cmd as
`--input_list_paths`

(rspfiles are necesary for modules like framework-minus-apex to avoid
exceeding cmd line limits)

Bug: 308687455
Test: m framework-minus-apex; # verified that the relevant files are
added as `--inputs` of javac

Change-Id: I2ab9277fc394eb00454ef503c78a9f3451e596ac
2024-04-10 00:37:31 +00:00
Cole Faust
8982b1c49e Remove "exported" ninja variables
There was infrastructure to export ninja variables to bazel. Now that
the bazel migration is cancelled, we don't need it anymore.

Bug: 315353489
Test: m nothing
Change-Id: I298cc2ac7ebd004557be3b30d75f7357cab0b7a0
2024-04-09 09:42:37 -07:00
Nikolay Elenkov
f28b5697b8 Merge "Add secretkeeper-v1-java to platform APIs" into main 2024-04-09 01:59:35 +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
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
Jihoon Kang
32e1b930e9 Merge "Add API compatilibility flags to the exportable stubs" into main 2024-04-03 15:34:43 +00:00
Treehugger Robot
eabd1ef484 Merge "Strip relative paths from android_library_import output files" into main 2024-04-02 21:01:45 +00:00
Colin Cross
28ac2ffc80 Strip relative paths from android_library_import output files
androidx.annotation_annotation is used as a test data file, and
converting it from an android_library to an android_library_import
causes the relative path used in the test data path to change.
Clear the relative path in android_library_import the same way that
android_library and other java based modules do.

Also change the name of classes-combined.jar to the name of the
module so that the output file has the right name if there are no
static dependences that require running the merge_zips step.

Bug: 288358614
Test: TestAndroidLibraryOutputFileRel
Change-Id: I28210aa370a742d789102ff71db3685ca744878f
2024-04-02 12:21:34 -07:00
Zi Wang
ddb2ee512c Move jarjar repackage action before combine action
With this change, the jarjar repackage actions are only on
the local classes of each module instead of the combined jar
that contains the static libs. The static libs don't need
jarjar repackage action on this module level because it has
been repackaged when building itself.

This change also removes the skip_jarjar_repackage property
since it's incompatible with this change. Actually skipping
jarjar repackage on a dep may result in incomplete repackage
on the module output.

Test: CI and observing the build time of SystemUIGoogle
Bug: 328067025
Ignore-AOSP-First: Will cp to aosp
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:78ffdd47a658dec4bf79e63d11a5f0f3b94876a4)
Merged-In: I476d959af025c46d2ba6d3f48ea378a086666a33
Change-Id: I476d959af025c46d2ba6d3f48ea378a086666a33
2024-04-02 16:44:02 +00:00
Ronald Braunstein
c654ad162c Merge "Add test_module_config_host" into main 2024-03-29 22:15:08 +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
Jihoon Kang
472f73fdac Add API compatilibility flags to the exportable stubs
The API compatibility flags allow the APIs that have moved between API
surfaces to be correctly represented in the stub artifacts by passing
the previously released set of APIs and removed APIs. These information
should be passed to metalava when generating the exportable stubs, so
that the APIs that move between the API surfaces are not blocked in the
hiddenapi flags.

Test: patch to 24Q3-beta-release, lunch sdk-trunk_staging-eng && m sdk
dist and ensure that the expected methods are not blocked in the
hiddenapi flags
Bug: 330753520

Change-Id: I030b0a46b09f0cea026fedc879f10d4edfd38ac3
2024-03-28 23:38:02 +00:00
Ronald Braunstein
1a6e7c032a Add test_module_config_host
This pairs with `test_module_config` but also works on the base is a
`java_test_host` module.
e.g.

	test_module_config_host {
	     name: "CtsOsHostTestCases_DERIVED_2566",
	     base: "CtsOsHostTestCases",
	     test_suites: ["general-tests"],
	     include_filters: [ "android.os.cts.StaticSharedLibsHostTests" ],
	     exclude_annotations: [ "androidx.test.filters.FlakyTest","org.junit.Ignore" ],
	}

The new module is composed of the previous and shares much of the same
code.

With respect to build size,
	Without this change, if you build CtsAppSecurityHostTestCases, there
	will be several copies of the jar (and related apks) :
	 *) 1 in framework
	     out/host/linux-x86/framework/CtsAppSecurityHostTestCases.jar
	 *) 1 in testcases for the test
	     out/host/linux-x86/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar
	 *) 1 per compatibility suite testcases
		out/host/linux-x86/mts-documentsui/android-mts-documentsui/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar
		out/host/linux-x86/mts-mediaprovider/android-mts-mediaprovider/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar
		out/host/linux-x86/mts/android-mts/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar
		out/host/linux-x86/cts/android-cts/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar
		out/host/linux-x86/mts-mainline-infra/android-mts-mainline-infra/testcases/CtsAppSecurityHostTestCases/CtsAppSecurityHostTestCases.jar

	A dervived test using CtsAppSecurityHostTestCases as base adds one more
	to its testcases dir:
	  *) derived testcase.
	     out/host/linux-x86/testcases/CtsAppSecurityHostTestCases_presubmit_ExternalStorageApp/CtsAppSecurityHostTestCases.jar

Fixes: b/327280990
Test: m clean && m  CtsOsHostTestCases_DERIVED_2566# as above
Test: atest CtsOsHostTestCases_DERIVED_2566 --collect-tests-only
Test: migrated the 71 TestMapping instances to Android.bp and build them.
  Ran tests on some of them.
  Ran some original `test_module_config` tests derived from `android_test` as well

TODO: Add actions to validate the given filters are valid for the given
test apks/jars.

Change-Id: I115eedb6ff6ba8e72bb49e71867daf49d25ca0f1
2024-03-28 15:07:17 -07:00
Kiyoung Kim
9743bab964 Ensure java level inter partition dependency with VNDK deprecation.
Previously JAVA dependency over partition was checked only when device
VNDK version is not empty. This change updates logic to enforce inter
partition dependency despite of VNDK version based on VNDK deprecation.

Bug: 330100430
Test: AOSP CF build succeeded
Change-Id: I7444ad612aa6c525e61cc5c2a89f5421ab4465b4
2024-03-28 06:50:11 +00:00
Colin Cross
cde5534ccd Support transitive proguard specs in android_library_import
Add support for android_library_import to propagate the proguard specs
from its static dependencies.

Bug: 326265727
Test: TestExportedProguardFlagFiles
Change-Id: I174c1d7937a529958f8d240214b279062ef74868
2024-03-27 14:14:09 -07:00
Colin Cross
eee4ab12fa Disable use_resource_processor when producing a shared library
Passing --shared-lib to aapt2 causes it to add an extra
onResourcesLoaded method that rewrites resources IDs to include
the package ID determined at runtime.  ResourceProcessorBusyBox
has no equivalent functionality, so disable whenever --shared-lib
is found in aaptflags for now.

Fixes: 330646473
Bug: 331641946
Test: manual
Change-Id: Ibb0c2c7bf7a41ab294f5c84b4b6018cc8a63b0f4
2024-03-27 11:58:58 -07:00
Nikolay Elenkov
7ee98928ea Add secretkeeper-v1-java to platform APIs
Bug: 324321147
Test: Manual -- trigger factory reset, confirm ISecretKeeper.deleteAll()
is being called in Trusty logs.

Change-Id: If793f784bc1a8c621a721d15da9aeb1ef11e7334
2024-03-27 06:51:34 +00:00
Gina Ko
465549b579 Revert "Migrate buildinfo.sh script into Soong"
Revert submission 3004875-buildinfo_prop_soong

Reason for revert: DroidMonitor-triggered revert due to breakage b/331462869

Reverted changes: /q/submissionid:3004875-buildinfo_prop_soong

Bug: 331462869
Change-Id: Ib8bbbad29a4ad7b800e6bd1a67a401c2225b78cb
2024-03-26 22:46:11 +00:00
Inseob Kim
5baf2cbcb6 Migrate buildinfo.sh script into Soong
To build system.img in Soong, we need all artifacts including
build.prop. This fully migrates buildinfo.prop file into Soong as a
first step to build build.prop on Soong.

Bug: 322090587
Test: compare build.prop before and after
Test: build multiple times and see build.prop isn't rebuilt
Change-Id: Icaa7e1fdab2a8c169ac00949d3aaf6c8212a1872
2024-03-26 05:55:49 +00:00
Colin Cross
dad2a361ef Revert^2 "Support static_libs for java_import modules"
c6c9c7354b

Change-Id: Id011aca133d7bb45023a63c0f53d84a4d694cc2f
2024-03-23 04:43:41 +00:00