Commit graph

3461 commits

Author SHA1 Message Date
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
Asmita Poddar
1f4475cee1 Merge "Revert "Ensure sscp jars get copied to $OUT/soong/system_server_dexjars"" into main 2024-01-25 10:08:11 +00:00
Spandan Das
b2fd4ff43f Revert "Ensure sscp jars get copied to $OUT/soong/system_server_dexjars"
This reverts commit 0b7089f134.

Reason for revert: Breaks auto builds https://groups.google.com/a/google.com/g/android-build-police/c/DfXeyxkyfYk/m/4SvZa-jkAAAJ

Change-Id: Ia6ebdf64d03284d2318978c35cb87fd4f0b79531
2024-01-25 04:25:38 +00:00
LaMont Jones
d381b62ac4 Merge "Propagate AconfigFiles in ModuleBase." into main 2024-01-25 01:31:12 +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
f5f4ad3db6 Convert coverageMutator to a TransitionMutator
Convert coverageMutator to a TransitionMutator as a step towards
variants-on-demand.

Bug: 319288033
Test: coverage_test.go
Test: treehugger coverage builds
Change-Id: Ic50c0040dea8b42c36b5d784221daa00b7b0d379
2024-01-24 10:17:10 -08:00
Spandan Das
0b7089f134 Ensure sscp jars get copied to $OUT/soong/system_server_dexjars
(This was missed in aosp/2876756, which copied only the bcp jars)

This hardcoded location is used by dex2oat to compile the dexpreopt
artifacts. The copy rules are currently generated by java_(sdk)_library
for source builds, and their prebuilt counterparts in prebuilt builds.

After this change, the copy rule will be bifurcated between source and
prebuilt builds
1. For source builds, it will come from java_(sdk)_library
2. For prebuilt builds, it will come from the top-level prebuilt apex.
   Since there can be multiple prebuilt apexes in trunk stable,
   HideFromMake will be used to determine which deapexed jar to copy.

The bifurfaction is expected to be temporary. It is needed for now since
the `apex_contributions` which will be used for source vs prebuilt
selection have not been populated completely.

Test: Added a unit test
Test: Presubmits
Test: git_master-art-host:
art-gtest (https://android-build.corp.google.com/builds/abtd/run/L40800030001459791)
Test: git_main:art_standalone_tests
(https://android-build.corp.google.com/builds/abtd/run/L09000030001463855)

Bug: 308790457

Change-Id: I3105d3b3a7e5c41cb601d07806f4ea483a61b50a
2024-01-24 05:14:40 +00:00
Cole Faust
22e8abcaa6 Make hiddenAPIFlagFileCategory an int
hiddenAPIFlagFileCategory used to contain function pointers, and is
used in a provider. Providers must be serializable for incremental
soong support, so the function pointers must be removed.

Refactor hiddenAPIFlagFileCategory into a simple int.

Bug: 322069292
Test: m nothing --no-skip-soong-tests
Change-Id: I2bd50fa1b59979f30869b405314cbef16ee345f1
2024-01-23 18:01:47 -08:00
Treehugger Robot
4509f502e5 Merge "Skip strict updatability linting on more apexes" into main 2024-01-18 22:04:11 +00:00
Treehugger Robot
193bb8c317 Merge "Add better error handling to bootDexJar function" into main 2024-01-18 20:38:13 +00:00
Cole Faust
e17f93a193 Skip strict updatability linting on more apexes
strict updatability linting has been disabled for a while now.
In the process of re-enabling it, we need to allowlist all the apexes
that have violations.

Bug: 320698986
Test: Presubmits
Change-Id: I96501bc120d8127cb3675ecbee088ea887fabbc1
2024-01-18 11:25:59 -08:00
Spandan Das
3a3920129d Add better error handling to bootDexJar function
aosp/2876754 missed adding error handling to one of the places which
consumes the dex jar deapexed from prebuilt apexes. This CL ensures that
when we have multiple prebuilt apexes _without_ flagging, the hiddenapi
processing code emits a more descriptive error "Multiple deapxers..."
rather than a cryptic error "<module> does not provide a dex jar"

Test: m nothing --no-skip-soong-tests

Change-Id: I80849fa7cca17d724ac53c94bb353b169175ee28
2024-01-17 20:59:43 +00:00
Kiyoung Kim
6794cc20c5 Merge "Soong works with empty VNDK version" into main 2024-01-17 05:06:21 +00:00
Spandan Das
8a768e6a5c Merge "Drop runtime apex deps from implicit baselineApexAvailable map" into main 2024-01-16 20:37:00 +00:00
Spandan Das
1d15969595 Drop runtime apex deps from implicit baselineApexAvailable map
The availability of these soong modules to com.android.runtime has
been made explicit in Android.bp files

One exception is libz. Making apex_available explicit has some subtle
implications on stub/impl selection which breaks coverage builds.

Bug: 281077552
Test: m nothing
Change-Id: I6db7db6dfcb5c468ca68c3e166fe79b9356c4fa8
2024-01-16 19:25:21 +00:00
Kiyoung Kim
8487c0b876 Soong works with empty VNDK version
This change is to fix more misc issues to enable Soong without VNDK
version. This change contains

* Update properties in generated Android.mk
* Update VNDK APEX build to work without VNDK version

Bug: 316829758
Test: AOSP Cuttlefish build succeeded
Change-Id: I10f3c798299afe2d539ec3426b8e2b6068a158f6
2024-01-15 17:31:10 +09: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
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
Yu Liu
e92e561460 Merge "Add container to the path of the merged aconfig files." into main 2024-01-11 17:04:19 +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
Seungjae Yoo
91ef5bb8a7 Merge "[apex] Add support for prebuilt_etc types in ApexNativeDependencies" into main 2024-01-11 01:09:26 +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
Treehugger Robot
ee18a66643 Merge "Drop wifi apex deps from implicit baselineApexAvailable map" into main 2024-01-10 20:50:25 +00:00
Spandan Das
1050adad02 Drop wifi apex deps from implicit baselineApexAvailable map
The availability of these soong modules to com.android.wifi has
been made explicit in Android.bp files

Bug: 281077552
Test: m nothing
Change-Id: I6ac447ffe4b477a49064ed0ec4081e087f0edf9d
2024-01-10 19:46:28 +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
Kiyoung Kim
4c41458f9c Merge "Split usage of UseVndk" into main 2024-01-10 01:15:45 +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
Alice Wang
4fab2dc673 [apex] Add support for prebuilt_etc types in ApexNativeDependencies
This cl adds support for prebuilt_etc types in
ApexNativeDependencies, this enables us to include rialto only in
the arm64 environment.

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

Bug: 316829758
Test: m nothing --no-skip-soong-tests passed
Change-Id: Ic61fcd16c4554c355f6005894a4519b044b27fe5
2024-01-09 11:37:14 +09:00
Kiyoung Kim
6284e0a935 Merge "Generate image variation without version" into main 2024-01-05 04:57:26 +00:00
Kiyoung Kim
b5fdb2e966 Generate image variation without version
Current CC/Rust Image variations are generated with target VNDK version.
However, this is no longer valid if VNDK is deprecated. This change
generates image variation without version ("vendor", "product") if VNDK
is deprecated.

Bug: 316829758
Test: m nothing --no-skip-soong-tests passed
Test: aosp_cf_x86_64_phone build succeeded
Change-Id: I2387ed8a2632bfd9462621f882a947695ae1653d
2024-01-05 11:15:23 +09:00
Spandan Das
2c3a401c4a Merge "Drop mediaprovider deps from implicit baselineApexAvailable map" into main 2024-01-04 17:43:31 +00:00
Spandan Das
070490ce20 Merge "Drop tethering deps from implicit baselineApexAvailable map" into main 2024-01-03 17:46:31 +00:00
Spandan Das
69d083a065 Drop mediaprovider deps from implicit baselineApexAvailable map
The availability of these soong modules to com.android.mediaprovider has
been made explicit in Android.bp files

Bug: 281077552
Test: m nothing
Change-Id: I4c1e751a2a912271049bd241a01168685716bf9c
2024-01-02 21:57:52 +00:00
Spandan Das
9d0c23f78a Drop tethering deps from implicit baselineApexAvailable map
The availability of these soong modules to com.android.tethering has
been made explicit in Android.bp files

Bug: 281077552
Test: m nothing
Change-Id: Ib96d5ecb8518628fda8c474b10e443abacc9bc21
2024-01-02 18:19:40 +00:00
Spandan Das
64c9e0ce6e Use the correct bootjars for hiddneapi when multiple prebuilts exist
hiddenapi processing require boot jars from apexes to determine the full
set of methods available at runtime.
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 platform_bootclasspath to select the right
deapexerd .jar files when mutliple prebuilts exist.

Implementation details
- Create a dependency edge from platform_bootclasspath to
  all_apex_contributions (DepsMutator)
- For every boot jar, query all_apex_contributions to get the path to
  dexjar file (GenerateAndroidBuildActions)

Some other important details
- 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
- This CL has a functional change when building with source apexes. At
  ToT, the unecoded hiddenapi dex jar is used for package check and
  generating the monolithic stub file. After this change, the hiddenapi
  encoded file will be used for these operations.
  This should be fine since the
  package and dex signature do not change across the encoded and
  unencoded dex file. In fact, we already have a split today. When
  building with prebuilts, we use the encoded dex file. When building
  with source, we use the unecoded dex file.

Test: Added a unit test
Test: Manual testing in internal described below
- lunch cf_x86_64_phone-next-userdebug
- flagged com.google.android.adservices using apex_contributions
- aninja -t commands out/soong/hiddenapi/hiddenapi-stubs-flags.txt # no
  diff before and after
Bug: 308790777

Change-Id: I72c70f0ae1b587679203ea254c9c12a48e7aa782
2024-01-02 17:56:14 +00:00
Colin Cross
ad579a8c71 Merge changes I152f8e5e,I3259a9b8 into main
* changes:
  Reland "Remove non-generic provider APIs"
  Update usage of SetProvider
2023-12-22 17:40:00 +00:00
Spandan Das
a41b8ecc62 Update usage of SetProvider
Test: go build ./apex (top of stack)
Change-Id: I3259a9b88c6a22f94e41ef43e2c42d9ea56c2afb
2023-12-22 00:06:05 +00:00
Spandan Das
3858202715 Drop libprofile modules from baselinseApexAvailable map
The implicit //apex_available:anyapex seems to be unused, so we can drop
it

Bug: 281077552
Test: m nothing
Change-Id: I66fef50901bfd19237a9ef96b169ecefa01d76b9
2023-12-21 20:18:48 +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
Spandan Das
96feedc555 Merge "Use the correct prof file when multiple prebuilt apexes exist" into main 2023-12-20 00:02:20 +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
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
Spandan Das
2069c3f74d Move dexpreopt processing from java_*_import to prebuilt_apex
dexpreopt of apex system server from prebuilts involves three soong
modules
1. prebuilt_apex / apex_set
2. an internal deapexer module created by the prebuilt apex
3. java_import/java_sdk_library

(3) acts as a shim for the deapexer to set the dexjar extracted from the
prebuilt apex. This methodolody requires a 1:1 correspondence across the
three modules

This breaks down when we have multiple versions of the same prebuilt
apex in the tree. In preparation for this, move the dexpreopt
processing from (3) to (1). Each prebuilt_apex will create the necessary
rules for dexpreopting the jars deapexed from itself. In the future,
apex_contributions will be used to pick which service-foo.{odex|.vdex} to
install depending on which prebuilt apex is selected.

Implementation details
- Embed dexpreopter in prebuiltApex structs so that this module type can
  register the dexpreopt rules. Since a single apex can have multiple
  system server jars, this also requires creating an additional scope in
  dexpreopt.go to prevent name collisions
- Add the dexpreopt modules as required in initApexFilesForAndroidMk
- Add the depreopt modules to androidMk in AndroidMkEntries. Drop the
  equivalent from java_import and java_sdk_library_import

Bug: 308790457
Test: existing soong unit tests
Test: lunch cf_x86_64_phone-next-userdebug && m out/target/product/vsoc_x86_64/system/apex/com.google.android.adservices.apex
Test: Verified that the above command installs
/out/target/product/vsoc_x86_64/system/framework/oat/x86_64/apex@com.android.adservices@javalib@service-adservices.jar@classes.{odex|vdex} and the equivalent files of service-sdksandbox

Test: presubmits

Change-Id: I01cea8956d2857fb864b415e73d3d2686d069b5e
2023-12-18 23:17:26 +00: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
Yu Liu
cec0e410cd Support rust modules when packaging aconfig files in apex.
Also remove the code to package aconfig files for transitive
dependencies since those files should have already been included in the
direct dependencies.

Bug: 311173471
Test: Unit tests
Change-Id: I25637af9381f71a78b70a8de9894618188c9735d
2023-12-11 17:43:07 -08:00
Colin Cross
8ff105860d Remove ConvertWithBp2build implementations
Remove the ConvertWithBp2build implementations from all the module
types, along with the related code.

Bug: 315353489
Test: m blueprint_tests
Change-Id: I212672286686a318893bc7348ddd5a5ec51e77a7
2023-12-08 13:51:05 -08:00
Colin Cross
d788b3e6cb Merge aconfig files per-module
Passing the list of all transitive aconfig files to Make causes extra
Kati analysis runs when dependencies are changed in Android.bp files.
Since Make is going to merge them anyways, merge them per-module and
pass a single aconfig file to Make for each module.

Fixes: 313698230
Test: m out/target/product/vsoc_x86_64/system/etc/aconfig_flags.pb
Change-Id: Ifde4826bc93bc06e40338f72b4cb39eed26ca08d
2023-12-07 04:17:37 +00:00
Jooyung Han
2034875cac Error if vendor apex adds an LLNDK library
This is a common mistake when creating a vendor apex. They often try to
list all dependencies. Adding an LLNDK results in putting a stub library
in APEX, which simply doesn't work.

This change prevents stubs from being added to APEX.

Bug: 314033460
Test: go test ./apex
Change-Id: Ic3365047028d9ab6f06992d52aece5a3890177bb
2023-12-05 15:23:56 +09:00
Treehugger Robot
fedbb5c3be Merge changes from topics "libz-no-stubs-for-vendor", "vendor-etc-linker-config" into main
* changes:
  Generate vendor specific STUB_LIBRARIES
  Add cc_library.target.vendor.no_stubs
2023-12-05 05:47:08 +00:00
Colin Cross
2998c33d43 Merge "Add TestContext parameter to ContentFromFileRuleForTests" into main 2023-12-05 00:29:10 +00:00
Jooyung Han
85707de8c1 Add cc_library.target.vendor.no_stubs
This is to handle libz special case. libz has stubs but not an LLNDK.
So, libz.vendor should be treated as non-stub-providing libraries and
Vendor APEX should bundle it if it's used by its contents.

libz will set no_stubs for vendor/product variants.

Bug: 313806237
Test: go tests ./apex/...
Change-Id: I10759d7073838909126f8bfe87654f11aa02fd32
2023-12-04 11:06:20 +09:00
Colin Cross
f61d03d241 Add TestContext parameter to ContentFromFileRuleForTests
The next CL will need a TestContext parameter in
ContentFromFileRuleForTests in order to retrieve the file rule contents
from the Config.  Add it and update all the tests that use it in order
to simply review of the next CL.

Bug: 306029038
Test: go test ./...
Change-Id: Ia4b4c9854017ea3472fa2f8ba42cf7f72720496e
2023-12-03 17:22:56 -08:00
Yu Liu
9dc6b1025d Merge "Add container property to aconfig_declarations." into main 2023-11-30 21:33:34 +00:00
Colin Cross
74656ccf35 Merge "Don't write license data to Android-${TARGET_PRODUCT}.mk" into main 2023-11-28 22:51:32 +00:00
Yu Liu
eae7b36699 Add container property to aconfig_declarations.
Bug: 311155208
Test: Unit test
Change-Id: I7b187138856d0144203961e82b6dad5e2f8eed9d
2023-11-28 12:37:02 -08:00
Inseob Kim
6a4bb378df Merge "Allow apex to use generated file_contexts" into main 2023-11-22 07:45:53 +00:00
Colin Cross
a16bd6b714 Don't write license data to Android-${TARGET_PRODUCT}.mk
All the necessary license data is already propagated through the license
metadata file, and the entries in Android-${TARGET_PRODUCT}.mk are not
used.  Remove them, which should both reduce the size and parsing cost
of the Android-${TARGET_PRODUCT}.mk file and also removes a variable
that changes when dependencies are added or removed, which will
eventually allow running kati less often.

Bug: 309006256
Test: No change to out/Android-aosp_cf_x86_64_phone.ninja
Change-Id: Idfeb6fd10d77497ca274f8e74fe8e994ce1cafe6
2023-11-21 15:27:44 -08:00
Colin Cross
d442a0e882 Add DataPath.ToRelativeInstallPath
Add a method to DataPath that converts it to the relative install path
in preparation for adding additional complexity to DataPath.

Bug: 311428265
Test: builds
Change-Id: I65b06238aafda2db72c6a253744a3087976451cd
2023-11-17 19:06:50 -08:00
Colin Cross
09ad3a6505 Change deps of ctx.Install* from Paths to InstallPaths
Installed files should only depend on other installed files, change
the deps arguments of the ctx.Install* methods from Paths to
InstallPaths.

Bug: 311428265
Test: builds
Change-Id: I1ebef60a943bdbe907744cc43aa985371ac56d32
Merged-In: I1ebef60a943bdbe907744cc43aa985371ac56d32
2023-11-17 19:06:43 -08:00
Inseob Kim
28d06d2eac Allow apex to use generated file_contexts
To support trunk stable, file_contexts files should be processed before
creating APEX images. That means that file_contexts may be under out/.
This change relaxes the path check so we can use Soong-generated
file_contexts, not only the real source file_contexts. Of course the
restriction that modules should be under system/sepolicy is still
enforced.

Bug: 306563735
Test: build with generated file_contexts; see virt apex
Change-Id: I3aa368b338141d4826fc8622e1c8d2838bfd8484
2023-11-17 18:06:45 +09:00
Colin Cross
d7812415c3 Merge "Stop collecting path entry for module_bp_java_deps.json from each module type" into main 2023-11-15 21:01:38 +00:00
Colin Cross
a644c263dd Stop collecting path entry for module_bp_java_deps.json from each module type
The jdepsGeneratorSingleton can get the module path directly, it doesn't
need to be collected by each module type that implements IDEInfo.  Fixes
module types (like android_library) that didn't reach the code that
collected the path.

Bug: 309835196
Test: out/soong/module_bp_java_deps.json contains path for ExtServices.core
Change-Id: If8cb81b4f708e0367f156ade164bee253bf53492
2023-11-15 11:40:48 -08:00
Jooyung Han
fed9cce4b6 Use vendor_file for vendor apex root
It was 'vendor_apex_metadata_file', but root directories can be simply
labelled as 'vendor_file' so that linker can resolve paths in vendor
apexes.

Bug: 310528686
Test: m blueprint_tests
Change-Id: I689b23efccb7be61980e791e185fcef28a76d9bc
2023-11-14 13:52:51 +09:00
Spandan Das
39e21ee0dd Remove redundant baseline apex_available entries
These soong modules list the relevant apex_available values explicitly
in Android.bp files

Test: m nothing
Bug: 281077552
Change-Id: I7ec8e0f9d7ab7cbfb881d59d3e5d2bb8a2975ff8
2023-11-13 21:36:15 +00:00
Spandan Das
bf6f44167f Remove empty baseline apex_available maps
And com.android.appsearch since the lone entry in the map specifies
com.android.appsearch in its Android.bp file explicitly

Bug: 281077552
Test: m nothing
Change-Id: I0b7e37f0b6ace21d37c8b0077bacf83b49318744
2023-11-13 21:06:16 +00:00
Jiakai Zhang
04445d5443 Merge "Use the correct mainline BCP jars for app dexpreopt." into main 2023-11-08 10:56:58 +00:00
Jooyung Han
55a7306aeb Add check for unwanted_transitive_deps
apex.unwanted_transitive_deps can break the APEX when any of listed deps
is actually needed. To avoid that, a new validation is added to see if
"unwanted" deps are actually not used by any ELF files in the APEX.

The new validation runs only for non-test apexes with
unwanted_transitive_deps set because test apexes can be broken
intentionally.

Bug: 295593640
Test: m com.android.virt
Change-Id: I29a3f7ef76b59594a08cfacca4811f16bf7172cc
2023-11-07 13:09:56 +09:00
Jiakai Zhang
c6879f3ddd Use the correct mainline BCP jars for app dexpreopt.
Before this change, the build system had special logic to find mainline
BCP jars and copy them to a special location for app dexpreopt. This
logic doesn't work on `next`. In fact, we don't need this logic anymore.
Since we are now generating the mainline boot image extension, we can
reference the inputs of the mainline boot image extension, which are
exactly the mainline BCP jars needed for app dexpreopt.

Bug: 309302263
Test: atest art_standalone_dexpreopt_tests (on next)
Test: m --no-skip-soong-tests nothing

Change-Id: I055018ffbc5d7e5678f305e65a7f1c7e73bf3b99
2023-11-06 18:44:52 +00:00
Jooyung Han
912a6f3501 Enable dup check for test apexes
Bug: 263308515
Test: m test_broken_com.android.art
Change-Id: I54aaba9424973f4d54c5a17f640cd79ac5dd28ec
2023-11-02 18:31:37 +09:00
Jooyung Han
a8bd72aec2 Add apex.unwanted_transitive_deps property
It can be used as a workaround when the current build system adds more
than necessary to APEX.

Bug: 263308515
Bug: 295593640
Test: m blueprint_tests
Change-Id: Ib59c4ac59e6128b3d112b97876e9e2d1e6ec4211
2023-11-02 18:31:37 +09:00
Jooyung Han
78a658b81f Merge changes from topic "fix-apexkeys" into main
* changes:
  Rewrite how to generate apexkeys.txt
  Refactor around apexKeysText singleton
2023-11-01 05:13:06 +00:00
Jooyung Han
286957df99 Rewrite how to generate apexkeys.txt
Instead of listing all apexes in the source tree, now each apex emits
its own fragment for apexkeys.txt, which is pointed by
LOCAL_APEX_KEYS_FILE. Makefile collects apexkeys.txt from installed apex
files. This is to avoid listing unrelated apexes (not installed,
testdata, unexported namespaces, etc.)

Bug: 304914238
Test: m apexkeys.txt
Test: m blueprint-tests
Change-Id: Iefbe6e486cb418955584ad1a282455307e90be95
2023-10-30 16:48:36 +09:00
Jooyung Han
2cf35e7bfd Refactor around apexKeysText singleton
apexkeys.txt should list the installed apexes. But for now it lists all
apexes in the source tree. To fix this, each apex(or prebuilt/apexset)
will generate its own apexkey info and they'll be merged into a single
text only for installed apexes.

This change is a preparation before the upcoming change. We'll reuse the
apexKeyEntry stuff from the current implementation.

Bug: 304914238
Test: m blueprint_tests
Change-Id: If9d5d992e5e2b0120e017265d2590b1c55152f52
2023-10-30 11:17:16 +09:00
Justin Yun
d578412cf1 Stop using VNDK from product partition
Product modules install required vndk modules in /product/lib[64].
But still the product modules can link to the llndk from system
partition using the list in /system/etc/llndk.libraries.txt.
To install /system/etc/llndk.libraries.txt file, use
llndk_libraries_txt singleton without versioned name.

Until VNDK is fully removed, the vndk apex must install the versioned
llndk.libraries.<ver>.txt file to the vndk apex.
Use llndk_libraries_txt_for_apex singleton for this purpose.

Test: lunch cf_x86_64_phone-next-userdebug; m
Test: atest GtsVndkDependencyTestCases
Bug: 299867815
Bug: 302255959
Change-Id: I058616081fe31597a9b76b772b69927807436896
2023-10-25 14:36:04 +09:00
Jihoon Kang
cc9e2186e2 Fix build configuration dependant Soong test
This change fixes a Soong test that is dependent on the build
configuration (from-source stub build vs from-text stub build) by
setting the test configuration to build from source stub and add
an additional test case configured with build from text stub so
that the expected behaviors of both from-source and from-text
stub builds can be tested.

Bug: 275570206
Test: m nothing && m nothing --build-from-text-stub
Change-Id: I483be27ad3eebbf6af050e80265859919fc28fd8
2023-10-20 09:24:50 +00:00
Justin Yun
ce12ea8f95 Merge "Generate product variants by default" into main 2023-10-04 06:29:31 +00:00
Colin Cross
004bd3f526 Revert "Split Rust crate builds into compile and link phases."
This reverts commit e7c71c344d.
The intermediates created by the separated rust compile steps are very
large, on the order of 60GB.  This is more than CI can support for now,
revert the split into compile and link phases.  This comes at the expense
of incremental build time, especially when modifying C/C++ sources that
are dependencies of rust modules.

Bug: 293349612
Test: builds
Change-Id: I81169e7d0727330c8de5e7688dcdc87fe7b8d3b5
2023-10-02 22:15:55 -07:00
Justin Yun
af1fde43f9 Generate product variants by default
PRODUCT_PRODUCT_VNDK_VERSION is set to 'current' by default. Now, we
can generate product variants without checking the
PRODUCT_PRODUCT_VNDK_VERSION build variable. Remove reading the
PRODUCT_PRODUCT_VNDK_VERSION variable from soong and generate product
variants by default.

Bug: 302255959
Test: m
Change-Id: I9a9b2076f4367c5ce9a393bbb206f8dee3884bd8
2023-09-27 16:36:40 +09:00
Colin Cross
40c7bae1df Merge changes from topics "revert-2629131-sandbox-rust-inputs-JRFPQTIPEY", "revert-2758566-WBNIADIEXA" into main
* changes:
  Revert^3 "add rust_toolchain_rustc_prebuilt module type"
  Revert^3 "add crate_root property to rust modules"
  Revert^3 "allow Ninja variables in RuleBuilder API"
  Revert "conditionally escape rule builder command"
  Revert "support sandboxed rust rules"
  Revert "fix failing rust_aconfig_library test"
  Revert "rustSetToolchainSource to use linux-x86 srcs"
  Revert "remove rust deps on clang prebuilts"
2023-09-23 05:19:13 +00:00
Wen-yi Chu
41326c1f41 Revert "support sandboxed rust rules"
Revert submission 2629131-sandbox-rust-inputs

Reason for revert: Fail on android build.

Reverted changes: /q/submissionid:2629131-sandbox-rust-inputs

Change-Id: Ifd9aa46e80a12d8f4ffa0a2daa74b96727cbb7e6
2023-09-22 22:05:54 +00:00
Jooyung Han
90934ac906 Use assemble_vintf output for vintf fragments in APEX
With aosp/2681229, assemble_vintf modifies the input, instead of
checking. APEX should use the output of assemble_vintf instead of
running it as validation.

Bug: 299034304
Test: m
Change-Id: I9446908e1df85b4f3f89d29ebe9cace3982d7757
2023-09-22 15:47:15 +09:00
Sam Delmerico
52d1cc334b Merge changes from topics "revert-2746976-revert-2605644-rulebuilder-ninja-vars-OAAWYCDDLT-KMAGKVIXAT", "sandbox-rust-inputs" into main
* changes:
  support sandboxed rust rules
  conditionally escape rule builder command
  Revert^2 "allow Ninja variables in RuleBuilder API"
  Revert^2 "add crate_root property to rust modules"
  Revert^2 "add rust_toolchain_rustc_prebuilt module type"
2023-09-20 18:48:21 +00:00
Christopher Parsons
c331812a59 Merge "Have ConvertWBp2build use Bp2buildMutatorContext" into main 2023-09-20 17:56:24 +00:00
Chris Parsons
637458d326 Have ConvertWBp2build use Bp2buildMutatorContext
This no-op refactoring facilitates some upcoming functional changes for
"bp2build allowlist v2". The work requires that the bp2build conversion
mutator be changed from a TopDown mutator to a BottomUp mutator.
Refactoring all bp2build-related methods so that they use Bp2buildMutatorContext
makes it easier to make this functional change without touching tens of
files and multiple projects.

Bug: 285631638
Test: m bp2build
Change-Id: I3d1ef3064146e959c6f0dc315350fc9764bf2bd2
2023-09-20 14:49:35 +00:00
Liz Kammer
9e2a5a7d6d Don't panic for unhandled product vars
Instead, we return an error. This allows us to access some product
variable information earlier when it will not be used as an attribute
without panicing

Test: m nothing
Change-Id: Id094b2b9e1364a8d174d99b3824fa149fb235b3e
2023-09-19 15:58:22 -04:00
Sam Delmerico
a588d153c8 support sandboxed rust rules
This commit adds support for compiling rust rules inside the sbox
sandbox. To compile a rust module with sandboxing enabled, the entry
point to the crate must be specified via the `crate_root` property, and
all input sources and compile-time data must be specified via the `srcs`
and `compile_data` properties.

Bug: 286077158
Change-Id: I8c9dc5cf7578037a583b4be2e2f73cf20ffd4408
2023-09-15 22:46:56 +00:00
Jooyung Han
e615441832 apex: validate vintf fragments in vendor APEX
In Make, vintf fragments are checked with assemble_vintf. Since vendor
APEXes can have vintf fragments, perform the same check with vintf
fragments in APEX.

Bug: 299034304
Test: m test.bad2.com.android.hardware.wifi
  (should fail if its module type is `apex`)
Change-Id: I2f9ed50066b9b499b3562bfa51214c1e375d5747
2023-09-08 21:36:00 +09:00
Jooyung Han
4bc102672a apex: invoke conv_linker_config validate as validation
`conv_linker_config validate` command is used to validate the linker
configuration embedded in APEX to detect common mistakes.

For example, when used in APEX, linker configuration can't set
provideLibs/requireLibs. For APEX, there are
provideSharedLibs/requireSharedLibs in APEX manifest for that purpose.

One might make mistake by setting provideLibs in linker config.
Now, when these unsupported properties are set, there'll be build-time
error like:

 // set provideLibs key in com.android.art's linker config.
 $ m com.android.art
   ...image.apex/etc/linker.config.pb: provideLibs is set. Use provideSharedLibs in apex_manifest

Bug: 264341796
Test: m com.android.art (see above)
Change-Id: Ibaf7322616ad333569e6d721680f3d72243402a2
2023-09-08 15:40:12 +09:00
Kiyoung Kim
86b9b13607 Merge "Temporarily link Vendor APEX with vendor libbinder when VNDK deprecated" into main 2023-09-08 04:21:17 +00:00
Treehugger Robot
8763530dff Merge "android_app APEX_GLOBAL_MIN_SDK_VERSION_OVERRIDE" into main 2023-09-07 16:55:45 +00:00
Kiyoung Kim
cbe2ba04b7 Temporarily link Vendor APEX with vendor libbinder when VNDK deprecated
As VNDK is in deprecation, any Vendor APEX which used use_vndk_as_stable
should copy former-VNDK libraries into its own APEX. However, libbinder
is not allowed to create APEX variant, so it should use libbinder_ndk
instead. This change is to temporalily allow Vendor APEX modules link
with libbinder in /vendor/lib, while any Vendor APEX modules using
libbinder transit into libbinder_ndk.

Bug: 296491928
Test: Cheetah build and boot succeeded
Change-Id: I40beb255bab658b75685e78f48e14520058616d6
2023-09-07 16:18:27 +09:00
Sam Delmerico
0e0d96efa7 android_app APEX_GLOBAL_MIN_SDK_VERSION_OVERRIDE
Currently the product variable that is controlled by
APEX_GLOBAL_MIN_SDK_VERSION_OVERRIDE only overrides apexes, but it
doesn't apply to android_apps. This commit allows android_apps which set
updatable: true in their Android.bp to have their min_sdk_version be
overriden by this product variable.

Bug: 295311875
Test: go test
Change-Id: If3cb82a17cae4553b577dd1a4637ee13c3c95302
2023-09-05 21:38:16 +00:00
Jiakai Zhang
9c60c17fb3 Support adding a library as both a JNI library and a regular library.
Bug: 299087066
Test: m nothing
Change-Id: I6cafe23395b7306727a071ccefe3b189c56e928b
2023-09-05 15:20:53 +01:00
Jooyung Han
138ee09e28 Merge changes from topic "deprecate-zip-apex" into main
* changes:
  apex: Remove host support
  apex: Remove apexPackagingMutator
  apex: Remove 'zip' apex support
2023-08-23 23:48:43 +00:00
Jooyung Han
8d4a1f03b0 apex: Remove host support
Since we no longer support "zip" APEX, we don't need "host" support.

For example, we don't need go/python binary support.

Bug: 279835185
Test: m
Change-Id: I6e8d2b205e42662f31866dc9ac7507524effd144
2023-08-23 14:01:21 +09:00
Jooyung Han
a0503a51a0 apex: Remove apexPackagingMutator
Bug: 279835185
Test: m
Change-Id: I2f5293a5a86d2ea66c1107659abc2e746fe2775e
2023-08-23 14:01:17 +09:00
Jooyung Han
06a8a1c384 apex: Remove 'zip' apex support
zip apex is no longer supported.

Bug: 279835185
Test: m
Change-Id: I651b0dc4e0efe766f61e97b1e5dd263e0ab74102
2023-08-23 14:01:13 +09:00
Cole Faust
d22afe96d7 Add apex compat symlinks to LOCAL_SOONG_INSTALL_SYMLINKS
We want to make FULL_SYSTEMIMAGE_DEPS more accurate so that we can
remove the need for `m installclean`.

Currently, the compat symlinks are installed by adding them as
dependencies of other installed files. Doing this doesn't end up
propagaing the compat symlinks all the way to FULL_SYSTEMIMAGE_DEPS.

Add them to LOCAL_SOONG_INSTALL_SYMLINKS, which will cause them to
be propagated to FULL_SYSTEMIMAGE_DEPS.

Bug: 205632228
Test: Full build with a change to delete files not in FULL_SYSTEMIMAGE_DEPS from the staging dir
Change-Id: Idc7fc0a0dbf7c8ac3f0628c16413cd1df69a7821
2023-08-22 11:59:07 -07:00
Chun-Yi Lee
516a188206 Merge "Revert "Add apex compat symlinks to LOCAL_SOONG_INSTALL_SYMLINKS"" into main 2023-08-22 02:11:23 +00:00
Chun-Yi Lee
0a693c5b5c Revert "Add apex compat symlinks to LOCAL_SOONG_INSTALL_SYMLINKS"
Revert submission 2718295-colefaust_track_apex_compat_symlinks

Reason for revert: To validate if this change is causing the build breakage.

Reverted changes: /q/submissionid:2718295-colefaust_track_apex_compat_symlinks

Change-Id: I1896530219cf984efdf9ca7f4b14d8784367f242
2023-08-22 01:18:45 +00:00
Cole Faust
f36d157ce7 Merge "Add apex compat symlinks to LOCAL_SOONG_INSTALL_SYMLINKS" into main 2023-08-21 21:54:37 +00:00
Cole Faust
b23d574655 Add apex compat symlinks to LOCAL_SOONG_INSTALL_SYMLINKS
We want to make FULL_SYSTEMIMAGE_DEPS more accurate so that we can
remove the need for `m installclean`.

Currently, the compat symlinks are installed by adding them as
dependencies of other installed files. Doing this doesn't end up
propagaing the compat symlinks all the way to FULL_SYSTEMIMAGE_DEPS.

Add them to LOCAL_SOONG_INSTALL_SYMLINKS, which will cause them to
be propagated to FULL_SYSTEMIMAGE_DEPS.

Bug: 205632228
Test: Full build with a change to delete files not in FULL_SYSTEMIMAGE_DEPS from the staging dir
Change-Id: I0600ccf8d863d5e29e044c82293ece730fc98d43
2023-08-18 16:05:44 -07:00
Alex Buynytskyy
655ad9a236 Merge "Ignore some prebuilt vndk libs for trunk-stable next" into main 2023-08-18 17:51:23 +00:00
Justin Yun
f14beafb7c Ignore some prebuilt vndk libs for trunk-stable next
Source tree may include prebuilt vndk snapshot libs that are newer
than or equal to the PLATFORM_VNDK_VERSION.
Ignore those prebuilt vndk snapshot libs.

Bug: 296488609
Test: lunch cf_x86_64_phone-next-userdebug; m nothing
Change-Id: I3adaf3b7636f53884f08540959d2ec2fddfb6921
2023-08-18 18:01:08 +09:00
Kiyoung Kim
a2d6deedab Relocate llndk.libraries.txt into system
llndk.libraries.txt file is currently located within the VNDK APEX.
However, this file is still required even if VNDK APEX is deprecated.
This change removes llndk.libraries.txt from VNDK APEX, so it can be
installed within the system image.

Bug: 290160925
Test: aosp_cf build succeeded with llndk.libraries.txt in the system
image

Change-Id: I09a0a43babaa58ff16fc04ea71ab41ab68b54b70
2023-08-16 10:03:16 +09:00
Vinh Tran
4eeb2a9514 Remove dylibs prop from rust module types
For device build, rust defaults to dylib linkage for rustlibs deps. `dylibs` prop was provided for flexibility.

By removing it, we're enforcing users to either use the default linkage (dylibs for device and rlibs for host) or rlibs prop explicitly. This means no dylibs for host modules. This makes sense because host modules always uses rlib linkage against libstd. The flexibility with dylibs prop opened room for linkage collisions because the dependencies don't link against libstd the same way.

Test: go test
Change-Id: I2fc221daa8a9bb42bdcf6d9823c723a4ddabe7b5
2023-08-14 14:03:28 -04:00
Jooyung Han
4ed512b3c7 apex: respect relative_install_path of rust modules
Bug: 295453836
Test: m
Change-Id: I0637d13f6f87fead3cf53a093d9ce84dea681a08
2023-08-11 16:32:58 +09:00
Treehugger Robot
abe5e13b9f Merge "add override_apex to version_variant test" into main 2023-07-31 20:36:07 +00:00
Kiyoung Kim
f97a42e5f2 Merge "APEXes contain VNDK libraries when VNDK is deprecated" into main 2023-07-27 01:24:53 +00:00
Kiyoung Kim
8269cee6e2 APEXes contain VNDK libraries when VNDK is deprecated
Currently vendor APEX can link to VNDK when 'use_vndk_as_stable'
property is set as true. However, when VNDK is deprecated, all former
VNDK libraries should be included in the vendor APEX despite of property
value. This change ignores use_vndk_as_stable when VNDK is set as
deprecated.

Bug: 290318998
Test: aosp_cf_x86_64_phone with WITH_VNDK=false build checked that
Vendor APEX contains all required VNDK libraries within the APEX

Change-Id: I648277d734274e7852b3effc24e7780e55089f75
2023-07-26 13:23:35 +09:00
Elliott Hughes
575451d111 Merge "Remove a bunch of stuff from the libc allowlist." into main 2023-07-25 18:45:08 +00:00
Sam Delmerico
419f9a3802 add override_apex to version_variant test
Bug: 285138555
Test: go test ./apex
Change-Id: I973156325cc396eb6d32be3d08ea6154b722d925
2023-07-21 12:00:13 -04:00
Elliott Hughes
c9642681bd Remove a bunch of stuff from the libc allowlist.
bionic/libc/Android.bp explicitly declares this now.

Test: treehugger
Change-Id: I88b54c45842bdf34449cdbbcaa9cb3c2774b8b6c
2023-07-20 21:10:31 +00:00
Ivan Lozano
87987fd058 Merge "rust: Add vendor and recovery dylib support." into main 2023-07-18 13:08:08 +00:00
Ivan Lozano
add122a828 rust: Add vendor and recovery dylib support.
Adds dylib support for vendor and recovery images.

This changes the default linkage for vendor and recovery images to
dylib, which matches the platform default linkage. This also means that
by default, dylib-std variants are used for rlib dependencies.

Bug: 204303985
Test: Soong tests.
Test: m dist vendor-snapshot
Test: RECOVERY_SNAPSHOT_VERSION=current m dist recovery-snapshot
Change-Id: If84074b8615a70c45e7e162abeb853dc8c34d49a
2023-07-14 12:43:09 -04:00
Jiakai Zhang
556bdf8e96 Add a Make variable to determine ART boot image jars for testing.
Bug: 290583827
Test: m nothing
Change-Id: I6eb0c83dd14682905ebaf3af55171856300eb2e3
2023-07-14 12:13:30 +01:00
Jiakai Zhang
cb13b5d1bd Refactor dexpreopt for boot jars to make it flexible to config changes.
In the past, dexpreopt for boot jars was very inflexible, and it was
incredibly hard to make a change that is as simple as adding a jar to a
boot image. Boot image generation was handled by
"platform_bootclasspath" and "bootclasspath_fragment" separately. This
caused not only code duplication but also the inflexiblity as such a
design did not fit today's use cases, where a boot image may take jars
from multiple mainline modules and the platform, and a mainline module
can contribute to multiple boot images. The design casued a huge
maintenance burden as any change to the boot image cost multi-week
efforts.

In recent years, efforts have been made to improve this a bit by a bit.
This change is another step towards making dexpreopt reasonable.

After this change, all boot images are generated by "dex_bootjars",
which is in build/soong and is therefore available on both the full
source tree and the thin manifest (master-art). The change decouples
profile generation/extraction from boot image generation. Profiles for
mainline modules are still handled by "bootclasspath_fragment"
because they need to be packed into APEXes when building mainline
modules and extracted from APEXes whem building the system image from
prebuilt modules. Boot images are not handled by
"bootclasspath_fragment" anymore.

Bug: 290583827
Test: m (all existing tests are still passing)
Test: Manually checked that the boot images are exactly the same as
  before.
Change-Id: Ib5a5f401bee334ffcab5c26618e0c8888b84575a
2023-07-14 12:13:28 +01:00
Jiakai Zhang
3444e561dc Change the profile path on host.
This is to decouple profile generation from image configs. A boot image
profile is either for a mainline module or for the platform, which is
orthogonal to boot images.

Bug: 290583827
Test: m nothing
Change-Id: I0918f2fa945a2af1839f1a08ecede331c64d0317
2023-07-11 17:59:24 +01:00
Jiakai Zhang
f7f782c4f1 Remove Modules() from BootclasspathFragmentApexContentInfo.
The Modules() method was for the ART boot image in the ART APEX. It's no
longer needed because we don't install the ART boot image in the ART
APEX anymore.

Bug: 290583827
Test: m nothing
Change-Id: I674a5fa1ed18908413a64129df5947c7d26e638e
2023-07-11 15:29:17 +01:00
Jiakai Zhang
b69e89559f Fix some tests for dexpreopt and remove unnecessary tests.
This CL is to prepare for the changes in http://r.android.com/2652081.
See the description of that CL for the reasons.

Some tests were set up in a fragile way and were easy to be broken when
the implementation changes. This CL is a pure test change that fixes
them.

This CL also removes TestNoUpdatableJarsInBootImage. That test checks
what should go to the ART boot image and what should go to the
platform one, which does not apply today because boot images are not
associated with mainline modules anymore: a boot image may take jars
from multiple mainline modules and the platform, and a mainline module
can contribute to multiple boot images. In practice, we have ART jars in
the platform boot image, and we are going to add core-icu4j and
consrypt to the ART boot image, which is now for testing only.

Bug: 290583827
Test: m nothing
Change-Id: I22c45cbf6f853b030b68edb51197854e9c53a02e
2023-07-11 15:29:12 +01:00
Jooyung Han
eec1b3fe26 Remove "flattened" apexes
Now soong doesn't build "flattened" apexes.

Bug: 279835185
Test: m nothing (soong tests)
Test: m && launch_cvd (cuttlefish)
Change-Id: Id3c540ece1a15cecacc185da9aa17285edd2f493
2023-06-21 14:29:26 +09:00
Jooyung Han
eeeda8a94c Remove PRODUCT_INSTALL_EXTRA_FLATTENED_APEXES
We will deprecate flattened apexes. In this change, GSI-specific make
variable (PRODUCT_INSTALL_EXTRA_FLATTENED_APEXES) is removed. The
variable was used to install both image/flattened apexes in the GSI, so
that it works on ro.apex.updatable devices and not-updatable devices.

Now, GSI will have only image APEXes in it.

Bug: 278826656
Test: lunch gsi_arm64-userdebug && m # no flattened apexes
Change-Id: Ie5fe505b9f2a6a1687252513788fd3e16bc147c5
2023-06-20 14:31:39 +09:00
Jooyung Han
6c762092ee Remove --blkid_path argument
deapexer doesn't need it.

Bug: 279858383
Test: presubmit
Test: m MODULE_BUILD_FROM_SOURCE=false droid
Change-Id: Ie8311c74682f366cf6aeebb669500d01675cd0bf
2023-06-14 15:23:03 +09:00
Jooyung Han
4137756d2d Merge "vendor apex: label apex_manifest as vendor_apex_metadata_file" 2023-06-07 23:59:59 +00:00
Sam Delmerico
1ef69c75fb Merge "update docs for apex_available_name" 2023-06-06 21:16:06 +00:00
Sam Delmerico
c3df113402 update docs for apex_available_name
Bug: 285138555
Change-Id: Ib987ac7a4995e69cbdbfc77adbf8d2b835e15cc2
2023-06-06 12:14:23 -04:00
Sam Delmerico
743b4c5a9b add variant_version to bp2build apex converter
Bug: 285138555
Test: b build //build/bazel/examples/... --config=android
Test: b test //build/bazel/tests/... --config=android
Change-Id: I7350930d48ccd13e96bdb4f994f47071a0dde70f
2023-06-06 12:09:28 -04:00
Sam Delmerico
e91698af9f add apex_available_name to bp2build apex converter
Bug: 285138555
Test: b build //build/bazel/examples/... --config=android
Test: b test //build/bazel/tests/... --config=android
Change-Id: I11372cbc01b89d530a35f90375ca6fa87834edd2
2023-06-06 12:08:56 -04:00
Sam Delmerico
6d65a0fc3d add variant_version property to apexBundle
This property allows modifying the variant version that is put into the
APEX manifest.

Bug: 285138555
Change-Id: I42b8c0ddad8822a0a329e99ec4ec62f8c3546ee9
2023-06-06 11:14:40 -04:00
Sam Delmerico
ca81653730 add apex_available_name property to apexBundle
This property allows developers to create multiple modules that provide
the same APEX implemenation with some differences. For example, an APEX
that targets the current SDK can be developed alongside an APEX that
targets a pre-S SDK. Common dependencies of these APEX modules can both
use the value of the apex_available_name property in their
apex_available lists and be packaged in either APEX module.

Bug: 285138555
Change-Id: Ia2cb027e2f19bd6d3d1c02e3d3742a0122a43c97
2023-06-06 11:14:36 -04:00
Jooyung Han
be95390729 vendor apex: label apex_manifest as vendor_apex_metadata_file
Since vendor APEXes are installed in vendor partition, there shouldn't
be system_file according to Treble. Instead, we can force-label / and
/apex_manifest.pb as vendor_apex_metadata_file so that apexd (and other
system components) can still read them.

Bug: 285075529
Test: m nothing (soong test)
Change-Id: Idb36b8c4c68b29e2235dbda38ee323d4b781e1d5
2023-06-02 22:11:16 +00:00
Sam Delmerico
b1daccdc97 ensure that privapp_allowlist is installed before android_app
AndroidMk assumes that the app is the last file installed, and it uses
this assumption to populate the LOCAL_SOONG_INSTALLED_MODULE entry. This
CL moves the privapp_allowlist installation to before the app
installation to respect this assumption.

Bug: 242509786
Test: go test
Test: OUT_DIR=out.ref m nothing &&
  cp aosp/2562351 && OUT_DIR=out.change m nothing &&
  GOWORK=$PWD/build/bazel/mkcompare/go.work \
  go run android/bazel/mkcompare/cmd -json \
  <(sed -e "s/out\.ref/out/g" out.ref/soong/Android-aosp_cheetah.mk) \
  <(sed -e "s/out\.change/out/g" out.change/soong/Android-aosp_cheetah.mk)
  && verify manually that the only diffs are related to the removal of
  the prebuilt_etc module.
Change-Id: I95ec27070f575e79fb976de68493a219717ed89a
2023-05-25 18:54:06 +00:00
Sam Delmerico
15809f8101 don't require package_name for non-override android_apps
For a non-override android_app, we can assume that the privapp_allowlist
already contains the correct package_name, and so we don't need to
overwrite it in this case.

Bug: 242509786
Test: go test
Merged-In: I0f137e34cae3478dc8b9178d138121ff1d936f07
Change-Id: I0f137e34cae3478dc8b9178d138121ff1d936f07
2023-05-24 11:09:31 -04:00
LaMont Jones
0c10e4dcc0 Parallelize singleton execution
Bug: 281536768
Test: manual, presubmits
Change-Id: I57fdc76ba6b277e88e196b506af87127a530fd37
2023-05-19 20:31:32 +00:00
Spandan Das
34e0b94815 Merge "Remove CellBroadcast apps from baseline apex available map" 2023-05-18 02:13:39 +00:00
Treehugger Robot
9514d5bb60 Merge "apex: drop metadata gathering for multitree." 2023-05-17 20:14:45 +00:00
Treehugger Robot
7754be760a Merge "Update apex test to verify behavior" 2023-05-16 22:05:40 +00:00
LaMont Jones
d20214f6fb apex: drop metadata gathering for multitree.
This was only partially implemented, and is not needed.

Test: presubmits
Change-Id: Ia6534c62051cd484d46333fbbf8a0fa8ce8288e7
2023-05-16 17:44:29 +00:00
Liz Kammer
5f108fa895 Update apex test to verify behavior
Verify logic for transitive shared vs static deps to
ensure in Bazel that these are handled similarly.

Test: go test soong tests
Change-Id: I015935fa4d7eb1ac40666d47a8de8e48150a043e
2023-05-16 16:57:18 +00:00
Nicolas Geoffray
036ff9a5c1 Add support for missing public / private key files for apexes.
Test: art/tools/buildbot-build.sh on a manifest that doesn't contain all
dependencies.

Change-Id: I8274bc0b616907032b51bc1b68c54888e7e58571
2023-05-16 10:20:39 +01:00
Jiakai Zhang
4abf2f4540 Merge changes from topic "boot-image-b280776428"
* changes:
  Dexpreopt ART jars and framework jars together.
  Unify installDirOnHost and installDirOnDevice.
  Remove the ability to install boot images by bootclasspath_fragments.
  Prepare tests for dexpreopt changes.
2023-05-12 10:48:44 +00:00
Treehugger Robot
f8fbff1671 Merge "Drop redundant libraries from baseline apexAvailable map" 2023-05-12 06:04:23 +00:00