Commit graph

2717 commits

Author SHA1 Message Date
Treehugger Robot
b8d4e69927 Merge "Allows prebuilts in override_apex." am: e267bc8f74
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1811097

Change-Id: I732915686e54509c30f6855ea29d562bc83cf680
2021-09-03 16:13:56 +00:00
Treehugger Robot
e267bc8f74 Merge "Allows prebuilts in override_apex." 2021-09-03 16:01:31 +00:00
Daniel Norman
5a3ce13c6a Allows prebuilts in override_apex.
Bug: 197787336
Test: Create an override_apex that uses a different `prebuilts` than its
      base. Observe built contents.
Test: apex_test.go
Change-Id: I7666ed6cfe3f2fa5dd81e5f8c1961477dabbbd3c
2021-09-02 09:28:52 -07:00
Spandan Das
ab47a767d8 Merge "Skip dexbootjar check using AllowMissingDependencies flag" am: b7e5985fd5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1803934

Change-Id: I55ae4c5858330385876eb42e0fa16773ca748150
2021-08-31 16:12:21 +00:00
Spandan Das
b7e5985fd5 Merge "Skip dexbootjar check using AllowMissingDependencies flag" 2021-08-31 16:06:10 +00:00
Lukács T. Berki
8526bc95ef Merge "Rename BuildDir and NinjaBuildDir." am: 5602d33025
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1810356

Change-Id: I6af3316fb122af7a05b71de7f9cd371746bb5f21
2021-08-27 13:54:13 +00:00
Lukacs T. Berki
9f6c24a887 Rename BuildDir and NinjaBuildDir.
These are just out/ and out/soong/ and the old names were quite
confusing.

Test: Presubmits.
Merged-In: I999ca62162062f27e449f83ffb00fa580d4065b8
Merged-In: I2fcd80a9e376a6842a06aa104a9f6f5c5e16f8c7
Change-Id: Ib481d2aac40df8da1b74174dc8ec576c1cb48be0
2021-08-27 10:08:49 +02:00
Treehugger Robot
a88fc3e79e Merge "Make bpfs properties overridable" am: 60dc5c0db2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1810456

Change-Id: Ib8196d660983d724e4ecde5c08a9ab2da979df99
2021-08-27 05:07:16 +00:00
Treehugger Robot
60dc5c0db2 Merge "Make bpfs properties overridable" 2021-08-27 04:57:10 +00:00
markchien
7c803b8746 Make bpfs properties overridable
To support different variable bpfs file between mainline module and
non-updatable module(e.g. Android GO). Make bpfs properties overridable.

Test: m
Bug: 190523685
Change-Id: I4c63e35f74230de94b21f3ceb2beb90f0f9ddb11
2021-08-27 03:03:45 +00:00
Spandan Das
10ea4bf9d4 Skip dexbootjar check using AllowMissingDependencies flag
Soong checks that every module part of a bootclass_fragment provides a
dex boot jar file, even if the module is not a dependency of vendor.img

Using AllowMissingDepdencies() to skip this check allows vendors to be
more aggressive in removing projects from their source tree

Test: In build/soong, run go test ./...
Test: m nothing
Bug: 196306898
Bug: 192616764
Change-Id: I78b062afdc19a6a3251aa8552230f3fcf334b6fb
2021-08-27 02:54:07 +00:00
Colin Cross
8dae8cbcc1 Merge "Support musl builds in Make" am: b37a92ccc8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1797129

Change-Id: I771db86c62207bde3e4ba60569e4d3ebbfe32358
2021-08-26 01:27:24 +00:00
Colin Cross
b37a92ccc8 Merge "Support musl builds in Make" 2021-08-26 01:14:47 +00:00
Jiyong Park
b4adefa58e Merge changes I15328e0b,I731227c2 am: 19312d4224
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1808218

Change-Id: I58224f0fc056f174567241a13d9eb54dbaef5d12
2021-08-25 22:48:34 +00:00
Jiyong Park
5df7bd33f7 crt objects for APEX and vendor variants have correct target API levels
Previously, crt objects for APEX and vendor variants targetted API level
16 regardless of their context. For example, even if BOARD_VNDK_VERSION
is set to 29, or an APEX has `min_sdk_version: "29"`, the target API
level was from `min_sdk_version` property of the crt object which is set
to 16.

The meaning of min_sdk_version is quite different when it comes to crt
objects. It means the lowest API level that it CAN target for. It does
NOT mean the API level it SHOULD always target.

This has caused some other problems like TLS segment underalignment for
vendor libraries because the vendor libraries were all built with TLS
layout from API level 16.

This change fixes the problem by correctly implementing the different
semantic of min_sdk_version for crt objects.

Bug: N/A
Test: m nothing

Change-Id: I15328e0b6cbabbe151dd65c7469c6355e167b78a
2021-08-25 16:26:47 +09:00
satayev
dbd6abe28d Merge "Make sure that classpath fragment contents appear in make vars." am: 28e5eda261
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1740313

Change-Id: I216856a16603567c623114d3b5b42506e9dc89b2
2021-08-24 13:40:05 +00:00
satayev
28e5eda261 Merge "Make sure that classpath fragment contents appear in make vars." 2021-08-24 13:29:58 +00:00
Colin Cross
c74ea4b77b Support musl builds in Make
Rewrite linux_musl to linux when exporting to Make.

Bug: 190084016
Test: m USE_HOST_MUSL=true adb
Change-Id: I48eed5bd7380a07c5106a9b2bd96899fb58f7a7f
2021-08-18 22:02:54 +00:00
Liz Kammer
680bd2dd0a Merge "Don't create a new module for bp2build conversion." am: 380dbb9327
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1792714

Change-Id: Ie7d6d5908d06f14121691f7aa0f57c7c7303e67a
2021-08-18 19:44:01 +00:00
Liz Kammer
380dbb9327 Merge "Don't create a new module for bp2build conversion." 2021-08-18 19:28:20 +00:00
Martin Stjernholm
50c2a30ffa Merge "Remove fallback workaround for APEX variants which is now unnecessary." am: 3931b8c70d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1756730

Change-Id: If29fac31f319229cd877d38b3852698815664e54
2021-08-18 08:56:47 +00:00
Liz Kammer
2ada09a546 Don't create a new module for bp2build conversion.
A performance improvement for bp2build as Blueprint/Soong no longer have
the overhead of additional modules. The creation of these modules
results in:
* traversal of additional modules for each subsequent mutator
* synchronization over a go channel to collect newly created modules:
https://cs.android.com/android/platform/superproject/+/master:build/blueprint/context.go;l=2594,2600;drc=1602226f23181b8c3fbfcaf3358f0297e839d7d3

We avoid both of these by storing the information directly in the
underlying module.

Also as a fringe benefit, removes some necessary boilerplate for
conversion.

For benchmarks, reduces runtime ~1% for 1% converted, ~24% for 100%
converted. See more: go/benchmarks-for-https:-r.android.com-1792714

Test: ran benchmarks/tests in bp2build
Test: build/bazel/ci/bp2build.sh
Change-Id: Ie9273b8cbab5bc6edac1728067ce184382feb211
2021-08-17 15:57:09 -04:00
satayev
d34eb0c4a6 Make sure that classpath fragment contents appear in make vars.
The source of truth for what jars are in BOOTCLASSPATH and
SYSTEMSERVERCLASSPATH is make; adding a classpath fragment in soong
with a new jar in the contents without having it declared in make
is wrong (excluding test apexes).

Bug: 191369843
Test: m nothing
Change-Id: Ifd313776ee7ad206031244534ed3870126e4f835
2021-08-16 12:00:25 +01:00
Martin Stjernholm
0e17c1a57e Remove fallback workaround for APEX variants which is now unnecessary.
Test: m nothing
Bug: 191269918
Change-Id: I13091d5ffdd46947899db273b9cb2399dda23907
2021-08-15 22:32:37 +01:00
Paul Duffin
d483d1ac66 Merge "Filter blocked entries from modular flag files" am: 1f0cc77010 am: 78fc6dc40a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1788095

Change-Id: I377eee1d14a930d00f944522d1cc71cd43411175
2021-08-11 19:07:45 +00:00
Paul Duffin
1f0cc77010 Merge "Filter blocked entries from modular flag files" 2021-08-11 18:36:37 +00:00
satayev
4d566bea9b Merge "Fix tests to use correct fixtures for configuring (Apex)BootJars." am: 721f42d12a am: 9958b36643
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1787998

Change-Id: Id9248b6b54547e55c28bb386c867294ec20df873
2021-08-11 16:42:47 +00:00
Paul Duffin
280bae6d20 Filter blocked entries from modular flag files
Previously, the sdk snapshot would include all the entries from the
stub-flags.csv and all-flags.csv modular files generated by a single
bootclasspath_fragment. That included implementation details, i.e.
class members that are not part of a stable API or the hidden API which
meant that the sdk snapshots were implementation dependent.

This change removes the implementation details from the modular flag
files, i.e. those entries that are only marked as "blocked". When
comparing the files against the corresponding subset of the monolithic
files it assumes that any entries missing from the modular flag files
are blocked.

Bug: 194063708
Test: atest --host verify_overlaps_test signature_patterns_test
      m out/soong/hiddenapi/hiddenapi-flags.csv
      - manually change files to cause difference in flags to check
        that it detects the differences.
Change-Id: I6b67b2253cf029d6830b58a06ebb0c8fcaa0dd71
2021-08-11 17:29:47 +01:00
satayev
721f42d12a Merge "Fix tests to use correct fixtures for configuring (Apex)BootJars." 2021-08-11 16:13:20 +00:00
Colin Cross
390babfeae Merge "Collect lint reports from apps in apexes" am: 7131982a76 am: 3dc9d726ed
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1792871

Change-Id: Ibc44f45a5a8a5ecb977943a2beb26e6e1e465862
2021-08-11 14:44:08 +00:00
Colin Cross
7131982a76 Merge "Collect lint reports from apps in apexes" 2021-08-11 14:15:35 +00:00
Colin Cross
8355c1524f Collect lint reports from apps in apexes
Lint reports were only being collected from jars in apexes, not
apps.

Bug: 188772607
Test: mainline_modules_arm64 build
Change-Id: Ie84819343f8b8ab3f43496bbc9b7876d0d0d8e70
2021-08-10 19:25:59 -07:00
LaMont Jones
0bbc2d0229 Merge "Improve handling of errors from zipinfo" am: b02043b84d am: 4b3afb7798
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1790956

Change-Id: Ibe3bd86d8c2163ff873794be96a25827874b5e29
2021-08-10 18:40:32 +00:00
LaMont Jones
b02043b84d Merge "Improve handling of errors from zipinfo" 2021-08-10 18:12:27 +00:00
satayev
abcd59731e Fix tests to use correct fixtures for configuring (Apex)BootJars.
This is in preparation to r.android.com/1740313 where setting correct
variables would be enforced (i.e. apex and non-apex boot jars must be in
config.ApexBootJars and config.BootJars correspondingly).

Bug: 191369843
Test: m nothing
Change-Id: Ic86680c1f7af53d229083b2cc58beb3ceccb4b6a
2021-08-10 15:35:52 +01:00
LaMont Jones
4224c6216d Improve handling of errors from zipinfo
Bug: 153900481
Test: manual
Change-Id: Ib60578ead4ccaa7ba09f628a6c9281c0cc70e6ce
2021-08-09 19:31:39 +00:00
Kun Niu
f8c99a8012 Merge "Use prebuild modules even when coverage is enabled." into sc-dev am: fe1d6c535c
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/15472697

Change-Id: If8bc890561f17a5179a8d655043be1ac36d165f2
2021-08-06 19:31:24 +00:00
Kun Niu
fe1d6c535c Merge "Use prebuild modules even when coverage is enabled." into sc-dev 2021-08-06 19:12:27 +00:00
Paul Duffin
b32b624d71 Separate creation of signature patterns from overlap checking am: 67b9d61ac2 am: 0623c3e8f9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1788091

Change-Id: If9d75256940429dbf6890ca5a07d1806b81e6c53
2021-08-06 16:39:14 +00:00
Paul Duffin
67b9d61ac2 Separate creation of signature patterns from overlap checking
Previously, the signatures used to select the subset of the monolithic
flags were simply the signatures read from the modular flags file. This
change moves the creation of the signature list into a separate script
that outputs the signatures to a file and then passes the path through
Soong from the bootclasspath_fragment modules that create it to the
platform_bootclasspath module that uses it to compare the modular
flags against the monolithic flags.

Currently, the signatures are the full signatures but follow up changes
will replace them with patterns (hence the name) that avoids having to
include implementation details in the hidden API flags that are output
as part of a bootclasspath_fragment's snapshot.

This change moves the stub flags related code next to the all flags
related code as they are treated in a similar way.

Bug: 194063708
Test: atest --host verify_overlaps_test signature_patterns_test
      m out/soong/hiddenapi/hiddenapi-flags.csv
      - manually change files to cause difference in flags to check
        that it detects the differences.
Change-Id: I2855bf6d05c91b8a09591664185750361c7e644f
2021-08-06 13:40:34 +01:00
Kun Niu
ce1dcf6a9f Use prebuild modules even when coverage is enabled.
Bug: 194323871
Test: local build passed.
Change-Id: I94a3922453473de7d754afce4b05ac3b6ae3765d
2021-08-05 18:15:28 +00:00
Mathew Inwood
766f3510e4 Merge "Update error message for new policy." am: bf49705608 am: 775f9e37c7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1784430

Change-Id: Ib4c443c1eae2dc7f840566455b573f255575f875
2021-08-04 10:20:47 +00:00
Mathew Inwood
bf49705608 Merge "Update error message for new policy." 2021-08-04 09:59:33 +00:00
Treehugger Robot
69c6143138 Merge changes Ie2012adb,Ib0283ca6 am: 03beb0ec77 am: 47992dd860
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1784476

Change-Id: I7e41072eaf3e953591232b6bb8df6a7c1b961c2a
2021-08-04 05:06:04 +00:00
Treehugger Robot
03beb0ec77 Merge changes Ie2012adb,Ib0283ca6
* changes:
  static rust binaries are also prohibited in APEXes
  Revert "Revert "Prohibit static executable in APEX""
2021-08-04 04:35:20 +00:00
Mathew Inwood
768a01160a Update error message for new policy.
A new presubmit hook enforces that required information is present in
any CL that adds new dependencies to allowed_deps.txt.

Test: m
Bug: 195303213
Change-Id: I1fb932a52f64f9cbf0d12ead75ffd3d9c2a5e942
2021-08-03 14:40:46 +01:00
Jiyong Park
a9baefe81f Merge "Revert "Prohibit static executable in APEX"" am: 2fe71a5165 am: 2af22b8729
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1784474

Change-Id: I125a2dfb96277064ff7daa195d4a80c315655879
2021-08-03 08:19:22 +00:00
Jiyong Park
d12979d09a static rust binaries are also prohibited in APEXes
Also fixes a bug that the test runs for host APEXes like
com.android.art.host.

Bug: 185971244
Test: m
Test: build mainline_modules target on aosp-master
Change-Id: Ie2012adbf2f4eda5454d5eaa30f128fb1e20ad37
2021-08-03 07:52:46 +00:00
Jiyong Park
192600a7d0 Revert "Revert "Prohibit static executable in APEX""
This reverts commit 2125aab504.

Reason for revert: relanding along with a forward fix

Change-Id: Ib0283ca6beefa2f3073860287d00553ad0af6317
2021-08-03 07:52:17 +00:00
Jiyong Park
2fe71a5165 Merge "Revert "Prohibit static executable in APEX"" 2021-08-03 07:50:26 +00:00
Yen-Chao Chen
2125aab504 Revert "Prohibit static executable in APEX"
This reverts commit 3a8130c797.

Reason for revert: Build failed.

Change-Id: I28c72c8c3adaeb23bff9bffe3994971aa3f2e4f4
2021-08-03 04:51:12 +00:00
Jiyong Park
42a7f17aa1 Merge "Prohibit static executable in APEX" am: d8a3513155 am: 7986f564b6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1779746

Change-Id: Iefdcf93ceb0d0b9654afffe0c03be28af33a9eaf
2021-08-03 04:16:24 +00:00
Jiyong Park
d8a3513155 Merge "Prohibit static executable in APEX" 2021-08-03 03:48:01 +00:00
Huang Jianan
13cac63cc7 Add EROFS support for APEX build system
Bug: 195274797
Test: mmm system/apex/apexer/testdata
Change-Id: I21dbe8b1bfe02d267c710f3c0dd4abaa737cffe0
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-08-02 18:47:25 +08:00
Rupert Shuttleworth
e317474f43 Merge "Add support for prebuilts attribute to the bp2build APEX converter." am: 36a3ef297f am: 5d80f5a189
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1781087

Change-Id: Ib5250493dd8f92befedd654d5dda1c517f6657d1
2021-07-28 12:48:38 +00:00
Rupert Shuttleworth
9447e1ee12 Add support for prebuilts attribute to the bp2build APEX converter.
Test: Updated unit test.

Change-Id: I73dfa84d7a55c0b94393ad6257b5f16313422852
2021-07-28 06:03:17 -04:00
Rupert Shuttleworth
fce917e915 Merge "Add initial bp2build converter support for apex_key modules." am: 8e5b4c5043 am: 7ab55acf47
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1778751

Change-Id: Iaad9fbbc7f1dcb2970d22adce8f6d1eba7418972
2021-07-28 08:09:37 +00:00
Rupert Shuttleworth
eb8c85abf5 Add initial bp2build converter support for apex_key modules.
Test: Added unit test.

Change-Id: I1ec2adfcef770ff91bcf35b89d9961f4d2b8a814
2021-07-28 01:45:54 -04:00
Jiyong Park
3a8130c797 Prohibit static executable in APEX
If a library is statically included in a static executable, it's
behavior is different from the case where the same library is statically
(or dynamically) linked to a non-static executable. To reduce the number
of test configs that we need to consider, it is required to prohibit
static executables in APEXes.

Bug: 185971244
Test: m
Change-Id: I0cd8fca669d55088e2329fef1f859eeb297502dd
2021-07-27 22:42:23 +09:00
Rupert Shuttleworth
d0ec532fa6 Add some more properties to the bp2build APEX converter (second try) am: 6e4950a061 am: 6de2c9b72b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1778212

Change-Id: Ic13b56e93a31357887d37c21952d5a2fe8d85d87
2021-07-27 10:57:03 +00:00
Rupert Shuttleworth
6e4950a061 Add some more properties to the bp2build APEX converter (second try)
In particular:

- AndroidManifest
- file_contexts
- key
- certificate
- min_sdk_version
- updatable
- installable
- native_shared_libs
- binaries

Test: Updated unit test

Change-Id: I1c6e8c4b6b24ce487f64e5d37bd594dbb000fe6f
2021-07-27 05:02:50 -04:00
Rupert Shuttleworth
53b662e2f3 Merge "Revert "Add some more properties to the bp2build APEX converter."" am: d0e6ad1ab3 am: 8ed074029d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1778407

Change-Id: I732ad6808d71b32642fb5892387a6500c31af9d3
2021-07-27 03:25:29 +00:00
Treehugger Robot
b97add46c7 Merge "Add some more properties to the bp2build APEX converter." am: 57dd3c40e8 am: 23c45bb446
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1778085

Change-Id: I7274c07caeee96306b69172793a9c9699839b35b
2021-07-27 03:02:43 +00:00
Rupert Shuttleworth
d0e6ad1ab3 Merge "Revert "Add some more properties to the bp2build APEX converter."" 2021-07-27 02:56:56 +00:00
Rupert Shuttleworth
0358478150 Revert "Add some more properties to the bp2build APEX converter."
This reverts commit 69bf4c0d60.

Reason for revert: Possibly broke CI (https://android-build.googleplex.com/builds/quarterdeck?branch=aosp-master-bazel&target=bp2build-incremental&lkgb=7266256&fkbb=7237028), rolling back just in case...

Change-Id: I14ebac4f47576a73285d1f724ae4499036e8e678
2021-07-27 02:37:32 +00:00
Treehugger Robot
57dd3c40e8 Merge "Add some more properties to the bp2build APEX converter." 2021-07-27 02:17:51 +00:00
satayev
ad6cb082a4 Merge "Rename UpdatableBootJars to ApexBootJars." am: 4102c0cc47 am: adb9e9f752
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1773912

Change-Id: Iecc5f48620b2d4e5390ab9a081b2193924bd0dda
2021-07-26 18:29:56 +00:00
satayev
4102c0cc47 Merge "Rename UpdatableBootJars to ApexBootJars." 2021-07-26 17:59:36 +00:00
Rupert Shuttleworth
69bf4c0d60 Add some more properties to the bp2build APEX converter.
In particular:

- AndroidManifest
- file_contexts
- key
- certificate
- min_sdk_version
- updatable
- installable
- native_shared_libs
- binaries

Test: Updated unit test

Change-Id: I9ea13f021d63ec0f75006b3b0b23ec8178c7e9da
2021-07-26 07:32:36 -04:00
Paul Duffin
dbcc29647a 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: 193095050
Test: m nothing
      - Added unit tests, which all failed and then fixed the tests.
Merged-In: If0706e4551a331b48d383123088e63924dded48b
Change-Id: If0706e4551a331b48d383123088e63924dded48b
(cherry picked from commit 630b11e9d4)
2021-07-23 09:42:28 +01:00
satayev
d604b210c4 Rename UpdatableBootJars to ApexBootJars.
Note that ART apex boot jars and core-icu4j are exceptions here as they
are not part of ApexBootJars. ART apex boot jars are defined in their
own variable, while core-icu4j is treated as a regular non-updatable
boot jar.

Bug: 191127295
Test: atest CtsClasspathsTestCases
Change-Id: I3cea3d82ef521655a1a5ffa8cae2258ab9d08bfc
2021-07-22 17:35:42 +01:00
Treehugger Robot
627ecdc0e7 Merge "apex: pass --align-file-size to signapk" am: c30a4c3f3c am: 9f354c8694
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1762581

Change-Id: I256bd030afdf7bd44b7397cdf55ca44b14239dd1
2021-07-21 00:51:09 +00:00
Treehugger Robot
c30a4c3f3c Merge "apex: pass --align-file-size to signapk" 2021-07-21 00:23:08 +00:00
Treehugger Robot
4760903116 Merge "Require prebuilt_bootclasspath_fragment to provide hidden API files" am: 41461f3660 am: 70d39ce053
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1772628

Change-Id: I276e323889e5a70ddf56b7ca71add649858c32a1
2021-07-20 20:38:22 +00:00
Treehugger Robot
854571f683 Merge changes I343712d7,Ic076ea85 am: 9c01fc686d am: 93ece5b8e2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1772627

Change-Id: Id0587dc7c2a4e1019f3699aa3b3b7e5015e5e2e5
2021-07-20 20:38:13 +00:00
Paul Duffin
54e4197da1 Require prebuilt_bootclasspath_fragment to provide hidden API files
Previously, the prebuilt_bootclasspath_fragment was not required to
provide hidden API files as not all usages of that module provided
them. That should no longer be the case so this change makes the
prebuilt_bootclasspath_fragment stricter and so now always require
them.

Bug: 194063708
Test: m out/soong/hiddenapi/hiddenapi-flags.csv
      - check that this does not change the contents.
Change-Id: I3f19a1b4246f09a927c0f6b0f41b8678150d6cc2
2021-07-20 19:18:13 +01:00
Paul Duffin
40a3f65430 Improve hidden API checking in TestBootDexJarsFromSourcesAndPrebuilts
Previously, the test only checked how the intermediate index file was
created from class jars. This change also checks how the monolithic
index file was created from the intermediate index file and the index
files generated from each bootclasspath_fragment.

At the moment the checks reveal that the monolithic index file is
created solely from the intermediate index file. However, a follow up
change to Soong will alter the behavior of the test.

Bug: 194063708
Test: m nothing
Change-Id: I343712d7d17ab0a07f5b32226321fc6815847e1f
2021-07-20 19:17:56 +01:00
Jingwen Chen
5c2e25258a Merge "Fix apex bp2build." am: 8bdc1bb3d7 am: d3f17aed08
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1769290

Change-Id: I7c2eb2c283537bbde02db9701e869d9aa46674fc
2021-07-19 05:36:19 +00:00
Jingwen Chen
f59a8e117e Fix apex bp2build.
apexBundle was missing InitBazelModule for it to have bazel_module properties.

Test: soong unit test
Fixes: 193866723
Change-Id: I5fb38c8b2e8edaecef44162491d399c0223d3fb1
2021-07-16 09:32:49 +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
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
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
Jooyung Han
5d00f50f75 apex: pass --align-file-size to signapk
APEX files are sized as 4K-aligned so that they can be passed to Guest
OS via block apexes.

Bug: 192991318
Test: check size of built APEX files
Change-Id: I32d988f3cdf2717dbebd87b2ced01840e07a3a9b
2021-07-12 11:35:48 +09:00
Rupert Shuttleworth
268466707b Add partial bp2build support for APEX targets (second try). am: a9d76dd423 am: 37b29c925c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1755109

Change-Id: Id29697a17140dccf5ca9764a95f6f5db51a8783a
2021-07-02 13:38:14 +00:00
Rupert Shuttleworth
a9d76dd423 Add partial bp2build support for APEX targets (second try).
Test: Added unit test
Change-Id: Icbf0475251aac5d1f13bd35a18f90b6c70f3ae29
2021-07-02 07:36:07 -04:00
Martin Stjernholm
95994067b1 Do not allow duplicate deapexer dependencies.
Without these errors, the last encountered deapexer would silently be
used, and we wouldn't know if it was taken from the prebuilt APEX that
actually get installed in the system image.

With this error check there may be only one enabled prebuilt_apex or
apex_set for each apex_name (which defaults to the module name). E.g.
if there are both prebuilt com.android.foo and com.google.android.foo,
it is necessary to disable one of them in the .bp file.

Merged-In is set from https://r.android.com/1745454, a change that has
gone into AOSP and internal master, as well as sc-dev-plus-aosp, but
specifically not sc-dev. This change cannot merge into sc-dev-plus-aosp
and others, because they may or may not have the com.google.android.art
prebuilt APEX present depending on manifest, and with this check
exactly one of com.android.art and com.google.android.art prebuilts has
to be present and enabled. It'll be cherry-picked to AOSP along with a
full fix for b/192006406, when it can be safely enabled everywhere.

Test: m nothing SOONG_CONFIG_art_module_source_build=false
Test: m nothing SOONG_CONFIG_art_module_source_build=true
Test: m nothing
  with enabled:true for the com.android.art prebuilt APEX - check that
  it fails with an "ambiguous duplicate deapexer" error
Bug: 192006406
Bug: 192542393
Change-Id: I44566fd26b12f82a8a67fe4a69e56303460756d0
Merged-In: Id2410b4e38a78ec2146a42298840954381a7c472
2021-07-02 00:31:01 +01:00
Weng Su
eb8a7b740a Revert "Add partial bp2build support for APEX targets." am: 7ce730b90c am: 9bc2ee5ca0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1753900

Change-Id: Iff2f0d358658098ccfd06bdca58a20b72db16de7
2021-07-01 08:00:41 +00:00
Rupert Shuttleworth
50be2a3716 Add partial bp2build support for APEX targets. am: 22b606b5f0 am: 356b7ca109
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1733232

Change-Id: Ia301f78ab5e9ad38d0eee2a525a4eb2895ae5722
2021-07-01 06:57:23 +00:00
Weng Su
7ce730b90c Revert "Add partial bp2build support for APEX targets."
Revert submission 1733232-roboleaf-apex

Reason for revert: b/192523357 Broken build 7512065 on aosp-master on sdk_x86_64-sdk
Reverted Changes:
Ie82c263f6:Add a stub rule for building APEX bundles.
I93e2a25fa:Add partial bp2build support for APEX targets.

Change-Id: I8e836fe7f466e02f3108680f9653412299e929e0
2021-07-01 06:51:11 +00:00
Rupert Shuttleworth
22b606b5f0 Add partial bp2build support for APEX targets.
Test: Added unit test

Change-Id: I93e2a25fa43eec1ffb8fb30c346a9b523195a0fd
2021-06-30 22:20:23 -04:00
Paul Duffin
46ab291f67 Ignore license and similar dependencies of prebuilt_apex/apex_set
Previously, when determining which dependencies, direct or transitive,
of a prebuilt_apex/apex_set required APEX variants the code assumed
that all dependencies implemented ApexModule. While that is true for
the modules that can be explicitly mentioned in the exported...
properties it is not true for all of them. e.g. A
prebuilt_apex/apex_set can depend on license modules which do not
implement ApexModule.

This change simply ignores any module that does not implement
ApexModule.

Bug: 179354495
Test: m nothing
Merged-In: Iead6f9d1085d169335b88ceadcce2d8cc042254d
Change-Id: Iead6f9d1085d169335b88ceadcce2d8cc042254d
(cherry picked from commit fee8cf36e3)
2021-06-30 00:08:49 +01:00
Paul Duffin
d7be777f25 Ignore license and similar dependencies of prebuilt_apex/apex_set am: fee8cf36e3
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/15132673

Change-Id: I88690c5637ab0e3a67415afa19fcfef0707b2b78
2021-06-29 23:06:29 +00:00
Paul Duffin
fee8cf36e3 Ignore license and similar dependencies of prebuilt_apex/apex_set
Previously, when determining which dependencies, direct or transitive,
of a prebuilt_apex/apex_set required APEX variants the code assumed
that all dependencies implemented ApexModule. While that is true for
the modules that can be explicitly mentioned in the exported...
properties it is not true for all of them. e.g. A
prebuilt_apex/apex_set can depend on license modules which do not
implement ApexModule.

This change simply ignores any module that does not implement
ApexModule.

Bug: 179354495
Test: m nothing
Change-Id: Iead6f9d1085d169335b88ceadcce2d8cc042254d
2021-06-29 18:42:55 +01: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
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
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
Martin Stjernholm
82c88ca8c6 Merge "Fix inconsistencies in the apex names used for the apex variations." into sc-dev 2021-06-27 23:08:48 +00:00
Treehugger Robot
a2792263fa Merge "Fix inconsistencies in the apex names used for the apex variations." am: f46e95899b am: 28bbdf23f7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1748294

Change-Id: I930769a7d48eedace77d12cf51f1e50ebb874cbb
2021-06-25 23:33:49 +00:00
Treehugger Robot
f46e95899b Merge "Fix inconsistencies in the apex names used for the apex variations." 2021-06-25 22:50:00 +00: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
Martin Stjernholm
d8da28ea9c Fix inconsistencies in the apex names used for the apex variations.
Add an apex_name property to prebuilt APEX modules to allow specifying
the "runtime" name of the APEX, i.e. the one it gets mounted as in /apex/,
which is also the one used for the apex variations.

Introduce a callback to retrieve that name consistently for all APEX
modules (apex, override_apex, prebuilt_apex, and apex_set), and update
some apex mutator code paths to use it.

For APEX source modules (apex and override_apex), it's necessary to add
a new field in apexBundle, since the name property gets overridden for
the override variant that override_apex creates.

Cherry-picked from https://r.android.com/1748294.

Test: m nothing
Bug: 191269918
Change-Id: If8612639bffdf91cbcab3387b0603bf5dffef1f5
Merged-In: If8612639bffdf91cbcab3387b0603bf5dffef1f5
2021-06-25 21:27:14 +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
99926a2a77 Merge "Support hidden API processing for modules that use platform APIs" 2021-06-25 18:25:39 +00:00
Jiyong Park
56a39ad6d9 Merge changes from topic "stub_from_rust"
* changes:
  Add platform_apis property to APEX module type
  Rust module in APEX uses stub libraries across APEX boundaries
2021-06-25 17:52:43 +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
4faf5c17e2 Add test for modular hiddenapi list rule
Adds a test to establish a baseline for a follow up change that adds
module_lib support to hidden API processing.

Bug: 179354495
Test: m nothing
Merged-In: I5630075825c674b2e4f38bd459c7b061c01fc362
Change-Id: I5630075825c674b2e4f38bd459c7b061c01fc362
(cherry picked from commit 48b6741510)
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
Martin Stjernholm
bfffae7bec Fix inconsistencies in the apex names used for the apex variations.
Add an apex_name property to prebuilt APEX modules to allow specifying
the "runtime" name of the APEX, i.e. the one it gets mounted as in /apex/,
which is also the one used for the apex variations.

Introduce a callback to retrieve that name consistently for all APEX
modules (apex, override_apex, prebuilt_apex, and apex_set), and update
some apex mutator code paths to use it.

For APEX source modules (apex and override_apex), it's necessary to add
a new field in apexBundle, since the name property gets overridden for
the override variant that override_apex creates.

Test: m nothing
Bug: 191269918
Change-Id: If8612639bffdf91cbcab3387b0603bf5dffef1f5
2021-06-25 16:41:05 +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
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
7c2a47b90b Merge "Add test for modular hiddenapi list rule" am: b8410ec07c am: f4610affbc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1744415

Change-Id: I76aa568dcc16c08e7bee3a02b18695603f4e7953
2021-06-25 11:26:50 +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
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
48b6741510 Add test for modular hiddenapi list rule
Adds a test to establish a baseline for a follow up change that adds
module_lib support to hidden API processing.

Bug: 179354495
Test: m nothing
Change-Id: I5630075825c674b2e4f38bd459c7b061c01fc362
2021-06-24 22:04:05 +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
Jiyong Park
1bc8412d37 Add platform_apis property to APEX module type
The property is used to allow non-updatable APEXes to use platform APIs
(e.g. symbols marked as "# platform-only").

Bug: 191637950
Test: m com.android.virt com.android.compos
Merged-In: Id2410b4e38a78ec2146a42298840954381a7c472
Change-Id: Id2410b4e38a78ec2146a42298840954381a7c472
(cherry picked from commit fb63625a7f)
2021-06-24 19:50:32 +09:00
Jiyong Park
105dc321ce Rust module in APEX uses stub libraries across APEX boundaries
This change fixes a bug that rust module in APEX has access to private
symbols of a native library even when the native library is outside of
the APEX.

To fix this, the stub selection logic in the cc package is exctacted as
a function ChooseStubOrImpl and is used also in the rust package.

Bug: 190767845
Test: m
Merged-In: I5c4cbdd5d27f257ab329d9dadbcd87d41a87f46a
Change-Id: I5c4cbdd5d27f257ab329d9dadbcd87d41a87f46a
(cherry picked from commit 3b5f88e091)
2021-06-24 19:50:06 +09:00
Jiyong Park
9477c26f6c Add platform_apis property to APEX module type
The property is used to allow non-updatable APEXes to use platform APIs
(e.g. symbols marked as "# platform-only").

Bug: 191637950
Test: m com.android.virt com.android.compos
Merged-In: Id2410b4e38a78ec2146a42298840954381a7c472
Change-Id: Id2410b4e38a78ec2146a42298840954381a7c472
(cherry picked from commit fb63625a7f)
2021-06-24 11:28:33 +09:00
Jiyong Park
7d55b61783 Rust module in APEX uses stub libraries across APEX boundaries
This change fixes a bug that rust module in APEX has access to private
symbols of a native library even when the native library is outside of
the APEX.

To fix this, the stub selection logic in the cc package is exctacted as
a function ChooseStubOrImpl and is used also in the rust package.

Bug: 190767845
Test: m
Merged-In: I5c4cbdd5d27f257ab329d9dadbcd87d41a87f46a
Change-Id: I5c4cbdd5d27f257ab329d9dadbcd87d41a87f46a
(cherry picked from commit 3b5f88e091)
2021-06-24 11:27:41 +09:00
satayev
09a45d755f Merge "VNDK APEX: skips VNDK-Ext" am: 17c4507dec am: 125bba00cf
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1744554

Change-Id: Ic32f9b3df65b747e5126a50d65b472f4fe3df9df
2021-06-23 20:24:59 +00:00
satayev
17c4507dec Merge "VNDK APEX: skips VNDK-Ext" 2021-06-23 19:52:56 +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
Jooyung Han
7d6e79bc63 VNDK APEX: skips VNDK-Ext
In legacy VNDK mode (DeviceVndkVesion=""), the check was missing. We
don't want VNDK-Ext in VNDK APEX in any case.

Bug: 191770320
Test: m nothing
Change-Id: I08f36a4c1696bf82d25d629841e172d2716a366d
2021-06-24 01:56:03 +09: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
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
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
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
a1a2baf8a7 Merge "Fix monolithic hidden API processing with prebuilts" 2021-06-22 11:44:11 +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
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
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
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
Paul Duffin
062838fcca Merge "Add ClasspathElement support" into sc-dev 2021-06-20 18:06:03 +00:00
Paul Duffin
1970d6c5ce Merge "Extract createEntriesForApexFile" into sc-dev 2021-06-20 18:05:55 +00:00
Nikita Ioffe
5476c95e50 Merge "Set default value of generate_hashtree property to true" into sc-dev 2021-06-19 00:12:16 +00: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
Paul Duffin
9dc8c54fc4 Extract createEntriesForApexFile
While this seems like a simple refactoring it does actually fix an
issue. Previously, when the ExtraEntries func was being defined inline
within the for ... loop it used the loop variable "fi". Unfortunately,
that meant that the func created on each iteration ended up using the
value for "fi" that was set on the last iteration.

Extracting the creation of the entry into a separate method means that
each func created gets its own "fi" variable with the correct values.

Bug: 177892522
Test: m SOONG_CONFIG_art_module_source_build=false nothing
      - without this change it reported duplicate rules for apache-xml.jar
        which is the last entry in the art-bootclasspath-fragment. With
        this change it works fine.
Merged-In: Ia063b513f758e1bbe73407c0441b72453f412acf
Change-Id: Ia063b513f758e1bbe73407c0441b72453f412acf
(cherry picked from commit 155c17779c)
2021-06-18 21:02:10 +01: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
9eea670062 Merge "Extract createEntriesForApexFile" am: e91f1537e2 am: f86a697730
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738978

Change-Id: Ia3114e68a4f32ea87565dd65c3ac601d80df5558
2021-06-18 18:13:54 +00:00
Paul Duffin
e6aefedeba Merge "Add ClasspathElement support" 2021-06-18 18:13:06 +00:00
Paul Duffin
e91f1537e2 Merge "Extract createEntriesForApexFile" 2021-06-18 17:11:29 +00:00
Nikita Ioffe
cd3654f9fe Set default value of generate_hashtree property to true
Test: presubmit
Test: m
Bug: 190621617
Change-Id: I546730f168632c5d5d41c686853bde93a8ba7911
Merged-In: I546730f168632c5d5d41c686853bde93a8ba7911
(cherry picked from commit e261ae64e2)
2021-06-18 15:06:06 +01:00
Nikita Ioffe
3b0b1bd798 Merge "Set default value of generate_hashtree property to true" am: f932613c3f am: 59b8d28cf6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1736785

Change-Id: Ic44e048dc70adb79f94db056ad8969f656e43d1e
2021-06-18 13:43:02 +00:00
Nikita Ioffe
f932613c3f Merge "Set default value of generate_hashtree property to true" 2021-06-18 13:14:22 +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
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
fd53e21098 Copy implementation and header jars to make when possible
Fixes test issues caused by a jar containing a classes.dex file was
copied to a place that was expected a jar containing class files.

Bug: 191360201
Test: - in master-art
      find out/ -name \*core-icu4j\* | xargs rm -fr
      art/tools/buildbot-build.sh --target --installclean
      art/tools/bootjars.sh --path --core
      - examine file output from previous script for core-icu4j,
        before this change it contained classes.dex file after this
        change it contained *.class files.
Merged-In: I05ecf652535ec097125fb76d6ca80fee6587f98d
Change-Id: I05ecf652535ec097125fb76d6ca80fee6587f98d
(cherry picked from commit 85fa344d09)
2021-06-18 12:11:17 +01:00
Paul Duffin
c30aea20a0 Make apex variants of prebuilt apex exported modules available in make
Previously, the apex variants of modules exported from prebuilt_apex
and apex_set modules were not exported to make. Neither by the modules
themselves or by the prebuilt apex module. The master-art build relied
on the platform variants of the conscrypt and core-icu4j libraries
being exported to make so that they could be used by vogar.

Unfortunately, a change to export the prebuilt_bootclasspath_fragment
modules that contain the conscrypt and core-icu4j prebuilt libraries
from the corresponding prebuilt_apex prevented the platform variants
of those libraries from being exported at all which broke the
master-art builds as it only has prebuilts of those modules. It did not
break the aosp/master build as that has source modules.

The difference between the two builds is that the apex module type
makes its contents available in make but the prebuilt_apex/apex_set
module types do not.

This change causes the prebuilt_apex/apex_set module types to behave
more like the apex module type by making its exported libraries
available in make.

Bug: 179354495
Test: m droid
      - in aosp/master
      art/tools/buildbot-build.sh --target --installclean
      - in master-art and aosp/master
Merged-In: I57537d17d4920d37d896ed491c6aaa15302cb25d
Change-Id: I57537d17d4920d37d896ed491c6aaa15302cb25d
(cherry picked from commit a35f8db127)
2021-06-18 12:10:32 +01:00
Paul Duffin
5ec165d755 Create APEX variant for prebuilt_apex/apex_set
Previously, the prebuilt_apex/apex_set did not have an apex specific
variant created which meant that they depended upon the platform
variant of the modules it depended upon. This change creates an
apex variant for them just as is done for the apex module type which
causes it to depend upon the apex specific variant of the modules it
depends upon.

Test: m droid
Bug: 179354495
Merged-In: I7d6f3609c267b3e90b90b9befe7d76f351a0c2bd
Change-Id: I7d6f3609c267b3e90b90b9befe7d76f351a0c2bd
(cherry picked from commit 6717d88f46)
2021-06-18 12:02:43 +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
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
155c17779c Extract createEntriesForApexFile
While this seems like a simple refactoring it does actually fix an
issue. Previously, when the ExtraEntries func was being defined inline
within the for ... loop it used the loop variable "fi". Unfortunately,
that meant that the func created on each iteration ended up using the
value for "fi" that was set on the last iteration.

Extracting the creation of the entry into a separate method means that
each func created gets its own "fi" variable with the correct values.

Bug: 177892522
Test: m SOONG_CONFIG_art_module_source_build=false nothing
      - without this change it reported duplicate rules for apache-xml.jar
        which is the last entry in the art-bootclasspath-fragment. With
        this change it works fine.
Change-Id: Ia063b513f758e1bbe73407c0441b72453f412acf
2021-06-18 07:43:32 +01: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
Paul Duffin
33ddfdf42b Merge "Copy implementation and header jars to make when possible" am: 94b2e705d1 am: d11c1c8fa4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1740074

Change-Id: I83a02203cbebd6dff91a06a7969615fbdfd01390
2021-06-17 21:37:45 +00:00
Paul Duffin
85fa344d09 Copy implementation and header jars to make when possible
Fixes test issues caused by a jar containing a classes.dex file was
copied to a place that was expected a jar containing class files.

Bug: 191360201
Test: - in master-art
      find out/ -name \*core-icu4j\* | xargs rm -fr
      art/tools/buildbot-build.sh --target --installclean
      art/tools/bootjars.sh --path --core
      - examine file output from previous script for core-icu4j,
        before this change it contained classes.dex file after this
        change it contained *.class files.
Change-Id: I05ecf652535ec097125fb76d6ca80fee6587f98d
2021-06-17 20:33:54 +01: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
b4bbf2ca10 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
Change-Id: I5dc77c8fb272bac289b8891d1eac801e541af1f5
2021-06-17 15:59:07 +01:00
Paul Duffin
fef5500a76 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
Change-Id: I5cc341b5b4168b8eb196f72273a00d498de6856f
2021-06-17 14:56:05 +01:00
satayev
b98371cc13 Add classpath fragment property to skip proto generation.
This must always be true for updatable apexes, but is not necessary
for non-updatable apexes like com.android.i18n.

In a follow up this will be used to figure out whether apex boot jars
should be bundled into platform_bootclasspath.

Bug: 191127295
Test: atest CtsClasspathsTestCases derive_classpath_test
Change-Id: Ib7dc5b057cb24955222fb97f3ff9da079f30ed77
2021-06-17 12:59:33 +01:00
Paul Duffin
e521881bd4 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.
Change-Id: I60996a34d06ed1c87ed244ab3509621999ad86ec
2021-06-17 10:20:33 +01:00
Paul Duffin
8e69cba899 Merge "Make apex variants of prebuilt apex exported modules available in make" am: 2c891873d6 am: ea621048f3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738035

Change-Id: I1399ecfd269e68a6d69766cf9cd85294cb376adf
2021-06-17 07:04:35 +00:00
Paul Duffin
dc998efc9f Merge "Create APEX variant for prebuilt_apex/apex_set" am: 2960e9bdf2 am: 70fc36a6fc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1738034

Change-Id: I0cf928c7649040fe588ae8ff9d7db55f4f6c7610
2021-06-17 07:04:27 +00:00
Paul Duffin
a35f8db127 Make apex variants of prebuilt apex exported modules available in make
Previously, the apex variants of modules exported from prebuilt_apex
and apex_set modules were not exported to make. Neither by the modules
themselves or by the prebuilt apex module. The master-art build relied
on the platform variants of the conscrypt and core-icu4j libraries
being exported to make so that they could be used by vogar.

Unfortunately, a change to export the prebuilt_bootclasspath_fragment
modules that contain the conscrypt and core-icu4j prebuilt libraries
from the corresponding prebuilt_apex prevented the platform variants
of those libraries from being exported at all which broke the
master-art builds as it only has prebuilts of those modules. It did not
break the aosp/master build as that has source modules.

The difference between the two builds is that the apex module type
makes its contents available in make but the prebuilt_apex/apex_set
module types do not.

This change causes the prebuilt_apex/apex_set module types to behave
more like the apex module type by making its exported libraries
available in make.

Test: m droid
      - in aosp/master
      art/tools/buildbot-build.sh --target --installclean
      - in master-art and aosp/master
Change-Id: I57537d17d4920d37d896ed491c6aaa15302cb25d
2021-06-16 19:02:58 +01:00
Paul Duffin
6717d88f46 Create APEX variant for prebuilt_apex/apex_set
Previously, the prebuilt_apex/apex_set did not have an apex specific
variant created which meant that they depended upon the platform
variant of the modules it depended upon. This change creates an
apex variant for them just as is done for the apex module type which
causes it to depend upon the apex specific variant of the modules it
depends upon.

Test: m droid
Bug: 179354495
Change-Id: I7d6f3609c267b3e90b90b9befe7d76f351a0c2bd
2021-06-16 18:54:19 +01:00
Nikita Ioffe
e261ae64e2 Set default value of generate_hashtree property to true
Test: presubmit
Test: m
Bug: 190621617
Change-Id: I546730f168632c5d5d41c686853bde93a8ba7911
2021-06-16 18:15:03 +01:00
Paul Duffin
a49f6b9138 Merge "Dedup apex/Prebuilt and apex/ApexSet" into sc-dev 2021-06-16 12:38:37 +00:00
Paul Duffin
ef6b69558a Dedup apex/Prebuilt and apex/ApexSet
Moves common properties, fields and method into the prebuiltCommon
type.

One slight change is that this change causes the Prebuilt module to use
the outputApex when generating the AndroidMkEntries instead of the
inputApex that it used before. They are the exact same files as the
inputApex is simply copied to the outputApex. The only impact will be
on build time as some rules now depend on the cp rule being run when
they did not before and the base name of the file may be different.

Test: m droid
      - check generated out/soong/Android...mk file before and after
        to make sure the only difference is due to switching from the
	inputApex to outputApex.
Bug: 179354495
Change-Id: I8437af00d6bb7d0d339f25b3b02cd1cf67d6938a
Merged-In: I8437af00d6bb7d0d339f25b3b02cd1cf67d6938a
2021-06-16 11:56:14 +00:00
Paul Duffin
a9c8110470 Dedup apex/Prebuilt and apex/ApexSet
Moves common properties, fields and method into the prebuiltCommon
type.

One slight change is that this change causes the Prebuilt module to use
the outputApex when generating the AndroidMkEntries instead of the
inputApex that it used before. They are the exact same files as the
inputApex is simply copied to the outputApex. The only impact will be
on build time as some rules now depend on the cp rule being run when
they did not before and the base name of the file may be different.

Test: m droid
      - check generated out/soong/Android...mk file before and after
        to make sure the only difference is due to switching from the
	inputApex to outputApex.
Bug: 179354495
Change-Id: I8437af00d6bb7d0d339f25b3b02cd1cf67d6938a
Merged-In: I8437af00d6bb7d0d339f25b3b02cd1cf67d6938a
2021-06-16 10:35:48 +01:00
Paul Duffin
b176d29bd2 Dedup apex/Prebuilt and apex/ApexSet
Moves common properties, fields and method into the prebuiltCommon
type.

One slight change is that this change causes the Prebuilt module to use
the outputApex when generating the AndroidMkEntries instead of the
inputApex that it used before. They are the exact same files as the
inputApex is simply copied to the outputApex. The only impact will be
on build time as some rules now depend on the cp rule being run when
they did not before and the base name of the file may be different.

Test: m droid
      - check generated out/soong/Android...mk file before and after
        to make sure the only difference is due to switching from the
	inputApex to outputApex.
Bug: 179354495
Change-Id: I8437af00d6bb7d0d339f25b3b02cd1cf67d6938a
2021-06-16 09:36:26 +01:00
Paul Duffin
3e2db5c10b Make copyBootJarsToPredefinedLocations simpler and less fragile
Previously, copyBootJarsToPredefinedLocations relied on all its
parameters having the same length and the same order. That made it
quite fragile as changes to one of the parameters without corresponding
changes to the other would cause failures. It also combined the
retrieval of the boot dex jars from the modules, handling of missing
boot dex jar files and the generation of the rules to copy the files.

This change separates the retrieval of boot dex jars and handling of
missing files from the copying of those files while at the same time
making the function less fragile by replacing the three ordered
parameters with two maps that shared common keys.

Bug: 179354495
Test: m nothing
Merged-In: Idbcd24a7e8af89f7895a20aeddc58502dcbaad03
Change-Id: Idbcd24a7e8af89f7895a20aeddc58502dcbaad03
(cherry picked from commit 5f148ca7cf)
2021-06-16 03:06:35 +01:00
Paul Duffin
0c70a7a0b0 Make TestPlatformBootclasspath_Fragments more realistic
Move the bootclasspath_fragment to be part of an apex to match how they
are expected to be used. Also adds the bar library to the boot jars
config as every module in a bootclasspath_fragment that is referenced
from a platform_bootclasspath module is expected to be in the config.

Bug: 179354495
Test: m nothing
Merged-In: I6f826dce9c006d630ee31d4171fe6fb458cc9442
Change-Id: I6f826dce9c006d630ee31d4171fe6fb458cc9442
(cherry picked from commit dc3f9566a2)
2021-06-16 03:06:34 +01:00
Paul Duffin
5991ba5119 Move TestPlatformBootclasspath_Fragments to apex package
This test checks that fragments which are referenced from a
platform_bootclasspath module contribute their hidden API flags to those
used by platform_bootclasspath module. Previously, it was unrealistic
because the bootclasspath_fragment does not belong in an APEX.

This change moves the test from the java package to the apex package to
allow it to be modified to make the bootclasspath_fragment part of an
apex.

Bug: 179354495
Test: m nothing
Merged-In: Icb57f2e1eaea4b14aab5f47f3af7d05ea0555816
Change-Id: Icb57f2e1eaea4b14aab5f47f3af7d05ea0555816
(cherry picked from commit ffa8375f07)
2021-06-16 03:06:34 +01:00
bralee
b0c1f0c45a AIDEGen: Collect dependencies info from APEX module.
Add apex dependencies.

Bug: 188004865
Test: 1. aidegen frameworks/base/apex/appsearch frameworks/base/apex/appsearch/testing   frameworks/base/services/tests/servicestests   frameworks/base/core/tests/coretests   cts/tests/appsearch   external/icing   vendor/google_testing/integration/tests/scenarios
      2. The dependency graph shows it is workable to provide the result to let IDE's [Project structure] to include the service-appsearch as source directory.
Change-Id: Ifd1548f0a86c1c73f8279e8ecea67756aeb1281e
2021-06-15 08:35:13 +08:00
Nikita Ioffe
5868ba016d Merge "Rename test_only_no_hashtree to generate_hashtree" 2021-06-14 20:16:21 +00:00
Paul Duffin
00da4dc303 Merge "Make copyBootJarsToPredefinedLocations simpler and less fragile" am: cc1bd8364a am: 174d9c7eec
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1731414

Change-Id: I76746fa8b13b7b4632638ba211199d4d7b0d48d4
2021-06-14 08:32:56 +00:00
Paul Duffin
4fac8ad0d4 Merge "Make TestPlatformBootclasspath_Fragments more realistic" am: baa8e55dec am: e599574c92
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1731417

Change-Id: Ib371be888ad56a6ceb67148bd1a0f14367abc71b
2021-06-11 05:07:10 +00:00
Paul Duffin
40d0145d29 Merge "Move TestPlatformBootclasspath_Fragments to apex package" am: 2eddb50fd5 am: 0d2a3ad17d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1731416

Change-Id: I3299f527aa8cc365784db1ecc15e83bc6889b3b3
2021-06-11 05:07:04 +00:00
Nikita Ioffe
0f02adec5e Merge "Rename test_only_no_hashtree to generate_hashtree" into sc-dev am: dce0713739
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/14920581

Change-Id: If41297bae4bff155224fe9c13d704c615fec3ac0
2021-06-10 16:27:25 +00:00
Nikita Ioffe
9d9960f240 Rename test_only_no_hashtree to generate_hashtree
In order not to introduce any changes in the system image default value
of generate_hashtree is currently set to false. Once all the APEXes that
shouldn't have hashtree enable (i.e. non-updatable ones) explicitly set
`generate_hashtree: false` default value will be switched to true.

Test: checked that are no diffs between ${OUT}/system/apex without this
  change and with this change.
Test: m
Bug: 190621617
Change-Id: I5a3144f8f6ea7dee25678af43e2b07a8c85daa9e
Merged-In: I5a3144f8f6ea7dee25678af43e2b07a8c85daa9e
(cherry picked from commit da6dc31389)
2021-06-10 16:54:53 +01:00
Paul Duffin
5f148ca7cf Make copyBootJarsToPredefinedLocations simpler and less fragile
Previously, copyBootJarsToPredefinedLocations relied on all its
parameters having the same length and the same order. That made it
quite fragile as changes to one of the parameters without corresponding
changes to the other would cause failures. It also combined the
retrieval of the boot dex jars from the modules, handling of missing
boot dex jar files and the generation of the rules to copy the files.

This change separates the retrieval of boot dex jars and handling of
missing files from the copying of those files while at the same time
making the function less fragile by replacing the three ordered
parameters with two maps that shared common keys.

Bug: 179354495
Test: m nothing
Change-Id: Idbcd24a7e8af89f7895a20aeddc58502dcbaad03
2021-06-10 14:28:10 +01:00
Paul Duffin
dc3f9566a2 Make TestPlatformBootclasspath_Fragments more realistic
Move the bootclasspath_fragment to be part of an apex to match how they
are expected to be used. Also adds the bar library to the boot jars
config as every module in a bootclasspath_fragment that is referenced
from a platform_bootclasspath module is expected to be in the config.

Bug: 179354495
Test: m nothing
Change-Id: I6f826dce9c006d630ee31d4171fe6fb458cc9442
2021-06-10 12:36:43 +01:00
Paul Duffin
ffa8375f07 Move TestPlatformBootclasspath_Fragments to apex package
This test checks that fragments which are referenced from a
platform_bootclasspath module contribute their hidden API flags to those
used by platform_bootclasspath module. Previously, it was unrealistic
because the bootclasspath_fragment does not belong in an APEX.

This change moves the test from the java package to the apex package to
allow it to be modified to make the bootclasspath_fragment part of an
apex.

Bug: 179354495
Test: m nothing
Change-Id: Icb57f2e1eaea4b14aab5f47f3af7d05ea0555816
2021-06-10 12:36:43 +01:00
Nikita Ioffe
da6dc31389 Rename test_only_no_hashtree to generate_hashtree
In order not to introduce any changes in the system image default value
of generate_hashtree is currently set to false. Once all the APEXes that
shouldn't have hashtree enable (i.e. non-updatable ones) explicitly set
`generate_hashtree: false` default value will be switched to true.

Test: checked that are no diffs between ${OUT}/system/apex without this
  change and with this change.
Test: m
Bug: 190621617
Change-Id: I5a3144f8f6ea7dee25678af43e2b07a8c85daa9e
2021-06-09 19:43:46 +01:00
Treehugger Robot
654b4d2337 Merge "Use fingerprint when min_sdk is current or none" am: dddb0152a5 am: 6302bc5461
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1720035

Change-Id: I5985f1e80b2e38f0f6fb031f1706c3494170f9c7
2021-06-01 10:43:33 +00:00
Colin Cross
cbb2b8172d Treat java libraries in classpath fragments as directly in apex
Coverage is applied to java libraries that are directly in an apex.
Mark java libraries that are in an apex through a bootclasspath_fragment
or a systemserverclasspath_fragment as directly in the apex by
implementing CopyDirectlyInAnyApexTag on the dependency tags used for
their contents.

Bug: 183759446
Test: TestApexJavaCoverage
Change-Id: I0116f5f415083b5194000988cb257454ef115200
Merged-In: I0116f5f415083b5194000988cb257454ef115200
(cherry picked from commit c33e5216f1)
2021-05-27 13:14:33 -07:00
Liz Kammer
4854a7d2cb Use fingerprint when min_sdk is current or none
We have versions of the same apex targetting different min_sdk_versions;
however, fingerprint is overriding the hardcoded min_sdk_version. We
should only be overriding if it is current or unset.

Test: go test apex soong tests
Change-Id: Id030a5ba7d8edebb806ce83d318132fd839a00a5
2021-05-27 14:28:27 -04:00
Martin Stjernholm
c4f4cedc47 Merge "Drop "prebuilt_" prefixes from names registered in ApexInfo.InApexXxx."
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1719298

Bug: 180325915
Change-Id: I1fd96bad2326612d153fed31308914902f58d3ec
Merged-In: Icbe4e025ce1a4c8dd258ff95d326ca2f27905188
(cherry picked from commit f4c44417a3)
2021-05-27 17:23:16 +00:00
Martin Stjernholm
6912b71c08 Merge "Drop "prebuilt_" prefixes from names registered in ApexInfo.InApexXxx." am: 664b2cf89a am: 5eb4b21deb
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1719298

Change-Id: I72b64b8f26bdb135838f8cf735b2ac7da84cdba7
2021-05-27 10:14:36 +00:00
Martin Stjernholm
664b2cf89a Merge "Drop "prebuilt_" prefixes from names registered in ApexInfo.InApexXxx." 2021-05-27 09:24:55 +00:00
Colin Cross
532e863da0 Merge changes I0116f5f4,I950c9b54,I967f5c42 am: 4ab2dd1afe am: 7ca753793f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1718475

Change-Id: I864c97d90aa8f2ec4e43ac9d39464ca257b608e2
2021-05-27 01:38:25 +00:00
Colin Cross
4ab2dd1afe Merge changes I0116f5f4,I950c9b54,I967f5c42
* changes:
  Treat java libraries in classpath fragments as directly in apex
  Make CopyDirectlyInAnyApex match the documentation
  Remove unused cc.copyDirectlyInAnyApexDependencyTag
2021-05-27 00:56:52 +00:00
Martin Stjernholm
7e6cf31742 Merge "Move logic to disable flattening in unbundled app mode from Soong to make." am: 0770a175a1 am: 8f8a1abeb7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1714380

Change-Id: I7d8b1ddd5fd18468430a0b0be0686d6f365ab021
2021-05-26 19:15:59 +00:00
Martin Stjernholm
0770a175a1 Merge "Move logic to disable flattening in unbundled app mode from Soong to make." 2021-05-26 18:21:45 +00:00
Colin Cross
c33e5216f1 Treat java libraries in classpath fragments as directly in apex
Coverage is applied to java libraries that are directly in an apex.
Mark java libraries that are in an apex through a bootclasspath_fragment
or a systemserverclasspath_fragment as directly in the apex by
implementing CopyDirectlyInAnyApexTag on the dependency tags used for
their contents.

Bug: 183759446
Test: TestApexJavaCoverage
Change-Id: I0116f5f415083b5194000988cb257454ef115200
2021-05-26 10:07:44 -07:00
Martin Stjernholm
be10503d3a Drop "prebuilt_" prefixes from names registered in ApexInfo.InApexXxx.
Neither InApexVariants nor InApexModules should have them. This allows
us to get rid of InApexVariantByBaseName as well.

Test: m nothing
Test: m nothing SOONG_CONFIG_art_module_source_build=false
Bug: 180325915
Change-Id: Icbe4e025ce1a4c8dd258ff95d326ca2f27905188
2021-05-26 17:05:17 +01:00
Artur Satayev
f1adfb38fb Merge "Rename generate proto config file to match classpath type." into sc-dev 2021-05-25 19:40:05 +00:00
satayev
207d97ef20 Merge "Rename generate proto config file to match classpath type." am: 70975ac815 am: 0e595182a3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1713996

Change-Id: Ia6d89b8c5fa22e9e073e16810ab44631f1646e2c
2021-05-25 14:42:54 +00:00
satayev
70975ac815 Merge "Rename generate proto config file to match classpath type." 2021-05-25 14:17:04 +00:00
Paul Duffin
0788cd6038 Only export boot image files to APEX if they are actually created
Previously, the generation of the rules to create the boot image files
was separate from the code to provide those files to the APEX which
meant that it was possible for the APEX to try and use files that had
no rules to create them.

This changes avoids that by only exporting the files once the rules
have been created.

This necessitated a few changes to tests that were relying on the
previous behavior. Including removing completely the test that used an
image_name: "boot" as that is no longer a valid configuration name as
its functionality has been replaced by platform_bootclasspath.

A follow up change will make the validation of the properties of
bootclasspath_fragment stricter to prevent "boot" being used as the
image_name.

Bug: 177892522
Bug: 188680624
Test: lunch qemu_trusty_arm64-userdebug
      m droid dist
      - verify that before this change it fails and after this change
        it works.
      m com.android.art
      - verify that this change does not change the APEX contents with
        either qemu_trusty_arm64-userdebug or aosp_arm64-userdebug
Merged-In: I0497a151eb0731cbe6a1a7e7bbbb1e4dda75898f
Change-Id: I0497a151eb0731cbe6a1a7e7bbbb1e4dda75898f
(cherry picked from commit 58e0e769c9)
2021-05-25 09:30:20 +01:00
Martin Stjernholm
cb3ff1e412 Move logic to disable flattening in unbundled app mode from Soong to
make.

Avoids TARGET_FLATTEN_APEX lying about it, so we can trust it in
scripts, e.g. in art/build/apex/runtests.sh.

Test: banchan com.android.art; art/build/apex/runtests.sh
Bug: 179900989
Change-Id: I5361957c448e61634689968424450420479f6111
2021-05-25 00:28:27 +01:00
Paul Duffin
dafcf9c54d Merge "Only export boot image files to APEX if they are actually created" am: 6778edb558 am: 923bb78212
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1716109

Change-Id: I5214f09a1510dc7e9072f04f3536bdde804fb69e
2021-05-24 22:58:30 +00:00
Paul Duffin
67c1e57551 Support hidden API processing for fragments with dependencies
Previously, a bootclasspath_fragment that depended on classes provided
by another bootclasspath_fragment did not support hidden API processing
as it would not supply information about those dependencies.

This change adds support for that as follows. Each fragment:
1. Exports the transitive sets of stub dex jars for each of the public,
   system, test and core_platform APIs (where relevant).
2. Adds dependencies onto its dependent fragments.
3. Retrieves the API stubs dex jars from its dependent fragments and
   passes them to the "hiddenapi list" tool which will use them to
   resolve dependencies but will not output them to the generated
   flags.

Once the flags are generated the existing encoding functionality
encodes the flags into the dex files of the bootclasspath_fragment's
content modules which are then packaged into the apex.

Bug: 179354495
Test: m com.android.sdkext
      - verify that this does not change the contents of the apex files
Merged-In: I3e82a6dbb437f1e417e5d7e25aeb212e378603d0
Change-Id: I3e82a6dbb437f1e417e5d7e25aeb212e378603d0
(cherry picked from commit f1b358cb57)
2021-05-24 20:26:02 +01:00
Paul Duffin
2100e6f95c Support hidden API processing for fragments with dependencies am: f1b358cb57 am: 95a64e35a0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1710437

Change-Id: I61c7810343ae468d68a01724f844346919551f21
2021-05-24 17:59:24 +00:00
Paul Duffin
58e0e769c9 Only export boot image files to APEX if they are actually created
Previously, the generation of the rules to create the boot image files
was separate from the code to provide those files to the APEX which
meant that it was possible for the APEX to try and use files that had
no rules to create them.

This changes avoids that by only exporting the files once the rules
have been created.

This necessitated a few changes to tests that were relying on the
previous behavior. Including removing completely the test that used an
image_name: "boot" as that is no longer a valid configuration name as
its functionality has been replaced by platform_bootclasspath.

A follow up change will make the validation of the properties of
bootclasspath_fragment stricter to prevent "boot" being used as the
image_name.

Bug: 177892522
Bug: 188680624
Test: lunch qemu_trusty_arm64-userdebug
      m droid dist
      - verify that before this change it fails and after this change
        it works.
      m com.android.art
      - verify that this change does not change the APEX contents with
        either qemu_trusty_arm64-userdebug or aosp_arm64-userdebug
Change-Id: I0497a151eb0731cbe6a1a7e7bbbb1e4dda75898f
2021-05-24 16:22:43 +01:00
Paul Duffin
f1b358cb57 Support hidden API processing for fragments with dependencies
Previously, a bootclasspath_fragment that depended on classes provided
by another bootclasspath_fragment did not support hidden API processing
as it would not supply information about those dependencies.

This change adds support for that as follows. Each fragment:
1. Exports the transitive sets of stub dex jars for each of the public,
   system, test and core_platform APIs (where relevant).
2. Adds dependencies onto its dependent fragments.
3. Retrieves the API stubs dex jars from its dependent fragments and
   passes them to the "hiddenapi list" tool which will use them to
   resolve dependencies but will not output them to the generated
   flags.

Once the flags are generated the existing encoding functionality
encodes the flags into the dex files of the bootclasspath_fragment's
content modules which are then packaged into the apex.

Bug: 179354495
Test: m com.android.sdkext
      - verify that this does not change the contents of the apex files
Change-Id: I3e82a6dbb437f1e417e5d7e25aeb212e378603d0
2021-05-24 14:56:10 +01:00
satayev
53d0678b57 Rename generate proto config file to match classpath type.
There is no need to leak soong module names.

Bug: 180105615
Test: m && launch_cvd; atest CtsClasspathsTestCases
Change-Id: I04f4e181d2f42b9d71641980a2c7c4e8cbc8e426
Merged-In: I04f4e181d2f42b9d71641980a2c7c4e8cbc8e426
2021-05-24 13:38:45 +01:00
satayev
227e745e56 Rename generate proto config file to match classpath type.
There is no need to leak soong module names.

Bug: 180105615
Test: m && launch_cvd; atest CtsClasspathsTestCases
Change-Id: I04f4e181d2f42b9d71641980a2c7c4e8cbc8e426
2021-05-24 12:52:01 +01:00
Paul Duffin
b40610ad00 Perform hidden API encoding in bootclasspath_fragment
Previously, the apex content info was populated with hidden API encoded
dex jars retrieved directly from the java module. This change retrieves
the unencoded dex jars from the java module, encodes them and then
stores the result in the apex content info.

Bug: 179354495
Test: m com.android.art com.android.ipsec com.android.os.statsd com.android.conscrypt
      - verify that this does not change the contents of the apex files
Merged-In: Ib1b6eb8b62ac50e03b9e0d07c877ca70bb6f6d25
Change-Id: Ib1b6eb8b62ac50e03b9e0d07c877ca70bb6f6d25
(cherry picked from commit 54c98f5b4a)
2021-05-23 18:41:47 +01:00
Paul Duffin
effa46cd61 Perform hidden API encoding in bootclasspath_fragment am: 54c98f5b4a am: 9ef1a9fc36
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1710512

Change-Id: I67ed11f9e5685c4427a3a8d62e3c9161ebd6a1b6
2021-05-23 15:45:13 +00:00
Paul Duffin
54c98f5b4a Perform hidden API encoding in bootclasspath_fragment
Previously, the apex content info was populated with hidden API encoded
dex jars retrieved directly from the java module. This change retrieves
the unencoded dex jars from the java module, encodes them and then
stores the result in the apex content info.

Bug: 179354495
Test: m com.android.art com.android.ipsec com.android.os.statsd com.android.conscrypt
      - verify that this does not change the contents of the apex files
Change-Id: Ib1b6eb8b62ac50e03b9e0d07c877ca70bb6f6d25
2021-05-23 11:21:38 +01:00
Martin Stjernholm
63c1912ec2 Merge "Fix indexing bug when config.Arches() returns an empty array." am: 22053dcbf2 am: 029005ee20
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1716108

Change-Id: I16798dc8a2d554c8f8562471d75227e8e807704d
2021-05-22 19:28:15 +00:00
Martin Stjernholm
df298b3bed Fix indexing bug when config.Arches() returns an empty array.
This happens when com.android.art.host is not disabled in
prebuilts/build-tools/build-prebuilts.sh.

Test: m nothing
Test: env OUT_DIR=out prebuilts/build-tools/build-prebuilts.sh
  on the aosp-build-tools branch
Bug: 188922057
Change-Id: Ib21d17bb627e4cf7faee320febe65e1bb4566d4e
2021-05-21 21:07:26 +01:00
Martin Stjernholm
f7a62e6c73 Merge changes I4e7a7ac5,I0c73361b into sc-dev
* changes:
  Record the actual APEXes that a module is part of.
  Rename InApexes -> InApexVariants
2021-05-21 19:22:15 +00:00
Paul Duffin
7555fcbab3 Store dex jar paths in bootclasspath_fragment's apex content info
Previously, the DexBootJarPathForContentModule(module) simply called
directly through to the module to retrieve the dex jar path. This
change changes it so the bootclasspath_fragment retrieves the dex
jars from the module and stores them in the info structure for this
method to retrieve directly.

This makes it easier for the bootclasspath_fragment to stop retrieving
hidden API encoded dex jars from the module and perform the encoding
itself.

Bug: 179354495
Test: m com.android.art com.android.ipsec com.android.os.statsd com.android.conscrypt
      - verify that this does not change the contents of the apex files
Merged-In: Ic79dea080f10f4017f1a75d6d1fb5a3bfe04c2ce
Change-Id: Ic79dea080f10f4017f1a75d6d1fb5a3bfe04c2ce
(cherry picked from commit 1a8010a241)
2021-05-21 09:34:53 +01:00
Jiyong Park
59b9f14173 Record the actual APEXes that a module is part of.
Consider this case:

apex {
    name: "com.android.foo",
    native_libs: ["foo"],
}

override_apex {
    name: "com.mycompany.android.foo",
    base: "com.android.foo",
}

cc_library {
    name: "foo",
}

There are two APEXes defined: "com.android.foo" and
"com.mycompany.android.foo" which is a copy of "com.android.foo" with
some properties overridden (e.g. signing keys).

The module "foo" is mutated into two variants by the apex mutator: the
platform variant and the apex variant. The former has the variation name
"" and the later has "apex<min_api_ver>" which usually is "apex10000".

Internally, the apex variant has an alias "com.android.foo".

ApexInfo.InApexVariants() returns only "com.android.foo" when called for
the module "foo".

We can see that the information that "foo" is also part of
"com.mycompany.android.foo" is completely lost. This is causing problem
when we compare the apex membership by their "soong module name", not
the "apex name". In the example above, the two modules have different
soone module names, but have the same apex name: "com.android.foo".

To fix that, this CL introduces a new field `InApexes` to the `ApexInfo`
struct. It has the actual name of the APEXes that the module is part of.
With the example above, `InApexes` is ["com.android.foo",
"com.mycompany.android.foo"].

Cherry-picked from https://r.android.com/1710529.

Bug: 180325915
Test: m nothing
Test: m nothing on non-AOSP targets with ag/13740887 applied.

Change-Id: I4e7a7ac5495d2e622ba92a4358ed967e066c6c2e
Merged-In: I4e7a7ac5495d2e622ba92a4358ed967e066c6c2e
2021-05-20 17:36:22 +01:00
Jiyong Park
712e8b5b1b Rename InApexes -> InApexVariants
.. in preparation for the upcoming change. This change doesn't alter any
behavior.

InApexes is a misleading name. People expects that it has the list of
soong module names of the APEXes that a module is part of. So, for
example, `core-oj` is a part of both `com.android.art` and
`com.google.android.art`. However, in reality, that's not true. The
field has `com.android.art` only. This is because the two APEXes
(android and Google) have the same apex name which is `com.android.art`.
That apex name is used in various places like the `apex_available` and
allows us to keep using the same name regardless of whether the APEX is
overridden or not.

However, this is causing problems in some cases where the exact list of
soong module names is required. The upcoming change will add a new field
to handle the case and the new field actually will get the name
'InApexes'. So, the existing field is renamed to a less misleading name
`InApexVariants`.

Cherry-picked from https://r.android.com/1710528.

Bug: 180325915
Test: m nothing

Change-Id: I0c73361b452eddb812acd5ebef5dcedaab382436
Merged-In: I0c73361b452eddb812acd5ebef5dcedaab382436
2021-05-20 17:36:22 +01:00
Paul Duffin
41b91fad5b Merge "Store dex jar paths in bootclasspath_fragment's apex content info" am: bf4e6ec8a7 am: 02d4f36f2c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1710510

Change-Id: I751375cd9d4f4c40f776ceb858ecd83e992e4b04
2021-05-20 13:34:41 +00:00
Paul Duffin
bf4e6ec8a7 Merge "Store dex jar paths in bootclasspath_fragment's apex content info" 2021-05-20 12:46:48 +00:00
Jiyong Park
1df9944677 Merge changes I4e7a7ac5,I0c73361b am: 6fae608181 am: 058b7332db
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1710529

Change-Id: I45f947f67305801b2389c2dcb84b66caf997cea1
2021-05-20 10:42:10 +00:00
Jiyong Park
6fae608181 Merge changes I4e7a7ac5,I0c73361b
* changes:
  Record the actual APEXes that a module is part of.
  Rename InApexes -> InApexVariants
2021-05-20 09:59:59 +00:00
Paul Duffin
40aa4363cb Merge "Workaround to make AlwaysUsePrebuiltSdks() work with platform_bootclasspath" 2021-05-20 06:58:34 +00:00
Paul Duffin
d90fde3758 Test dex jar paths provided to apex by bootclasspath_fragment
This change adds a test to verify the existing behavior to provide a
baseline against which following changes can be compared.

Bug: 179354495
Test: m nothing
Merged-In: Ib7dadf3e65151f4e925251f7b1a9c099e824ea63
Change-Id: Ib7dadf3e65151f4e925251f7b1a9c099e824ea63
(cherry picked from commit f2fa0b5e8e)
2021-05-20 07:56:17 +01:00
Paul Duffin
32669567f6 Merge "Test dex jar paths provided to apex by bootclasspath_fragment" am: 4483ec110d am: 5f12386d2f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1710508

Change-Id: I007f4b574e820553261cb8e17455f4f267df50f6
2021-05-19 20:30:00 +00:00
Paul Duffin
1a8010a241 Store dex jar paths in bootclasspath_fragment's apex content info
Previously, the DexBootJarPathForContentModule(module) simply called
directly through to the module to retrieve the dex jar path. This
change changes it so the bootclasspath_fragment retrieves the dex
jars from the module and stores them in the info structure for this
method to retrieve directly.

This makes it easier for the bootclasspath_fragment to stop retrieving
hidden API encoded dex jars from the module and perform the encoding
itself.

Bug: 179354495
Test: m com.android.art com.android.ipsec com.android.os.statsd com.android.conscrypt
      - verify that this does not change the contents of the apex files
Change-Id: Ic79dea080f10f4017f1a75d6d1fb5a3bfe04c2ce
2021-05-19 16:17:30 +01:00
Paul Duffin
59db6d4c5d Workaround to make AlwaysUsePrebuiltSdks() work with platform_bootclasspath
The AlwaysUsePrebuiltSdks() causes all java_sdk_library_import modules
to be preferred over the source, i.e. as if they had prefer: true set.
That interacts badly with the work that is being done to integrate the
bootclasspath_fragment/platform_bootclasspath modules into the build.

It would work fine once that integration has been completed but in the
interim it causes problems. e.g. it does not cause a problem in AOSP
because those java_sdk_library_import modules that are affected have
already been integrated into the build properly.

Unfortunately, internally that is not the case because there are
java_sdk_library/java_sdk_library_import modules that still need to
be updated.

Before the java_sdk_library_import can be safely preferred each
java_sdk_library/java_sdk_library_import module that contributes to the
bootclasspath must:
* Be in the contents of matching bootclasspath_fragment and
  prebuilt_bootclasspath_fragment modules.
* Have an apex and one of a prebuilt_apex/apex_set that contains the
  dex implementation jar and lists the prebuilt_bootclasspath_fragment
  name in its exported_bootclasspath_fragments property.

Safely preferred in this context means that the whole build will
continue to work rather than the current situation which is that only
some of the build will work and some will fail if an attempt is
actually made to build it.

Unfortunately, many java_sdk_library_import modules are missing:
* The prebuilt_bootclasspath_fragment.
* The exported_bootclasspath_fragments property on the
  prebuilt_apex/apex_set that contains them.

Together these cause the following symptoms:
1. The java_sdk_library_import does not have a dex implementation jar.
2. The java_sdk_library_import does not have a myapex variant.

These workarounds will avoid Soong reporting build failures. However,
the build will still fail if an attempt is made to build anything
produced by the platform-bootclasspath, e.g. hidden API processing or
a system image.

Bug: 188505921
Bug: 179354495
Test: m TARGET_BUILD_APPS=Calendar
Change-Id: I3226e21cd6a7f9e4d6bbe94e54129ac5e1d4c679
2021-05-19 14:12:45 +00:00
Paul Duffin
f2fa0b5e8e Test dex jar paths provided to apex by bootclasspath_fragment
This change adds a test to verify the existing behavior to provide a
baseline against which following changes can be compared.

Bug: 179354495
Test: m nothing
Change-Id: Ib7dadf3e65151f4e925251f7b1a9c099e824ea63
2021-05-19 13:48:25 +01:00
Paul Duffin
7487a7abb6 Workaround to make AlwaysUsePrebuiltSdks() work with platform_bootclasspath
The AlwaysUsePrebuiltSdks() causes all java_sdk_library_import modules
to be preferred over the source, i.e. as if they had prefer: true set.
That interacts badly with the work that is being done to integrate the
bootclasspath_fragment/platform_bootclasspath modules into the build.

It would work fine once that integration has been completed but in the
interim it causes problems. e.g. it does not cause a problem in AOSP
because those java_sdk_library_import modules that are affected have
already been integrated into the build properly.

Unfortunately, internally that is not the case because there are
java_sdk_library/java_sdk_library_import modules that still need to
be updated.

Before the java_sdk_library_import can be safely preferred each
java_sdk_library/java_sdk_library_import module that contributes to the
bootclasspath must:
* Be in the contents of matching bootclasspath_fragment and
  prebuilt_bootclasspath_fragment modules.
* Have an apex and one of a prebuilt_apex/apex_set that contains the
  dex implementation jar and lists the prebuilt_bootclasspath_fragment
  name in its exported_bootclasspath_fragments property.

Safely preferred in this context means that the whole build will
continue to work rather than the current situation which is that only
some of the build will work and some will fail if an attempt is
actually made to build it.

Unfortunately, many java_sdk_library_import modules are missing:
* The prebuilt_bootclasspath_fragment.
* The exported_bootclasspath_fragments property on the
  prebuilt_apex/apex_set that contains them.

Together these cause the following symptoms:
1. The java_sdk_library_import does not have a dex implementation jar.
2. The java_sdk_library_import does not have a myapex variant.

These workarounds will avoid Soong reporting build failures. However,
the build will still fail if an attempt is made to build anything
produced by the platform-bootclasspath, e.g. hidden API processing or
a system image.

Bug: 188505921
Bug: 179354495
Test: m TARGET_BUILD_APPS=Calendar
Change-Id: I3226e21cd6a7f9e4d6bbe94e54129ac5e1d4c679
Merged-In: I3226e21cd6a7f9e4d6bbe94e54129ac5e1d4c679
2021-05-19 11:42:20 +00:00
satayev
2f45f4eec1 Add systemserverclasspath_fragments property to apex.
- All contents of the fragment are added as java_lib dependencies.
- Generated classpaths.proto is added into etc as required.

Bug: 180105615
Test: m nothing
Merged-In: I8e8e8b019c4ca2909182f205a47deffa946de6da
Change-Id: I8e8e8b019c4ca2909182f205a47deffa946de6da
(cherry picked from commit 333a1732b1)
2021-05-18 10:37:52 +01:00