Commit graph

5401 commits

Author SHA1 Message Date
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
Orion Hodson
e6e499b3eb Merge "Support using java_sdk_library components in stub_libs" into sc-dev 2021-07-01 15:54:10 +00:00
Paul Duffin
fb5229b3bc Merge "Revert "Make bootclasspath_fragments always perform hidden API processing"" into sc-dev 2021-07-01 15:47:24 +00:00
Paul Duffin
71e98fa303 Revert "Make bootclasspath_fragments always perform hidden API processing"
This reverts commit 2b255d7f6b.

Reason for revert: build breakage http://b/192554546

Bug: 179354495
Change-Id: Id758af3f59bc83b02d8af4b1b83b3f279a208595
2021-07-01 15:27:27 +00:00
Paul Duffin
9f2a02741b Merge "Make bootclasspath_fragments always perform hidden API processing" into sc-dev am: f4a65fee98
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/15171637

Change-Id: I9aedbf6f53cdff3ef80692b65e8e22f4884b09b8
2021-07-01 14:36:53 +00:00
Paul Duffin
f4a65fee98 Merge "Make bootclasspath_fragments always perform hidden API processing" into sc-dev 2021-07-01 14:20:41 +00:00
Orion Hodson
a8ea2833a2 Merge ""module_current" and "system_server_current" should contain ART's @SystemApi(MODULE_LIBRARIES)" into sc-dev 2021-07-01 13:48:57 +00:00
Paul Duffin
b5e4a38f2f Ensure that systemserverclasspath_fragment does not depend on prebuilts am: ba96f7c5b6
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/15171640

Change-Id: Ia35d288312380dab42988db13f87a11fdfd16f5d
2021-07-01 13:27:44 +00:00
Paul Duffin
5842387832 Support using java_sdk_library components in stub_libs
Previously, if a bootclasspath_fragment had both a java_sdk_library
module and one of its components in stub_libs properties they would be
treated as separate modules instead of simply different APIs from the
same module. That would result in them both providing stub dex jars to
"hiddenapi list" which would fail because it found duplicate
definitions of the same class.

e.g. Specifying something like this:
    api: {
        stub_libs: [
            "art.module.public.api",
        ],
    },
    core_platform_api: {
        stub_libs: [
            "art.module.public.api.stubs.module_lib",
        ],
    },

would cause "hiddenapi list" to fail because it would have been passed
paths to two dex jars (actually the same dex jar but that does not
matter) each of which defined the same class, e.g. java.lang.Object.

This change treats the "art.module.public.api.stubs.module_lib" and
"art.module.public.api" modules as being the same for the purposes of
hidden API processing.

(cherry picked from commit 3f0290ef79)

Bug: 192446466
Test: m nothing
Merged-In: I9de96337f64f26e24cff040d4bbed9eecc67b1ed
Change-Id: I9e1cb82bea96022faaec98edc0c9ea7eac6204b0
2021-07-01 14:27:42 +01:00
Paul Duffin
746ce447c5 Merge "Defer error reporting of missing prebuilt dex jar files" am: 4b51e27046 am: 032a126e75
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1751341

Change-Id: I1b864cce2c30e682808834aec53448a0b6cd484f
2021-07-01 11:24:19 +00:00
Paul Duffin
ba96f7c5b6 Ensure that systemserverclasspath_fragment does not depend on prebuilts
Bug: 190037398
Test: m nothing
Change-Id: I85671613c70bbfe8adde1d24d7f59ed7b53a8120
2021-07-01 12:24:12 +01:00
Paul Duffin
2b255d7f6b 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-01 11:56:41 +01:00
Paul Duffin
4b51e27046 Merge "Defer error reporting of missing prebuilt dex jar files" 2021-07-01 10:55:16 +00:00
Orion Hodson
7be1ef9502 Merge ""module_current" and "system_server_current" should contain ART's @SystemApi(MODULE_LIBRARIES)" am: 39924233e0 am: 472603d46f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1748050

Change-Id: I7c699d6a1b6f7a4f093ca953dab5f161b377093d
2021-07-01 10:08:12 +00:00
Victor Chang
2d457e1cc8 "module_current" and "system_server_current" should contain ART's @SystemApi(MODULE_LIBRARIES)
Before this fix, compiling a java_library against sdk_version:
"module_current" can't use the @SystemApi(MODULE_LIBRARIES) provided
by the ART module because the system module "core-current-stubs-system-modules"
contains only the public APIs.

Use the new system module with module lib APIs.

(cherry picked from commit b54f5aa359)

Bug: 183097033
Test: m droid
Merged-In: I274e2710d1ff34e896aa620bfafb4481180c53b5
Change-Id: I374bc4899ef8f60344e37a94ad3cb8492f47fb4d
2021-07-01 10:57:26 +01:00
Paul Duffin
a06f2e448f Merge "Support using java_sdk_library components in stub_libs" am: f03aaf5fc7 am: 0b11f6c748
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1752643

Change-Id: I645e7dbdc7913fce092d210cf5e521da594ef4ea
2021-07-01 09:57:19 +00:00
Orion Hodson
39924233e0 Merge ""module_current" and "system_server_current" should contain ART's @SystemApi(MODULE_LIBRARIES)" 2021-07-01 09:43:41 +00:00
Paul Duffin
f03aaf5fc7 Merge "Support using java_sdk_library components in stub_libs" 2021-07-01 09:22:49 +00:00
Maxim Pleshivenkov
d2b51f3b8b Added quotes to protect wildcard am: 9d773841c9 am: 7dcc124a75
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1752900

Change-Id: I5e1dc291d9e8833f35eadd9005c6405f6b8be7ae
2021-06-30 22:20:47 +00:00
Paul Duffin
3f0290ef79 Support using java_sdk_library components in stub_libs
Previously, if a bootclasspath_fragment had both a java_sdk_library
module and one of its components in stub_libs properties they would be
treated as separate modules instead of simply different APIs from the
same module. That would result in them both providing stub dex jars to
"hiddenapi list" which would fail because it found duplicate
definitions of the same class.

e.g. Specifying something like this:
    api: {
        stub_libs: [
            "art.module.public.api",
        ],
    },
    core_platform_api: {
        stub_libs: [
            "art.module.public.api.stubs.module_lib",
        ],
    },

would cause "hiddenapi list" to fail because it would have been passed
paths to two dex jars (actually the same dex jar but that does not
matter) each of which defined the same class, e.g. java.lang.Object.

This change treats the "art.module.public.api.stubs.module_lib" and
"art.module.public.api" modules as being the same for the purposes of
hidden API processing.

Bug: 192446466
Test: m nothing
Change-Id: I9de96337f64f26e24cff040d4bbed9eecc67b1ed
2021-06-30 19:36:52 +01:00
Maxim Pleshivenkov
9d773841c9 Added quotes to protect wildcard
When generating zip archive with zip2zip wildcard mask is specified.
Bash attempts to resolve wildcard **/*.class. If android build
top directory containts subfolder(s) with .class, bash wildcard
resolution  succeeds. Bash passes list of files to zip2zip instead
of actual wildcard. Created archive doesn't contain required files.

Adding quotes to wildcard to prvent that.

Bug: NA
Test: manual - build with coverage enabled
Change-Id: Iebdaa32693fe820f0f79588d61cb89660ea2b611
2021-06-30 14:29:49 -04:00
Colin Cross
f2d6bdde9d Merge changes from topic "lint-update-7.1.0" am: 1dfd1039a5 am: 20389cda89
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1746720

Change-Id: Ib988b63de0391d14107442e6ab0bc56c03d527be
2021-06-30 18:12:52 +00:00
Colin Cross
2b8c5cd365 Filter srcjars out of srcFiles am: b0ef30ab4a am: 5da98c1c34
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1751182

Change-Id: I2bba227d8994d0da177829e19613a1f6134b0c6c
2021-06-30 18:12:47 +00:00
Paul Duffin
56c93e899a Use both module name and stem name to filter updatable boot jars
Sometimes the stem property is set to change both the installed file
name and the name use to filter the configured module list, e.g. when
adding a test library to replace the standard library, e.g. test_foo
instead of foo.

Sometimes it is used just to change the installed file name.

This change uses both to filter the updatable boot jars and not just
the stem.

Bug: 180105615
Test: m nothing
Change-Id: I6c459fc3597b1e4f062bc9a4e52843305b538c5f
2021-06-29 23:35:25 +01:00
satayev
783195cc5b Use system stubs for framework-doc-system-stubs.
The target is used to generate api_versions.xml file used by Android
Lint, point it to the system stubs in prebuilts/sdk/.

Bug: 190665366
Test: m framework-doc-system-stubs
Change-Id: I27fbad9eb1d84792901974674cbd85f0994bc9f1
2021-06-29 22:25:57 +01:00
Victor Chang
b54f5aa359 "module_current" and "system_server_current" should contain ART's @SystemApi(MODULE_LIBRARIES)
Before this fix, compiling a java_library against sdk_version:
"module_current" can't use the @SystemApi(MODULE_LIBRARIES) provided
by the ART module because the system module "core-current-stubs-system-modules"
contains only the public APIs.

Use the new system module with module lib APIs.

Bug: 183097033
Test: m droid
Change-Id: I274e2710d1ff34e896aa620bfafb4481180c53b5
2021-06-29 22:05:58 +01:00
Colin Cross
b0ef30ab4a Filter srcjars out of srcFiles
srcFiles is passed to Lint, and given it both the srcjars and the
expanded sources from the srcjars confuses it about which files are
generated.  Remove srcjars from srcFiles after handling them.

Bug: 192245952
Test: m lint-check
Change-Id: Ic57d1c623f4cac7cd79f1342bac4b51bd2535ac3
2021-06-29 10:43:57 -07:00
Colin Cross
a36c2b830f Downgrade new errors from lint 7.1.0-dev to warnings
Test: m lint-check
Change-Id: I442bc160e578b0230204cb083f1a245febb0f785
2021-06-29 10:43:57 -07:00
Paul Duffin
ef083c9556 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
Change-Id: Ibde3bf840a7413785cd32bd6cea1c322f90c59af
2021-06-29 13:41:03 +01:00
Treehugger Robot
ba0b3bb665 Merge changes I5823fdb5,I3e44c137 am: 26999937e2 am: 46d7b4d06f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1749115

Change-Id: I2cbc753efa5c44c693414f9e7db7a48174065bbb
2021-06-28 20:07:44 +00:00
Jooyung Han
f05ca9c0ea Tag android_app_import's apk as android:"path"
Now, android_app_import can use apk from other modules like genrule.

Bug: 192200378
Test: m com.android.compos
Change-Id: I5823fdb53b6aa20bfd9ec4dd16aafe63e65b6b68
2021-06-29 02:07:24 +09:00
Paul Duffin
fb8f07bc0e Calculate widest stub dex jars per module
Previously, the stub dex jars for each HiddenAPIScope was created by
merging the stub dex jars provided by each module for that scope. Then
the widest stub dex jars were chosen. So, if module A provided public,
system and test stub dex jars and module B provided only public then
the stub dex jars for each scope would be:
* public -> A,B
* system -> A
* test -> A

So, the widest API scope for which there are stub dex jars is "test"
and so the widest stub dex jars would just come from module A and not
module B. So, when "hiddenapi list" is run for module C which depends
on modules A and B it only gets given stub dex jars for module A which
means that it cannot resolve all the types that C may use which can
lead to incorrect flags being generated.

This change does not merge the stub dex jars from each module together
and instead keeps them separate by module. The widest stub dex jars
list is constructed by asking each module in turn for their widest stub
dex jars. e.g. Given the above example we would have:

Module A:
* public
* system
* test <- widest

Module B:
* public <- widest

So, the widest stub dex jars will be A's test and B's public stub dex
jars.

Bug: 179354495
Test: m out/soong/hiddenapi-flags.csv
      - make sure that this does not change the file.
Merged-In: Ib137825ebffe94b2bf220732bae6077f7b7ac6db
Change-Id: Ib137825ebffe94b2bf220732bae6077f7b7ac6db
(cherry picked from commit 280a31aac3)
2021-06-28 16:05:05 +01:00
Paul Duffin
d05bb8eebd Add test to show issues with widest stub dex jars
The widest stub dex jars should include the widest stub dex jars
provided by each module. So, if module A has public, system and test
and module B has only public then the widest stub dex jars should
include module A's test and module B's public stub dex jars. Instead,
they just include module A's test.

That behaviour is needed so that when the "hiddenapi list" tool is run
against a module C that it is passed stub dex jars from both module A
and module B so that any references to the types provided by those APIs
can be resolved.

A follow up change will fix this issue.

Bug: 179354495
Test: m nothing
Merged-In: Ibd31964e8d2a33fa92fbd0b800c9fe054ee359c7
Change-Id: Ibd31964e8d2a33fa92fbd0b800c9fe054ee359c7
(cherry picked from commit d2b1e0ca92)
2021-06-28 16:05:05 +01:00
Paul Duffin
fdb2fb6f1f Allow hiddenapi list to ignore missing classes/members
When generating the stub-flags.csv for a bootclasspath_fragment the
hiddenapi list tool is not given a complete set of all classes and
members. This change causes it to ignore them by passing the new
--fragment option to it.

This does not risk changing the flags as the stub-flags.csv files
created with the --fragment option are compared with the monolithic
out/soong/hiddenapi/hiddenapi-stub-flags.txt file which is not run
with this option to ensure that they match.

Bug: 179354495
Test: m out/soong/hiddenapi-stub-flags.csv
      - make sure that this does not change the file.
Merged-In: I890c7374c445759cade4d685f51e81261b7ccea2
Change-Id: I890c7374c445759cade4d685f51e81261b7ccea2
(cherry picked from commit 156b5d3b61)
2021-06-28 16:05:04 +01:00
Paul Duffin
e5f1b2f131 Merge "Calculate widest stub dex jars per module" am: 634966767c am: f72c380726
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1748467

Change-Id: Ie3fd02dda6a6de949a667c3512b89b3b6063a56b
2021-06-28 12:25:34 +00:00
Paul Duffin
634966767c Merge "Calculate widest stub dex jars per module" 2021-06-28 11:55:07 +00:00
Paul Duffin
14c190c4b5 Merge "Add test to show issues with widest stub dex jars" am: f6d3b2aef8 am: dc2947c21f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1748466

Change-Id: I2ceb38418509a8cc25b5db8d9dcd561a3e81fff9
2021-06-28 11:27:38 +00:00
Paul Duffin
0b57ca11ac Merge "Allow hiddenapi list to ignore missing classes/members" am: 9e4a27840b am: cac5c585dc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1747553

Change-Id: I828d35e39750bb5f57ceb6af6a11ba92ba6fd868
2021-06-28 11:27:28 +00:00
Paul Duffin
f6d3b2aef8 Merge "Add test to show issues with widest stub dex jars" 2021-06-28 10:58:55 +00:00
Paul Duffin
9e4a27840b Merge "Allow hiddenapi list to ignore missing classes/members" 2021-06-28 10:58:46 +00:00
Mathew Inwood
fbaa8e9d6a Merge "Use trimmed lint database for mainline modules" into sc-dev 2021-06-28 10:17:49 +00:00
Anton Hansson
7c05246ab2 Merge "Use trimmed lint database for mainline modules" am: 8aa7beb58d am: 2e764b82b8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1731410

Change-Id: I45582af575f269524359d1a2b666f9aa3056479d
2021-06-28 10:06:56 +00:00
Paul Duffin
280a31aac3 Calculate widest stub dex jars per module
Previously, the stub dex jars for each HiddenAPIScope was created by
merging the stub dex jars provided by each module for that scope. Then
the widest stub dex jars were chosen. So, if module A provided public,
system and test stub dex jars and module B provided only public then
the stub dex jars for each scope would be:
* public -> A,B
* system -> A
* test -> A

So, the widest API scope for which there are stub dex jars is "test"
and so the widest stub dex jars would just come from module A and not
module B. So, when "hiddenapi list" is run for module C which depends
on modules A and B it only gets given stub dex jars for module A which
means that it cannot resolve all the types that C may use which can
lead to incorrect flags being generated.

This change does not merge the stub dex jars from each module together
and instead keeps them separate by module. The widest stub dex jars
list is constructed by asking each module in turn for their widest stub
dex jars. e.g. Given the above example we would have:

Module A:
* public
* system
* test <- widest

Module B:
* public <- widest

So, the widest stub dex jars will be A's test and B's public stub dex
jars.

Bug: 179354495
Test: m out/soong/hiddenapi-flags.csv
      - make sure that this does not change the file.
Change-Id: Ib137825ebffe94b2bf220732bae6077f7b7ac6db
2021-06-28 10:56:43 +01:00
Anton Hansson
8aa7beb58d Merge "Use trimmed lint database for mainline modules" 2021-06-28 09:36:46 +00:00
Paul Duffin
a9c7f46118 Merge "Add sdk_library_test.go to Android.bp file" am: aed46487b0 am: e49ae4af3f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1748465

Change-Id: If48277205b9d227fead01970eb8f2cb9727907cc
2021-06-28 07:51:58 +00:00
Paul Duffin
d2b1e0ca92 Add test to show issues with widest stub dex jars
The widest stub dex jars should include the widest stub dex jars
provided by each module. So, if module A has public, system and test
and module B has only public then the widest stub dex jars should
include module A's test and module B's public stub dex jars. Instead,
they just include module A's test.

That behaviour is needed so that when the "hiddenapi list" tool is run
against a module C that it is passed stub dex jars from both module A
and module B so that any references to the types provided by those APIs
can be resolved.

A follow up change will fix this issue.

Bug: 179354495
Test: m nothing
Change-Id: Ibd31964e8d2a33fa92fbd0b800c9fe054ee359c7
2021-06-27 22:46:14 +01:00
Paul Duffin
156b5d3b61 Allow hiddenapi list to ignore missing classes/members
When generating the stub-flags.csv for a bootclasspath_fragment the
hiddenapi list tool is not given a complete set of all classes and
members. This change causes it to ignore them by passing the new
--fragment option to it.

This does not risk changing the flags as the stub-flags.csv files
created with the --fragment option are compared with the monolithic
out/soong/hiddenapi/hiddenapi-stub-flags.txt file which is not run
with this option to ensure that they match.

Bug: 179354495
Test: m out/soong/hiddenapi-stub-flags.csv
      - make sure that this does not change the file.
Change-Id: I890c7374c445759cade4d685f51e81261b7ccea2
2021-06-27 22:46:14 +01:00
Paul Duffin
9fc208ee54 Add sdk_library_test.go to Android.bp file
When this file was initially created by extracting the test from the
java_test.go file it was not added to Android.bp file so was not being
built and tested as it should. That lead to a recent change that left
it unable to compile. This change corrects both those issues.

Bug: 186723288
Bug: 179354495
Test: m nothing
Change-Id: I06f32bb572f57b6df3c772f1d9d21fe323fbf353
2021-06-27 20:42:48 +01:00
Paul Duffin
b3821fea38 Support hidden API processing for modules that use platform APIs
Previously, hidden API processing could only be done by those
bootclasspath_fragment modules that either did not depend on any other
fragments (e.g. art-bootclasspath-fragment) or only depended on APIs
provided by other fragments (e.g. i18n-bootclasspath-fragment). That
meant that modules like com.android.os.statsd-bootclasspath-fragment
that depended on APIs provided by parts of the platform which are not
yet part of another bootclasspath_fragment could not perform hidden
API processing.

This change adds support for a bootclasspath_fragment to specify the
additional stubs needed to perform hidden API processing. It adds a new
additional_stubs property that can be used to specify the additional
stub libraries.

Most bootclasspath_fragments that need to use the property will need
access to the APIs provided by the android-non-updatable.* libraries.
Rather than have each fragment explicitly specify the correct module
for each scope it treats "android-non-updatable" as if it was a
java_sdk_library that can provide different jars for each scope.
Soong will handle mapping that to the correct android-non-updatable.*
module.

Bug: 179354495
Test: m out/soong/hiddenapi/hiddenapi-flags.csv \
        out/soong/hiddenapi/hiddenapi-index.csv \
        out/soong/hiddenapi/hiddenapi-stub-flags.txt \
        out/soong/hiddenapi/hiddenapi-unsupported.csv
      - make sure that this change does not change the contents.
      m TARGET_BUILD_APPS=Calendar nothing
Merged-In: Ia8b79830ed0e6d42100de03d76b0c51b7f6c8ade
Change-Id: Ia8b79830ed0e6d42100de03d76b0c51b7f6c8ade
(cherry picked from commit 5cca7c44e5)
2021-06-25 21:59:28 +01:00
Paul Duffin
af193429d4 Verify the modular stub flags are subsets of the monolithic stub flags
Bug: 179354495
Test: m out/soong/hiddenapi/hiddenapi-stub-flags.txt
      - check that an error is reported if a modular stub-flags.csv file,
        i.e. one created by a fragment is not a subset of the monolithic
        file, e.g. because a signature in the modular file has different
        flags than it does in the monolithic or is not present there.
Merged-In: I46ebb495cb093a5e3abe7571c49933c845318549
Change-Id: I46ebb495cb093a5e3abe7571c49933c845318549
(cherry picked from commit 2e88097152)
2021-06-25 21:59:28 +01:00
Paul Duffin
31a6856823 Make ruleToGenerateHiddenAPIStubFlagsFile build rule
Previously, the func created a rule and returned it for the caller to
create with the appropriate name and description. This change passes
the name and description into the func and causes it to create the rule
itself. The func is also renamed to make it more consistent with the
other similar rules.

Bug: 179354495
Test: m nothing
Merged-In: I2a4455daa8a6090ed5568994b255848d063e1ab2
Change-Id: I2a4455daa8a6090ed5568994b255848d063e1ab2
(cherry picked from commit 4539a37a61)
2021-06-25 21:59:28 +01:00
Paul Duffin
12ef8d8bac Merge "Support hidden API processing for modules that use platform APIs" am: 99926a2a77 am: 9d67121fff
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1744417

Change-Id: I0929917000886efd04d021dd4370c66f09cca00c
2021-06-25 18:56:19 +00:00
Paul Duffin
75ca10d437 Merge "Verify the modular stub flags are subsets of the monolithic stub flags" am: 921d33d447 am: 6b923bc2c0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1745334

Change-Id: I0d420d934d63008a4de087c35a5c07caff2adf5f
2021-06-25 18:55:41 +00:00
Paul Duffin
f48c06ec21 Merge "Make ruleToGenerateHiddenAPIStubFlagsFile build rule" am: 49c91f32b2 am: 3a5056f429
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1745333

Change-Id: I3bb3957639442ee0e30e15d7abe230feea23547e
2021-06-25 18:54:28 +00:00
Paul Duffin
5c6f03cfbf Merge "Add ModuleLibHiddenAPIScope for hidden API processing" into sc-dev 2021-06-25 18:30:40 +00:00
Paul Duffin
3ca616b9f9 Merge "Add HiddenAPIScope to replace use of SdkKind" into sc-dev 2021-06-25 18:28:55 +00:00
Paul Duffin
05fc06ebcd Merge "Ensure consistent APEX variation for java_sdk_library and java_sdk_library_import" into sc-dev 2021-06-25 18:28:00 +00:00
Paul Duffin
99926a2a77 Merge "Support hidden API processing for modules that use platform APIs" 2021-06-25 18:25:39 +00:00
Pedro Loureiro
f1be9ba5a4 Use trimmed lint database for mainline modules
Lint's NewApi checks currently produce a lot of false positive findings.
The filtered lint database removes information of classes defined by
mainline modules which are the cases that might become a false positive.

This commit updates soong to use this database instead of the normal one
when linting mainline modules.

Test: m lint-check
Fixes: 186478867
Change-Id: Ica646081b9189303c393b36b2f02914d69eee291
Merged-In: Ica646081b9189303c393b36b2f02914d69eee291
2021-06-25 18:09:45 +00:00
Paul Duffin
2cb06b70fe Add ModuleLibHiddenAPIScope for hidden API processing
Although the hidden API runtime does not support a module-lib API flag
the hidden API processing does need to used them as they are needed by
the "hiddenapi list" tool for any bootclasspath_fragment module whose
contents builds against an sdk_version of "module_current". Without it
the "hiddenapi list" tool could fail to resolve references to classes
provided by other modules which would break the build.

Bug: 179354495
Test: m out/soong/hiddenapi/hiddenapi-flags.csv
      - make sure that this change has no effect on the generated flags.
Merged-In: I3ecb80fdaeba0e66d1ee25cb57152ab546d9bfe0
Change-Id: I3ecb80fdaeba0e66d1ee25cb57152ab546d9bfe0
(cherry picked from commit b51db2ed8e)
2021-06-25 16:44:30 +01:00
Paul Duffin
05bbff90bd Add HiddenAPIScope to replace use of SdkKind
Previously, the hidden API processing used SdkKind to identify the API
scopes, e.g. public, system, etc. that are of interest for hidden API
processing. Unfortunately, there is a mismatch between the SdkKind and
what hidden API processing needs. e.g. SdkKind includes values that are
not used by hidden API processing and hidden API processing needs
additional API scope specific information not provided by SdkKind. The
apiScope struct used in sdk_library.go is also not a suitable
representation for similar reasons.

This change adds the HiddenAPIScope (following a similar approach as
apiScope) that rectifies that and uses it as a replacement for SdkKind
in most parts of the hidden API processing. The SdkKind is still used
for retrieving information from java_sdk_library[_import] modules.

Follow up changes will extend the HiddenAPIScope with more information.

Bug: 179354495
Test: m out/soong/hiddenapi/hiddenapi-flags.csv
      - make sure that this change has no effect on the generated flags.
Merged-In: I97968f58535121652852b8d25217aa288afd2bfd
Change-Id: I97968f58535121652852b8d25217aa288afd2bfd
(cherry picked from commit 31fad800a7)
2021-06-25 16:44:30 +01:00
Paul Duffin
5cca7c44e5 Support hidden API processing for modules that use platform APIs
Previously, hidden API processing could only be done by those
bootclasspath_fragment modules that either did not depend on any other
fragments (e.g. art-bootclasspath-fragment) or only depended on APIs
provided by other fragments (e.g. i18n-bootclasspath-fragment). That
meant that modules like com.android.os.statsd-bootclasspath-fragment
that depended on APIs provided by parts of the platform which are not
yet part of another bootclasspath_fragment could not perform hidden
API processing.

This change adds support for a bootclasspath_fragment to specify the
additional stubs needed to perform hidden API processing. It adds a new
additional_stubs property that can be used to specify the additional
stub libraries.

Most bootclasspath_fragments that need to use the property will need
access to the APIs provided by the android-non-updatable.* libraries.
Rather than have each fragment explicitly specify the correct module
for each scope it treats "android-non-updatable" as if it was a
java_sdk_library that can provide different jars for each scope.
Soong will handle mapping that to the correct android-non-updatable.*
module.

Bug: 179354495
Test: m out/soong/hiddenapi/hiddenapi-flags.csv \
        out/soong/hiddenapi/hiddenapi-index.csv \
        out/soong/hiddenapi/hiddenapi-stub-flags.txt \
        out/soong/hiddenapi/hiddenapi-unsupported.csv
      - make sure that this change does not change the contents.
      m TARGET_BUILD_APPS=Calendar nothing
Change-Id: Ia8b79830ed0e6d42100de03d76b0c51b7f6c8ade
2021-06-25 16:20:19 +01:00
Paul Duffin
2e88097152 Verify the modular stub flags are subsets of the monolithic stub flags
Bug: 179354495
Test: m out/soong/hiddenapi/hiddenapi-stub-flags.txt
      - check that an error is reported if a modular stub-flags.csv file,
        i.e. one created by a fragment is not a subset of the monolithic
        file, e.g. because a signature in the modular file has different
        flags than it does in the monolithic or is not present there.
Change-Id: I46ebb495cb093a5e3abe7571c49933c845318549
2021-06-25 14:49:10 +01:00
Paul Duffin
4539a37a61 Make ruleToGenerateHiddenAPIStubFlagsFile build rule
Previously, the func created a rule and returned it for the caller to
create with the appropriate name and description. This change passes
the name and description into the func and causes it to create the rule
itself. The func is also renamed to make it more consistent with the
other similar rules.

Bug: 179354495
Test: m nothing
Change-Id: I2a4455daa8a6090ed5568994b255848d063e1ab2
2021-06-25 14:49:07 +01:00
Paul Duffin
ca9dcd2d38 Merge "Add ModuleLibHiddenAPIScope for hidden API processing" am: 136fd5554d am: 9579e5e4ac
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1744416

Change-Id: Ifa3bb7fdf5abdf084de1efcd321767d1cf6ab87f
2021-06-25 11:26:55 +00:00
Paul Duffin
ac35c397bc Merge "Add HiddenAPIScope to replace use of SdkKind" am: e09a6692de am: 7f5954a225
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1744414

Change-Id: I85bc152e161fafad8d086e58f5e296e2a10f5160
2021-06-25 11:26:43 +00:00
Paul Duffin
136fd5554d Merge "Add ModuleLibHiddenAPIScope for hidden API processing" 2021-06-25 11:08:31 +00:00
Paul Duffin
e09a6692de Merge "Add HiddenAPIScope to replace use of SdkKind" 2021-06-25 11:08:15 +00:00
Pedro Loureiro
18233a2b47 Use trimmed lint database for mainline modules
Lint's NewApi checks currently produce a lot of false positive findings.
The filtered lint database removes information of classes defined by
mainline modules which are the cases that might become a false positive.

This commit updates soong to use this database instead of the normal one
when linting mainline modules.

Test: m lint-check
Fixes: 186478867
Change-Id: Ica646081b9189303c393b36b2f02914d69eee291
2021-06-25 10:44:59 +00:00
Orion Hodson
ce3f20e5c2 Merge "Update dex_preopt related OWNERS" am: 4eb3d6599f am: f6ef94cc37
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1739057

Change-Id: Ib2e961cc7cabd2c0bd90d2faa3384bb961a52e61
2021-06-25 09:30:44 +00:00
Orion Hodson
4eb3d6599f Merge "Update dex_preopt related OWNERS" 2021-06-25 08:52:09 +00:00
Paul Duffin
b51db2ed8e Add ModuleLibHiddenAPIScope for hidden API processing
Although the hidden API runtime does not support a module-lib API flag
the hidden API processing does need to used them as they are needed by
the "hiddenapi list" tool for any bootclasspath_fragment module whose
contents builds against an sdk_version of "module_current". Without it
the "hiddenapi list" tool could fail to resolve references to classes
provided by other modules which would break the build.

Bug: 179354495
Test: m out/soong/hiddenapi/hiddenapi-flags.csv
      - make sure that this change has no effect on the generated flags.
Change-Id: I3ecb80fdaeba0e66d1ee25cb57152ab546d9bfe0
2021-06-24 22:04:09 +01:00
Paul Duffin
31fad800a7 Add HiddenAPIScope to replace use of SdkKind
Previously, the hidden API processing used SdkKind to identify the API
scopes, e.g. public, system, etc. that are of interest for hidden API
processing. Unfortunately, there is a mismatch between the SdkKind and
what hidden API processing needs. e.g. SdkKind includes values that are
not used by hidden API processing and hidden API processing needs
additional API scope specific information not provided by SdkKind. The
apiScope struct used in sdk_library.go is also not a suitable
representation for similar reasons.

This change adds the HiddenAPIScope (following a similar approach as
apiScope) that rectifies that and uses it as a replacement for SdkKind
in most parts of the hidden API processing. The SdkKind is still used
for retrieving information from java_sdk_library[_import] modules.

Follow up changes will extend the HiddenAPIScope with more information.

Bug: 179354495
Test: m out/soong/hiddenapi/hiddenapi-flags.csv
      - make sure that this change has no effect on the generated flags.
Change-Id: I97968f58535121652852b8d25217aa288afd2bfd
2021-06-24 21:56:27 +01:00
Paul Duffin
2d44b91e47 Merge "Ensure consistent APEX variation for java_sdk_library and java_sdk_library_import" am: 770193da6c am: 6376a132a7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1746296

Change-Id: Ifa5c52220eb38b3f8be980c2ff866e5862340a93
2021-06-24 15:17:46 +00:00
Jeongik Cha
ec9c82da9f Expose imageLocationsOnDevice as well as imageLocationsOnHost
Bug: 158843648
Test: check if dexpreopt.config for the module defined in mk file has
DexPreoptImageLocationsOnDevice field

Change-Id: Idb2de398871ff114245393a9dd92b5a1b5c942e7
Merged-In: Idb2de398871ff114245393a9dd92b5a1b5c942e7
(cherry picked from commit e3165c8de3)
2021-06-24 13:14:29 +00:00
Paul Duffin
2f7ccd56a8 Ensure consistent APEX variation for java_sdk_library and java_sdk_library_import
Previously, a java_sdk_library with shared_library = true would create
a variation per APEX because it depends on an sdkLibraryXml module
which generates a file containing the APEX name. However, a shared
java_sdk_library_import would create a merged APEX variation. The
inconsistent variations caused failures in sdkDepsReplaceMutator.

This change ensures that both java_sdk_library and
java_sdk_library_import create an APEX specific variation when their
shared_library property is true.

Bug: 190499958
Test: m nothing
      - ran the above command after modifying the test to reproduce the
        problem and then after fixing to verify that it fixed the problem.
Change-Id: Iee81776a8569db3e871c40cbde14d248dfeb56e4
2021-06-24 13:38:05 +01:00
Paul Duffin
ea8f808580 Ensure consistent APEX variation for java_sdk_library and java_sdk_library_import
Previously, a java_sdk_library with shared_library = true would create
a variation per APEX because it depends on an sdkLibraryXml module
which generates a file containing the APEX name. However, a shared
java_sdk_library_import would create a merged APEX variation. The
inconsistent variations caused failures in sdkDepsReplaceMutator.

This change ensures that both java_sdk_library and
java_sdk_library_import create an APEX specific variation when their
shared_library property is true.

Bug: 190499958
Test: m nothing
      - ran the above command after modifying the test to reproduce the
        problem and then after fixing to verify that it fixed the problem.
Change-Id: Iee81776a8569db3e871c40cbde14d248dfeb56e4
2021-06-24 13:33:01 +01:00
Jeongik Cha
2c9391aace Merge "Expose imageLocationsOnDevice as well as imageLocationsOnHost" am: c1218f395c am: e40749a1b6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1744553

Change-Id: I532648d21cd60b95fa7e6d868ecc2244e04299f4
2021-06-24 00:29:20 +00:00
Treehugger Robot
a8de9fb2ae Merge "Remove duplicate component from sdk snapshot" 2021-06-24 00:04:42 +00:00
Jeongik Cha
c1218f395c Merge "Expose imageLocationsOnDevice as well as imageLocationsOnHost" 2021-06-23 23:59:07 +00:00
Paul Duffin
b97b1579d3 Remove duplicate component from sdk snapshot
Previously, an sdk snapshot could contain the following:
* A java_sdk_library_import module, e.g. "foo" which creates component
  modules "foo.stubs", etc.
* A corresponding versioned module, e.g. "sdk_foo@current" which
  created component modules "sdk_foo@current.stubs", etc.
* An internal (to the sdk snapshot) java_import for one of "foo"'s
  components, e.g. "sdk_foo.stubs"
* A corresponding versioned module, e.g. "sdk_foo.stubs@current".

That causes a few problems:
1. The "foo.stubs" is duplicated.
2. The names of the components created by the versioned
   java_sdk_library_import are invalid, as they append the component's
   suffix to the version and not the name before the version.

The latter causes problems when building against prebuilts and fixing
that causes the generated snapshot to be invalid because it contains
duplicate definitions of the "sdk_foo.stubs@current" module. One
explicitly in the Android.bp file and one created by the
"sdk_foo@current" module.

Removing the duplicates from the snapshot causes errors as the name
generated by the snapshot for the component module, i.e.
"sdk_foo.stubs@current" does not match the name generated by the
"sdk_foo@current", i.e. "sdk_foo@current.stubs".

This change fixes them together.

Bug: 179354495
Test: m nothing
Merged-In: I515f235fe21755b5275af12366e96c24c94c0273
Change-Id: I515f235fe21755b5275af12366e96c24c94c0273
(cherry picked from commit a1aa7387f7)
2021-06-23 21:38:14 +01:00
Paul Duffin
25f05b1996 Remove duplicate component from sdk snapshot am: a1aa7387f7
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/15080378

Change-Id: I74fac58b575541c685179414b6d14aca66549b05
2021-06-23 20:32:26 +00:00
Paul Duffin
1491087dbb Merge "Output bootclasspath_fragment's fragments property to sdk snapshot" am: 94b51488d9 am: c7a0512670
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1742967

Change-Id: I81ab059b6cf18ea19933fd7acf50187d91f32494
2021-06-23 18:35:28 +00:00
Paul Duffin
94b51488d9 Merge "Output bootclasspath_fragment's fragments property to sdk snapshot" 2021-06-23 17:47:49 +00:00
Jooyung Han
73a471ea9b Merge "fix: comparison between min_sdk_version" am: 91913e3e07 am: bdafb79af7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1743953

Change-Id: Id481769c8852103cb3690911e44d103b0f9cbe6a
2021-06-23 17:34:59 +00:00
Jooyung Han
91913e3e07 Merge "fix: comparison between min_sdk_version" 2021-06-23 17:02:02 +00:00
Paul Duffin
a1aa7387f7 Remove duplicate component from sdk snapshot
Previously, an sdk snapshot could contain the following:
* A java_sdk_library_import module, e.g. "foo" which creates component
  modules "foo.stubs", etc.
* A corresponding versioned module, e.g. "sdk_foo@current" which
  created component modules "sdk_foo@current.stubs", etc.
* An internal (to the sdk snapshot) java_import for one of "foo"'s
  components, e.g. "sdk_foo.stubs"
* A corresponding versioned module, e.g. "sdk_foo.stubs@current".

That causes a few problems:
1. The "foo.stubs" is duplicated.
2. The names of the components created by the versioned
   java_sdk_library_import are invalid, as they append the component's
   suffix to the version and not the name before the version.

The latter causes problems when building against prebuilts and fixing
that causes the generated snapshot to be invalid because it contains
duplicate definitions of the "sdk_foo.stubs@current" module. One
explicitly in the Android.bp file and one created by the
"sdk_foo@current" module.

Removing the duplicates from the snapshot causes errors as the name
generated by the snapshot for the component module, i.e.
"sdk_foo.stubs@current" does not match the name generated by the
"sdk_foo@current", i.e. "sdk_foo@current.stubs".

This change fixes them together.

Bug: 179354495
Test: m nothing
Change-Id: I515f235fe21755b5275af12366e96c24c94c0273
2021-06-23 17:46:50 +01:00
Paul Duffin
3accbb5446 Add commonSdkLibraryAndImportModule interface
The commonSdkLibraryAndImportModule defines the methods that a module
which embeds the commonToSdkLibraryAndImport struct need to provide.

Bug: 179354495
Test: m nothing
Merged-In: I7a469ae03ea5c19922200284da08a9ae38a46751
Change-Id: I7a469ae03ea5c19922200284da08a9ae38a46751
(cherry picked from commit 71b33cca9d)
2021-06-23 17:46:50 +01:00
Paul Duffin
51227d875b Output bootclasspath_fragment's fragments property to sdk snapshot
Adds support for printing a PropertySet that has a property whose value
is an array of structs.

Bug: 179354495
Test: m nothing
      m conscrypt-module-sdk
      - check generated Android.bp file
Change-Id: I71be04188465610bcbea4d3c9a5e8204171a1eeb
2021-06-23 17:12:31 +01:00
Paul Duffin
b7a9ecd996 Merge "Add commonSdkLibraryAndImportModule interface" am: 2afa8915bb am: c461d90f18
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1744313

Change-Id: Ieb4124174daeb033d9faa388fe193d19c2d0fd85
2021-06-23 16:08:29 +00:00
Paul Duffin
2afa8915bb Merge "Add commonSdkLibraryAndImportModule interface" 2021-06-23 15:36:36 +00:00
Jeongik Cha
e3165c8de3 Expose imageLocationsOnDevice as well as imageLocationsOnHost
Bug: 158843648
Test: check if dexpreopt.config for the module defined in mk file has
DexPreoptImageLocationsOnDevice field

Change-Id: Idb2de398871ff114245393a9dd92b5a1b5c942e7
2021-06-23 23:18:50 +09:00
Paul Duffin
71b33cca9d Add commonSdkLibraryAndImportModule interface
The commonSdkLibraryAndImportModule defines the methods that a module
which embeds the commonToSdkLibraryAndImport struct need to provide.

Bug: 179354495
Test: m nothing
Change-Id: I7a469ae03ea5c19922200284da08a9ae38a46751
2021-06-23 11:50:08 +01:00
satayev
c92cff4f0d Merge "Append platform classpath proto configs with missing apex jars." am: a580b5ef0f am: f8f2d7b4e8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1739054

Change-Id: I825921148500db99b1f8a0fb3f6acadba2d023ac
2021-06-23 10:27:01 +00:00
satayev
a580b5ef0f Merge "Append platform classpath proto configs with missing apex jars." 2021-06-23 09:51:39 +00:00
Jooyung Han
4c4da0688c fix: comparison between min_sdk_version
Added test demonstrates the error case. The bug was that java modules'
ShouldSupportSdkVersion() converts min_sdk_version into effective
version before comparison, which discards "preview" version into
"future" version. That caused a weird case like rejecting with error
"should support "S"" even when it is set to "S".

Bug: n/a
Test: m nothing
Change-Id: Ieb53f0097b2969a8535778b1286dbfa0d4895ad4
2021-06-23 10:45:28 +09:00
Paul Duffin
bbb8c289b8 Merge "Disable boot jars package check if no boot jars have been configured" am: 99fc06f8ed am: 5a5f422c23
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1742164

Change-Id: I807bfedb98b3bf728bc68389b1aaf544b3fe69f4
2021-06-22 19:09:44 +00:00
satayev
b30905019f Append platform classpath proto configs with missing apex jars.
Any apex classpath fragment that doesn't generate its own classpaths
proto, must still propagate it's boot jars for the platform classpath
fragment to include for complete CLASSPATH variables on device.

Bug: 191127295
Test: atest CtsClasspathsTestCases derive_classpath_test
Change-Id: I93687f69006741fcd66eb6e04891a4b4bbcc3b47
2021-06-22 20:03:54 +01:00
Paul Duffin
99fc06f8ed Merge "Disable boot jars package check if no boot jars have been configured" 2021-06-22 18:28:16 +00:00
Paul Duffin
0b5a143c32 Remove unused apiModuleName
Bug: 179354495
Test: m nothing
Merged-In: Id1dd09a11c63981b32af524cffcdbd177c8f0232
Change-Id: Id1dd09a11c63981b32af524cffcdbd177c8f0232
(cherry picked from commit 86fe8f8514)
2021-06-22 19:16:28 +01:00
Paul Duffin
2a999332ef Fix monolithic hidden API processing with prebuilts
Prebuilt modules do not provide classesJars containing annotations.
Previously, the monolithic hidden API processing just used classesJars
from all the modules that provided them so when building against
prebuilts would have fewer classesJars than when building against
sources and so would produce different hidden API flags.

This change will generate the monolithic files from both classesJars
and files previously generated from hidden API processing. A fragment
that has performed hidden API processing will contribute its generated
files whereas standalone libraries and fragments which have not
performed hidden API processing will contribute classesJars.

Bug: 177892522
Test: m out/soong/hiddenapi/hiddenapi-flags.csv
      m SOONG_CONFIG_art_module_source_build=false out/soong/hiddenapi/hiddenapi-flags.csv
      - verify that the files are identical whether built from
        source or prebuilts.
Merged-In: I06f3c7df49626bec21a452bc9abf1bb9e7545e5c
Change-Id: I06f3c7df49626bec21a452bc9abf1bb9e7545e5c
(cherry picked from commit d061d40eb6)
2021-06-22 19:16:27 +01:00
Paul Duffin
4c2f78bff4 Make CheckHiddenAPIRuleInputs more reusable
Adds a message parameter and allows leading spaces in the expected file
string to allow them to be nicely indented.

Bug: 177892522
Test: m nothing
Merged-In: I33df26610738c48879fa0b8250dc377dd04bb07d
Change-Id: I33df26610738c48879fa0b8250dc377dd04bb07d
(cherry picked from commit 51d7da2c4e)
2021-06-22 19:16:27 +01:00
Paul Duffin
3ae9e2cef5 Use classpath elements in platform_bootclasspath
Use classpath elements in newMonolithicHiddenAPIInfo. That means the
method can collate information from both fragments and libraries rather
than just fragments. So, this change moves the collation of the
classesJars into the method.

Bug: 177892522
Test: m out/soong/hiddenapi/hiddenapi-flags.csv out/soong/hiddenapi/hiddenapi-index.csv
      - make sure that this change does not affect the contents.
Merged-In: I7c2a229fab60d02bd211438735a8d7303ed83386
Change-Id: I7c2a229fab60d02bd211438735a8d7303ed83386
(cherry picked from commit 89f570ac44)
2021-06-22 19:16:27 +01:00
Paul Duffin
4a5ce3c924 Remove unused apiModuleName am: 86fe8f8514 am: 276f616330
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1742160

Change-Id: Ic2d075eac6867ba41f3cb70e7cddf2433abee9fd
2021-06-22 17:48:04 +00:00
TreeHugger Robot
7b905a3f10 Merge "Fix bootDexJarByModule with UNSAFE_DISABLE_HIDDENAPI_FLAGS" into sc-dev 2021-06-22 16:05:09 +00:00
Paul Duffin
9ffbecc2c8 Disable boot jars package check if no boot jars have been configured
Some build configurations do not configure boot jars. In those cases
the boot jars package check fails so should be skipped.

Bug: 177892522
Test: m nothing
      lunch fvp_mini && m
Change-Id: I5498a8f5cdfb2fabf5223e94dfcee0e853059d01
2021-06-22 14:55:30 +01:00
Paul Duffin
5f9e7bcea4 Merge "Fix monolithic hidden API processing with prebuilts" am: a1a2baf8a7 am: 3adbb7cb05
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738977

Change-Id: I46c8714db2a0f357c573e34b9b4d26c946fa0878
2021-06-22 12:27:10 +00:00
Paul Duffin
86fe8f8514 Remove unused apiModuleName
Bug: 179354495
Test: m nothing
Change-Id: Id1dd09a11c63981b32af524cffcdbd177c8f0232
2021-06-22 12:45:07 +01:00
Paul Duffin
a1a2baf8a7 Merge "Fix monolithic hidden API processing with prebuilts" 2021-06-22 11:44:11 +00:00
Paul Duffin
beffed2ec4 Merge "Fix bootDexJarByModule with UNSAFE_DISABLE_HIDDENAPI_FLAGS" am: f93d38835c am: 2a0e34f499
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1741176

Change-Id: I564b690203bff67f3de19fa01322a06b453b0ba8
2021-06-22 10:35:25 +00:00
Adrian Roos
c618decdab Fix bootDexJarByModule with UNSAFE_DISABLE_HIDDENAPI_FLAGS
Fixes: 191652687
Test: UNSAFE_DISABLE_HIDDENAPI_FLAGS=true m
Change-Id: I7d85340681e54fbd0da69596b6846eb446c6ec6d
Merged-In: I7d85340681e54fbd0da69596b6846eb446c6ec6d
(cherry picked from commit e95a15e7c7)
2021-06-22 12:05:55 +02:00
Paul Duffin
f93d38835c Merge "Fix bootDexJarByModule with UNSAFE_DISABLE_HIDDENAPI_FLAGS" 2021-06-22 09:37:17 +00:00
Paul Duffin
60406b25f7 Merge "Make CheckHiddenAPIRuleInputs more reusable" am: 07cdd37ae5 am: f250ea10e4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738976

Change-Id: Ie1bb89d1b2aaf55ce0ee4ad9891cd891bc464096
2021-06-21 20:17:21 +00:00
Paul Duffin
5fc974aec9 Merge "Use classpath elements in platform_bootclasspath" am: 9d31361873 am: 5805a4f34a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738975

Change-Id: Ia072fc05e1f63b409ba8e837bd809af505b4f4e6
2021-06-21 20:16:57 +00:00
Paul Duffin
07cdd37ae5 Merge "Make CheckHiddenAPIRuleInputs more reusable" 2021-06-21 16:16:12 +00:00
Paul Duffin
9d31361873 Merge "Use classpath elements in platform_bootclasspath" 2021-06-21 16:16:00 +00:00
Adrian Roos
e95a15e7c7 Fix bootDexJarByModule with UNSAFE_DISABLE_HIDDENAPI_FLAGS
Fixes: 191652687
Test: UNSAFE_DISABLE_HIDDENAPI_FLAGS=true m
Change-Id: I7d85340681e54fbd0da69596b6846eb446c6ec6d
2021-06-21 14:55:19 +00:00
Paul Duffin
034196d9fe Simplify deapexer support
Uses the apex relative path to the file as the identifier that is used
to obtain the path to the corresponding file extracted from the apex.
That is instead of a special constructed string id.

Bug: 177892522
Test: m nothing
Merged-In: I5dc77c8fb272bac289b8891d1eac801e541af1f5
Change-Id: I5dc77c8fb272bac289b8891d1eac801e541af1f5
(cherry picked from commit b4bbf2ca10)
2021-06-21 10:54:22 +01:00
Paul Duffin
7db57e0a77 Remove javalib special case in createDeapexerModuleIfNeeded
Removes the special case in createDeapexerModuleIfNeeded for handling
java libraries and just get the Import and SdkLibraryImport module
types to implement RequiredFilesFromPrebuiltApex instead.

Bug: 177892522
Test: m nothing
Merged-In: I5cc341b5b4168b8eb196f72273a00d498de6856f
Change-Id: I5cc341b5b4168b8eb196f72273a00d498de6856f
(cherry picked from commit fef5500a76)
2021-06-21 10:54:22 +01:00
Treehugger Robot
f2d15a6921 Merge "AIDEGen: Collect dependencies info from APEX module." am: 348f20be0e am: 3ccb991a31
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1729192

Change-Id: Ie79c4757cd3e190c1bd9a03a8ee6302306fc9952
2021-06-21 07:50:24 +00:00
Treehugger Robot
348f20be0e Merge "AIDEGen: Collect dependencies info from APEX module." 2021-06-21 07:17:28 +00:00
Xin Li
9e2dcbd080 Merge "DO NOT MERGE - Merge RQ3A.210605.005" 2021-06-21 05:49:09 +00:00
Paul Duffin
c2d7c036e1 Merge "Simplify deapexer support" am: 0d7f2d30b5 am: fd198583f0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1740316

Change-Id: Ic9fffd50e5550cbdaa4731270b1f66b5bde2fde8
2021-06-20 18:43:17 +00:00
Paul Duffin
8ee224c159 Merge "Remove javalib special case in createDeapexerModuleIfNeeded" am: 6b592bdcdc am: 5349528f57
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1740315

Change-Id: Idef64da43b738b9f51c2e2ec1b563281eab4a60f
2021-06-20 18:43:11 +00:00
Paul Duffin
fd198583f0 Merge "Simplify deapexer support" am: 0d7f2d30b5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1740316

Change-Id: I69b8e53916f848e9cb15f58756efba0b76c2bedd
2021-06-20 18:29:09 +00:00
Paul Duffin
5349528f57 Merge "Remove javalib special case in createDeapexerModuleIfNeeded" am: 6b592bdcdc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1740315

Change-Id: I7af2d5bcae9bf96bbf555b11feba2f48010405a4
2021-06-20 18:28:26 +00:00
Paul Duffin
d061d40eb6 Fix monolithic hidden API processing with prebuilts
Prebuilt modules do not provide classesJars containing annotations.
Previously, the monolithic hidden API processing just used classesJars
from all the modules that provided them so when building against
prebuilts would have fewer classesJars than when building against
sources and so would produce different hidden API flags.

This change will generate the monolithic files from both classesJars
and files previously generated from hidden API processing. A fragment
that has performed hidden API processing will contribute its generated
files whereas standalone libraries and fragments which have not
performed hidden API processing will contribute classesJars.

Bug: 177892522
Test: m out/soong/hiddenapi/hiddenapi-flags.csv
      m SOONG_CONFIG_art_module_source_build=false out/soong/hiddenapi/hiddenapi-flags.csv
      - verify that the files are identical whether built from
        source or prebuilts.
Change-Id: I06f3c7df49626bec21a452bc9abf1bb9e7545e5c
2021-06-20 19:09:09 +01:00
Paul Duffin
51d7da2c4e Make CheckHiddenAPIRuleInputs more reusable
Adds a message parameter and allows leading spaces in the expected file
string to allow them to be nicely indented.

Bug: 177892522
Test: m nothing
Change-Id: I33df26610738c48879fa0b8250dc377dd04bb07d
2021-06-20 19:09:09 +01:00
Paul Duffin
89f570ac44 Use classpath elements in platform_bootclasspath
Use classpath elements in newMonolithicHiddenAPIInfo. That means the
method can collate information from both fragments and libraries rather
than just fragments. So, this change moves the collation of the
classesJars into the method.

Bug: 177892522
Test: m out/soong/hiddenapi/hiddenapi-flags.csv out/soong/hiddenapi/hiddenapi-index.csv
      - make sure that this change does not affect the contents.
Change-Id: I7c2a229fab60d02bd211438735a8d7303ed83386
2021-06-20 19:09:09 +01:00
Paul Duffin
0d7f2d30b5 Merge "Simplify deapexer support" 2021-06-20 18:08:41 +00:00
Paul Duffin
6b592bdcdc Merge "Remove javalib special case in createDeapexerModuleIfNeeded" 2021-06-20 18:08:29 +00:00
Xin Li
4a5f1256e8 DO NOT MERGE - Merge RQ3A.210605.005
Bug: 190855093
Merged-In: Ie1f9147e02f79062d1a17dca5f61ff518a2ae5a6
Change-Id: I34d36eeeef40d372c0585b90685a2cee7e37a1a8
2021-06-18 15:41:15 -07:00
TreeHugger Robot
9c98aa887c Merge "Reland aosp/1535007:" into stage-aosp-master 2021-06-18 22:35:59 +00:00
Treehugger Robot
f830560979 Merge "Allow disabling errorprone even when RUN_ERROR_PRONE is true" am: d430ddd0c5 am: 15d73e9a88
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1741654

Change-Id: Id616b4237e74e382ac7fc7902cbc43950875fc91
2021-06-18 22:09:04 +00:00
Treehugger Robot
15d73e9a88 Merge "Allow disabling errorprone even when RUN_ERROR_PRONE is true" am: d430ddd0c5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1741654

Change-Id: I8666e08ac5c4cb6f88a245f8f489bbbfbbe4370a
2021-06-18 21:57:45 +00:00
Ulya Trafimovich
55ff4a557d Reland aosp/1535007:
Enforce <uses-library> checks for android_app and android_app_import.

Bug: 132357300
Test: lunch aosp_cf_x86_phone-userdebug && m
Merged-In: I50911f727ba98df1035500dbbf467b849be8d6c2
Change-Id: Ief02df2afe56e58189e3165fbb6dbb75f6ff6384
2021-06-18 14:25:19 -07:00
Paul Duffin
f23512fa58 Add ClasspathElement support
The configuration of the bootclasspath, e.g. PRODUCT_BOOT_JARS,
includes libraries that are standalone and libraries that are part of
an APEX. All libraries that are part of an APEX must also be part of a
bootclasspath_fragment. Currently, the libraries and fragments are
handled separately but that is limiting as it does not make it easy to
process all the libraries while treating those from fragments
differently to standalone libraries. That is needed for hidden API
processing as it needs to use classesJars from standalone libraries
but pre-generated flag files from fragments.

This change adds support for ClasspathElements which is represents the
classpath as a whole while differentiating between standalone libraries
and fragments.

Bug: 177892522
Test: m nothing
Merged-In: I7a4adc67164a46079eb8ec0a17fc755044b4949d
Change-Id: I7a4adc67164a46079eb8ec0a17fc755044b4949d
(cherry picked from commit e245b61aa2)
2021-06-18 21:02:10 +01:00
Cole Faust
2b1536e4db Allow disabling errorprone even when RUN_ERROR_PRONE is true
Some modules use -XepDisableAllChecks to disable errorprone.
However, this still causes them to be compiled twice when
RUN_ERROR_PRONE is true. Allow the new enabled property to
be set to false to disable errorprone entirely, so that those
modules are only compiled once.

Bug: 190944875
Test: New unit tests
Change-Id: Ie68695db762fffcaf11bbbcb0509c4fcab73f5c5
2021-06-18 12:34:51 -07:00
Paul Duffin
082e9c0dde Merge "Add ClasspathElement support" am: e6aefedeba am: 10a66e1dee
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738974

Change-Id: Ic917f108fa2189a033373740bdaa959119c67c5c
2021-06-18 18:47:43 +00:00
Paul Duffin
10a66e1dee Merge "Add ClasspathElement support" am: e6aefedeba
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738974

Change-Id: I96319f285755414f01b24a65686399452c2797ab
2021-06-18 18:30:56 +00:00
Paul Duffin
b508405e08 Export boot image files from prebuilt_apex/apex_set
Previously, the prebuilt art-bootclasspath-fragment did not provide any
boot image files. That meant it was impossible to build any module that
requires access to those files from prebuilts, e.g. any module that
needs to be dexpreopt-ed.

This change enables that module to retrieve those files from the
prebuilt_apex.

Bug: 177892522
Bug: 189298093
Test: m nothing
      m droid SOONG_CONFIG_art_module_source_build=false SKIP_BOOT_JARS_CHECK=true
      - the previous command does not work but this change does fix one
        of the issues reported.
Merged-In: I1d4d9545172d79282918130df6b9aa55471bffc1
Change-Id: I1d4d9545172d79282918130df6b9aa55471bffc1
(cherry picked from commit 5466a3699c)
2021-06-18 12:11:17 +01:00
Paul Duffin
a0089ec78c Copy boot dex jars from prebuilt art-bootclasspath-fragment if preferred
Previously, the boot dex jars were only copied to the predefined
locations used by the build from the source art-bootclasspath-fragment
if it was preferred, otherwise no files were copied. That caused build
failures when attempting to build with ART prebuilts. This change
copies the files from prebuilts too.

Bug: 177892522
Bug: 189298093
Test: m nothing
      m droid SOONG_CONFIG_art_module_source_build=false SKIP_BOOT_JARS_CHECK=true
      - the previous command does not work but this change does fix one
        of the issues reported.
Merged-In: I35b37355170546daf6ecac2134d1ca9a73d0e3bc
Change-Id: I35b37355170546daf6ecac2134d1ca9a73d0e3bc
(cherry picked from commit ce918b0278)
2021-06-18 12:11:17 +01:00
Paul Duffin
4fd7dc7de0 Exclude jacocoagent from boot jars package check
This replicates the previous behavior when the boot jars package check
was performed by a singleton. When the singleton was removed and the
check was performed by the platform-bootclasspath the logic to exclude
jacocoagent from the list was lost. This change replaces it.

Bug: 191377804
Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true check-boot-jars
      - fails without this change passes with this change.
Merged-In: If9eae254045bef9a0c0963213721fc12a9f463cb
Change-Id: If9eae254045bef9a0c0963213721fc12a9f463cb
(cherry picked from commit 7f8721618c)
2021-06-18 12:11:17 +01:00
Paul Duffin
e11254793d Move boot jars package check into platform_bootclasspath
Bug: 177892522
Bug: 189298093
Test: m check-boot-jars
      m SOONG_CONFIG_art_module_source_build=false check-boot-jars
      - Ran both commands with and without java.lang in the
        package_allowed_list.txt
Merged-In: Iba1a881c8f6b6919d5c0c0520eb3073658f3b8d2
Change-Id: Iba1a881c8f6b6919d5c0c0520eb3073658f3b8d2
(cherry picked from commit c8ead41ba9)
2021-06-18 12:11:17 +01:00
Paul Duffin
360f8359f3 Cleanup bootclasspathFragmentInitContentsFromImage
Removes some unnecessary logic left over from previous changes.

Bug: 177892522
Test: m nothing
Merged-In: Id11e2ea8a647283af1b152b33757132e44dcd6c3
Change-Id: Id11e2ea8a647283af1b152b33757132e44dcd6c3
(cherry picked from commit 58e7586b3d)
2021-06-18 12:11:17 +01:00
Paul Duffin
c75bbcecdb Combine hidden API encoding with flag generation
Previously, the rules to perform hidden API encoding were generated
separately to the rules to perform hidden API flag generation. This
change combines them within the (renamed) produceHiddenAPIOutput()
method and makes the paths to the encoded dex files an output of the
generateHiddenAPIBuildActions method alongside the paths to the
generated flag files.

As encoded dex jars are now an output of the produceHiddenAPIOutput()
method which is implemented for both prebuilts and source
bootclasspath_fragment modules that necessitated the prebuilt also
providing paths to encoded dex files. That in turn required updates to
some of the tests to provide dex files from prebuilt_apex modules.

Similarly, as the produceHiddenAPIOutput() method may not be called
for some bootclasspath_fragment modules as they do not yet provide all
the information needed to perform hidden API encoding then it is
necessary to extract the encoded dex files produced by the modules
themselves. That also required a few changes to tests that did not
previously provide dex files.

Bug: 177892522
Test: m com.android.art
      - check that this change does not change the contents of the apex
        file, i.e. is byte-for-byte identical.
Merged-In: I60996a34d06ed1c87ed244ab3509621999ad86ec
Change-Id: I60996a34d06ed1c87ed244ab3509621999ad86ec
(cherry picked from commit e521881bd4)
2021-06-18 12:11:17 +01:00
Paul Duffin
e245b61aa2 Add ClasspathElement support
The configuration of the bootclasspath, e.g. PRODUCT_BOOT_JARS,
includes libraries that are standalone and libraries that are part of
an APEX. All libraries that are part of an APEX must also be part of a
bootclasspath_fragment. Currently, the libraries and fragments are
handled separately but that is limiting as it does not make it easy to
process all the libraries while treating those from fragments
differently to standalone libraries. That is needed for hidden API
processing as it needs to use classesJars from standalone libraries
but pre-generated flag files from fragments.

This change adds support for ClasspathElements which is represents the
classpath as a whole while differentiating between standalone libraries
and fragments.

Bug: 177892522
Test: m nothing
Change-Id: I7a4adc67164a46079eb8ec0a17fc755044b4949d
2021-06-18 11:46:52 +01:00
satayev
cbe33a0233 Merge "Add classpath fragment property to skip proto generation." am: f45966f35b am: 6ea9e45d9c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738336

Change-Id: I8382015b96a37117e62735a6d5a682c3645c397f
2021-06-18 10:45:32 +00:00
satayev
6ea9e45d9c Merge "Add classpath fragment property to skip proto generation." am: f45966f35b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738336

Change-Id: I153af3111b835ce3bbfb56b9d91cf43269285ee4
2021-06-18 10:29:26 +00:00
satayev
f45966f35b Merge "Add classpath fragment property to skip proto generation." 2021-06-18 10:17:50 +00:00
Paul Duffin
3d052d1495 Export boot image files from prebuilt_apex/apex_set am: 5466a3699c am: c4a3e6d2f3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1736777

Change-Id: I45874db42b8d17e0893d5e1c4b9aca6356066221
2021-06-18 07:05:13 +00:00
Paul Duffin
e59c339a43 Copy boot dex jars from prebuilt art-bootclasspath-fragment if preferred am: ce918b0278 am: 56a6834640
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1736226

Change-Id: I33abc58165d9ae42f5d567f7c77de5a9fe4bb187
2021-06-18 07:05:07 +00:00
Paul Duffin
c4a3e6d2f3 Export boot image files from prebuilt_apex/apex_set am: 5466a3699c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1736777

Change-Id: I1cf84ff519ca6865d3a87ae75b1f48fc6ed1e3f4
2021-06-18 06:48:21 +00:00
Paul Duffin
56a6834640 Copy boot dex jars from prebuilt art-bootclasspath-fragment if preferred am: ce918b0278
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1736226

Change-Id: I116ef8467e180b691ba6e6f2bcf38cd275f6ecba
2021-06-18 06:47:41 +00:00
TreeHugger Robot
aee99b3a13 Merge "DO NOT MERGE - Merge ab/7272582" into stage-aosp-master 2021-06-18 00:30:18 +00:00
Paul Duffin
5466a3699c Export boot image files from prebuilt_apex/apex_set
Previously, the prebuilt art-bootclasspath-fragment did not provide any
boot image files. That meant it was impossible to build any module that
requires access to those files from prebuilts, e.g. any module that
needs to be dexpreopt-ed.

This change enables that module to retrieve those files from the
prebuilt_apex.

Bug: 177892522
Bug: 189298093
Test: m nothing
      m droid SOONG_CONFIG_art_module_source_build=false SKIP_BOOT_JARS_CHECK=true
      - the previous command does not work but this change does fix one
        of the issues reported.
Change-Id: I1d4d9545172d79282918130df6b9aa55471bffc1
2021-06-17 23:05:43 +01:00
Paul Duffin
ce918b0278 Copy boot dex jars from prebuilt art-bootclasspath-fragment if preferred
Previously, the boot dex jars were only copied to the predefined
locations used by the build from the source art-bootclasspath-fragment
if it was preferred, otherwise no files were copied. That caused build
failures when attempting to build with ART prebuilts. This change
copies the files from prebuilts too.

Bug: 177892522
Bug: 189298093
Test: m nothing
      m droid SOONG_CONFIG_art_module_source_build=false SKIP_BOOT_JARS_CHECK=true
      - the previous command does not work but this change does fix one
        of the issues reported.
Change-Id: I35b37355170546daf6ecac2134d1ca9a73d0e3bc
2021-06-17 23:05:43 +01:00
Xin Li
007875cd10 DO NOT MERGE - Merge ab/7272582
Bug: 190855093
Merged-In: I0f5da13644fd2ec7b0472fe82918e3c6a72d953c
Change-Id: I33b074204ffba5aa2bf83bbbe350d744ee9d8c57
2021-06-17 21:41:17 +00:00
Paul Duffin
e50050657d Exclude jacocoagent from boot jars package check am: 7f8721618c am: eaae506467
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1739993

Change-Id: I9ad0a03bc1c2922ee2e4bad2a654b83b6fed6bbd
2021-06-17 21:37:36 +00:00
Paul Duffin
7f8721618c Exclude jacocoagent from boot jars package check
This replicates the previous behavior when the boot jars package check
was performed by a singleton. When the singleton was removed and the
check was performed by the platform-bootclasspath the logic to exclude
jacocoagent from the list was lost. This change replaces it.

Bug: 191377804
Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true check-boot-jars
      - fails without this change passes with this change.
Change-Id: If9eae254045bef9a0c0963213721fc12a9f463cb
2021-06-17 19:33:24 +01:00
Paul Duffin
d69575cd8c Merge "Move boot jars package check into platform_bootclasspath" am: 4aea00ec18 am: 55e9321255
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1737753

Change-Id: If40ca43057eac8569d1e69fa0e64b334507f9d38
2021-06-17 16:37:01 +00:00
Paul Duffin
0a212b3dd5 Merge "Cleanup bootclasspathFragmentInitContentsFromImage" am: 909a2fd055 am: 57f3d6c870
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1737754

Change-Id: I3ffe996a766ff50a938486a425aef4f293467685
2021-06-17 16:36:53 +00:00
Paul Duffin
fd609b6bb0 Merge "Combine hidden API encoding with flag generation" am: 975e757232 am: b9b5bcf0e3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1736225

Change-Id: I3197f3def4688fdeaeddc920cc55fc6364599b9a
2021-06-17 16:36:40 +00:00
Paul Duffin
4aea00ec18 Merge "Move boot jars package check into platform_bootclasspath" 2021-06-17 16:06:51 +00:00