Commit graph

35074 commits

Author SHA1 Message Date
Pedro Loureiro
f4a88b1633 Introduce NewApi lint checks
We are enabling NewApi lint check where the min sdk != compile sdk.
At the same time, we are introducing baseline files for existing
projects that fail this check in order to keep the build running.

At the very least we stop introducing new problems and teams might
realise of risks in their projects they were not aware of.

Bug: 150847901

Test: m lint-check
Change-Id: Icfa5eb98cc6b6708149f0c52fac8fc1440d9c3b0
Merged-In: Icfa5eb98cc6b6708149f0c52fac8fc1440d9c3b0
2021-04-13 15:19:02 +00:00
Treehugger Robot
c8ae73e678 Merge "Add reasons for cc_library_static modules to be on the deny list." 2021-04-13 15:06:10 +00:00
Ivan Lozano
3a7d000d12 cc: Create a common image mutator interface
As part of adding Vendor support to Rust, refactor the image mutator in
CC to a new common image mutator interface so this logic can be reused
across both CC and Rust.

Bug: 184042776
Test: m nothing
Change-Id: Ia55d5ad840db7cf1a64d6c65ed86487230cb8742
2021-04-13 11:04:44 -04:00
Liz Kammer
4f3e58c031 Merge "Add tests for bazel_handler" 2021-04-13 14:36:47 +00:00
Paul Duffin
60264a0b99 Improve realism of boot jar tests
Boot jars, updatable boot jars and art apex jars are part of two
separate but related configuration objects, the main Config struct
(actually the nested productVariables struct) and the dexpreopt
specific GlobalConfig. The fields in both are initialized from the same
data in the make config files but handled separately.

Previously each test that used one of the configuration objects would
generally just initialize the one it used. That would make the test
sensitive to the specific configuration object that was used. A
refactoring that change the code from using one configuration object to
the other would cause the test to fail.

Also, some tests would inadvertently create invalid configurations by
setting ArtApexJars without also setting BootJars. While the ability to
create invalid configurations is useful (and there are some tests that
exist to verify the behavior in that case) most tests should not be
using them.

This change simplifies the configuration of the tests and improves
their realism by:
1. Providing a new FixtureConfigureBootJars method that takes a set of
   boot jars and sets ArtApexJars, and BootJars in the
   dexpreopt.GlobalConfig and BootJars in the product variables too.
2. Providing a new FixtureConfigureUpdatableBootJars method that takes
   a set of boot jars and sets UpdatableBootJars in both the
   dexpreopt.GlobalConfig and productVariables.
3. Migrating existing tests to use these new methods.

Some tests still use the dexpreopt.FixtureSet...Jars() methods directly,
generally to create invalid configurations.

Bug: 177892522
Test: m nothing
Change-Id: I4d8f0b9762cfcc7ae6383bef08563d7c3fa13955
2021-04-13 14:48:34 +01:00
Paul Duffin
0b659866e8 Support UNSAFE_DISABLE_HIDDENAPI_FLAGS in platform_bootclasspath
Previously attempting to use m UNSAFE_DISABLE_HIDDENAPI_FLAGS would
cause a build failure.

It is necessary when UNSAFE_DISABLE_HIDDENAPI_FLAGS=true to create
empty files for the monolithic files so that those usages which are not
protected by the build flag, e.g. in dists or CTS tests like
CtsHiddenApiBlocklistTestApiTestCases do not cause ninja failures due
to reliance on a file that does not exist and has no rule to create it.

Bug: 177892522
Test: m nothing
      m UNSAFE_DISABLE_HIDDENAPI_FLAGS=true CtsHiddenApiBlocklistTestApiTestCases
Change-Id: I05d0b3680dbc0b5b7c7c0d792550faf848829647
2021-04-13 14:19:51 +01:00
Paul Duffin
90b8ad38e0 Remove noop code from generateHiddenAPIBuildActions
Change https://r.android.com/1673266 introduced some code that does
nothing. This change removes that.

Bug: 177892522
Test: m nothing
Change-Id: I349b17c7fe7e2f68a807dab43a4300da7fe0ad4d
2021-04-13 14:18:34 +01:00
Rupert Shuttleworth
43b04926b2 Add reasons for cc_library_static modules to be on the deny list.
Test: bp2build-sync.py write; bazel build //bionic/...
Change-Id: I8fc7036136adbcf16dc31d9691a8d18b99e3c3ae
2021-04-13 08:54:20 -04:00
Paul Duffin
99e4fc13bf Merge "Remove unused hiddenapi_flags module type" 2021-04-13 09:57:31 +00:00
Paul Duffin
db173510d3 Merge "Export monolithic hidden API files from platform_bootclasspath" 2021-04-13 09:57:12 +00:00
satayev
86628403e9 Merge "Introduce classpath_fragment.go." 2021-04-13 09:13:57 +00:00
Jiyong Park
63b0e0edce Merge "bootimg.cmdline is arch specific" 2021-04-13 08:58:50 +00:00
Artur Satayev
eabf2c175f Introduce classpath_fragment.go.
A skeleton of a classpath fragment's interface and base to be used by
any modules that provide entries for *CLASSPATH variables at runtime.

In follow up changes, this would be extended to generate
packages/modules/SdkExtensions/proto/classpaths.proto configs for such
modules to be bundled into system and individual apex binaries.

Bug: 180105615
Test: m
Change-Id: I2df550862e97222c5650c4d0480c90231fd78ef0
2021-04-13 08:58:18 +01:00
Lukacs T. Berki
53b2f36bd6 Delete android/env.go .
Properly plumb the available environment to the configuration instead of
going through the global variable originalEnv.

Test: Presubmit.
Change-Id: Ia1ea753d5e72c02a0dcaa4c0b43bd6e24fc47cec
2021-04-13 08:10:01 +02:00
Lukács T. Berki
ed0f6e846f Merge "Remove the dependency on a number of env vars." 2021-04-13 06:06:00 +00:00
Jiyong Park
30a083215b bootimg.cmdline is arch specific
microdroid_boot.img needs different kernel cmdline for x86_64 and arm64.

Bug: 185082754
Test: atest MicrodroidHostTests
Change-Id: I69be83cbdada6c49a033da2787908490ee76de36
2021-04-13 13:17:59 +09:00
Jingwen Chen
d4a58377fd Merge "rust_fuzzer: add toolchain libraries if non-empty" 2021-04-13 02:40:23 +00:00
Inseob Kim
dd0295d774 Support reexporting vndk from vendor snapshot
Bug: 184795475
Test: soong test
Change-Id: I0146de55e2ef54c1c8abd42f0f4d8b4db7444350
2021-04-13 10:16:49 +09:00
Inseob Kim
f7aadf70d8 Add flag test for cfi snapshot
Test: soong test
Change-Id: I651120b11f5b80c4b5f04172170afc533f24c54d
2021-04-13 10:15:31 +09:00
Treehugger Robot
4a39669a27 Merge "Add a test to check the intall partitions" 2021-04-13 00:15:38 +00:00
Treehugger Robot
dff81fa7d8 Merge "Install device_specific cc_prebuilt to ODM" 2021-04-13 00:14:40 +00:00
Treehugger Robot
3bc51dfc72 Merge "cpp output of an AIDL file is together with the headers" 2021-04-12 23:42:29 +00:00
Colin Cross
a02fba1b0e Merge "Add test for globs used during bootstrapping" 2021-04-12 23:42:00 +00:00
Paul Duffin
082afbb656 Remove unused hiddenapi_flags module type
Bug: 177892522
Test: m nothing
Change-Id: I604a86a25bbc722ec718b0b0272d0481218d3cd9
2021-04-13 00:23:55 +01:00
Paul Duffin
6a766453fd Export monolithic hidden API files from platform_bootclasspath
Makes the monolithic hidden API files accessible from the
platform_bootclasspath so they can be output to the dist build target
and used by other modules, e.g. by doing something like this:
  java_resources: [
    ":platform-bootclasspath{hiddenapi-flags.csv}",
  ],

It makes the paths relative to the out/soong/hiddenapi directory rather
than the out/soong directory to make them easier to use in the
java_resources property without changing the structure of the APK.
Without that attempting to use them in a java_resources property will
result in them being copied to a hiddenapi/ within the APK instead of
being used at the top level as existing APKs like
CtsHiddenApiBlocklistTestApiTestCases expect.

Bug: 177892522
Test: m nothing
Change-Id: I829412fc7d25411e0c2e0713d0d219a18f4af2ee
2021-04-13 00:23:55 +01:00
Liz Kammer
9c2108667b rust_fuzzer: add toolchain libraries if non-empty
Test: bp2build
Test: m nothing
Fixes: 185163319
Change-Id: Id8b8e5b21b71f949fa8fa27f8c8cc4aba00c1f7d
2021-04-12 18:52:29 -04:00
Liz Kammer
fe23bf3eb0 Add tests for request_type ParseResult functions.
Test: go test request_type_test
Test: bp2build generate & sync; mixed build libc
Change-Id: Id0b813e9de4d02d8625e42549999659ccb005c6d
2021-04-12 16:23:53 -04:00
Liz Kammer
b71794d8e6 Consolidate cc-specific cqueries.
There is little overlap at this point, but we expect these to converge
more over time, to handle exported includes, libs, etc., this will allow
those changes to be handled in one place and allow more consolidation of
code.

Test: bp2build generate & sync; mixed build libc
Change-Id: I51685dad9f4fc11a634965a3c9e84f4a0e279ecb
2021-04-12 15:59:08 -04:00
Liz Kammer
8d62a4f725 Add tests for bazel_handler
Test: go test
Test: m nothing
Test: bp2build generate && sync; mixed build libc
Change-Id: Id4307a9e735b50221a8effb963325aaa57c3c7d0
2021-04-12 15:59:06 -04:00
Jaewoong Jung
8e1c08cda6 Merge "Fix min_sdk_version err msg in apex." 2021-04-12 19:41:35 +00:00
Treehugger Robot
c8c4bf4c98 Merge "Add test for building cc_object with Bazel." 2021-04-12 19:40:47 +00:00
Liz Kammer
bda284bb19 Merge "Support paths for init_rc from Soong." 2021-04-12 19:05:27 +00:00
Paul Duffin
26bd783d0b Merge "Move generation of global hidden API flags to platform_bootclasspath" 2021-04-12 18:43:31 +00:00
Paul Duffin
690d5f2c7d Merge "Extract ruleToGenerateHiddenApiFlags" 2021-04-12 18:43:18 +00:00
Jaewoong Jung
86bcf70b3e Fix min_sdk_version err msg in apex.
It should suggest adding min_sdk_version to the child module, not the
apex one.

Test: Manually
Change-Id: Ibde94677a966dafd5912e566bb038783f03c20c9
2021-04-12 16:45:25 +00:00
Treehugger Robot
c1c2352d95 Merge "Make MockBazelContext more specific to cquerys" 2021-04-12 13:25:38 +00:00
Treehugger Robot
7ac4db7c3a Merge "bp2build/mixed builds denylist note_memtag_heap_async and sync temporarily." 2021-04-12 12:31:29 +00:00
Lukacs T. Berki
745380ce23 Remove the dependency on a number of env vars.
This is so that the way soong_build is invoked is simpler, which is in
turn useful so that it can be invoked multiple times within a single
build, which in turn will be used to invoke bp2build routinely (as
opposed to manually when needed)

Test: Presubmits.
Change-Id: Iddaebb05ff7bcedc0db8273192bb31284b739920
2021-04-12 12:07:44 +02:00
Paul Duffin
702210b804 Move generation of global hidden API flags to platform_bootclasspath
This change moves the generation of the global hidden API flags from
the singleton to the platform_bootclasspath module. It involves:
1. Moving the ruleToGenerateHiddenApiFlags to hiddenapi_modular.go.
2. Adding HiddenAPIAugmentationProperties to be used by the
   platform_bootclasspath type.
3. Moving the file paths into the platform-bootclasspath module
   definition in frameworks/base/boot/Android.bp.

The flagsRule is kept as a placeholder for now. The emptyFlagsRule is
also kept so that builds continue to work even when the frameworks/base
repository is not present.

Bug: 177892522
Test: verified that the out/soong/hiddenapi/... files are unchanged
      by this change
Change-Id: Idf4dd414a016831bfe04a01f93234c1c33819881
2021-04-12 11:04:24 +01:00
Paul Duffin
c6bb7cf8d7 Extract ruleToGenerateHiddenApiFlags
Extracts the code for creating the rule that creates the monolithic
hidden API flags file which is encoded into dex implementation jars.
This refactoring is in preparation for moving the functionality from
the hiddenapi_singleton into the platform_bootclasspath.

A follow up change will move the method into the new
hiddenapi_modular.go alongside the hiddenAPIAugmentationInfo as they
will both be used to perform hidden API processing for a
bootclasspath_fragment.

Bug: 177892522
Test: verified that the out/soong/hiddenapi/... files are unchanged
      by this change
Change-Id: I2729afa80cdfd2d1d4717365001648453d65632f
2021-04-12 11:04:09 +01:00
Treehugger Robot
02e40d0589 Merge "bp2build: refactor compiler/linker prop function." 2021-04-12 09:22:30 +00:00
Treehugger Robot
454ac1eff3 Merge "bp2build: codegen singleton lists on one line." 2021-04-12 08:29:18 +00:00
Jingwen Chen
0a92ed74ad bp2build/mixed builds denylist note_memtag_heap_async and sync temporarily.
This adds the two modules to the bp2build/mixed builds denylist while we
investigate b/185079815.

Test: TH
Change-Id: I6d67c5c24502ac48bdc90a005ddef86c46eab0b7
2021-04-12 05:37:42 +00:00
Jingwen Chen
a42c707572 Merge "bp2build: cc_library converter for //bionic/libdl:libdl_android" 2021-04-12 04:30:27 +00:00
Justin Yun
7f99ec7c1f Add a test to check the intall partitions
cc modules have complex image variant settings. To avoid setting
wrong partitions to modules, add a test to check the install
partition.

Bug: 184885453
Test: m nothing
Change-Id: I080661335f2da7281d6e6a0d2fedd1fcecb4b2cb
2021-04-12 13:19:28 +09:00
Robin Lee
33db5cbf6e Install device_specific cc_prebuilt to ODM
In aosp/531337 support for installing prebuilts to vendor and odm
partitions was introduced.

Since aosp/1542687 allowed installing vendor variants to odm, we
started to see device_specific cc_prebuilts not installed to odm
at all.

The reason for this is the InVendor condition is true for the
device_specific module and VendorVariantToOdm is false in cases
outside the one it was designed for, so SocSpecific returns true and
the module gets installed to vendor instead of odm.

We need to check if we're specifically building a vendor variant
before triggering this VendorVariantToOdm logic.

Bug: 184885453
Change-Id: I05be06a61c5fc3f2f72599eb4746c9c0523b956e
2021-04-12 13:12:45 +09:00
Tri Vo
eed4716def Merge changes I46e851c8,I2c9eb248
* changes:
  rust: Add HWASan build support
  Export CC HWASan sanitizer type
2021-04-09 22:31:09 +00:00
Ivan Lozano
1285766d3b Merge "rust: Remove stack-depth sancov" 2021-04-09 21:56:51 +00:00
Tri Vo
0a74c3e06e rust: Add HWASan build support
HWASan for static Rust executables is not supported yet.

Bug: 180495975
Test: build local test app with HWASan
Change-Id: I46e851c82a16943586ec3a789f09a58651d036e3
2021-04-09 10:59:23 -07:00
Jeffrey Vander Stoep
3e2d4d419b Merge "Disable clippy::upper-case-acronyms" 2021-04-09 17:48:43 +00:00