Commit Graph

42478 Commits

Author SHA1 Message Date
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
satayev 6bd823241f Use absolute paths in classpaths.proto.
The intention before was to use relative paths to a partition where a
config is defined. However, jars in /system_ext partition are planned to
be declared in /system's classpaths.proto config.

Bug: 180105615
Test: derive_classpath_test, CtsClasspathsTestCases
Change-Id: Icc3e1a903c34187cfcd67a3ae7bc3dd746445c03
Merged-In: Icc3e1a903c34187cfcd67a3ae7bc3dd746445c03
(cherry picked from commit 7d22657c458b7cf7f79cdd3c298bfec13be93533)
2021-05-19 12:22:23 +01:00
Colin Cross 3aec9423fe Don't propagate ASAN through shared library dependencies
Propagating enabling ASAN through shared library dependencies
doesn't make much sense, because only the non-ASAN variant is exposed
to Make, leading to an non-installed dependency.

Bug: 186487510
Test: TestAsan
Change-Id: I7d3f20f2d10beac09c66c6b6dcb7a34a513ff3b8
Merged-In: I7d3f20f2d10beac09c66c6b6dcb7a34a513ff3b8
(cherry picked from commit af98f58242c043b2f96dd6f415b18354af06b473)
2021-05-18 12:27:25 -07:00
TreeHugger Robot 9e06a2bddf Merge "Add systemserverclasspath_fragments property to apex." into sc-dev 2021-05-18 12:45:51 +00:00
Paul Duffin 64816e613d Merge "Add "contents" property to systemserverclasspath_fragment." into sc-dev 2021-05-18 12:19:09 +00:00
Paul Duffin c4a77332af Merge "Move classpaths.proto related info into a separate provider." into sc-dev 2021-05-18 12:19:04 +00:00
Paul Duffin fe07b367ea Merge "Add no-op systemserverclasspath_fragment module." into sc-dev 2021-05-18 12:18:55 +00:00
Paul Duffin 6acb50e5a3 Merge "Make uncompressDex available for use through hiddenAPIModule" into sc-dev 2021-05-18 10:40:43 +00:00
Paul Duffin 1c560dddf3 Merge "Remove hiddenAPI.primary field" into sc-dev 2021-05-18 10:40:37 +00:00
Paul Duffin 09df809672 Merge "Merge initHiddenAPI and hiddenAPIUpdatePaths" into sc-dev 2021-05-18 10:03:57 +00:00
Paul Duffin 195149e31d Merge "Remove configurationName from java library and hidden API" into sc-dev 2021-05-18 10:03:36 +00:00
Paul Duffin 03959c23fc Merge "Add a test for hidden API encoding of java_sdk_library" into sc-dev 2021-05-18 10:03:30 +00:00
Paul Duffin 8f5e36888d Merge "Add temporary restriction on hidden API processing" into sc-dev 2021-05-18 10:03:21 +00:00
Paul Duffin bcf3a97109 Merge "Order apex files by destination path not source path" into sc-dev 2021-05-18 10:03:13 +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 333a1732b17887260f2290ffacffffeff760eee5)
2021-05-18 10:37:52 +01:00
satayev 7b182e7177 Add "contents" property to systemserverclasspath_fragment.
Similar to bcp_fragment's contents, this property lists all java library
contributions made by this fragment.

Bug: 180105615
Test: m nothing
Merged-In: Ifb1f54d5db290fffaa31933d15207014bb72d2fb
Change-Id: Ifb1f54d5db290fffaa31933d15207014bb72d2fb
(cherry picked from commit 9366a053da11ba44c9d70671dfac7c294c5427d0)
2021-05-18 10:37:51 +01:00
satayev 72ede0fac5 Move classpaths.proto related info into a separate provider.
The new info struct can be easily shared with systemserverclasspath
fragments.

Bug: 180105615
Test: m nothing
Merged-In: I9986e64fdf19f4168da63c156de3dc9bcafac8d8
Change-Id: I9986e64fdf19f4168da63c156de3dc9bcafac8d8
(cherry picked from commit 14e49130bbeba7d222c8851e2f59710ac0f6eb71)
2021-05-18 10:37:51 +01:00
satayev 0cf6de5ca9 Add no-op systemserverclasspath_fragment module.
This would allow to start introducing these modules for apexes that
contribute to SYSTEMSERVERCLASSPATH.

In follow up, it will be evolved:
- platform_systemserverclasspath would have "fragments" property to
  list all individual systemserverclasspath_fragments;
- systemserverclasspath_fragment would have "contents" property to list
  contibuting java libs;
- systemserverclasspath_fragment would generate non-empty
  classpaths.proto config within individual apexes.

Bug: 180105615
Test: m nothing
Merged-In: Ibaaa3fae5f1eab9a41ceecc1214a53be6bbc8ba6
Change-Id: Ibaaa3fae5f1eab9a41ceecc1214a53be6bbc8ba6
(cherry picked from commit aa86bac2b01f7565f1ea8ec7c88308ef5ed6e7e2)
2021-05-18 10:37:51 +01:00
Paul Duffin 6c6dde04bd Make uncompressDex available for use through hiddenAPIModule
In order for the bootclasspath_fragment to perform dex encoding on its
contents it needs to know whether the dex file is uncompressed or not.
This change makes that information available by passing it to
initHiddenAPI, storing it in hiddenAPI struct and providing access
through the hiddenAPIModule.

Bug: 179354495
Test: m droid
Merged-In: I913416b4836766de194203fd8ed5124b61dfa3dd
Change-Id: I913416b4836766de194203fd8ed5124b61dfa3dd
(cherry picked from commit 1bbd0626f2d83036b4e1225cc51edfea5e4055b7)
2021-05-18 08:00:16 +01:00
Paul Duffin c9e52dbc57 Remove hiddenAPI.primary field
Now that the individual modules no longer participate in the generation
of the monolithic files it is no longer necessary to select a single
primary module to provide the information they need.

Bug: 179354495
Test: m droid
Merged-In: If09796de710927e3e3f2ccecad0b57ca5fce5dc9
Change-Id: If09796de710927e3e3f2ccecad0b57ca5fce5dc9
(cherry picked from commit 45897dd66327c4b1dd578650dc2f7f0ec572539b)
2021-05-18 08:00:02 +01:00
Paul Duffin f88ab95d85 Merge initHiddenAPI and hiddenAPIUpdatePaths
These two methods did very similar jobs and merging them together
simplifies the behavior.

Bug: 179354495
Test: m droid
Merged-In: Ibe1a23d54105e6a0e5693079cd8743679301fc85
Change-Id: Ibe1a23d54105e6a0e5693079cd8743679301fc85
(cherry picked from commit 74d18d1d6ff1ad8ec47c34182d1a22945e05e9d5)
2021-05-18 07:59:52 +01:00
Paul Duffin 59190602af Remove configurationName from java library and hidden API
The configurationName was intended to separate the name of the module
from the name used in configuration (such as BootJars) so that the
child implementation library of a java_sdk_library on the bootclasspath
would have hidden API encoding performed on it just as for the main
java_library embedded within the java_sdk_library.

While that did use to work it no longer does as the test added in the
preceding change proves. It is not surprising that this regression does
not appear to have caused any issues as the the child implementation
library is only a build time artifact and not used at runtime.

In future the only modules that will require hidden API encoding are
those that are part of a bootclasspath module so there is no point in
maintaining this capability.

Bug: 179354495
Test: m droid
Merged-In: Ief8136fa9e98600cdd8d36108ec22edc2ebd7c69
Change-Id: Ief8136fa9e98600cdd8d36108ec22edc2ebd7c69
(cherry picked from commit 66cdbf07ef2af6caf42e2c7b77b1a5fb86a4cee3)
2021-05-18 07:59:41 +01:00
Paul Duffin 78fc68695e Add a test for hidden API encoding of java_sdk_library
Fill a hole in the testing of hidden API encoding. Some comments in the
code indicate that the child implementation java_library of a
java_sdk_library should have hidden API flags encoded in its dex jar
just like the embedded java_library. However, this test proves that it
is not working. This will be fixed in a follow up change.

Bug: 179354495
Test: m nothing
Merged-In: Ia581a17f1e48dff252d17f16bf76adf039f46b60
Change-Id: Ia581a17f1e48dff252d17f16bf76adf039f46b60
(cherry picked from commit 0d586581d1c2d6d22e7f00007e50e579ca90df29)
2021-05-18 07:59:29 +01:00
Jeongik Cha 036f8f5e8d Add usesTargetFiles option in dexpreopt_gen
For running dex2oat on the target_files, the paths should be use the
device install path instead of the path starting with $(OUT).
So add usesTargetFiles option and basePath option which indicates
extracted path. With those options, the path is replaced with
$(basePath)/$(device path)

And also, add DexPreoptImageDeviceLocations in the config which refers
to the boot image path(without arch) on the device. Because
DexPreoptImage related device path was missing.

Bug: 158843648
Test: dexpreopt_gen -usesTargetFiles -basePath (extract path) and then
check if paths in the generated shell script are based on on-device
path.

Change-Id: I9667fadbf3b7c6f770e0d1bcbee5d67c1ecd8a3d
Merged-In: I9667fadbf3b7c6f770e0d1bcbee5d67c1ecd8a3d
(cherry picked from commit 4dda75e73e3e52e11b1cd37af33645fcfe5ed980)
2021-05-18 12:09:28 +09:00
TreeHugger Robot 2ca5b08593 Merge "Define vsr_min_shipping_api_level to cc_test" into sc-dev 2021-05-18 00:42:08 +00:00
Paul Duffin 460952c7f4 Add temporary restriction on hidden API processing
Hidden API processing of a bootclasspath_fragment requires the fragment
provides information, such as dependencies on other fragments and flag
files to override the default flags. Failing to do so will cause hidden
API generation to either fail or to generate different flags to that
generated by the hidden API processing done by platform_bootclasspath
which will cause the build to fail.

Previously, this was handled by only performing hidden API processing
for those modules that provide stub libs and relied on there only being
bootclasspath_fragments defined for ART (which already supports hidden
API processing), and Conscrypt and I18n neither of which provide stubs.
Unfortunately, that can no longer be relied upon due to a couple of
recent changes:
1. A java_sdk_library in a bootclasspath_fragment's content property is
   automatically treated a stub library. That avoids duplication for
   most bootclasspath_fragments that provide the implementation and
   stub libraries through the same java_sdk_library. It does not affect
   either ART, conscrypt or i18n as they all define the implementation
   separately to the stubs.

2. bootclasspath_fragment modules have been defined for a number of
   android modules as they are needed for reasons other than hidden API
   processing.

In combination this meant that rules to perform hidden API processing
were being created but they were not currently being used which is
good because they fail.

However, adding the fragment to the platform-bootclasspath will cause
those rules to be used as the platform_bootclasspath module performs a
consistency check on the hidden API flags generated by each of the
fragments to ensure that they are consistent with those it generates
itself.

The dynamic bootclasspath work will need to add fragments to the
platform_bootclasspath and without this change that would be blocked
until all fragments had been switched to generating hidden API flags
properly.

This change adds a new fragments property to the bootclasspath and
disables hidden API processing for everything other than ART and tests
if the fragments property or stub libs is empty.

Bug: 179354495
Test: - Before making this change.
      - Add com.android.os.statds-bootclasspath-fragment to platform-bootclasspath.fragments
      m out/soong/hiddenapi/hiddenapi-flags.csv
      - hidden API processing fails in statsd as it cannot find java.lang.Object.
      - After making this change, run the above command again and it should pass.

Merged-In: Ifbb362f8fcfb2c06595fbd5ae39421b536e329ef
Change-Id: Ifbb362f8fcfb2c06595fbd5ae39421b536e329ef
(cherry picked from commit 70cfdff3da2ea07cd5cb7f7b91474f6fa0c248e5)
2021-05-17 21:30:03 +01:00
Paul Duffin b18537443e Order apex files by destination path not source path
The destination path, i.e. the path the file will occupy in the APEX is
more stable and less likely to change than the source path, i.e. the
path of the file in the out or source directories. This makes it easier
to diff changes in the copy commands.

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
      - verify that this does change the order of copy_commands for the above apexes
Merged-In: Ia9ebe8418c59903cd738ee0fb9262b3f32a4ddbf
Change-Id: Ia9ebe8418c59903cd738ee0fb9262b3f32a4ddbf
(cherry picked from commit 56060290077a28257760e10fdf7894b99eb397a3)
2021-05-17 21:19:51 +01:00
Elliott Hughes 0e9cdb04df cc/linker.go: check min_sdk_version.
Checking sdk_version broke mainline code that compiles against a current
API level but needs to be able to run on an older API level.

Bug: http://b/187907243
Test: treehugger
Change-Id: If1192ef2809e39b043f0a384775b6c9e3a8bd619
2021-05-17 17:52:26 +00:00
Justin Yun 9876ffa7b3 Define vsr_min_shipping_api_level to cc_test
test_options in cc_test can have vsr_min_shipping_api_level to define
the minimum shipping api level that checks vendor api level in
addition to the device shipping api level. It can be used for the
tests that have dependency on the vendor api level.
vsr stands for the vendor software requirements.

Bug: 181284704
Test: manual test
Change-Id: I7f2cecd2818d35d86f7c08cb220e0c9db71fe0a8
Merged-In: I7f2cecd2818d35d86f7c08cb220e0c9db71fe0a8
(cherry picked from commit a364cfb69d3c5a3660bc4b19e40b4cd916496682)
2021-05-17 09:30:10 +09:00
Liz Kammer c2a739c9df Merge "Define a narrower context for getting arch props" am: 374623f91f am: f315fbeaa5 am: da4b4457b9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1708382

Change-Id: Ia67aa4f7cebba16a3159bb317270bd7a200d163f
2021-05-14 22:15:54 +00:00
Liz Kammer da4b4457b9 Merge "Define a narrower context for getting arch props" am: 374623f91f am: f315fbeaa5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1708382

Change-Id: Idc0016d1677d350867c915de3705a160b6fe0851
2021-05-14 21:57:18 +00:00
Liz Kammer f315fbeaa5 Merge "Define a narrower context for getting arch props" am: 374623f91f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1708382

Change-Id: Ie1c4f982f54d70f2c40ac3d7d48f0e28fd42dc05
2021-05-14 21:41:16 +00:00
Liz Kammer 374623f91f Merge "Define a narrower context for getting arch props" 2021-05-14 21:26:29 +00:00
Paul Duffin 20042da220 Merge "Refactor special handling of hidden API encoding for master-art" am: fdd9743609 am: 1b5e8cdbee am: 23b34baa5c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1707569

Change-Id: I5dbe8a4c4fc0f4e8a91ec9c04f32a7d71f96715e
2021-05-14 19:52:52 +00:00
Paul Duffin 63472fe5ba Merge "Stop generating unnecessary hidden API rules" am: b7c78731d4 am: 97961f4837 am: d12106540b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1707574

Change-Id: I592af32aa225403d5ba1d1a4c89dda84d3aad0ba
2021-05-14 19:52:47 +00:00
Paul Duffin 7b07c01f20 Merge "Generate monolithic hidden API files direct from class jars" am: 21f62ef867 am: b28f562092 am: 8063427dc4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1707573

Change-Id: I116c3a4028fd199df12ead373fbfb4d47c6fdf8e
2021-05-14 19:52:42 +00:00
Paul Duffin f8b776e97f Merge "Dedup hidden API rule generation" am: 2bc8b3a646 am: 93b312c2dd am: 29c6e9fa55
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1707572

Change-Id: I584f17bd5ee9092730d4e37c5b34233805dd6b1a
2021-05-14 19:52:33 +00:00
Paul Duffin 23b34baa5c Merge "Refactor special handling of hidden API encoding for master-art" am: fdd9743609 am: 1b5e8cdbee
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1707569

Change-Id: I49f3ee3a7bb0eb9f26440a278c5f1ec56a6037bf
2021-05-14 19:33:34 +00:00
Paul Duffin d12106540b Merge "Stop generating unnecessary hidden API rules" am: b7c78731d4 am: 97961f4837
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1707574

Change-Id: Ida624f82ac4394cad434a943271ecc64203fce26
2021-05-14 19:33:28 +00:00
Paul Duffin 8063427dc4 Merge "Generate monolithic hidden API files direct from class jars" am: 21f62ef867 am: b28f562092
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1707573

Change-Id: I64919be5a862620eb5077e6f18982e02eae8dcb4
2021-05-14 19:33:23 +00:00
Paul Duffin 29c6e9fa55 Merge "Dedup hidden API rule generation" am: 2bc8b3a646 am: 93b312c2dd
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1707572

Change-Id: Ib9a86e05001db3571b1be5ebb851fa5aa63af044
2021-05-14 19:33:15 +00:00
Paul Duffin 1b5e8cdbee Merge "Refactor special handling of hidden API encoding for master-art" am: fdd9743609
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1707569

Change-Id: Id36a114acd7854164cc3eee2c99e1144372b9f64
2021-05-14 19:18:41 +00:00
Paul Duffin 97961f4837 Merge "Stop generating unnecessary hidden API rules" am: b7c78731d4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1707574

Change-Id: I96fab0709252e6c0730b5a22a06e8a02358653a3
2021-05-14 19:18:34 +00:00
Paul Duffin b28f562092 Merge "Generate monolithic hidden API files direct from class jars" am: 21f62ef867
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1707573

Change-Id: I19deb2643cc128ca9f25d38152db864fdc0fe199
2021-05-14 19:18:27 +00:00
Paul Duffin 93b312c2dd Merge "Dedup hidden API rule generation" am: 2bc8b3a646
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1707572

Change-Id: I7d9edfc6383ba6efbc62714c12aa415cb9a45cfd
2021-05-14 19:17:11 +00:00
Liz Kammer b6dbc87c97 Define a narrower context for getting arch props
go best practices recommend defining an interface where it is used and
limiting the scope

Test: go test soong tests
Change-Id: I96293ba594d37360b1a8910161477133d4aafdd9
2021-05-14 15:14:40 -04:00
Paul Duffin fdd9743609 Merge "Refactor special handling of hidden API encoding for master-art" 2021-05-14 18:53:43 +00:00
Paul Duffin b7c78731d4 Merge "Stop generating unnecessary hidden API rules" 2021-05-14 18:53:08 +00:00
Paul Duffin 21f62ef867 Merge "Generate monolithic hidden API files direct from class jars" 2021-05-14 18:52:11 +00:00
Paul Duffin 2bc8b3a646 Merge "Dedup hidden API rule generation" 2021-05-14 18:51:10 +00:00