Commit Graph

5464 Commits

Author SHA1 Message Date
Paul Duffin
3bc8e218f9 Avoid permitted_packages related build failures in unbundled builds
Unbundled builds cause AlwaysUsePrebuiltSdks() to return true which
causes java_sdk_library_import modules to be preferred instead of their
corresponding java_sdk_library module. That causes the
platform-bootclasspath module to depend on prebuilt versions of modules
like framework-statsd which currently do not specify
permitted_packages and so cause a failure.

This is a temporary hack to prevent an unbundled build from checking
for permitted_packages. It can be removed once the prebuilts have been
updated to include the permitted_packages.

Bug: 193095050
Bug: 193889859
Test: m TARGET_BUILD_APPS=Calendar apps_only
      - before the change it failed in Soong.
      - after the change it started failing, later in Make, so the
        Soong problem has been worked around.
      - I reverted all the recent changes to permitted_packages and
        ran this and it still failed so that failure is unrelated to
        these changes.
Change-Id: I213d35437d76d61cf616d1f16dae213b311c6c8e
2021-07-16 17:03:17 +01:00
Ulyana Trafimovich
fe261473b8 Merge "Don't attempt to add stub libraries to class loader context." 2021-07-16 15:45:19 +00:00
Ulya Trafimovich
78645fbba1 Remove OptionalImplicitSdkLibrary() function (it's not used anymore).
Slightly improve documentation for `OptionalSdkLibraryImplementation()`.

Bug: 193425964
Test: m nothing
Change-Id: I3c3f385cf948cdbec54b5a6fb33a4d24d4b54be3
2021-07-16 16:24:31 +01:00
Paul Duffin
da286f4615 Make bootclasspath_fragments always perform hidden API processing
Previously, bootclasspath_fragment modules would only perform hidden
API processing if they provided some stub libraries and fragments. That
was needed because the bootclasspath_fragment modules were added before
Soong supported hidden API processing on all the different modules and
before they all provided the necessary information that hidden API
processing required.

This change stops hidden API being conditional as it is no longer
required as it has been enabled on all existing bootclasspath_fragment
modules.

Bug: 179354495
Test: m nothing
Change-Id: I0cbf11986adff1f2f967b96f86e6bfe0e9b8b1ef
2021-07-16 15:09:59 +01:00
Ulya Trafimovich
840efb6661 Don't attempt to add stub libraries to class loader context.
A Java module may depend on a stub library. In that case an additional
dependency on the implementation library is created, and it is used to
add the implementation library to class loader context. We should not
attempt to add the stubs library as well (previously the attempt to add
it happend after the implemention was added to CLC, to the attempt was
unsuccessful).

Raise an error if someone tries to add the same library with different
build/instal paths.

Also, rename local variable `implicitSdkLib` to `sdkLib` to better
reflect its meaning.

Bug: 193425964

Test: $ lunch aosp_cf_x86_64_phone-userdebug && m && launch_cvd
      $ adb wait-for-device && \
        adb root && \
        adb logcat | \
        grep -E 'ClassLoaderContext [a-z ]+ mismatch' -C1
      # empty output, no errors
Change-Id: I01c1bdd23f9d118d891d0b806e7e3b4d78896a34
2021-07-16 14:44:18 +01:00
Ulyana Trafimovich
2ddda9a593 Merge "Fix handling of "prebuilt_" prefix in classLoaderContextForUsesLibDeps." am: f87aae5356 am: 7a1642c416
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1768131

Change-Id: I90fb1f89fec2b7ad5f9006bcaeabde08e4adda64
2021-07-16 12:40:12 +00:00
Ulyana Trafimovich
f87aae5356 Merge "Fix handling of "prebuilt_" prefix in classLoaderContextForUsesLibDeps." 2021-07-16 12:00:29 +00:00
Ulyana Trafimovich
b7246725cc Merge "Refactor function to reduce nestedness level. No functional changes." am: 9cb1577ac7 am: de136dec72
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1768130

Change-Id: I2ee712fb8768bb7086a78f538c536e93cc7063c4
2021-07-16 10:12:30 +00:00
Ulyana Trafimovich
9cb1577ac7 Merge "Refactor function to reduce nestedness level. No functional changes." 2021-07-16 09:37:00 +00:00
Martin Stjernholm
5d56d75dbe Merge "Document how APEXes are identified in the boot jar variables." am: 9fe17bc8d9 am: 337f8cc2f2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1756729

Change-Id: If1e5211ffd2f1cab1d6cc62d1058f8b64fbb2dd2
2021-07-15 19:51:34 +00:00
Martin Stjernholm
9fe17bc8d9 Merge "Document how APEXes are identified in the boot jar variables." 2021-07-15 18:57:00 +00:00
Paul Duffin
cc7fc33e20 Merge "Build updatable-bcp-packages.txt from prebuilts in sdk snapshot" am: d2a23518b4 am: 3caa3a02ee
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1768127

Change-Id: I0f1bd5d1a6d53d12f9af41b46af3453af24c0591
2021-07-15 15:23:27 +00:00
Paul Duffin
2be643b605 Merge "Propagate permitted packages to sdk snapshot" am: 81d56dcd3f am: fcbeaa37a8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1768128

Change-Id: I71487b6536f93a0dbbf121ff45f5737858f3d373
2021-07-15 15:23:17 +00:00
Paul Duffin
d2a23518b4 Merge "Build updatable-bcp-packages.txt from prebuilts in sdk snapshot" 2021-07-15 14:58:12 +00:00
Paul Duffin
81d56dcd3f Merge "Propagate permitted packages to sdk snapshot" 2021-07-15 14:58:03 +00:00
satayev
4619a2bdd5 Merge "Update a comment about PRODUCT_UPDATABLE_BOOT_JARS." am: 1180b1fc4a am: 8ed574e839
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1768126

Change-Id: I3b36e57d068a35902c256bf84b3150f435031103
2021-07-15 14:33:25 +00:00
Ulya Trafimovich
e14f80b2d3 Fix handling of "prebuilt_" prefix in classLoaderContextForUsesLibDeps.
Changes:
- Cut off "prebuilt_" prefix from `dep`, not `libName`, because `dep` is
  used to replace library name in `usesLibraryProperties`, and these
  properties are specified without "prebuilt_" prefix.

- Do not remove "prebuilt_" prefix on the return value of
  `ProvidesUsesLib()`: this boils down to `provides_uses_lib` property
  which is specified without the prefix.

Bug: 193425964
Test: $ lunch aosp_cf_x86_64_phone-userdebug && m && launch_cvd
      $ adb wait-for-device && \
        adb root && \
        adb logcat | \
        grep -E 'ClassLoaderContext [a-z ]+ mismatch' -C1
      # empty output, no errors
Change-Id: I6cb65040027023d12ca0bc132d60c2c245174c40
2021-07-15 15:19:26 +01:00
Ulya Trafimovich
2444671b4a Refactor function to reduce nestedness level. No functional changes.
Bug: 193425964
Test: m nothing
Change-Id: Ic2d20eb5317f397919ecb01b64c5dd0da78e4a1a
2021-07-15 15:18:25 +01:00
Paul Duffin
630b11e9d4 Build updatable-bcp-packages.txt from prebuilts in sdk snapshot
Previously, the java_import and java_sdk_library_import modules did not
make their permitted_packages available to the rule that generates the
updatable-bcp-packages.txt file. This change corrects that.

Bug: 193763688
Test: m nothing
      - Added unit tests, which all failed and then fixed the tests.
Change-Id: If0706e4551a331b48d383123088e63924dded48b
2021-07-15 14:16:44 +01:00
Paul Duffin
869de147ab Propagate permitted packages to sdk snapshot
Previously, permitted_packages were not copied to the sdk snapshot.
This change corrects that.

Bug: 193763688
Test: m nothing
      - Added unit tests, which all failed and then fixed the tests.
Change-Id: I4560987f746f78c0ae706058195b6db4bea438aa
2021-07-15 14:15:58 +01:00
satayev
f208a5766e Update a comment about PRODUCT_UPDATABLE_BOOT_JARS.
Bug: 191127295
Test: n/a
Change-Id: I3d8e8689a79be79714b01cfd8abac34e7d963aee
2021-07-15 13:22:31 +01:00
Ulyana Trafimovich
732d7c431a Merge "Drop strings.HasPrefix when guarding strings.TrimPrefix." am: 7beb099546 am: cdaf15d04f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1765983

Change-Id: Ie6342e568e443a13eb840afb218dbb5a3931467d
2021-07-15 10:50:16 +00:00
Ulyana Trafimovich
7beb099546 Merge "Drop strings.HasPrefix when guarding strings.TrimPrefix." 2021-07-15 10:15:26 +00:00
Treehugger Robot
a5d5782e39 Merge "dexpreopt.config should be created even though unbundled image is built" am: 75d719fdd7 am: 1bc89a7af1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1730112

Change-Id: I4e91d1b293e84c69f032e148931357e2a050e10f
2021-07-15 09:28:40 +00:00
Ulya Trafimovich
497a09310b Drop strings.HasPrefix when guarding strings.TrimPrefix.
There is no need to check as `TrimPrefix` does nothing if the prefix
doesn't match (see https://pkg.go.dev/strings#TrimPrefix).

Bug: 193425964
Test: m nothing
Change-Id: Ieb82e72a471800e29eb6bb54308041a9ab4173e5
2021-07-15 08:30:27 +01:00
Jeongik Cha
4b073cd083 dexpreopt.config should be created even though unbundled image is built
Bug: 188179858
Test: compare dexpreopt_config.zip files from
 1. TARGET_BUILD_UNBUNDLED_IMAGE=true m dexpreopt_config_zip
 2. m dexpreopt_config_zip
(note that m clean should run between steps)

Change-Id: I36a6e8b10b9922cc5522accaf90af1aa05049a86
2021-07-15 09:57:49 +09:00
Treehugger Robot
4c72f68962 Merge "SdkLibraryImport's DexJarInstallPath uses installPath from source module" am: 257608f993 am: 64614bbcff
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1758354

Change-Id: Ibd345e6d76706c54d5cfb0799d80f5d107332f78
2021-07-14 01:21:18 +00:00
Jeongik Cha
d5fe8782e0 SdkLibraryImport's DexJarInstallPath uses installPath from source module
Even though actual installed module path is the same as source module,
it uses impl's one.

Bug: 188179858
Bug: 193082464
Test: compare dexpreopt_config.zip files from
  1. TARGET_BUILD_UNBUNDLED_IMAGE=true m dexpreopt_config_zip
  2. m dexpreopt_config_zip
  (note that m clean should run between steps)
Test: build aosp_cf_x86_64_phone,  launch_cvd, and then
  adb wait-for-device \
      && adb root \
      && adb logcat \
      | grep -E 'ClassLoaderContext [a-z ]+ mismatch' -C 1
      and then check if there is no message.

Change-Id: I34ffd9a2d214a6614c2befc35b2beec003cfcd25
2021-07-13 13:54:03 +00:00
Pedro Loureiro
49e0e81155 Merge "make system server modules use filtered lint database" 2021-07-13 08:55:13 +00:00
Paul Duffin
cb049b6791 Move modules containing ART, conscrypt and i18n from libcore am: bb360c32b6 am: 9e36fa0eda
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1762226

Change-Id: I1c4579886602978ebc718a9a1ba36ad161d98697
2021-07-12 12:30:11 +00:00
Paul Duffin
bb360c32b6 Move modules containing ART, conscrypt and i18n from libcore
This change moves the definitions of the following libraries which
directly include ART, conscrypt and i18n stubs, and their associated
java_system_modules from libcore to build/soong/java/core-libraries.
* core.current.stubs
* core-current-stubs-system-modules
* core.module_lib.stubs
* core-module-lib-stubs-system-modules
* legacy.core.platform.api.stubs
* legacy-core-platform-api-stubs-system-modules
* stable.core.platform.api.stubs
* stable-core-platform-api-stubs-system-modules

Bug: 193311122
Test: m droid
Change-Id: I42c4a0b5322897d40ecf41de088152dbdc526c96
2021-07-12 10:10:42 +01:00
Martin Stjernholm
1d51ea951e Document how APEXes are identified in the boot jar variables.
Test: n/a - comment changes only
Bug: 191269918
Change-Id: I5ccb5afb6bef5fa5af9d528dd1d6ffd555448d9a
2021-07-08 23:19:56 +01:00
Paul Duffin
b68c4c0b49 Generate boot images for host from prebuilts am: a56be7d781 am: 9dfd930cf7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1757170

Change-Id: I2d343d227edb0b5138537f1fc3d36c4806340d51
2021-07-06 15:28:37 +00:00
Paul Duffin
688efcdbde Switch boot image generation to use GetGlobalSoongConfig(ctx) am: 8fc51a8eb6 am: 371276f582
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1757169

Change-Id: Ia5c95bfaf3a77614e15c1c5221826ed4c3d8abd8
2021-07-06 15:09:01 +00:00
Paul Duffin
a56be7d781 Generate boot images for host from prebuilts
Previously, when building from prebuilts boot no rules were created to
produce the boot image files for the host, i.e. the OS on which the
build was running. That caused problems with checkbuilds. No rules were
produced as there was no host variant of a prebuilt apex to provide
them.

This change restructures the code to allow the prebuilt bootclasspath
fragment to build the host variants of the files from the dex files
provided by the prebuilt APEX. The generated files will not be the same
as they would be if built from source as there is no boot image profile
to use but it should be sufficient to satisfy the checkbuild target and
allow for host side testing.

Bug: 192575099
Test: m SOONG_CONFIG_art_module_source_build=false droid dist checkbuild
Change-Id: I6af00f19bb71aa18dd462f5eac6aa38e3e721023
2021-07-06 13:45:46 +01:00
Paul Duffin
8fc51a8eb6 Switch boot image generation to use GetGlobalSoongConfig(ctx)
Previously, boot image generation used GetCachedGlobalSoongConfig(ctx)
in order to get access to the GlobalSoongConfig. That required that
some other part of the code had called GetGlobalSoongConfig(ctx) to
initialize the cached value. That was left over from when the boot
image generation was done in a singleton which could not call
GetGlobalSoongConfig(ctx) directly. That is no longer true.

This change switches the uses of GetCachedGlobalSoongConfig(ctx) to
GetGlobalSoongConfig(ctx) and removes the now unnecessary call to
GetGlobalSoongConfig(ctx) from outside the functions.

Bug: 192575099
Test: m nothing
Change-Id: I34b7b1526d072d8b09fda7caa96e381695888e16
2021-07-06 12:51:04 +01:00
Pedro Loureiro
ffb643fc18 make system server modules use filtered lint database
Bug: 188851704
Test: m
Change-Id: Ie8f63286aeeb4cdbec5b9320c2ba41c8e37c7345
Merged-In: Ie8f63286aeeb4cdbec5b9320c2ba41c8e37c7345
2021-07-05 16:57:34 +00:00
Pedro Loureiro
2f58789d65 make system server modules use filtered lint database am: 7609182dda
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/15208490

Change-Id: I4c93b1a85206124c7fd282e35904d5c55b7d0d59
2021-07-05 16:50:55 +00:00
Pedro Loureiro
7609182dda make system server modules use filtered lint database
Bug: 188851704
Test: m
Change-Id: Ie8f63286aeeb4cdbec5b9320c2ba41c8e37c7345
2021-07-05 14:01:49 +00:00
Paul Duffin
7ecb331fd3 Merge "Generate boot zip file from prebuilt_bootclasspath_fragment" am: 452decbd88 am: 019e278025
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1753271

Change-Id: I969dde3851899374bd466c9a0e5263f0fe6d12c8
2021-07-05 12:27:08 +00:00
Paul Duffin
452decbd88 Merge "Generate boot zip file from prebuilt_bootclasspath_fragment" 2021-07-05 12:01:46 +00:00
Paul Duffin
59480e327e Merge "Use both module name and stem name to filter updatable boot jars" am: 276fd424ad am: 31620af91d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1748051

Change-Id: Ib0f336f1ee599d2cb8ed03af3caec2fb953a4878
2021-07-02 21:17:38 +00:00
Paul Duffin
276fd424ad Merge "Use both module name and stem name to filter updatable boot jars" 2021-07-02 20:41:07 +00:00
Paul Duffin
791604ff6c Retry: Make bootclasspath_fragments always perform hidden API processing am: dad8880399
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/15175112

Change-Id: I73d61880403062eaec056e003a9b4f3b2495b73f
2021-07-02 08:59:15 +00:00
Paul Duffin
56afb27fb0 Generate boot zip file from prebuilt_bootclasspath_fragment
Previously, the boot zip file, containing all the boot image files for
all the supported architectures, was only created from source. It was
not created when building from a prebuilt_bootclasspath_fragment. That
lead to build failures when building from ART prebuilts.

This change pulls the boot zip file creation out so that it can be done
for both source and prebuilt bootclasspath_fragment modules as well as
for the platform_bootclasspath module.

Bug: 192575099
Test: m out/target/product/generic_arm64/boot.zip
      m SOONG_CONFIG_art_module_source_build=false out/target/product/generic_arm64/boot.zip
      - Compare the output of the first command from before the change
        with the output from them both after and confirm that when the
        ART prebuilts are up to date with the source that there are no
        differences.
Change-Id: Ie7dd5e2ca4a865d06fd9ebf87320cf68c4d05bc3
2021-07-01 22:17:49 +01:00
satayev
4efc42d57f Merge "Use system stubs for framework-doc-system-stubs." am: 8e3356f610 am: 015ca2f4b9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1745338

Change-Id: Ieca85003da032ab1fc0ebac10e2fd59bdb8cd0f9
2021-07-01 17:49:54 +00:00
satayev
8e3356f610 Merge "Use system stubs for framework-doc-system-stubs." 2021-07-01 17:21:36 +00:00
Paul Duffin
dad8880399 Retry: Make bootclasspath_fragments always perform hidden API processing
Previously, bootclasspath_fragment modules would only perform hidden
API processing if they provided some stub libraries and fragments. That
was needed because the bootclasspath_fragment modules were added before
Soong supported hidden API processing on all the different modules and
before they all provided the necessary information that hidden API
processing required.

This change stops hidden API being conditional as it is no longer
required as it has been enabled on all existing bootclasspath_fragment
modules.

Bug: 179354495
Test: m nothing
Change-Id: Ibf81a7de63b888a3ebf445528326fa6101fdb1ba
2021-07-01 17:22:50 +01:00
Paul Duffin
886060a688 Defer error reporting of missing prebuilt dex jar files
Unless the prebuilt dex jar files are explicitly required to build
system images or dex preopting defer reporting of any missing dex boot
jars from Soong to Ninja.

This will prevent builds that contain prebuilt sdks, containing prebuilt
bootclasspath_fragment modules but without a corresponding apex_set or
prebuilt_apex module from failing even when it is not building against
the prebuilt sdk.

Bug: 179354495
Test: m nothing
Merged-In: Ibde3bf840a7413785cd32bd6cea1c322f90c59af
Change-Id: Ibde3bf840a7413785cd32bd6cea1c322f90c59af
(cherry picked from commit ef083c9556)
2021-07-01 17:20:53 +01:00
Paul Duffin
cc82eab6bb Merge "Revert "Make bootclasspath_fragments always perform hidden API processing"" into sc-dev am: fb5229b3bc
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/15175110

Change-Id: I5ac37d22100a88c205d068daecaacc2829280119
2021-07-01 16:03:02 +00:00