Commit graph

19240 commits

Author SHA1 Message Date
Treehugger Robot
3d60daadbc Merge "Switch java_sdk_library to use SetDefaultableHook()" 2020-05-07 20:39:05 +00:00
Colin Cross
c80828d567 Skip dexpreopting android_test_import modules
android_test_import modules should be labelled as tests so they are
not dexpreopted.

Bug: 155778135
Test: m CtsCorruptApkTests_Compressed_Q
Change-Id: I7baa5405d03df03920b01616b030ba77f882a77e
2020-05-07 12:06:14 -07:00
Colin Cross
7500f46b95 Merge "Add jni_uses_sdk_apis" 2020-05-07 18:09:47 +00:00
Colin Cross
7204cf0e6a Add jni_uses_sdk_apis
NetworkStackTests is using platform APIs for its Java code, but needs
to use portable JNI libraries.  Add a jni_uses_sdk_apis so that it
can select the SDK variants of JNI libraries even though it doesn't
set sdk_version.

(clean cherry-pick from internal branch)
Bug: 154665579
Test: atest NetworkStackTests
Merged-In: I841fb761ec1c1ab8596aac44e01eb7eb91428006
Change-Id: I841fb761ec1c1ab8596aac44e01eb7eb91428006
2020-05-07 18:09:06 +00:00
Ivan Lozano
6c4e5c05c3 Merge "Add gcov coverage support to Rust modules." 2020-05-07 17:56:43 +00:00
Paul Duffin
2af52380be Fix snapshot of a host/device cc_library with stubs
Adds a test that fails with unknown property android.stubs.versions
and then fixes that by marking the field from which that property is
created with 'ignored-on-host' and implemented the isHostVariant on
*osTypeSpecificInfo.

Bug: 155628860
Test: m nothing
Change-Id: I167b47a1374f541aa09d7e045972d740f1d9009c
2020-05-07 18:35:11 +01:00
Paul Duffin
12f67bcf42 Adds support for 'ignored-on-host'
Adds a filter mechanism that can exclude property values from being
included in the common value extraction. That is needed to prevent the
snapshot mechanism from generating invalid output for properties that
are ignored on host (and have their values cleared) and which are not
tagged with `android:"arch_variant"`.

Changes:
* Updates the documentation of SdkMemberType to explain what effect
  the 'ignored-on-host' tag has.
* Adds some tests for this new mechanism.

Bug: 155628860
Test: m nothing
Change-Id: I7ebd333079619dba546bc8c4911d567e0287b676
2020-05-07 18:35:11 +01:00
Paul Duffin
ee20962378 Detect invalid arch specific properties in snapshot
Previously, the snapshot code did not know whether a specific property
could be arch specific or not and assumed that they all were which
meant that it could generate snapshots containing arch specific values
for properties that are not arch specific and so would fail when
unpacked.

This change requires arch specific fields in SdkMemberProperties to be
tagged as such using `android:"arch_variant"` (just as in module input
property structures). Any property without that must have properties
that are common across all variants.

Bug: 155628860
Test: m nothing
Change-Id: Ifc8116e11d987cfe7aec2eeaa964f3bbf36b5dc2
2020-05-07 18:35:11 +01:00
Paul Duffin
bd7e3295dd Merge "Allow extractCommonProperties to return an error" 2020-05-07 16:17:42 +00:00
Paul Duffin
38e2fbdc90 Merge changes If673d482,I98b575b8
* changes:
  Remove reference to obsolete BuildSnapshot()
  Correct order of parameters to AssertDeepEquals
2020-05-07 15:50:06 +00:00
Treehugger Robot
4779327cf8 Merge "Remove implicit Bionic and kernel system includes." 2020-05-07 13:35:13 +00:00
Jeongik Cha
9d902cef58 Merge "Remove networkstack-aidl-interfaces-unstable-java from the whitelist" 2020-05-07 10:59:05 +00:00
Treehugger Robot
d9e4bf9840 Merge "Reduce the number of Soong invocations, and various other minor script fixes." 2020-05-07 10:36:54 +00:00
Treehugger Robot
aa71638941 Merge "java_sdk_library: Define relationship between api scopes" 2020-05-07 09:37:54 +00:00
Paul Duffin
f022920bde Switch java_sdk_library to use SetDefaultableHook()
Previously, java_sdk_library used AddLoadHook() to register a hook that
when called would create its child modules. That meant the
java_sdk_library properties that were used to create the child modules,
e.g. sdk_version could not be defaulted because the modules are created
before the defaults are applied.

This change switches java_sdk_library to use the new
SetDefaultableHook() mechanism to register the hook instead of the
AddLoadHook() mechanism.

It also prevents the child modules from being created if the module has
been disabled.

Bug: 155295806
Test: m checkapi
Change-Id: Ic6f90eb4449338e549878f64e8119e286b9aa549
2020-05-07 10:24:00 +01:00
Paul Duffin
955ade6475 Merge changes I13df3115,I825c6df0
* changes:
  Add hook to be called after defaults have been applied
  Move prebuilts mutators after defaults have been applied
2020-05-07 09:18:26 +00:00
Jiyong Park
45b90e79c9 Prevent statically linking to a lib providing stable C APIs
A lib providing stable C APIs should be available only to the APEX
containing the library. It shouldn't be available to other APEXes,
especially via static linking.

This change also fixes a bug that llndkImplDep (the dependency from
llndk stub to its implementation library) was recognized as being in the
same APEX.

Bug: 151051671
Test: m
Change-Id: Ifda7f4a367f68afcde93c86cda45a28cacd91f99
2020-05-07 16:20:00 +09:00
Jiyong Park
1c7e962957 Add GetPathString
The method is a thin wrapper around GetWalkPath and GetTagPath to make
it easy to construct a string representation of the current path.

It was originally inlined in the apex package. This change makes it a
function and moves it to the android package so make it more useful.

Bug: N/A
Test: m
Change-Id: I7e2bc2074baed759d67d9097151c9ac10e34ed31
2020-05-07 16:12:13 +09:00
Yo Chiang
6345dfde49 Merge "APEX should require base module of stub libraries" 2020-05-07 06:13:49 +00:00
easoncylee
1e3fdcd182 Add test_mainline_modules to the auto-gen test config(GTest only).
To support parameterized mainline modules in Test Mapping, we plan to
add a new parameter called test_mainline_modules in build system to
auto-generate the test config based on the parameter.

For detailed information: go/test-mapping-mainline-gcl
(serach for auto-generated pattern)

Bug: 155238134
Test: add "test_mainline_modules: [some.apk]" to libstatspull_test,
and build the modules, confirm the parameterized option is added
in the test config.

Change-Id: I31d6dfbb71881d7a7026cf2f36ba6ca6a97870ad
2020-05-07 12:35:14 +08:00
Martin Stjernholm
691503ea0b Reduce the number of Soong invocations, and various other minor script fixes.
-  We can pass all targets at once to build-aml-prebuilts.sh.
-  Less noise from build-mainline-modules.sh.
-  Default to the same out directory in both build scripts.
-  Addressed post-submit comments on https://r.android.com/1170907.
-  Various minor cleanups.

Test: build/soong/scripts/build-mainline-modules.sh
Change-Id: Id21ef80c2334462836e217032fc5bf63b7cd04e1
2020-05-06 22:51:15 +01:00
Paul Duffin
97486dbb4b Merge "Encapsulate getter into an extractorProperty structure" 2020-05-06 20:18:39 +00:00
Paul Duffin
11c91dc141 Merge "Encapsulate properties to be optimized in a container" 2020-05-06 20:18:22 +00:00
Makoto Onuki
574cc84a33 Merge "Merge the "big 3" metalava invocations into one" 2020-05-06 19:18:12 +00:00
Martin Stjernholm
41ab2519b4 Remove implicit Bionic and kernel system includes.
They are now explicit in the Bionic blueprints, and brought in through
dependencies on libc (which in turn is usually implicit through the
default system_shared_libs value). Modules that may break are cc_object
which don't depend on system_shared_libs, and those that explicitly set
system_shared_libs:[] but still assumes libc headers. In either case
the fix should be to add header_libs:["libc_headers"].

Test: Build and boot
Test: m checkbuild (on aosp_taimen and aosp_x86_64)
Bug: 153590472
Change-Id: I3217d8f36e49a987f5377866c8647f9dcccc37ce
2020-05-06 19:45:03 +01:00
Paul Duffin
4b8b79394f Allow extractCommonProperties to return an error
Refactoring in preparation for follow up changes.

Also:
* Adds a new AssertErrorMessageEquals() helper method.
* Improved error reporting in the accessor and added name to
  extractorProperty to ensure meaningful errors are reported.
* Added String() string method to propertiesContainer.
* Reports errors using the field name as the errors are not really
  fixable by developers and it is more meaningful to the build team.

Bug: 155628860
Test: m nothing
Change-Id: I5c5b8436bcbc39e4e7cd35df2577b2dac53e702a
2020-05-06 18:40:41 +01:00
Paul Duffin
425b0eacaa Remove reference to obsolete BuildSnapshot()
Bug: 155628860
Test: m nothing
Change-Id: If673d482e8318b5fbb86780236123b0bd59eb5d3
2020-05-06 18:40:41 +01:00
Paul Duffin
b28369a982 Encapsulate getter into an extractorProperty structure
Refactors the existing code to wrap a getter with a structure in order
to simplify adding additional per-property information. Adds an
emptyValue field to contain the empty value appropriate for the field
type.

Bug: 155628860
Test: m nothing
Change-Id: I7e169bd9b6e51b88e35bdf8673a5056337f778c1
2020-05-06 18:40:41 +01:00
Paul Duffin
f34f6d8538 Encapsulate properties to be optimized in a container
This allows additional metadata to be associated with a set of
properties that will be used in a follow up change to filter
properties that are ignored in some variants (e.g. host variants).

Bug: 155628860
Test: m nothing
Change-Id: Ie83c1ffbb71fd5d7a08d350571dad3e3209b1431
2020-05-06 18:40:41 +01:00
Paul Duffin
1d6c0df597 Correct order of parameters to AssertDeepEquals
The expected/actual were around the wrong way.

Bug: 155628860
Test: m nothing
Change-Id: I98b575b8b85dcbfd2075e77689f0329aa2eadbf0
2020-05-06 18:40:41 +01:00
Paul Duffin
97b53b83e4 java_sdk_library: Define relationship between api scopes
Needed for follow up changes.

Test: m checkapi
Bug: 155164730
Change-Id: I163223caed38161ce1fa7b96dc3772194c32c3e2
2020-05-06 18:40:35 +01:00
Makoto Onuki
88b9905d74 Merge the "big 3" metalava invocations into one
This CL merges the biggest three metalava invocations --
stub and signature file generation, api lint, and "check released" --
into one call.

For each of the existing separate rules for api lint and check released this change:
1) Stopped creating a separate rule containing its own metalava invocation.
2) Moved the code for creating the rule earlier so it can add extra flags to the combined metalava command.
3) Moved the message handling into metalava, allowing the message to be passed in.
4) Added a flag to record whether the specific check was needed so that you can separate the timestamp file creation out to run after the merged metalava command.

A couple of minor bug fixes and clarifications.

Bug: 151160048
Test:  "m" and treehugger

Test: Apply https://android-review.googlesource.com/c/platform/frameworks/base/+/1295541 and run `NINJA_ARGS="-k 999" m checkapi`
-> Make sure there are 4 kinds of lint failures ("AddedFinal" and "VisiblySynchronized") with the valid error messages, from:
- api-stubs-docs
- system-api-stubs-docs
- test-api-stubs-docs
- module-lib-api-

Test: Run the 4 cp commands shown by lint
-> Make sure the following 4 baseline files are updated:
frameworks/base/api/lint-baseline.txt
frameworks/base/api/module-lib-lint-baseline.txt
frameworks/base/api/system-lint-baseline.txt
frameworks/base/api/test-lint-baseline.txt

Test: Then run `NINJA_ARGS="-k 999" m checkapi` again.
-> Make sure the API lint errors are gone
-> Make sure "api-stubs-docs" shows the "You have tried to change the API from what has been
previously released in ..." error. (because of "AddedFinal")
-> Make sure it the other 3 API surfaces show the "You have tried to change the API from
what has been previously approved" error.

Test: Remove "final" from Intent.java and run "NINJA_ARGS="-k 999" m checkapi" again.
-> This time, all the 4 API surfaces say "You have tried to change the API from
what has been previously approved" error."

Test: Run the 4 "make *-update-current-api" commands shown in the above errors and "NINJA_ARGS="-k 999" m checkapi"
-> The exact command is:
$ make \
  module-lib-api-update-current-api \
  api-stubs-docs-update-current-api \
  test-api-stubs-docs-update-current-api \
  system-api-stubs-docs-update-current-api

-> Make sure frameworks/base/api/*-current.txt are properly updated.

Test: Run "m update-api"
-> Make sure no text signature files get updated.

Test: Run "m droid".
-> Make sure everything builds fine.

Change-Id: Ia1a5510b57d58748b4655473d4585636deb7f45e
Merged-In: Ia1a5510b57d58748b4655473d4585636deb7f45e
2020-05-06 13:00:01 +01:00
Yo Chiang
29555d5f33 APEX should require base module of stub libraries
Bug: 155841765
Bug: 7456955
Test: m nothing and check the content of out/soong/Android-*.mk
Change-Id: I1f109c27a5e9bcfeb3a887b2e8d6a2cf983aa730
2020-05-06 09:18:01 +00:00
Paul Duffin
afa9fa104d Add hook to be called after defaults have been applied
Previously, the only way for a module type to create modules (other
than defining its own mutator) was to register a LoadHook. However,
that is called before defaults are applied so any properties used in
that hook cannot take advantage of defaults, e.g. java_sdk_library
cannot use defaults to set its sdk_version property and have that
affect its child modules.

This change adds a new SetDefaultableHook() to DefaultableModule to
register a hook that is called after any defaults have been applied.

Also adds some tests to ensure that errors in the visibility property
introduced in a DefaultableHook are reported in the gather phase of
visibility processing.

A follow up change will switch java_sdk_library to use that instead
of the AddLoadHook() mechanism.

Bug: 155295806
Test: m checkapi
Change-Id: I13df3115f9e225f7324b6725eaeb16a78cc2538a
2020-05-06 08:55:19 +01:00
Paul Duffin
c988c8e202 Move prebuilts mutators after defaults have been applied
A follow up change will add a mechanism for a module to register a hook
that is called after any defaults have been applied. That is intended
for use by modules like java_sdk_library that create child modules that
are dependent upon properties that could be supplied by defaults.

Creating those child modules after prebuilts mutators are run will
cause problems if those child modules clash with prebuilts modules.
Moving the prebuilts mutators after the defaults mutators will fix
that.

Tests are currently being run with the mutators in different orders so
this change also cleans that up so they are consistent with the actual
code that is being run.

Bug: 155295806
Test: m checkbuild
Change-Id: I825c6df09058fb3a45db196661959eb332aca2f3
2020-05-06 08:55:16 +01:00
Jooyung Han
98c4750f39 enforce sdk_version for JNI libs for updatable APKs
JNI libs for "updatable" APKs or APKs in "updatable" APEXes should set
sdk_version which is equal to or less than APK's min_sdk_version.

In fact, we'd better check if min_sdk_version of JNI libs matches(or is
earlier than) min_sdk_version of the APK. But for now the build system
can't handle sdk_version/min_sdk_version correctly for JNI libs. That's
why sdk_version of JNI libs is enforced to match with min_sdk_version
of APK in this change.

Bug: 145796956
Test: m
Change-Id: Iee7e09dd25bd139d84d50f6a77836b4068c78ea9
2020-05-06 13:54:34 +09:00
Kris Alder
e051d0d324 add researcher_submitted field to cc_fuzz
Bug: 155105113
Test: make haiku
Change-Id: If6a3f2c7af9ebb41327e3695c850f962adb4122c
2020-05-06 03:25:54 +00:00
Treehugger Robot
00789cc58b Merge "Simplify package by using LoadHook instead of mutators" 2020-05-06 02:28:38 +00:00
Ramy Medhat
a1ffd53fe4 Merge "Add support for the remote execution of metalava actions." 2020-05-05 21:53:26 +00:00
Chris Gross
7097b0580c Merge "Allow bootjars in system_ext." 2020-05-05 21:12:39 +00:00
Paul Duffin
cdfcec98bb Simplify package by using LoadHook instead of mutators
This was not previously possible due to LoadHooks being run after the
module was registered.

Bug: 155462403
Test: m nothing
Change-Id: Ia8383b9d1272bb12c8a83948753a0e4b0d98a650
2020-05-05 20:47:04 +01:00
Treehugger Robot
39298b3598 Merge "Improve error messages when output file is invalid" 2020-05-05 17:11:39 +00:00
Matthew Maurer
e7fe2527f6 Merge "Switch rustc to 1.43.0" 2020-05-05 16:43:47 +00:00
Alexander Smundak
bd1f870df3 Merge "Canonicalize saved paths, Kythe cannot handle symlinks" 2020-05-05 15:54:46 +00:00
Anton Hansson
a1910e8488 Merge "Disable "check last" for test api" 2020-05-05 15:42:53 +00:00
Paul Duffin
d0666441b5 Merge "Document preArch mutators" 2020-05-05 15:24:16 +00:00
Ivan Lozano
a0cd8f9acb Add gcov coverage support to Rust modules.
This adds gcov coverage support for Rust device library and binary
modules (including test modules). Support is provided to pass Rust
static library gcno files to CC modules and visa versa.

Additional changes:
 * Begin mutator added for Rust modules.
 * SuffixInList added to android package.
 * CoverageEnabled added to Coverage interface.
 * CoverageFiles added to LinkableLibrary interface.
 * Fix in coverage mutator for non-CC modules which marked the wrong
   variant as the coverage variant.
 * Added coverage libraries to the cc.GatherRequiredDepsForTest.

Bug: 146448203
Test: NATIVE_COVERAGE=true COVERAGE_PATHS='*' m -j <rust_module>
Change-Id: If20728bdde42a1dd544a35a40f0d981b80a5835f
2020-05-05 10:30:15 -04:00
Anton Hansson
6478ac17fc Disable "check last" for test api
@TestApi does not have stability requirements, so we shouldn't be
checking its compatibility with the last released version.

This CL removes the expectation that a test-removed.txt is checked in
for each module during finalization.

Bug: 155197156
Test: m (with SDK 30 imported)
Change-Id: Ib3f671493f1d230116bec51b884e8072643b10d4
Merged-In: Ib3f671493f1d230116bec51b884e8072643b10d4
(cherry picked from commit 6bf8e415a50826a378cc58aba87854f52c9f1d32)
2020-05-05 14:52:49 +01:00
Paul Duffin
712993cf0c Improve error messages when output file is invalid
Bug: 155720025
Test: m nothing
Change-Id: I01eebaad58c5a6950e4419d0a8bf80bd02fed543
2020-05-05 14:12:22 +01:00
Anton Hansson
fb6d57e134 Merge "Make prebuilt_sdk support module-lib and system-server" 2020-05-05 13:12:10 +00:00