Commit graph

35702 commits

Author SHA1 Message Date
Elliott Hughes
11bc0eef0c Merge "cc/linker.go: check min_sdk_version." 2021-05-15 00:35:21 +00:00
Treehugger Robot
32ef4e25b8 Merge "Define vsr_min_shipping_api_level to cc_test" 2021-05-15 00:21:11 +00:00
Treehugger Robot
718ac9276b Merge "Add usesTargetFiles option in dexpreopt_gen" 2021-05-14 23:39:49 +00:00
Dan Albert
7f0e9f970c Merge "Add script for building and archiving rustdocs." 2021-05-14 22:52:35 +00:00
Liz Kammer
374623f91f Merge "Define a narrower context for getting arch props" 2021-05-14 21:26:29 +00:00
Elliott Hughes
852edc147a 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-14 14:03:53 -07:00
Dan Albert
4d247476ac Add script for building and archiving rustdocs.
Test: OUT_DIR=out DIST_DIR=dist build/soong/scripts/build-rustdocs.sh
Bug: http://b/162741284
Change-Id: Ie94318ed9cc99024a27d414bfecc083b2fa96b57
2021-05-14 13:18:07 -07: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
Paul Duffin
b0f20d134f Merge "Allow shared libraries on bootclasspath" 2021-05-14 17:03:03 +00:00
Bill Peckham
054619d198 Merge "Fix missing headers for vndk snapshotted libc" 2021-05-14 16:52:11 +00:00
Colin Cross
9debc21ca3 Merge "Add order-only dependency on shared libraries" 2021-05-14 16:48:57 +00:00
Jeongik Cha
4dda75e73e 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
2021-05-15 00:29:49 +09:00
Paul Duffin
79fd3d728c Allow shared libraries on bootclasspath
A previous change treated this as an error in order to try and detect
issues with misconfigured java_sdk_library modules and/or
bootclasspath_fragment modules but unfortunately this is not always an
error, e.g. when migrating a library that was a shared library to the
bootclasspath.

This change stops treating that as an error.

Bug: 179354495
Test: m nothing
Change-Id: I4a833ab5f4caf86c6cd340090fc65d2c2f141512
2021-05-14 16:14:17 +01:00
Paul Duffin
b6f53c064e Refactor special handling of hidden API encoding for master-art
Instead of encoding the hidden API with an empty set of flags when the
monolithic flags are not available this simply disables encoding
altogether which should have the same behavior at runtime.

This change also removes the unused flags field in hiddenAPISingleton
which was set but never read.

Bug: 179354495
Test: m nothing
Change-Id: I32d5825e5271829993dd4e5be4d4ee1b22fa7b22
2021-05-14 15:57:10 +01:00
Paul Duffin
afaa47c74a Stop generating unnecessary hidden API rules
The rules to extract hidden API information from an individual module
in order to create module specific files are no longer necessary as
the monolithic files are created directly from the module's class jars
and not the module specific files.

Bug: 179354495
Test: verified that the monolithic out/soong/hiddenapi/... files are
      unchanged by this change
Change-Id: I573ac17f3ea5da5a2a7e4f08718160dacca71c0c
2021-05-14 15:57:10 +01:00
Paul Duffin
537ea3d04c Generate monolithic hidden API files direct from class jars
Previously, the monolithic hidden API files, e.g. hiddenapi-index.csv
file, were generated in two steps. First, each module created its own
files using the information in its class jars. Then, the monolithic
files were created by merging those module specific files into a larger
file.

This change switches to generating the monolithic files directly from
the class jar files and bypassing the intermediate files.

In order to ensure that this change did not change the monolithic files
it is necessary for the hiddenapi-metadata.csv to go through a
reformatting step. Hopefully, this will be able to be removed in a
follow up change.

Bug: 179354495
Test: verified that the monolithic out/soong/hiddenapi/... files are
      unchanged by this change
Change-Id: I5a78e747516014b7c0f402a4b4431b14be6a84b2
2021-05-14 15:57:04 +01:00
Paul Duffin
850e61f234 Dedup hidden API rule generation
Bug: 179354495
Test: verified that the monolithic out/soong/hiddenapi/... files are
      unchanged by this change
Change-Id: I54b677c97712a7573ff5eed017c1b2198b80bc51
2021-05-14 14:53:19 +01:00
Inseob Kim
cc12d90753 Fix missing headers for vndk snapshotted libc
VNDK snapshot depends on addExportedGeneratedHeaders to grab generated
headers. This change adds a missing addExportedGeneratedHeaders call to
make libc's headers captured correctly.

Bug: 181326838
Test: VNDK_SNAPSHOT_BUILD_ARTIFACTS=true m dist vndk && unzip -l
out/dist/*.zip

Change-Id: Iaa89b5255c836761a26c77bb27f35f768f49039e
2021-05-14 20:15:55 +09:00
Paul Duffin
098c878838 Make hidden API handle jacoco-stubs consistently
Previously, when code coverage was enabled the monolithic hidden API
processing would add jacoco-stubs to public APIs only as that would
make them accessible for everyone. However, the
art-bootclasspath-fragment added jacoco-stubs to public, system and
test APIs as that was the simplest way of handling it and while the
extract APIs were unnecessary they would not change behavior.

Unfortunately, that lead to a difference in the flags generated which
caused the check that verifies flags are consistent between the
monolithic and modular files to fail.

This change adds jacoco-stubs to system and test APIs for the
monolithic hidden API processing to ensure consistency.

Bug: 179354495
Bug: 188143639
Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true out/soong/hiddenapi/hiddenapi-flags.csv
      - ran before making the change to reproduce the problem and after
        to verify the fix.
Change-Id: Icbd15f0ece871a8c44d9e4a73fd0f7acc3760bba
2021-05-14 10:19:46 +00:00
Justin Yun
a364cfb69d 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
2021-05-14 12:47:18 +09:00
Colin Cross
af98f58242 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
2021-05-13 18:02:57 -07:00
Colin Cross
58dd6a92e5 Add order-only dependency on shared libraries
Improve the dependency accuracy by adding an order-only dependency
on the shared library alongside the existing depenency on the
table of contents file.  The dependency won't cause the module
to be rebuilt when the the shared library changes, but will allow
anything using the ninja graph for sandboxing to know the dependency
exists.

Test: manual
Change-Id: I3accbcabee62fa0ad3eb3d1aaedc5a4bffe27308
2021-05-13 18:01:24 -07:00
Paul Duffin
34827d4c0e Use java_sdk_library in bootclasspath_fragment contents as stubs
A java_sdk_library specified in the bootclasspath_fragment contents
must be providing APIs for the bootclasspath_fragment and so must be
treated as if they were specified in the stub_libs. This avoids having
to specify them in both contents and stub_libs.

Bug: 179354495
Test: m nothing
Change-Id: I535065ee1a79b439e2676f35e06a75d4626adcaf
2021-05-14 01:49:19 +01:00
Paul Duffin
dfa1083fee Validate monolithic and modular hidden API flags are consistent
This makes sure that where there is overlap between the hidden API
flags generated for a module and the monolithic flags that they are
identical. That ensures that the modular hidden API flags will be
compatible with previous releases that relied on the monolithic flags.

Bug: 179354495
Test: m out/soong/.intermediates/art/build/boot/art-bootclasspath-fragment/android_common_apex10000/modular-hiddenapi/all-flags.csv
      m out/soong/hiddenapi/hiddenapi-flags.csv
      - Create some inconsistencies between the above two files.
      m out/soong/hiddenapi/hiddenapi-flags.csv.valid
Change-Id: Iaf9e23cef63e221608955d89dc8d496bcc70c86e
2021-05-14 01:49:19 +01:00
Paul Duffin
2fef136885 Generate hidden API flags for a bootclasspath_fragment
This change adds support for generating the hidden API flags for the
contents of a bootclasspath_fragment. Currently, it will only work for
the art-bootclasspath-fragment as it has no support for creating
dependencies between bootclasspath_fragment modules which will be
needed for handling any other bootclasspath_fragment.

The hidden API flag generation added by this change is completely
separate to the normal hidden API processing and is not as yet encoded
in dex jars so will have no effect on the runtime.

The generated files are provided for use by other modules and copied
into the sdk snapshot. That is needed to allow the build to verify that
the hidden API flags generated by the individual bootclasspath_fragment
modules are consistent with the flags generated for the whole
bootclasspath, whether building from source or prebuilts.

Bug: 179354495
Test: m art-module-sdk
      m out/soong/.intermediates/art/build/boot/art-bootclasspath-fragment/android_common_apex10000/modular-hiddenapi/all-flags.csv
      m out/soong/hiddenapi/hiddenapi-flags.csv
      - test that the former file is a subset of the latter and that
        where they overlap they are identical.
Change-Id: Ie27303e2960953db1b7abe95510e3bca4411b09a
2021-05-14 01:48:51 +01:00
Paul Duffin
001e606e5c Populate hiddenAPI structure even when not active
The modular hidden API processing needs access to the classesJarPaths
and bootDexJarPath fields of the hiddenAPI structure even if the
modules are not themselves considered to be active participants in the
existing hidden API processing.

This change moves the initialization of those fields to before inactive
modules are ignored.

Bug: 179354495
Test: m art-module-sdk out/soong/hiddenapi/hiddenapi-flags.csv
Change-Id: I06f96d39d0b413295d3e2af50453ebe7e4d3e9c8
2021-05-14 01:45:42 +01:00
Paul Duffin
f4600f6e6a Disallow shared libraries in bootclasspath_fragment contents
Bug: 177892522
Test: m nothing
Change-Id: I78c8ef8664ec1eb0fe3456a2de2cb956162ca0da
2021-05-14 00:39:24 +01:00
Yuntao Xu
0589914135 Merge "syntax check to jacoco filters for any build" 2021-05-13 23:11:48 +00:00
Treehugger Robot
ef0439d969 Merge "Soong: check if lndk is needed for apex build" 2021-05-13 22:49:39 +00:00
Zhijun He
ec2858799b Soong: check if lndk is needed for apex build
This is to fix the unnecessary dependencies inclusion
when building apex modules.

Test: Build
Bug: 186306595
Change-Id: I1f3bbdb0a1f97a8338b45ca29c92acf9b20eadd3
2021-05-13 14:04:45 -07:00
Paul Duffin
a10bd3c127 Add java_sdk_library in bootclasspath_fragment contents to sdk
A java_library specified in a bootclasspath_fragment's contents
property will be automatically added to the sdk containing that
bootclasspath_fragment. Previously, if that was attempted with a
java_sdk_library it would be added to the sdk as if it was a normal
java_boot_libs which would prevent the sdk from containing the
API specific artifact such as current.txt files and stub libraries
and sources.

This change fixes that and adds a java_sdk_library as a java_sdk_libs
module.

Bug: 177892522
Test: m nothing
Change-Id: Ided57b846ce5b8940c7e898c786fd77602582ea2
2021-05-13 21:25:42 +01:00
Yuntao Xu
5b009aedf9 syntax check to jacoco filters for any build
Perform syntax check to jacoco filters for any build.

Bug: 183622051
Test: Manual
Test: TreeHugger
Change-Id: Iff90d7b45bdad8706c43c7e16d98270af688d20b
2021-05-13 12:42:24 -07:00
Paul Duffin
17ccf26748 Merge "Add support for converting OptionalPath to Paths" 2021-05-13 19:33:09 +00:00
Paul Duffin
4bbf45faef Merge "Build boot images in bootclasspath_fragment/platform_bootclasspath" 2021-05-13 16:32:23 +00:00
Treehugger Robot
820397deb2 Merge "Add support for SOONG_SDK_SNAPSHOT_USE_SRCJAR" 2021-05-13 16:00:40 +00:00
Paul Duffin
f356e5a533 Merge "Separate storing config for MakeVars from building boot image" 2021-05-13 14:01:36 +00:00
Paul Duffin
7dbfe7c4ee Merge "Make hidden API bootclasspath_fragment test more realistic" 2021-05-13 14:00:00 +00:00
Jingwen Chen
ccfd7fc939 Merge "bp2build: build //external/scudo/..." 2021-05-13 12:19:43 +00:00
Paul Duffin
ef08185951 Add support for converting OptionalPath to Paths
Appending a Path or Paths to a slice of Paths is simple but appending
an OptionalPath requires conditional logic which makes OptionalPaths
harder to use. This change makes it easy to append the embedded Path,
if any, to a slice of Paths.

Bug: 179354495
Test: m nothing
Change-Id: Ibf80a23043c846162e17c3a98b2590bca653b170
2021-05-13 12:40:08 +01:00
Paul Duffin
475daafb1b Make hidden API bootclasspath_fragment test more realistic
Adds the bootclasspath_fragment to an apex and also adds an sdk library
to the stub_libs property.

Bug: 179354495
Test: m nothing
Change-Id: I2a5fffe915eb62923cc60732352d4d050dec4398
2021-05-13 12:40:08 +01:00
Paul Duffin
cfd24da1f4 Merge "Move copying of dex files from dexpreopt_bootjars singleton" 2021-05-13 10:53:51 +00:00
Jingwen Chen
1d35a87072 Merge "bp2build: export some cc toolchain flags into Starlark." 2021-05-13 10:31:54 +00:00
Paul Duffin
c75bf688cb Merge "Move markPlatformAvailability mutator before apexMutator" 2021-05-13 09:50:56 +00:00
Paul Duffin
9896b3424b Merge "Allow module types to force creation of a default APEX variant" 2021-05-13 08:07:19 +00:00
Jingwen Chen
75be1cae8f bp2build: build //external/scudo/...
Test: TH
Fixes: 187158841
Change-Id: I73c1d8fe075d2534c2389973b9381405d9389044
2021-05-13 06:25:49 +00:00
Jingwen Chen
bf61afb7f7 bp2build: export some cc toolchain flags into Starlark.
This CL exports common/global/device/host clang/ld/ldd flags
from their Ninja variable initialization locations in
cc/config/global.go and cc/config/clang.go to make Bazel's cc_toolchain
and Soong's cc actions more consistent with each other.

This does not handle env-dependent or arch-specific toolchain flags
yet (logic in compiler.go and linker.go).

Test: TH
Bug: 187086342
Bug: 187084737
Bug: 186628704
Bug: 187857770
Change-Id: Ie403d7cd23f35160897b9dd902c799cbf1bd7f0c
2021-05-13 06:25:47 +00:00