Commit graph

35792 commits

Author SHA1 Message Date
Martin Stjernholm
0e4ccebb16 Don't fail if the target module is disabled in dex2oat tool
dependencies.

dexpreopt.RegisterToolDeps runs late after prebuilt dependencies have
been resolved, and there's special code in dex2oatPathFromDep to
resolve the prebuilt from the source module. However, if the source
module is disabled then the dependencies check in validateAndroidModule
will complain, so we need to disable that check in this particular
situation.

Also add a comment to explain why dexpreopt.RegisterToolDeps needs to
run so late.

Test: m nothing
Bug: 145934348
Bug: 172480615
Change-Id: Ibc673303d0336768fa23261a2068e91a08f46a30
2021-05-18 21:58:38 +01:00
Martin Stjernholm
0780372ae8 Use oatdump rather than oatdumpd for boot jar boot.*.oatdump.txt files.
oatdumpd isn't available as a prebuilt.

Test: m SOONG_CONFIG_art_module_source_build=false droid
Bug: 172480615
Change-Id: I70317eb8f253272d629f23063cbe265d556caad3
2021-05-18 21:57:28 +01:00
Treehugger Robot
fe027e0ec9 Merge "Update flags passed to kotlinc" 2021-05-18 20:54:39 +00:00
Colin Cross
48a2d110b3 Merge "Don't propagate ASAN through shared library dependencies" 2021-05-18 19:20:34 +00:00
Elliott Hughes
5f314b1613 Rename gccCmd mingwCmd now that's all it's used for.
Bug: http://b/185257607
Test: treehugger
Change-Id: Ida079183828444f122ba6ea5662f63796677de7d
2021-05-18 11:56:02 -07:00
satayev
7d22657c45 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
2021-05-18 19:37:32 +01:00
Chris Parsons
c4fb133380 Support middleman actions in mixed builds
This allows support of generated hdrs / srcs in mixed builds.

Test: Manually verified that libc_bionic_ndk passes compilation (failed
previously due to missing generated heaer)
Test: bp2build and mixed_libc CI scripts
Test: New aquery test

Change-Id: I88e359a4bd9eba383c207d5cf812272725ff0a3d
2021-05-18 14:07:44 -04:00
Elliott Hughes
ca8f680040 Merge "Use "${config.ClangBin}/llvm-" for TOOLS_PREFIX." 2021-05-18 16:32:07 +00:00
Rupert Shuttleworth
413a7a97fb Have bp2build generate BUILD.bazel instead of generating BUILD.
Test: TH
Change-Id: I465d29da96dd77c432890a38a56203e291b8ceed
2021-05-18 09:01:36 -04:00
Rupert Shuttleworth
c29cace414 In the finder, keep track of BUILD files instead of only BUILD.bazel files.
Test: TH
Change-Id: I95bf638ff1f71849a885d22326c5c527a3d00947
2021-05-18 08:40:24 -04:00
Jingwen Chen
535429299a Remove libjemalloc5 and libc_jemalloc_wrapper from denylist.
See b/188503688 for more info on why libjemalloc5 is in the
bp2buildCcLibraryStaticOnlyList.

Bug: 188503688

Fixes: 187012490
Fixes: 186828626

Test: TH
Change-Id: I2b70cf99b2efa81f3f35ab0b61716eb0f6f9ebd6
2021-05-18 10:43:26 +00:00
Jiyong Park
78349b56a0 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"].

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

Change-Id: I4e7a7ac5495d2e622ba92a4358ed967e066c6c2e
2021-05-18 16:05:29 +09:00
Jiyong Park
ab50b0795a 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`.

Bug: 180325915
Test: m nothing

Change-Id: I0c73361b452eddb812acd5ebef5dcedaab382436
2021-05-18 16:05:14 +09:00
satayev
f1d8819d7d Merge changes I8e8e8b01,Ifb1f54d5,I9986e64f
* changes:
  Add systemserverclasspath_fragments property to apex.
  Add "contents" property to systemserverclasspath_fragment.
  Move classpaths.proto related info into a separate provider.
2021-05-17 22:40:08 +00:00
satayev
3d3a2218a6 Merge "Add no-op systemserverclasspath_fragment module." 2021-05-17 22:37:29 +00:00
Christopher Parsons
72a13e8d40 Merge "bp2build: support generated sources and hdrs" 2021-05-17 22:13:09 +00:00
satayev
333a1732b1 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
Change-Id: I8e8e8b019c4ca2909182f205a47deffa946de6da
2021-05-17 21:46:08 +01:00
satayev
9366a053da 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
Change-Id: Ifb1f54d5db290fffaa31933d15207014bb72d2fb
2021-05-17 21:46:08 +01:00
satayev
14e49130bb 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
Change-Id: I9986e64fdf19f4168da63c156de3dc9bcafac8d8
2021-05-17 21:46:04 +01:00
satayev
aa86bac2b0 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
Change-Id: Ibaaa3fae5f1eab9a41ceecc1214a53be6bbc8ba6
2021-05-17 20:53:59 +01:00
Chris Parsons
484e50aa7c bp2build: support generated sources and hdrs
There are two pieces to make this work:
1. Local include paths must include $(BINDIR)-relative paths, to support
generated headers in those directories.
2. The srcs that bp2build outputs for BUILD targets must include labels
for targets given in generated_hdrs and generated_srcs.

Support for exported_generated_hdrs intentionally deferred.

This allows us to remove several targets from the bp2build denylist.
Some are moved to the mixed build denylist, because genreated headers are
still unsupported in mixed builds.
Test: bp2build.sh CI script

Change-Id: Ib4f9dac20f6445487b8dad53b91eac01f437a590
2021-05-17 14:30:07 -04:00
Aurimas Liutikas
24a987fefb Update flags passed to kotlinc
- Remove -Xuse-ir as it is default in Kotlin 1.5
- Add -Xsam-conversions=class for KT-46512

Change-Id: Ie351bb9ad5ec51ef7b7346d0076868d04cfe9811
2021-05-17 17:47:13 +00:00
Paul Duffin
1bbd0626f2 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
Change-Id: I913416b4836766de194203fd8ed5124b61dfa3dd
2021-05-17 18:38:06 +01:00
Paul Duffin
45897dd663 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
Change-Id: If09796de710927e3e3f2ccecad0b57ca5fce5dc9
2021-05-17 18:38:06 +01:00
Paul Duffin
74d18d1d6f Merge initHiddenAPI and hiddenAPIUpdatePaths
These two methods did very similar jobs and merging them together
simplifies the behavior.

Bug: 179354495
Test: m droid
Change-Id: Ibe1a23d54105e6a0e5693079cd8743679301fc85
2021-05-17 18:38:06 +01:00
Paul Duffin
66cdbf07ef 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
Change-Id: Ief8136fa9e98600cdd8d36108ec22edc2ebd7c69
2021-05-17 18:38:06 +01:00
Paul Duffin
0d586581d1 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
Change-Id: Ia581a17f1e48dff252d17f16bf76adf039f46b60
2021-05-17 18:38:06 +01:00
Paul Duffin
e8b0169bb4 Merge "Add temporary restriction on hidden API processing" 2021-05-17 17:16:33 +00:00
Lukács T. Berki
b1caeb0768 Merge "Print free disk space when starting build_test." 2021-05-17 14:47:15 +00:00
Lukács T. Berki
33ebde3bce Merge "Refactor GetTargetProperties()." 2021-05-17 14:17:54 +00:00
Treehugger Robot
38db1b0974 Merge "Don't install rust modules that are never installable" 2021-05-17 13:55:49 +00:00
Lukacs T. Berki
4070bcdcde Print free disk space when starting build_test.
This is so that we know whether the attached bug is caused by the disk
being full.

Bug: 187870338
Test: Presubmits.
Change-Id: Ib09f51d971de556e5737ad2754836f2a12f60281
2021-05-17 14:33:01 +02:00
Lukacs T. Berki
5f51839d0d Refactor GetTargetProperties().
This is so that its implementation is more amenable to implementing
`target: { android_arm: { ... } }` and the like.

In addition, add a Boolean return value to getChildPropertyStruct() and
use it at every call site so that we only merge property structs when it
makes sense.

Bug: 187530594
Test: Presubmits.
Change-Id: I1b441c14b3d90a12b84dc89f82dd053978e89c7e
2021-05-17 14:04:04 +02:00
Rupert Shuttleworth
0096079bbc Make bazel build //external/... work by only allowing "approved" existing BUILD files in the Bazel workspace.
Test: bazel build //bionic/... //external/... //frameworks/... //system/...

Test: ./build/bazel/scripts/run_presubmits.sh

Change-Id: I91865ca87c6535053e7a14d2526ff3ce0991bfea
2021-05-17 06:34:53 -04:00
Paul Duffin
70cfdff3da 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.

Change-Id: Ifbb362f8fcfb2c06595fbd5ae39421b536e329ef
2021-05-17 07:39:10 +01:00
Jiyong Park
bf8147ab66 Don't install rust modules that are never installable
rust modules that return false on EverInstallable don't get installed.
Currently, proc_macro modules are such ones.

Bug: 187810017
Test: m microdroid on aosp_arm64 and inspect that *.dylib.so files
from host x86_64 are not there.

Change-Id: Ia57289a04dbff6e4f2ce2733c60de5338305904c
2021-05-17 13:27:20 +09:00
Treehugger Robot
37ef223972 Merge "Order apex files by destination path not source path" 2021-05-17 04:07:20 +00:00
Paul Duffin
5606029007 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
Change-Id: Ia9ebe8418c59903cd738ee0fb9262b3f32a4ddbf
2021-05-16 22:28:26 +01:00
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