Commit Graph

3401 Commits

Author SHA1 Message Date
Paul Duffin
c459dc8c02 Merge "Switch boot jars package check to using dex jars" am: 68ecbaf614 am: aa50b67217 am: d54bddbda2 am: cb606c48f2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1479315

Change-Id: If8e9c34e194fbbab52e33993792ff375bff28e2b
2020-11-11 14:34:30 +00:00
Paul Duffin
68ecbaf614 Merge "Switch boot jars package check to using dex jars" 2020-11-11 12:53:23 +00:00
Mathew Inwood
660ed8cb7d Merge "Temporarily move APIs to blocked list." am: 82d5b6726b am: 1917bee275 am: 1c7d02ef58 am: d5afd757e3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1494179

Change-Id: I44e7a1dbc9a21eafe7614f44e41cc99750c26fe2
2020-11-11 10:46:08 +00:00
Mathew Inwood
82d5b6726b Merge "Temporarily move APIs to blocked list." 2020-11-11 09:13:48 +00:00
Paul Duffin
a975cb25ec Merge "Remove support for droidstubs in sdk/module_exports" am: 99a7622885 am: 14301ccfd1 am: 4fc198029d am: 9f3d5d7d11
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1492857

Change-Id: I1cabd47542a339da717a2d858668f11a4b544ddd
2020-11-10 19:57:18 +00:00
Paul Duffin
2d8e1a7e59 Switch boot jars package check to using dex jars
The switch to use dex jars instead of class jars means that a boot jar
that is defined by a dex_import module will now be checked against the
package_allowed_list.txt so it is possible that it will detect
previously unreported problems.

Test: m check-boot-jars - for failing and passing cases
Bug: 171479578
Bug: 125517186
Change-Id: Ie614898dade0fb43c9418d7afb9138169db6f097
2020-11-10 17:37:43 +00:00
Paul Duffin
99a7622885 Merge "Remove support for droidstubs in sdk/module_exports" 2020-11-10 17:34:00 +00:00
Anton Hansson
45ab2c48f4 Merge "Remove dead code" am: a1b3314286 am: 00d7ec3375 am: ab2ebb04ba am: 989e7e6daa
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1488756

Change-Id: Ided08e856716c584c0e61ccd7c04a4b1b65f565d
2020-11-10 15:35:30 +00:00
Paul Duffin
aa78948155 Merge "Use glob for java_sdk_library_import stub_srcs" am: 37fa489a9e am: 0b578e9241 am: a3f456e3d0 am: 6f1e1ff0a6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1492856

Change-Id: I4aa7bfcb1c5743013af784a31944a05e143a6134
2020-11-10 15:35:23 +00:00
Anton Hansson
a1b3314286 Merge "Remove dead code" 2020-11-10 14:35:13 +00:00
Paul Duffin
a3cb6cf2e5 Remove support for droidstubs in sdk/module_exports
The droidstubs support in sdk/module_exports was a temporary measure
to work around the fact that some APIs were being defined by direct use
of droidstubs instead of java_sdk_library.

This change removes that support as those APIs have all been switched
from droidstubs to use java_sdk_library so droidstubs support is no
longer needed.

Bug: 168301990
Test: m nothing
Change-Id: I3517bed29b030438a0423a6cb8c248992a988222
2020-11-10 13:55:17 +00:00
Paul Duffin
37fa489a9e Merge "Use glob for java_sdk_library_import stub_srcs" 2020-11-10 13:54:23 +00:00
Mathew Inwood
59093e3769 Temporarily move APIs to blocked list.
Bug: 170729553
Test: m

Change-Id: I62db78941785fd1bd336cfe81c8e9763e08a0eb0
2020-11-10 13:08:58 +00:00
Paul Duffin
7f97957ded Use glob for java_sdk_library_import stub_srcs
Some java_sdk_library modules do not have any stubs for some API
scopes. That results in an empty ".srcjar" being created for them which
ends up not creating a directory for the stubs sources when that
snapshot is unzipped. Previously, that would cause a build failure as
the generated java_sdk_library_import module used the directory, which
did not exist, in its stub_srcs property.

This change switches the stubs_srcs property to use a glob pattern of
"**/*.java" relative to the directory instead of using the directory
directly. When the directory does not exist the glob pattern is
resolved to an empty set of paths and does not break the build.

Bug: 172811712
Test: Add sdkextensions-sdk sdk module (local patch)
      m sdk-extensions (local patch)
      unpack generated snapshot
      m nothing - results in build failure due to missing directory
      Make this change and repeat above except this time the build works.
Change-Id: I691ffbfdc01ba89bbcaf647dcbb7dfebc3c8aec2
2020-11-09 17:42:52 +00:00
Anton Hansson
30a4c9d665 Remove dead code
I removed the last use of this method in r.android.com/1450117.

Bug: 169395887
Test: m nothing
Change-Id: I3bbb600d92dac8d9c3dec0eee14c45cdfd320ce0
2020-11-05 10:49:45 +00:00
Jingwen Chen
f27c766051 Merge "Add ctx.ModuleDir and top level module dirs of input sources to JDK9 --patch-module lookup." am: 366c7d3a74 am: bb24d6d16c am: ad37e4010f am: e23a79a717
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1480608

Change-Id: I0e00a1969b710fdfd81c11a12ecccf504d009688
2020-11-03 05:53:23 +00:00
Jingwen Chen
5136a6e5aa Add ctx.ModuleDir and top level module dirs of input sources to JDK9
--patch-module lookup.

javac --patch-module accepts a list of directories and/or jars for JDK9
module patching (see bug for more details). In Bazel-Ninja execution,
Bazel executes the javac action in its own execution root working
directory, unlike Ninja, which works in the Android top level directory.
The Bazel execution root is formed of a symlink forest of top level
directories. This symlink forest is a problem for javac because it
doesn't traverse into symlinks.

To support Bazel executing these javac actions, we explicitly encode the
module directory, and the top level directory of any other source file
inputs into the --patch-module javac flag.

For example, the "core-all" libcore module compiles into `java.base`,
and depends on filegroups outside of `libcore` (`tools`). This CL adds
`tools` to the --patch-module lookup dir, on top of `libcore`.

See java_test.go for more details.

Bug: 150878007
Fixes: 150878007
Test: m
Test: bazel build droid (aosp_flame)
Change-Id: Id95b0a9a675fc75678f7b5e600344b4403f0c518
2020-11-02 17:49:57 -05:00
Paul Duffin
cb15e50b24 Merge "Move boot jars package check from make" am: 1eacd95001 am: d4f99cdebf am: 6a20dd5c29 am: d0c7e75f64
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1478639

Change-Id: Iac8ecf4c8910934d0f6ac11113bc8106f35a31b7
2020-10-30 12:04:31 +00:00
Jingwen Chen
ddc74e50d6 java compilation: refactor and extract javac flag computation into a am: 9cb8d1b37b am: 76d6f9be1c am: 63e2704c6a am: c54138f858
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1480607

Change-Id: I29d3af3cf2372ea3e55f2b627f0a00d04e00eb67
2020-10-30 11:04:46 +00:00
Paul Duffin
1eacd95001 Merge "Move boot jars package check from make" 2020-10-30 10:06:46 +00:00
Jingwen Chen
9cb8d1b37b java compilation: refactor and extract javac flag computation into a
separate function.

This cleans up the internal wiring for a follow-up --patch-module
functionality change.

Bug: 150878007
Test: m
Change-Id: Ie7d9c2b1ad40e055da8a53d632510bef408fc7d2
2020-10-30 00:55:58 -04:00
Ulyana Trafimovich
76d69c3bf2 Merge "Drop "android.hidl.manager" -> "android.hidl.base" dependency from class loader context." am: 42cac12541 am: c8b9f0a679 am: eafca437da am: a42dbeaf29
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1478218

Change-Id: Id8cdd0b682235126cbda3865606c511e2e456eec
2020-10-29 19:17:04 +00:00
Ulyana Trafimovich
42cac12541 Merge "Drop "android.hidl.manager" -> "android.hidl.base" dependency from class loader context." 2020-10-29 17:51:48 +00:00
Ulya Trafimovich
180fecedf0 Drop "android.hidl.manager" -> "android.hidl.base" dependency from class loader context.
This dependency is incorrect and shouldn't exist.
It has been removed in https://r.android.com/1467918

Test: m nothing
Bug: 170710203
Bug: 132357300
Change-Id: If3036437e138b552436f135425e6bd15be043678
2020-10-29 17:47:34 +00:00
Paul Duffin
9a89a2a0ea Move boot jars package check from make
Adds a singleton that traverses the module variants finding the ones
that are in the list (updatable and non-updatable) of boot jars and
add a ninja rule to ensure that they only contain packages from an
allowed list.

Replaces a hack that ignored any prebuilt boot jars supplied as dex
file with an equivalent one to ensure that they are still ignored.
A follow up change that switches to checking dex jars will allow the
hack to be removed.

The boot jars check can be strict or lax. If strict then all the boot
jars listed in the configuration must be found, otherwise it will only
check the ones it finds. It is strict by default unless
TARGET_BUILD_UNBUNDLED=true or ALLOW_MISSING_DEPENDENCIES=true.

Moves the script and data file from build/make.

Test: m check-boot-jars - for failing and passing cases
      SKIP_BOOT_JARS_CHECK=true - no check-boot-jars target created
	  ALLOW_MISSING_DEPENDENCIES=true - not strict
	  TARGET_BUILD_UNBUNDLED=true - not strict
      verified manually that apart from path differences the same
      files (same check sum) were checked in both old make checks and
      the new Soong ones
      EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true m check-boot-jars
Bug: 171479578
Change-Id: I9d81d6650ba64fc0d48d2dab4ba5a3ba8dd03dec
2020-10-29 17:20:06 +00:00
Ulyana Trafimovich
54874ad136 Merge "Move part of logic from construct_context.py to Soong." am: e430ac338a am: bc4e9d5f8a am: a9fa672c56 am: ea8b14a87b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1453038

Change-Id: I95bbb8a843ba46a0a32949a0157f65061a65bde9
2020-10-29 16:01:08 +00:00
Ulyana Trafimovich
e430ac338a Merge "Move part of logic from construct_context.py to Soong." 2020-10-29 13:53:17 +00:00
Ulyana Trafimovich
3a81ccd8f9 Merge "Add separate dependency tags for compat libs based on SDK version." am: 05b9a65f25 am: 9d5814ff7c am: 7b898a1960 am: ad16c12eba
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1453037

Change-Id: I92ac79581ad5cd29b9e05398d4e9b8ea7345fa2d
2020-10-29 12:04:16 +00:00
Ulyana Trafimovich
9ba949ae48 Merge "Fix handling of "android.test.mock" in class loader context." am: 17da06cfd9 am: 94b74f9559 am: deea2844fd am: a9381bec3f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1467832

Change-Id: I6f245711fd003a5f2c3f036241053c781c26c1fd
2020-10-29 12:04:06 +00:00
Ulyana Trafimovich
05b9a65f25 Merge "Add separate dependency tags for compat libs based on SDK version." 2020-10-29 10:27:59 +00:00
Ulyana Trafimovich
17da06cfd9 Merge "Fix handling of "android.test.mock" in class loader context." 2020-10-29 10:27:33 +00:00
Ulyana Trafimovich
175d8d6cd2 Merge "Unify handling of compat and normal libs in class loader contexts." am: c5b6f32751 am: 228f63b4c1 am: 4dc62516cb am: 182b45c981
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1450817

Change-Id: Idd32fb1f1cfdff57a152492794fddbb642629190
2020-10-28 18:18:25 +00:00
Ulyana Trafimovich
c5b6f32751 Merge "Unify handling of compat and normal libs in class loader contexts." 2020-10-28 17:05:05 +00:00
Paul Duffin
3527eadd0c Merge "Retry: Make ConfiguredJarList immutable" am: c097474f21 am: 101339a133 am: 104a934353 am: 1e6f10bf33
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1476916

Change-Id: I52505ceea5d1284ac3fdfc9f7d3e47a8d85cf972
2020-10-28 11:29:34 +00:00
Paul Duffin
3b8b84973b Cleanup usages of CreateConfiguredJarList am: e10dfa4e3d am: d34168219d am: f80f9004ea am: 6eb013d805
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1471781

Change-Id: I4dcf51fa2fc7b661240943233dbf6312e8163bf3
2020-10-27 18:19:40 +00:00
Paul Duffin
7d584e9360 Retry: Make ConfiguredJarList immutable
By making the Append and RemoveList methods return a new list instead
of modifying the existing list it makes the ConfiguredJarList usages
easier to reason about and safer to use, especially considering that
they are primarily used in global configuration.

Added some tests for Append/RemoveList to ensure that they work and
do not modify the original or result in newly created lists sharing
storage with the original which would lead to corruption.

Bug: 171756871
Bug: 171479578
Test: m nothing
      EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true m nothing
Change-Id: I541c4686ecdd45c6a0c8b1c93fedf0fcd5952e2b
2020-10-27 17:37:20 +00:00
Paul Duffin
7df37bee7f Switch BootJars/UpdatableBootJars to ConfiguredJarList am: 69d1fb1e39 am: 769b1eab84 am: 3e29458b28 am: 0b34b8cdfb
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1471779

Change-Id: I90e1bafedf0492e8299cad31e7b4a648c3cc3bfa
2020-10-27 17:29:01 +00:00
Ulya Trafimovich
8130c482ab Move part of logic from construct_context.py to Soong.
construct_context.py is a script that runs at Ninja stage and constructs
class loader context arguments for dex2oat. Previously it accepted lists
of library paths and concatenated them into one class loader context
string. The script also handled the dependency of "android.hidl.manager"
on "android.hidl.base" that is not tracked by the build system and must
be handled in a special way.

Now that class loader context representation is going to change from
flat lists to trees, passing paths to individual libraries as script
arguments is no longer possible, because a list of paths cannot
represent a class loader context tree. Passing the trees in a serialized
form is also inconvenient, because the script would have to parse them,
which would complicate it a lot.

Therefore this patch ports all the concatenation and "android.hidl.base"
handling to Soong. It is not possible to port the remaining script to
Soong because Soong has no information about the targetSdkVersiion of
the dexpreopted apps (it is in the manifest and sometimes in an APK, and
has to be extracted at Ninja time).

Test: construct_context_test.py
Test: new subtests in TestUsesLibs
Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: Icdb03cf00d1e27e4cff3844b89bfaec4de502dd7
2020-10-27 17:05:30 +00:00
Ulya Trafimovich
b521811d7b Add separate dependency tags for compat libs based on SDK version.
The version in the tag is the SDK version that in which compatibility
library was added as a separate libary. Using distinct tags makes it
possible to differentiate between dependencies for different SDK
versions (this will be needed in subsequent CLs).

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I72296c05d6649e811ddc701aaeb84f91d1ba66cb
2020-10-27 17:05:30 +00:00
Ulya Trafimovich
46b3d5bd05 Fix handling of "android.test.mock" in class loader context.
Mimick the way PackageManager handles it at runtime: do add it to class
loader context for apps with targetSdkVersion < 30, but only if
"android.test.runner" is used. Previously it was not added at all.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I4c06635277ab13e21069b9fa0b46eb6a2547dfdd
2020-10-27 17:05:30 +00:00
Ulya Trafimovich
24813e1d80 Unify handling of compat and normal libs in class loader contexts.
Also, add tests for compatibility libraries in class loader context.

This CL separates special-case handling of compatibility libraries into
a "fixup" step that is done after class loader context is constructed by
Soong. This allows to handle compatibility libraries and normal
libraries uniformly, which should enable further simplification of class
loader context representation (in subsequent CLs).

Currently the only "fixup" step is removal of libraries from conditional
class loader context if they already are in unconditional context. This
check cannot be done at the time when the libraries are added to
conditional context, because the full uncoditional context is not yet
known at that time. Previously construction of unconditional context was
delayed, now it is no longer delayed and handled in the same way as
unconditional context, and the "fixup" does the filtering.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: Ie71e9fb2d3d529b5317cd84e09ab3c853017c349
2020-10-27 17:05:30 +00:00
Paul Duffin
e10dfa4e3d Cleanup usages of CreateConfiguredJarList
After previous refactorings the CreateConfiguredJarList function is now
only used in tests and are supplied with a PathContext that will cause
ReportPathErrorf() to panic. So, this change removes the ctx parameter,
calls panic directly on any error and renames the method to make it
clear that it is for testing only.

Bug: 171479578
Test: m nothing
Change-Id: Icfb4bdfe720afa855b64ecf0e74a0b030882d029
2020-10-27 10:36:29 +00:00
Paul Duffin
69d1fb1e39 Switch BootJars/UpdatableBootJars to ConfiguredJarList
This change:
* Switches BootJars/UpdatableBootJars fields of config.productVariables
  from []string to ConfiguredJarList.
* Updates BootJars() method to simply concatenate the jars list from
  the BootJars/UpdatableBootJars fields.
* Adds an UnmarshalJSON(..) method to ConfiguredJarList to support
  unmarshalling from a single string array to avoid having to change the
  format of the JSON file from which the configuration is loaded.
* Adds some additional calls to ConfiguredJarList(..) in tests to
  convert from []string to ConfiguredJarList. They pass nil as the
  ctx argument as there is no suitable PathContext which will cause any
  errors to be thrown using panic. That is reasonable for hard coded
  values in tests. A follow up change will clean up the calls to
  ConfiguredJarList(..).

Bug: 171479578
Test: m nothing
Change-Id: I59b94dafb479ccd8f0471ed802be175af57be271
2020-10-27 10:36:29 +00:00
Anton Hansson
71beaf12dc Merge "Make highmem classification of metalava optional" am: 72b1df4b79 am: ba63a2c9ce am: d951c976bb am: e04d8e7b3f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1474017

Change-Id: I8473530af498e04b0880f921920448b36597a1a8
2020-10-27 09:39:42 +00:00
Joanne Chung
342c8bba27 Merge "Revert "Make ConfiguredJarList immutable"" am: 578b5f06c6 am: 1f67171167 am: 7b907ab4eb am: 495a40d67d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1475896

Change-Id: Ib65f69eadfc708fc2775768c29abb79bcf6b4553
2020-10-27 06:15:12 +00:00
Joanne Chung
1f25794e03 Revert "Make ConfiguredJarList immutable"
This reverts commit 052f4727fe.

Reason for revert: Looks to have broken master b/171756871

Change-Id: I6b3b7039c3e3b8ac453734281cb8e7c71b65aed3
2020-10-27 03:22:29 +00:00
Paul Duffin
f63c3b4925 Merge "Make ConfiguredJarList immutable" am: e1878c101d am: 7ad2fa969b am: 89e8d18655 am: 8df961a826
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1471776

Change-Id: Ia35aa8e42f0a88f6182ac6aa0e91ce1b204c23cf
2020-10-26 21:28:28 +00:00
Paul Duffin
052f4727fe Make ConfiguredJarList immutable
By making the Append and RemoveList methods return a new list instead
of modifying the existing list it makes the ConfiguredJarList usages
easier to reason about and safer to use, especially considering that
they are primarily used in global configuration.

Bug: 171479578
Test: m nothing
Change-Id: I102c4fb42f0c54e4ed299d2921fbf5efeb6e99b9
2020-10-26 15:57:11 +00:00
Anton Hansson
52ac73d21e Make highmem classification of metalava optional
We have added a lot of metalava invocations since the highmem
differentation was added, most of which do not use a lot of memory.

By collecting data of max rss per process we have narrowed down
the set of highmem modules to a smaller set, and will annotate the
relevant modules as such.

Bug: 170701554
Test: NINJA_HIGHMEM_NUM_JOBS=3 m checkapi (no long tail of metalava)
Change-Id: Ic9c8c91388b02889111ef596fc6fd8bde9b42b9d
2020-10-26 11:38:40 +00:00
Mathew Inwood
9b8c1a54b0 Merge "Tag removed APIs as such in hiddenapi_flags.csv." am: 1e8118da95 am: 6123adab59 am: 1f4b17f49e am: f36f496c15
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1469622

Change-Id: I9af52d5b97eefe04dc7cf81127c219d1ecf0799a
2020-10-26 11:02:21 +00:00