Commit Graph

6076 Commits

Author SHA1 Message Date
Paul Duffin
397924a23b java_sdk_library_import: Copy all prebuilt properties to child modules
Previously, only the prefer property was copied from the
java_sdk_library_import module to its child modules which meant that if
the use_source_config_var property was used to control the prefer
property that the child modules would never be used. That can cause
build breakages when building against prebuilts as some parts of the
build will use prebuilt files from java_sdk_library_import and some
will use source files from the corresponding java_sdk_library.

This change copies the use_source_config_var property too.

It also adds tests to verify that dependencies on child modules of a
java_sdk_library use the prebuilt child modules of the corresponding
java_sdk_library_import. That revealed a bug with the handling of stub
sources where the prefer property was set after creating the module
which has also been fixed.

Bug: 249192297
Test: m nothing
      # Cherry pick into branch broken by previous behavior and make
      # sure that it fixes it.
Change-Id: I5719c257f8457bcb2238bc7965215512a20f1095
(cherry picked from commit bf4de041de)
Merged-In: I5719c257f8457bcb2238bc7965215512a20f1095
2022-09-29 10:30:29 +00:00
Paul Duffin
f7cd863c87 java_sdk_library: Use dist_stem when generating sdk snapshot file names
The API finalization process for platform releases copies various files
from the apistubs/ dist directory into prebuilts/sdk/<n>/...  Having
them use the same name in both places makes that process simpler. For
most modules the name of the file is derived from the name of the
module by appending a suffix but unfortunately, for some modules that
does not work. e.g. the conscrypt.txt file is produced by the
conscrypt.module.public.api module. The dist_stem property was added to
java_sdk_library to allow the stem name of the file to differ from the
module name.

The API finalization process for extension APIs does something similar
as it extracts various files from the snapshots and copies them into
the appropriate extension API specific directory in
prebuilts/sdk/extensions/<n>. Instead of copying files from the
apistubs/ dist directory (which is not built for trains) it copies them
from sdk snapshots that are built as part of the train.

Previously, the sdk snapshot used to derive the name of the files
within the snapshot from the name of the module, it ignored the
dist_stem property. This change causes it to use the dist_stem property
to make it consistent with the apistubs/ dist directory naming.

The file name is created in
sdkLibrarySdkMemberProperties.AddPropertyToSet() which does not have
access to the dist_stem property. So, it has to be supplied in the
sdkLibrarySdkMemberProperties instance in the new Stem property.

Bug: 248258460
Test: m nothing
      BUILD_NUMBER=fixed packages/modules/common/build/mainline_modules_sdks.sh --build-release=latest
      # Ran the previous command before and after and make sure that the
      # conscrypt, art and icu sdk snapshots use the dist_stem value but
      # none of the other snapshots are affected.
Change-Id: Ied52003de63dcdb86a252a39bb8781f85d51a6ff
(cherry picked from commit e840995ac3)
Merged-In: Ied52003de63dcdb86a252a39bb8781f85d51a6ff
2022-09-27 09:06:53 +00:00
Paul Duffin
28e66cac86 Exclude unsupported libraries from sdk snapshot
(cherry picked from commit 1938dba8b6)

When an sdk snapshot is targeted at release X then it cannot include
bootclasspath fragment libraries which are not present in that build as
otherwise it causes build failures. It should also not include any
unsupported libraries, i.e. libraries that cannot work on that release.

This change causes sdk snapshot to exclude libraries that have a
    min_sdk_version > target build release

It also ensures that hidden API flags do not include any information
from excluded libraries.

Bug: 240406019
Test: BUILD_NUMBER=fixed packages/modules/common/build/mainline_modules_sdks.sh
      # Ran the previous command with and without this change to make
      # sure that this change excludes framework-connectivity-t library from the
      # tethering sdk snapshot for S, including from the hidden API flag files.
Merged-In: I57969b85a12e9e5a3fc76c055b260cec5d5f7d7f
Change-Id: Ie142db49aad8e82ada21c343a7563102e74566a2
2022-09-22 13:59:50 +01:00
Paul Duffin
311210cd65 Separate hidden API flag info for sdk from platform_bootclasspath
Previously, the sdk snapshot and platform_bootclasspath both used the
HiddenAPIInfo/Provider to retrieve the hidden API related information
they needed. This change separates them by adding a new
HiddenAPIInfoForSdk/Provider that is used to provide the information
needed by the sdk snapshot. This allows a follow up change to generate
different information for the sdk and for the platform depending on the
target build release of the sdk snapshot.

Bug: 240406019
Test: packages/modules/common/build/mainline_modules_sdks.sh
      # Ran the previous command with and without this change to make
      # sure that this change does not change the sdk snapshot
      # contents.
Change-Id: I30cea6cf8dae1be467b7063430d6197e5baa684b
(cherry picked from commit 887efdd779)
Merged-In: I30cea6cf8dae1be467b7063430d6197e5baa684b
2022-09-21 12:42:51 +00:00
Paul Duffin
722e5ccb51 Separate hidden API flag generation from encoding
Previously, the rules for encoding hidden API flags into dex files were
generated in the hiddenAPIRulesForBootclasspathFragment alongside the
rules for creating the hidden API flag files.

This change separates the encoding from the generation of the flags.
This will allow a follow up change to generate API flags for the sdk
snapshot separately without affecting the encoded dex files.

Bug: 240406019
Test: m nothing
Change-Id: I3ab3ff5780e7b2e322665d3ea15f1438f2e403bd
(cherry picked from commit af70518189)
Merged-In: I3ab3ff5780e7b2e322665d3ea15f1438f2e403bd
2022-09-21 12:42:44 +00:00
Paul Duffin
91c1676c8e Revert "bootclasspath_fragment: Treat some specific modules as test"
This reverts commit ff9b6faba2.

Reason for revert: No longer needed
Bug: 194063708
Test: m nothing
Change-Id: Ic2f6761c9a0a00a612724cb429f002a16522e53f
(cherry picked from commit d0fe1307aa)
Merged-In: Ic2f6761c9a0a00a612724cb429f002a16522e53f
2022-09-17 09:03:01 +00:00
TreeHugger Robot
3fd5d95c61 Merge "add jacocoagent by default to Java modules" into tm-mainline-prod 2022-09-16 18:31:11 +00:00
Colin Cross
27bf106c58 Move embedded notice file path above aapt rule generation
The embedded notice file generation for apps was moved below the aapt
rules, which meant the added asset path was ignored.  Move the code
to pick the notice file path selection back above the aapt rules,
and leave the code to generate the notice file rule where it is.

Bug: 236006463
Test: m NetworkStack ALWAYS_EMBED_NOTICES=true
Change-Id: I1421fb0dbcdb759281259abfae7bddc9aecdaa56
Merged-in: I1421fb0dbcdb759281259abfae7bddc9aecdaa56
(cherry picked from commit 3d6cfd14d3)
2022-09-15 17:11:47 +00:00
Sam Delmerico
f15716ffab add jacocoagent by default to Java modules
On coverage builds, R8 will fail to properly optimize and fail the build
if ignore_warnings: false, because jacoco injects dependencies on
jacocoagent classes, but the jacocoagent library is not part of the
classpath libraries passed in to R8 in its arguments.

Instead we can add jacocoagent as a libs dependency for these modules so
that it will get pulled into the r8 flags.

Bug: 243903417
Test: cherry-pick ag/19866767 &&
  make SKIP_ABI_CHECKS=true PRODUCT=cf_x86_phone-userdebug
  EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true
  CLANG_COVERAGE=true COVERAGE_PATHS=""
  TARGET_USERDATAIMAGE_PARTITION_SIZE=17179869184
  SKIP_BOOT_JARS_CHECK=true service-uwb
Change-Id: Icc24cc260b896fc800125a0318308d823ccf7a83
(cherry picked from commit 1e3f78f866)
Merged-In: Icc24cc260b896fc800125a0318308d823ccf7a83
2022-09-12 13:59:18 +00:00
Sam Delmerico
969f8f0a25 disable usage of plugins as static libs
Test: m auto_value_plugin
Test: m androidx.appsearch_appsearch-compiler
Test: m intdef-annotation-processor-test
Test: atest intdef-annotation-processor-test
Test: m view-inspector-annotation-processor-test
Test: atest view-inspector-annotation-processor-test
Test: m Robolectric_processor_tests
Test: atest Robolectric_processor_tests
Bug: 225388628
Change-Id: I9e3dd81f44333b680f2e81283c02a9be5a4de15b
(cherry picked from commit 0d1c4a0fee)
Merged-In: I9e3dd81f44333b680f2e81283c02a9be5a4de15b
2022-09-09 21:44:23 +00:00
Sam Delmerico
cfd0caaf78 jacoco libs dependency for instrumented libraries
On coverage builds, R8 will fail to properly optimize and fail the build
if ignore_warnings: false, because jacoco injects dependencies on
jacocoagent classes, but the jacocoagent library is not part of the
classpath libraries passed in to R8 in its arguments.

Instead we can add jacocoagent as a libs dependency for these modules so
that it will get pulled into the r8 flags.

Bug: 243903417
Test: add optimize.ignore_warnings: false to NetworkStackAppDefaults &&
  make SKIP_ABI_CHECKS=true PRODUCT=cf_x86_phone-userdebug \
  EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true \
  CLANG_COVERAGE=true COVERAGE_PATHS="" \
  TARGET_USERDATAIMAGE_PARTITION_SIZE=17179869184 \
  SKIP_BOOT_JARS_CHECK=true \
  NetworkStack
Change-Id: I71313b1fd35437ec52890f5c30b3fd1381c7c3d2
(cherry picked from commit c75937264b)
Merged-In: I71313b1fd35437ec52890f5c30b3fd1381c7c3d2
2022-09-05 04:20:55 +00:00
Paul Duffin
b5e3c9802a Add hidden API properties to java_sdk_library modules
Previously, hidden API properties were only allowed on
bootclasspath_fragment and platform_bootclasspath module types. This
change allows them to be specified on java_sdk_library modules too. It
involves the following changes:

1. Add the properties to the java.Module.
2. Populate and provide a HiddenAPIPropertyInfo struct from
   java_sdk_library modules.
3. Modify bootclasspath_fragment to merge information gathered from its
   content libraries as if it was specified on the fragment itself.

Bug: 240406019
Test: m nothing
      packages/modules/common/build/mainline_modules_sdks.sh
      # Ran the previous command with and without this change to make
      # sure that this change does not change the sdk snapshot
      # contents.
Change-Id: I64eb71c2039ddc14cf380689d0cec7ec221f5b88
(cherry picked from commit 3f1ae0b55a)
Merged-In: I64eb71c2039ddc14cf380689d0cec7ec221f5b88
2022-08-21 12:18:06 +00:00
TreeHugger Robot
067e12f46a Merge "Dedup apiFile and removedApiFile fields" into tm-mainline-prod 2022-08-19 17:31:31 +00:00
Paul Duffin
6cdfd3fcfb Dedup apiFile and removedApiFile fields
Previously, there were two separate fields for each of the API and
removed API files because in some cases it needed a WritablePath and in
other cases it could only be a Path.

This change refactors the code so that the WritablePath is no longer
needed, the duplicate fields deleted and the remaining field is changed
to Path. It also removes a few unused fields.

Bug: 234113632
Test: m nothing
Change-Id: If81f5fe2aa05d9d7b2bc23869fdb2397649d67b3
(cherry picked from commit c71d2b7629)
Merged-In: If81f5fe2aa05d9d7b2bc23869fdb2397649d67b3
2022-08-19 15:26:33 +00:00
Paul Duffin
04beaabb46 Push Hidden_api inside HiddenAPIFlagFileProperties
All usages of HiddenAPIFlagFileProperties use it as the type of a
Hidden_api field. This change pushes the field inside the struct and
just embeds the struct inside the structs that need it making it
simpler and more consistent with how the HiddenApiPackageProperties
struct is used.

This is extracted as a separate change as while the change is simple
it does affect a lot of lines. Keeping it separate makes it easier to
review the changes.

Bug: 240406019
Test: packages/modules/common/build/mainline_modules_sdks.sh
      # Ran the previous command with and without this change to make
      # sure that this change does not change the sdk snapshot
      # contents.
Change-Id: I664453029574ef68dc5712f7bf137a1a6e78e864
(cherry picked from commit 9b61abbd84)
Merged-In: I664453029574ef68dc5712f7bf137a1a6e78e864
2022-08-19 15:19:32 +00:00
Paul Duffin
710a9edf21 Refactor handling of hidden API property provided information
In preparation for adding hidden API properties to individual
java_sdk_library modules this change refactors the handling of that
information.

1. Renames HiddenApiPackageProperties to HiddenAPIPackageProperties
   to be consistent with other similar structs.

2. Creates a new HiddenAPIPropertyInfo struct to be used to provide
   property derived information from one module to another. It includes
   both flag files as well as the information about which packages are
   used.

3. The HiddenAPIPropertyInfo is embedded within the existing
   HiddenAPIFlagInput in place of the existing flag files field.

4. The fields in the HiddenAPIPropertyInfo struct are populated from
   the HiddenAPI*Properties structs.

5. Access to package information is retrieved from the info struct
   instead of directly from the properties. That means that no changes
   will be needed to this code when info from other modules is merged
   into the struct in a follow up change.

Bug: 240406019
Test: packages/modules/common/build/mainline_modules_sdks.sh
      # Ran the previous command with and without this change to make
      # sure that this change does not change the sdk snapshot
      # contents.
Change-Id: I773279a4b621bcc3c40e3bfe193f2c7b0caeccd6
(cherry picked from commit 1e9e9388d8)
Merged-In: I773279a4b621bcc3c40e3bfe193f2c7b0caeccd6
2022-08-19 15:19:26 +00:00
Paul Duffin
719cc628ce Revert "Check that API is up-to-date when building java_sdk_library"
This reverts commit c166b68589.

Bug: 234113632
Bug: 236187167
Reason for revert: causes problems with update-api, see b/236187167

Change-Id: I4c88151cb5e2c86bb6c1a955c5065966a4fbb3e0
(cherry picked from commit e7a8664a6a)
Merged-In: I4c88151cb5e2c86bb6c1a955c5065966a4fbb3e0
2022-08-17 09:19:32 +00:00
Ante Culo
8bfefc0e75 Merge "rust: Allow rust_ffi_shared in jni_libs" into tm-mainline-prod 2022-08-16 21:38:55 +00:00
Ivan Lozano
be6873f813 rust: Allow rust_ffi_shared in jni_libs
Allow listing rust_ffi_shared modules as a jni_libs dependency
in conjunction with platform_api: true. This allows inclusion by
android_app modules.

Bug: 237304791
Test: android_app module builds with a rust_ffi_shared dependency.
Change-Id: I3a28e1baa522ad8f9c2aa86f1d23b19ce9f967e1
Merged-In: I3a28e1baa522ad8f9c2aa86f1d23b19ce9f967e1
2022-08-16 19:46:25 +00:00
Artur Satayev
79b1f25dc2 Merge "Set targetSdkVersion to 10000 for MTS tests targeting current" into tm-mainline-prod 2022-08-08 08:57:04 +00:00
Spandan Das
cf9b0070c0 Set targetSdkVersion to 10000 for MTS tests targeting current
MTS tests built on unstable branches (e.g. git_master) should be testable on
old system images (e.g. S). However, they run into an error during installation
on older images:
`Requires development platform $<current_codename>, but this is a
release platform`

This CL fixes this issue by updating the target_sdk_version of MTS test apps
targeting current to the magical sdk_version 10000

Bug: 227473065
Test: go build ./java
Test: TH
Change-Id: Ic0358a48a19dc239defbb4ee8ec99225cce75584
Merged-In: Ic0358a48a19dc239defbb4ee8ec99225cce75584
2022-08-07 20:11:18 +00:00
Remi NGUYEN VAN
4987e7e397 Make ignorewarnings optional in optimize
This allows targets to opt-in to running R8 without the -ignorewarnings
flag. Ignored warnings can cause code to be optimized incorrectly, so
this makes the build safer for such targets.

Ideally ignore_warnings should default to false, but all targets need to
be fixed for that to happen. As a first step, provide a mechanism for
individual targets to ensure they do not introduce regressions.

Bug: 229727645
Bug: 180878971
Bug: 226127213
Bug: 239990030
Test: m (runs dex_test)
Change-Id: Ic0eef29598c1ee47e958da8a5048d9696165a235
(cherry picked from commit bdad314f97)
Merged-In: Ic0eef29598c1ee47e958da8a5048d9696165a235
2022-08-05 01:27:10 +00:00
Bob Badour
65ebcd772e Make sure dist files have license metadata.
Bug: 151177513
Bug: 210912771
Bug: 240342946

Test: m droid dist reportmissinglicenses

Change-Id: I0c85f6c49a3e9d9bb3219ed6ddfb939d90f80656
Merged-in: I0c85f6c49a3e9d9bb3219ed6ddfb939d90f80656
2022-08-03 14:02:35 -07:00
Bob Badour
919855091c Add gen_notice module.
Refactor notices to support notices for multiple modules.

Enforce visibility and handle missing dependencies.

Test: m cts dist reportmissinglicenses

Test: m droid dist

Bug: 213388645
Bug: 240342946

Change-Id: Id6a81987f087419ad37d0cce57a71e8a7c4cd6e0
Merged-in: Id6a81987f087419ad37d0cce57a71e8a7c4cd6e0
Merged-in: I07963c83eaddfe363a04871e813b56fe7f1465ad
Merged-in: Ib2f8d0ad46ffe795d392166a74a7c6309b1246e2
Merged-in: I1d630c3d14d27b7605ab13d204d34b6851a24d33
2022-08-03 14:02:33 -07:00
Paul Duffin
9bcfe69743 Revert "Patch to fix Aug train issue with tethering"
Revert "[automerge] Patch to fix Aug train issue with tethering ..."

Revert submission 19432194-presubmit-am-5e598b33be884d9f98a29ce1c3c575fb

Reason for revert: Not needed in tm-mainline-prod and breaks bluetooth.
Reverted Changes:
I57969b85a:Patch to fix Aug train issue with tethering
Ie6560f201:[automerge] Patch to fix Aug train issue with teth...

Change-Id: If44d16a00847a554862aa139c04370ad30166c74
2022-07-28 10:07:30 +00:00
Paul Duffin
a649ad5b31 Patch to fix Aug train issue with tethering
A temporary patch to fix issues with the tethering module sdk in the
August train. This will be reverted immediately and only used for
specific builds for the August train and possibly the September train
if this has not been fixed properly by then. The proper fix will be
implemented under b/238472881.

This patch removes framework-tethering-t from the snapshot's Android.bp
file and removes its effect on the hidden API flag files too.

Bug: 238472881
Test: build train
Change-Id: I57969b85a12e9e5a3fc76c055b260cec5d5f7d7f
2022-07-28 09:31:28 +00:00
Paul Duffin
f33bea357e Export any platform_compat_config used by apex to sdk snapshot
Previously, the platform_compat_config modules needed to be explicitly
listed in the sdk snapshot and the apex. This change will automatically
export them to the sdk snapshot when the apex is listed in its apexes
property.

Bug: 232401814
Test: m tethering-module-sdk
      # Before this change the generated snapshot did not contain the
      # platform_compat_config, after this change it did.
      m art-module-sdk
      # As that explicitly specifies the platform_compat_config in its
      # compat_configs property this change has no effect.
Change-Id: Ia854b9a52db2b1619fca41a387ce98d7f9f9efe9
(cherry picked from commit fcf79850d8)
Merged-In: Ia854b9a52db2b1619fca41a387ce98d7f9f9efe9
2022-07-21 10:41:38 +00:00
Paul Duffin
be75059999 Use implementation jar for updatable-media in snapshot for S
While enabling prebuilts in T we hit b/229932396 which was caused by
some parts of the build depending on the prebuilt updatable-media jar
which used to be a full implementation jar but which is now an invalid
jar as the snapshot must not be including implementation details. We
fixed the issue in T but we are hitting the same problem in S with the
M-2022-07.

That is the first train in which the prebuilt updatable-media module
provides an invalid jar, prior to that it was always providing an
implementation jar. This change tweaks the sdk snapshot generation
code to use an implementation jar for updatable-media in the S
snapshot to avoid partners having to cherry pick changes similar to
those needed to fix b/229932396 in T.

Bug: 239121291
Test: packages/modules/common/build/mainline_modules_sdks.sh
      # Check that S media snapshot includes implementation jar.
      # Check that S art snapshot includes invalid jar.
      # Check that T media snapshot includes invalid jar.
Change-Id: Ib49484d00a60b4ed7f8268e04f9c10a3498edb56
(cherry picked from commit 1364891fad)
Merged-In: Ib49484d00a60b4ed7f8268e04f9c10a3498edb56
2022-07-15 22:34:28 +00:00
Paul Duffin
3532c556ed bootclasspath_fragment: Require at least one hidden_api package property
Previously, the split_packages, single_packages and package_prefixes
properties were all optional and the split_packages defaulted to ["*"].
As that value conflicted with the other package properties that meant
that split_packages always had to be specified even if it was to just
set it to an empty array.

This change requires at least one of them to be specified and defaults
split_packages to an empty list which means it is not required,
although it can be helpful to make that explicit.

Bug: 194063708
Test: m nothing
Change-Id: I5a4c2d68e72e39f5c4a2441326dfce8685fc8ff2
(cherry picked from commit 9fd564711e)
Merged-In: I5a4c2d68e72e39f5c4a2441326dfce8685fc8ff2
2022-07-12 12:01:02 +00:00
Paul Duffin
e2c7fd9b8c bootclasspath_fragment: Treat some specific modules as test
Treats bootclasspath_fragment modules that have not yet been converted
to test modules as if they were test modules. This is a temporary work
around to ease the migration to bootclasspath_fragment_test modules and
is expected to be reverted.

Bug: 194063708
Test: m nothing
Change-Id: I093fbec4e926719b644c64ebfc63f9e3070e28db
(cherry picked from commit ff9b6faba2)
Merged-In: I093fbec4e926719b644c64ebfc63f9e3070e28db
2022-07-12 12:01:00 +00:00
Paul Duffin
ab9fbab7ef bootclasspath_fragment: Add test specific module type
This is needed to allow the behavior of the bootclasspath_fragment to
be tweaked for test fragments.

Bug: 194063708
Test: m nothing
Change-Id: Iee5c09d5b580d088ba081d95a788dbde883078ed
(cherry picked from commit c15b9e99e5)
Merged-In: Iee5c09d5b580d088ba081d95a788dbde883078ed
2022-07-12 12:00:58 +00:00
Paul Duffin
2bf4389d33 Add apexes property to sdk
Specifying an apex in the apexes propety will cause all the
*classpath_fragments that are contents of the APEX to be automatically
added as members of the sdk and appear in the snapshot.

The purpose of this change is to dedup the APEX and sdk definitions and
try and avoid some of the issues that we have been finding while
attempting to build against the prebuilts.

Two tests, one each for bootclasspath_fragment and
systemserverclasspath_fragment, have been refactored to compare the
output when adding the *fragment to the sdk directly of via the APEX.
That ensures switching to use the APEX will not change the sdk snapshot
unless it was previously missing a *fragment.

There was also a slight difference in where the hidden API flags were
copied from. That should have no impact on the output as the flags are
identical.

The sdk snapshot generation needed some tweaks to avoid generating a
prebuilt for the APEX.

Bug: 232401814
Test: m nothing
Merged-In: I7aaf16a3a0ab4bebf97765d1484215cc008dc4b8
Change-Id: I7aaf16a3a0ab4bebf97765d1484215cc008dc4b8
(cherry picked from commit 4e7d1c43e2)
2022-07-11 21:17:19 +00:00
Paul Duffin
09bb15da5e Merge "Stop exporting systemserverclasspath_fragment when targeting S" into tm-dev am: 0147aca453
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/19135262

Change-Id: I9039499819e938deb9d13557bdee26fc56bd6f4c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-07 17:21:58 +00:00
Paul Duffin
b0c28d63d6 Stop exporting systemserverclasspath_fragment when targeting S
Previously, when targeting the S release the generated sdk snapshot
would contain prebuilt_systemserverclasspath_fragment modules even
though they were only added in T.

This allows SdkMemberTypes to specify the set of target build releases
they support and ignores them when targeting an unsupported target
build release.

The Merged-In value was chosen to prevent this from being merged into
branches where it will conflict due to https://r.android.com/2105804.
That will allow this change to be submitted in tm-dev before it is
submitted in AOSP.

Test: m nothing
      packages/modules/common/build/mainline_modules_sdks.sh
      # Check that the for-S-build snapshots do not include SSCPFs.
Bug: 237718221
Change-Id: I2df08c2fcebf9b866695d691572a9d3783758b17
Merged-In: Ib6d1b72bc8399fbb39075494ae37da92f4b28d03
2022-07-05 14:48:09 +00:00
Paul Duffin
029d72027d Avoid modifying Compile_dex property
Previously, the code would modify the Compile_dex property to set it to
true if the module was part of an APEX as the APEX needs the dex file.
That lost information about whether the Compile_dex property was
specified in the .bp file and also meant that the APEX variant had
different properties to other variants which could result in unexpected
differences in behavior between them.

One of those differences can occur in the sdk snapshot generation code
which uses the Compile_dex property to determined whether to write a
compile_dex property in the generated snapshot. If it uses an APEX
variant then it will always add compile_dex: true but if it used a non
APEX variant then it would depend on the setting of compile_dex in the
source. That leads to the generated snapshot being affected not just
by the set of modules that are included but also how they were
specified.

This change stops modifying the properties and just uses a local
variable to store the updated value. All the other (4) uses of the
Compile_dex property were checked and 1 accesses the property before
it is updated, 2 access the property from a module type (Import) that
does not update the property and the other is in the sdk snapshot
generation code which accesses it after it has been modified but needs
to access the unmodified value.

This is needed for the follow up change that allows an sdk module to
reference an apex to automatically add exportable parts of the apex
contents to the sdk snapshot avoiding duplication which can lead to
errors.

Bug: 232401814
Test: m nothing
Change-Id: Ibc80d93473a266dc9f9900ec1cb175b51460b5e9
(cherry picked from commit e7b1f5b0a5)
Merged-In: Ibc80d93473a266dc9f9900ec1cb175b51460b5e9
2022-06-29 18:17:36 +00:00
TreeHugger Robot
fd0e961f31 Merge "Move embedded notice file path above aapt rule generation" into tm-dev am: 8378feda12
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/19049995

Change-Id: Ib6f1fb5fdeafc34f913145738853eef219f1d66b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-23 20:07:51 +00:00
Colin Cross
3d6cfd14d3 Move embedded notice file path above aapt rule generation
The embedded notice file generation for apps was moved below the aapt
rules, which meant the added asset path was ignored.  Move the code
to pick the notice file path selection back above the aapt rules,
and leave the code to generate the notice file rule where it is.

Bug: 236006463
Test: m NetworkStack ALWAYS_EMBED_NOTICES=true
Change-Id: I1421fb0dbcdb759281259abfae7bddc9aecdaa56
Merged-in: I1421fb0dbcdb759281259abfae7bddc9aecdaa56
2022-06-23 18:05:09 +00:00
Pedro Loureiro
5a92f17f03 Translate SDK codenames to SDK versions for finalized releases am: 489912283e
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/18965894

Change-Id: Ia21684260f4dbd6a4c43922b6f68b02372cd4bba
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-17 22:01:30 +00:00
Pedro Loureiro
489912283e Translate SDK codenames to SDK versions for finalized releases
This applies to updatability attributes of shared libraries.

Bug: 235318264

Test: atest UpdatableSharedLibsTest
Change-Id: Id2c2b769a99ca1debb5d8525e46d37698ef2fc6c
2022-06-17 20:01:21 +00:00
TreeHugger Robot
233a6b334a Merge "Fix strip_prefix flags to strip install paths." into tm-dev am: d23c863fae
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/18818123

Change-Id: Iac2ff232d5eeb1ad1a0fadbeec5ee51efb03db27
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-10 23:35:11 +00:00
TreeHugger Robot
d23c863fae Merge "Fix strip_prefix flags to strip install paths." into tm-dev 2022-06-10 23:06:33 +00:00
Bob Badour
3d16d5ddf8 Fix strip_prefix flags to strip install paths.
Bug: 235331488

Test: m droid dist

Change-Id: I3cd2af5d90e46a4c983728bc9b2d941d6ffda229
Merged-in: I3cd2af5d90e46a4c983728bc9b2d941d6ffda229
2022-06-09 15:00:08 -07:00
Sam Delmerico
1326a1dd38 add multilib data_device_bins properties am: b706b4efef
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/18799733

Change-Id: Icb3b4ed362e27d11c525a4e142e912e6fd735988
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-09 14:28:52 +00:00
Sam Delmerico
b706b4efef add multilib data_device_bins properties
Some targets need to be able to specify the specific architecture for a
data_device_bin module. This commit adds new properties to allow
specification of first, both, 32, or 64 multilib properties.

Bug: 231448797
Bug: 232408185
Test: go test ./java -run TestDataDeviceBinsBuildsDeviceBinary
Change-Id: I457cf4b1a9ccb28b46042f874c96bd0a87009fab
Merged-In: I457cf4b1a9ccb28b46042f874c96bd0a87009fab
2022-06-08 19:26:01 +00:00
Paul Duffin
870462bb6a Check that API is up-to-date when building java_sdk_library
Previously, the checked in version of an API was only checked to make
sure it was up-to-date when running the checkapi target. This change
adds a validation dependency to the ninja rule that generates the API
from source so that up-to-date check is always performed every time
the API is generated. However, because it is a validation dependency
it does not lengthen the build's critical path.

Bug: 234113632
Test: echo > packages/modules/SdkExtensions/java/android/os/ext/api/current.txt
      m framework-sdkextension
      # Passes without this change even though the checked in API is
      # not up-to-date.
      # With this change the build fails reporting correctly that the
      # checked in API is not up-to-date.
Change-Id: I8e65cf716d94aecd61bd943f1485468664ad4a22
(cherry picked from commit c166b68589)
Merged-In: I8e65cf716d94aecd61bd943f1485468664ad4a22
2022-05-28 10:01:01 +00:00
Paul Duffin
dec8138db1 Add custom java_sdk_library info to the SDK info file
(cherry picked from commit 958806b8c8)

Previously the SDK info file only contained basic common information
about each member. This change adds support for each member to
provide custom information to add to the info file.

It uses that mechanism to add the following:
* "dist_stem"
* "scopes" object containing:
  * for each scope a:
    "<scope>" object containing:
    * "current_api" - the path within the snapshot for the API's .txt
                      file.
    * "removed_api" - the path within the snapshot for the removed
                      API's .txt file.
    * "latest_api" - the path within the build to the latest finalized
                     API .txt file.
    * "latest_removed_api" - the path within the build to the latest
                             finalized removed API .txt file.

In order to access the latest API files it was necessary to add and
resolve dependencies on the module that makes them available. In order
to do that safely the code for creating the names of the modules was
refactored to avoid duplicating the name creation logic.

Bug: 204763318
Test: m nothing
Merged-In: Ica68abbd2b2c7c2b2b7877b502f96cc89f06fd68
Change-Id: Ica68abbd2b2c7c2b2b7877b502f96cc89f06fd68
2022-05-23 14:26:30 +00:00
Colin Cross
d7d2a2a6bf Merge "Fix prebuilts of overridden apps" into tm-dev 2022-05-18 17:40:23 +00:00
Colin Cross
5088544ddc Fix prebuilts of overridden apps
AndroidApp had its own HideFromMake method and flag that shadowed
the one in ModuleBase.  This caused performOverrideMutator to set the
AndroidApp flag, but ModuleBase.skipInstall to read the ModuleBase
flag, resulting in a conflicting install rule being created.  Remove
AndroidApp's HideFromMake in favor of the ModuleBase one.

Bug: 232788722
Test: TestOverrideAndroidAppWithPrebuilt
Change-Id: I8c0dfcb50ff4dc1e4d0574f150b10d79908f46aa
Merged-In: I8c0dfcb50ff4dc1e4d0574f150b10d79908f46aa
(cherry picked from commit aaa0c1ffcd)
2022-05-17 14:39:36 -07:00
Spandan Das
91250b1ae4 Enforce updatable=true on apps of updatable apexes
- Update apex_info (a topdown mutator) so that it sets updatable=true on
  apps of updatable apexes
- Write a unit test that tests different combinations of
  updatable/non-updatable apks-in-apexes
- Update an existing unit test that asserts a different error

Test: go test ./java
Test: m nothing (in internal)
Bug: 209409604

Change-Id: Ie8881b857afcec44addf27fc360c5b8abf726bd2
Merged-In: Ie8881b857afcec44addf27fc360c5b8abf726bd2
(cherry picked from commit 42e89508ee)
2022-05-13 19:16:23 +00:00
Spandan Das
456a77e9a0 Update sdk_version check for jni_libs of updatable apps
With aosp/1640364, all variants of a cc_* module use min_sdk_version as
the version part of the clang triple. Therefore, checking
min_sdk_version of jni_libs should be sufficient to ensure that there is
no unintended access to symbols in newer Android versions

Test: go test ./java
Test: TH
Bug: 155209650
Bug: 209409604

Change-Id: I6c064f8a6ea12c8aa40165a9063380306a180c9b
Merged-In: I6c064f8a6ea12c8aa40165a9063380306a180c9b
(cherry picked from commit 2e8c044b2c)
2022-05-13 19:15:58 +00:00