Commit Graph

27521 Commits

Author SHA1 Message Date
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 7ccacaedbe Remove unnecessary properties in GlobalJSONConfig
This change removes the properties in GlobalJSONConfig that are used to
hold the unmarshalled []string along with the code to convert them into
ConfiguredJarList as they are no longer necessary because the
ConfiguredJarList.UnmarshalJSON(..) method can handle that automatically.

Bug: 171479578
Test: m nothing
Change-Id: Ie297cd00cb23d12e544d922454868db6fe9eb77c
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
Paul Duffin 0141660c63 Refactor creation of ConfiguredJarList from list of pairs
This change:
* Changes splitConfiguredJarPair to return an error rather than
  reporting it through the context.
* Extracts the splitting of a list of pairs into a pair of lists into a
  new splitListOfPairsIntoPairOfLists() method for reuse in a follow up
  change.

Bug: 171479578
Test: m nothing
Change-Id: I824ed1bc673b47757424563fc37e1190adff2ed1
2020-10-27 10:36:26 +00:00
Anton Hansson 72b1df4b79 Merge "Make highmem classification of metalava optional" 2020-10-27 08:07:08 +00:00
Treehugger Robot 07bc11722b Merge "Fix path conflict for vendor_ramdisk_available" 2020-10-27 06:27:12 +00:00
Joanne Chung 578b5f06c6 Merge "Revert "Make ConfiguredJarList immutable"" 2020-10-27 04:57:31 +00:00
Treehugger Robot bb0e7034b9 Merge "Cleanup references to system/core/liblog -> system/logging/liblog" 2020-10-27 03:33:37 +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
Treehugger Robot 38da41c234 Merge "Add code to enable USE_BAZEL=1 m functionality in AOSP." 2020-10-27 01:51:38 +00:00
Treehugger Robot f26f734867 Merge "InstallPath keeps its partition dir" 2020-10-27 01:33:12 +00:00
Paul Duffin e1878c101d Merge "Make ConfiguredJarList immutable" 2020-10-26 20:14:02 +00:00
Paul Duffin 728e626cb6 Merge "Remove unnecessary ConfiguredJarList.apex(int) method" 2020-10-26 20:13:45 +00:00
Yifan Hong 39143a941f Fix path conflict for vendor_ramdisk_available
... and ramdisk_available modules. If a module is both
vendor_ramdisk_available and ramdisk_available, on a device
that mark recovery_as_boot and move_recovery_resources_to_vendor_boot
simultaneously (and incorrectly),
both will be installed to recovery/root/first_stage_ramdisk. Fix the
path conflict of the two variants by moving the vendor_ramdisk variant
to vendor-ramdisk/first_stage_ramdisk instead.

Also update comments for Vendor_ramdisk_available.

Test: m nothing -j
Bug: 156098440

Change-Id: I2b776b6fd8f5a2c361c0f6a89231e3cebc2646f0
2020-10-26 12:50:05 -07:00
Treehugger Robot 93d8c6443e Merge "Add libdmabufheap to the list of allowed dependencies" 2020-10-26 19:31:57 +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
Paul Duffin 1e8c6072bb Remove unnecessary ConfiguredJarList.apex(int) method
This is only used from within the ConfiguredJarList implementation and
provides no real benefit over directly accessing the apexes slices.
Similarly, uses of Jar(int) from within the implementation are also
replaced with direct slice access.

Bug: 171479578
Test: m nothing
Change-Id: I7e799b1049f4a1da4140e55831c4559751278de6
2020-10-26 15:26:41 +00:00
Baligh Uddin 637df8e206 Cleanup references to system/core/liblog -> system/logging/liblog
BUG: 170387172
Test: TH
Change-Id: I08053d29beacb0a5c9a4d30443fe6086ce52f83e
2020-10-26 14:34:53 +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
Rupert Shuttleworth 680387bf1d Add code to enable USE_BAZEL=1 m functionality in AOSP.
Test: Manually, but builds currently fail due to a recent change to bazel_handler.go.
Change-Id: I9a45a2c73d1755032b11f6b913c03f83a28f63c5
2020-10-26 09:23:24 +00:00
Mathew Inwood 1e8118da95 Merge "Tag removed APIs as such in hiddenapi_flags.csv." 2020-10-26 08:52:11 +00:00
Treehugger Robot 23f8adb64f Merge "Enable sdk and sdk members in os_arch granularity" 2020-10-26 00:16:35 +00:00
Yifan Hong b646bc183a Merge changes from topic "vendor_ramdisk_soong"
* changes:
  Vendor ramdisk modules install to correct location
  Add vendor-ramdisk image to Soong.
2020-10-24 01:08:16 +00:00
Cole Faust 26c468c155 Merge "Export proguard_flags_files from android_librarys" 2020-10-23 19:35:57 +00:00
Colin Cross ed5dee0a8f Merge "Add llndk_stubs property" 2020-10-23 18:09:42 +00:00
Martin Stjernholm 9649748516 Merge "Rename ART release APEX to com.android.art." 2020-10-23 10:03:24 +00:00
Jiyong Park 8fe14e6a49 Enable sdk and sdk members in os_arch granularity
This amends Idad7ef138cdbcbd209d390bf6c10ca8365d4619f. With the change,
when there is a member that returns IsHostOsDependent() == true,
the sdk having the member and the member itself are disable for host and
only the os that the member supports is explicitly enabled.

However, that change will cause a problem when we add the support for
the linux_bionic_arm64 target. The target is not enabled when building
sdk snapshots. The only linux_bionic target that is enabled is
'linux_bionic_x86_64'. However, since the granularity is os which is
linux_bionic, the snapshot is generated as follows.

cc_prebuilt_binary {
    target: {
        host: {
	    enabled: false,
	},
	linux_bionic: {
            enabled: true,
        },
	linux_bionic_x86_64: {
            srcs: ["x86_64/bin/..."],
	},
	// no srcs for linux_bionic_arm64
    },
}

Above is a problem for linux_bionic_arm64 target because the target is
enabled (via linux_bionic.enabled: true), but srcs is not provided.

To fix the problem, the enabling of a target is done in a target
(os_arch) granularity, rather than os granularity. For example, above
now becomes ...

cc_prebuilt_binary {
    target: {
        host: {
	    enabled: false,
	},
	linux_bionic_x86_64: {
            enabled: true,
            srcs: ["x86_64/bin/..."],
	},
    },
}

Only the targets that the snapshot actually can provide srcs are enabled
and the rest of the host targets are disabled.

Bug: 159685774
Test: m nothing
Test: build/soong/scripts/build-aml-prebuilts.sh
runtime-module-host-exports

Change-Id: Ibca48c40f6dc4628b5f4bfa4ceb68ebe0973cc81
2020-10-23 13:05:13 +09:00
Steven Moreland 8f01ff814b Merge "apex dependency error: note 'apex_available'" 2020-10-22 23:08:18 +00:00
Cole Faust 9a631319ab Export proguard_flags_files from android_librarys
If an android_library has a proguard flag file, that
file should also be used when compiling apps with the
library.

Fixes: 171425221
Test: New unit test in app_test.go, and manually
2020-10-22 21:07:35 +00:00
Yifan Hong dd8dacc131 Vendor ramdisk modules install to correct location
Install to recovery/root/first_stage_ramdisk if
BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT,
otherwise vendor-ramdisk. In addition, append /system
if not InstallInRoot().

On devices with dedicated recovery partition,
BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT is not set,
and this installs to the correct place (under $OUT/vendor-ramdisk).

On devices without a dedicated recovery partition:
- To install a module available before switching root
  to /first_stage_ramdisk, e.g. a binary under /system/bin,
  use recovery{_available} and install the recovery variant
  of the module.
- To install a module available after switching root
  to /first_stage_ramdisk, e.g. a binary under
  /first_stage_ramdisk/system/bin,
  use vendor_ramdisk{_available} and install the vendor_ramdisk
  variant of the module.

Test: pass
Bug: 156098440

Change-Id: I1af3f8889891a3e58263cda36f0680ce2b480499
2020-10-22 10:26:26 -07:00
Yifan Hong 60e0cfb5cb Add vendor-ramdisk image to Soong.
Add vendor_ramdisk_available and vendor_ramdisk attribute to
various rules. When a vendor_ramdisk variant of a module is
generated, it is installed to $OUT/vendor-ramdisk.

It is similar to a ramdisk image.
Test: m nothing -j

Change-Id: Ib2d16459f3094dbe21c3bdb7c016cb4b2bf62765
2020-10-22 10:26:26 -07:00
Yifan Hong 5ac5247c26 Merge "makefile_goal: not arch specific." 2020-10-22 17:20:46 +00:00
Alistair Delva 6b07ff2d9d Merge "Add external/vm_tools/p9 to rust allowed paths" 2020-10-22 17:17:03 +00:00
Jiyong Park 957bcd9c32 InstallPath keeps its partition dir
This change introduces the concept of partition dir for InstallPaths.
It's the path to the partition where the InstallPath is rooted at. For
example, it's out/soong/target/product/<device>/<partitoon> for paths
created for device modules. For host modules, it is defined as
out/soong/host/<host_os>-<host_arch>.

The partition dir is obtained using the new PartitionDir() function.

Another change is that a freshly created InstallPath (usually via
PathForModuleInstall) is the result of joining PartitionDir() and the
remaining path elements. For example, PathForModuleInstall(ctx, "foo",
"bar").Rel() now returns "foo/bar". Previously, that call returned the
relative path from config.buildDir() ("out/soong"). This change is in
line with the behavior of other path-creating functions like
PathForModuleSrc where Rel() returns the path relative to the
contextually determined path like the module source directory.

Notice that the Join() call to InstallPath doesn't change
PartitionDir(), while does change the result of Rel().

p := PathForModuleInstall(ctx, "foo", "bar")
p.PartitionDir() is out/soong/host/linux-x86
p.Rel() is foo/bar

q := p.Join(ctx, "baz")
q.PartitionDir() is still out/soong/host/linux-x86
q.Rel() now returns baz

Bug: N/A
Test: m nothing
Change-Id: I916bb1c782a4bfe0fbd4854e349cd2a2a42f56b6
2020-10-22 22:04:08 +09:00
Hridya Valsaraju 87076a45be Add libdmabufheap to the list of allowed dependencies
It needs to be in the list since it is needed by codec2_vndk.
It will eventually replace libion(also in the list).

Test: m
Bug: 168333162
Change-Id: If11d7e845bd4704f34f84435b5cac32b614312a8
2020-10-21 22:09:44 -07:00
Jooyung Han 12aa3e44d0 Merge "run vndk-sp closure check before double-loadable" 2020-10-22 02:01:58 +00:00
Steven Moreland 6e36cd6104 apex dependency error: note 'apex_available'
This error tracks `apex_available` closure, but the message doesn't
indicate this variable specifically. Calling it out to try to make
the problem more searchable/discoverable/intuitable.

Bug: N/A
Test: apex_test.go
Change-Id: Ib254ace1dbd4e77d073ed4f98ee181dd86adfcfc
2020-10-22 01:23:33 +00:00
Treehugger Robot 78386129c0 Merge "Add stats from ninja subprocesses to build.trace.gz" 2020-10-21 22:52:24 +00:00
Jooyung Han 627ce86770 Merge "Do not install vndk lib" 2020-10-21 22:11:49 +00:00
Yifan Hong 397315f620 makefile_goal: not arch specific.
A makefile_goal should not have any arch variants.

Test: pass
Bug: 161563386
Change-Id: Ice879a097d62bf2a119189701a34eb2fb9767b25
2020-10-21 14:09:14 -07:00
Treehugger Robot 0aedb1efe1 Merge changes I65a78260,I4b3cbbc3
* changes:
  Rename time to event in Soong metrics system.
  Add resource usage metrics in Soong metrics.proto.
2020-10-21 20:03:04 +00:00
Colin Cross 0477b42276 Add llndk_stubs property
Prepare for making the relationship between an llndk_library stubs
module and the cc_library implementation module explicit by
adding an llndk_stubs property.  Each cc_library will be updated
to point to its llndk_library, and the llndk_library name will
be changed to make the .llndk suffix explicit.  Then the implicit
connection and suffix can be removed.

Bug: 170784825
Test: m checkbuild
Change-Id: I6b0482a3f286ec29b2e928551aa4317749f2b499
2020-10-21 10:55:33 -07:00
Julien Desprez 7b111ece08 Merge "Remove hosttestlib from suite dependencies" 2020-10-21 17:55:15 +00:00
Nikita Ioffe 97cbce163f Merge "Propagate min_sdk_version to apexer" 2020-10-21 17:52:16 +00:00
Treehugger Robot 8d8e03f192 Merge "Assume 32-bit ARM has Neon support in Mainline module SDKs." 2020-10-21 17:16:50 +00:00
Alistair Delva ebb2901bb0 Merge "Alpha sort rust allowed_list.go" 2020-10-21 17:00:50 +00:00
Patrice Arruda 457c5d3426 Rename time to event in Soong metrics system.
Several structs and files are named time which records the total
execution of a traceable event. Soon, resource information of an
executed process is collected during a build event so a more generic
name is applied.

Bug: b/169453825
Test: go test and m nothing. Checked the soong_metrics protobuf.
Change-Id: I65a782603530d51018d6cc1192c18cfeef7566a0
2020-10-21 08:54:56 -07:00