Commit graph

20407 commits

Author SHA1 Message Date
Paul Duffin
344c4eeda9 java_sdk_library: Specify visibility of stubs modules
Adds two new properties to specify the visibility of the stubs modules
(source and library) created by the java_sdk_library. Excludes
visibility property from being inherited when creating the module so it
can be properly specified by copying across the relevant property.

Test: m checkapi
Bug: 155164730
Merged-In: Iffdd9f191ff0d74646356ac577560cc38efdd790
Change-Id: Iffdd9f191ff0d74646356ac577560cc38efdd790
(cherry picked from commit 4911a89181)
2020-05-10 23:56:52 +01:00
Paul Duffin
129171b6d4 Retry: Fix snapshot of a host/device cc_library with stubs
Change since last attempt: Disable test that breaks on darwin.

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
Merged-In: Ia4e744c9e799d5adaf8a2f761516f568ec363ad4
Change-Id: Ia4e744c9e799d5adaf8a2f761516f568ec363ad4
(cherry picked from commit 7a1f7f32ab)
2020-05-10 23:56:40 +01:00
Paul Duffin
4d125bd8ad Retry: 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
Merged-In: Ibafdb6e921ba5abe505bd8a91ca5a1d9c9b5d0cb
Change-Id: Ibafdb6e921ba5abe505bd8a91ca5a1d9c9b5d0cb
(cherry picked from commit c459f89fb4)
2020-05-10 23:56:28 +01:00
Paul Duffin
08385bf9ac Retry: 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
Merged-In: I3df60f0b53ba02ec2c55a80c7da058eac5909d26
Change-Id: I3df60f0b53ba02ec2c55a80c7da058eac5909d26
(cherry picked from commit 864e1b45db)
2020-05-10 23:56:18 +01:00
Paul Duffin
6d7f0a719c java_sdk_library: Add support for module_lib API surface
Adds api scope for the module_lib and adds that to the list of all
all available scopes. The scope is generated if and only if the
api_surfaces property contains "module_lib".

No other changes are needed as the generation of the APIs is completely
driven by the allApiScopes array and the information in its contained
apiScope structures.

Test: m checkapi
Bug: 155164730
Merged-In: I7769af6823badca8715a270f86cf53b4e954b7df
Change-Id: I7769af6823badca8715a270f86cf53b4e954b7df
(cherry picked from commit 8f265b9ab9)
2020-05-08 19:38:57 +01:00
Paul Duffin
3a254985af java_sdk_library: Control API surfaces generated
Adds a per scope set of properties that allows explicit control over
the API surfaces generated.

Previously, the term active was used to determine whether it was
generated but that was a little abstract and unclear so has been
replaced by generated.

Test: m nothing
Bug: 155164730
Merged-In: I7539d89618b61f6b9d1a4b60cc3f9614b157f0d9
Change-Id: I7539d89618b61f6b9d1a4b60cc3f9614b157f0d9
(cherry picked from commit 3375e35d99)
2020-05-08 19:38:57 +01:00
Paul Duffin
75dcc80396 Export API files as part of the java_sdk_library
Bug: 153443117
Test: m nothing

Merged-In: I9d6f5b91a7cc25019e2eb9e3c138f0874d2831de
Change-Id: I9d6f5b91a7cc25019e2eb9e3c138f0874d2831de
(cherry picked from commit 1fd005d5b3)
2020-05-08 19:38:57 +01:00
Paul Duffin
f488ef2a3c Export stub sources as part of the java_sdk_library
Minor refactoring of checkMergeZip(string) -> checkMergeZips(...string)
to allow testing of multiple merge zips.

Bug: 153443117
Test: m nothing
Merged-In: I8db00f611ced15f8476ba16f2834a72e8c913596
Change-Id: I8db00f611ced15f8476ba16f2834a72e8c913596
(cherry picked from commit 3d1248ceb6)
2020-05-08 19:34:30 +01:00
Paul Duffin
40cd500f07 Merge changes Ic6f90eb4,I5c5b8436,If673d482,I98b575b8 into rvc-dev
* changes:
  Switch java_sdk_library to use SetDefaultableHook()
  Allow extractCommonProperties to return an error
  Remove reference to obsolete BuildSnapshot()
  Correct order of parameters to AssertDeepEquals
2020-05-08 06:46:19 +00:00
Paul Duffin
2aaef53b6d 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
Merged-In: Ic6f90eb4449338e549878f64e8119e286b9aa549
Change-Id: Ic6f90eb4449338e549878f64e8119e286b9aa549
(cherry picked from commit f022920bde)
2020-05-07 23:06:13 +01:00
Paul Duffin
1c58f5795a 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
Merged-In: I5c5b8436bcbc39e4e7cd35df2577b2dac53e702a
Change-Id: I5c5b8436bcbc39e4e7cd35df2577b2dac53e702a
(cherry picked from commit 4b8b79394f)
2020-05-07 23:00:04 +01:00
Paul Duffin
d7acc7b73e Remove reference to obsolete BuildSnapshot()
Bug: 155628860
Test: m nothing
Merged-In: If673d482e8318b5fbb86780236123b0bd59eb5d3
Change-Id: If673d482e8318b5fbb86780236123b0bd59eb5d3
(cherry picked from commit 425b0eacaa)
2020-05-07 22:59:55 +01:00
Paul Duffin
9ec2a79ab2 Correct order of parameters to AssertDeepEquals
The expected/actual were around the wrong way.

Bug: 155628860
Test: m nothing
Merged-In: I98b575b8b85dcbfd2075e77689f0329aa2eadbf0
Change-Id: I98b575b8b85dcbfd2075e77689f0329aa2eadbf0
(cherry picked from commit 1d6c0df597)
2020-05-07 22:59:44 +01:00
Colin Cross
f30c453df1 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
Merged-In: I7baa5405d03df03920b01616b030ba77f882a77e
2020-05-07 12:40:27 -07:00
Colin Cross
2572225993 Merge "Add jni_uses_sdk_apis" into rvc-dev 2020-05-07 16:21:51 +00:00
Jaewoong Jung
4d480bcd0f Merge "Make android_app_import multi targets arch module." into rvc-dev 2020-05-07 15:19:49 +00:00
Paul Duffin
51a2bee304 java_sdk_library: Define relationship between api scopes
Needed for follow up changes.

Test: m checkapi
Bug: 155164730
Merged-In: I163223caed38161ce1fa7b96dc3772194c32c3e2
Change-Id: I163223caed38161ce1fa7b96dc3772194c32c3e2
(cherry picked from commit 97b53b83e4)
2020-05-07 11:37:06 +01:00
Paul Duffin
1b115d32b4 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
Merged-In: I13df3115f9e225f7324b6725eaeb16a78cc2538a
Change-Id: I13df3115f9e225f7324b6725eaeb16a78cc2538a
(cherry picked from commit afa9fa104d)
2020-05-07 11:36:57 +01:00
Paul Duffin
eedf3f1f4a 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
Merged-In: I825c6df09058fb3a45db196661959eb332aca2f3
Change-Id: I825c6df09058fb3a45db196661959eb332aca2f3
(cherry picked from commit c988c8e202)
2020-05-07 11:36:44 +01:00
Paul Duffin
8de6aa4263 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
Merged-In: I7e169bd9b6e51b88e35bdf8673a5056337f778c1
Change-Id: I7e169bd9b6e51b88e35bdf8673a5056337f778c1
(cherry picked from commit b28369a982)
2020-05-07 09:53:32 +01:00
Paul Duffin
f3644f12d0 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
Merged-In: Ie83c1ffbb71fd5d7a08d350571dad3e3209b1431
Change-Id: Ie83c1ffbb71fd5d7a08d350571dad3e3209b1431
(cherry picked from commit f34f6d8538)
2020-05-07 09:53:05 +01:00
TreeHugger Robot
93f1d81cc0 Merge "Simplify package by using LoadHook instead of mutators" into rvc-dev 2020-05-07 06:56:29 +00:00
TreeHugger Robot
c40859ae12 Merge "Remove networkstack-aidl-interfaces-unstable-java from the whitelist" into rvc-dev 2020-05-07 05:43:24 +00:00
Colin Cross
76583a443e 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.

Bug: 154665579
Test: atest NetworkStackTests
Change-Id: I841fb761ec1c1ab8596aac44e01eb7eb91428006
2020-05-06 17:56:46 -07:00
Jaewoong Jung
a689ffe207 Make android_app_import multi targets arch module.
This makes it consistent with android_app. Also, most android_app_import
modules with JNI libs target a single arch.

(This is a cherry-pick change.)

Test: TreeHugger
Bug: 154281342
Change-Id: I5bbb2d2b733bbd6b868898285683ba5ff45be10b
Merged-In: I5bbb2d2b733bbd6b868898285683ba5ff45be10b
2020-05-06 15:19:42 -07:00
Artur Satayev
388d39ba9a Introduce min_sdk_version to deps info.
Bug: 149622332
Test: m
Change-Id: Ie6568cb8a82d5cca9a3dc91b5a068abf4b0632dc
Merged-In: Ie6568cb8a82d5cca9a3dc91b5a068abf4b0632dc
Exempt-From-Owner-Approval: cp from aosp
(cherry picked from commit 480e25b74f)
2020-05-06 15:01:14 +00:00
Artur Satayev
fb0a636f6d Merge "Introduce flat deps info list." into rvc-dev 2020-05-06 13:45:16 +00:00
Paul Duffin
a43e13e5d4 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
Merged-In: Ia8383b9d1272bb12c8a83948753a0e4b0d98a650
Change-Id: Ia8383b9d1272bb12c8a83948753a0e4b0d98a650
(cherry picked from commit cdfcec98bb)
2020-05-06 08:21:39 +01:00
Paul Duffin
2df45faa7b Improve error messages when output file is invalid
Bug: 155720025
Test: m nothing
Merged-In: I01eebaad58c5a6950e4419d0a8bf80bd02fed543
Change-Id: I01eebaad58c5a6950e4419d0a8bf80bd02fed543
(cherry picked from commit 712993cf0c)
2020-05-06 08:21:22 +01:00
Paul Duffin
6615b30812 Document preArch mutators
Bug: 155295806
Test: m checkbuild
Merged-In: I4cd6647a8707f49363d297a3b3082ef19ba93868
Change-Id: I4cd6647a8707f49363d297a3b3082ef19ba93868
(cherry picked from commit aa4162e71e)
2020-05-06 08:20:34 +01:00
Martin Stjernholm
bb0e839da9 Do not propagate dynamic dependencies for stub libs.
Test: m nothing
Test: Build an SDK snapshot including libc, check that the generated
  cc_prebuilt_library_shared for it is a stub that doesn't depend on
  ld-android.
Bug: 152255951
Bug: 154310674
Merged-In: Ie5ec02aebdf00b75756a6eda40db821488d30065
Change-Id: Ie5ec02aebdf00b75756a6eda40db821488d30065
(cherry picked from commit cc330d665a)
2020-05-06 08:19:07 +01:00
Martin Stjernholm
13b8b6ac70 Do not propagate the stub symbol file to prebuilts.
This partially reverts https://r.android.com/1278193. The propagated
symbol files contain all versions, even though only one is applicable
in a given SDK snapshot.

It's uncertain what repercussions this might have, but one is that if
we were to update a snapshot for a fixed version then it might change
because the symbol file contains new versions that aren't applicable.
Since the symbol file isn't actually needed at this point it's better
to wait with this step until the use cases for it are more clear.

Test: m nothing
Test: Create an SDK snapshot with Bionic libs, drop it into a
  master-art tree without bionic/ in it, build ART APEXes, and check
  that the Soong phase completes (specifically that the stubs are
  detected even without symbol files).
Bug: 152481980
Merged-In: Ic79f89bc6d11d0b6552fa20791f5680ff9a40c0d
Change-Id: Ic79f89bc6d11d0b6552fa20791f5680ff9a40c0d
(cherry picked from commit bdd0dffc1b)
2020-05-06 08:18:49 +01:00
Martin Stjernholm
cd497b0506 Propagate stubs to the SDK for libraries that have them.
Necessary to make the APEX build logic treat the libraries as API
boundaries rather than dependencies to bundle.

The .so files in the snapshots are the compiled stub libraries in this
case. They are strictly speaking redundant since they can be generated
from the .map.txt files in the snapshots, but doing that would require
extending the cc_prebuilt_library(_shared) module types with a full
compiler pass etc, and that would break a lot of assumptions in the cc
package.

Test: m nothing
Test: Create an SDK snapshot with Bionic libs, drop it into a
  master-art tree without bionic/ in it, build ART APEXes, and check
  that the Soong phase completes (specifically no errors about various
  APEX libs requiring libc that is not available to them).
Bug: 152481980
Merged-In: I31b928e6261198b6dd6f6b17196e714f07b64172
Change-Id: I31b928e6261198b6dd6f6b17196e714f07b64172
(cherry picked from commit c5dd4f7c1f)
2020-05-06 08:18:35 +01:00
Martin Stjernholm
8c0db63809 Don't run new test on Darwin that lacks snapshot support.
Test: m nothing
Bug: 152514829
Bug: 152255951
Merged-In: Ib14af7caa408e252242e6933f7281aab3888789c
Change-Id: Ib14af7caa408e252242e6933f7281aab3888789c
(cherry picked from commit 66a06945aa)
2020-05-06 08:18:15 +01:00
Martin Stjernholm
bddfbc463d Propagate empty vs unspecified system_shared_libs correctly.
Necessary to get correct prebuilts for many Bionic libs.

Cleaned up numerious "system_shared_libs: []" from test fixtures, since
they otherwise would need correction in the expected results, and it is
better to have a single test focused on testing system_shared_libs
propagation.

Test: m nothing
Bug: 152255951
Merged-In: If2e8a5296223e6281d833312660e8e9e4cd184c0
Change-Id: If2e8a5296223e6281d833312660e8e9e4cd184c0
(cherry picked from commit 10566a035f)
2020-05-06 08:17:57 +01:00
Martin Stjernholm
fcb99e07fc Add SDK member support for cc_object.
Test: m nothing
Test: Add
    sdk {
        name: "runtime-module-sdk",
        native_shared_libs: [
            "libc",
            "libdl",
            "libm",
            "ld-android",
        ],
        native_objects: [
            "crtbegin_dynamic",
            "crtbegin_static",
            "crtend_android",
        ],
    }
  to bionic/apex/Android.bp. Then:
    build/soong/scripts/build-aml-prebuilts.sh runtime-module-sdk
  Take the generated runtime-module-sdk-current.zip and unzip into a
  master-art tree without bionic/, edit the generated Android.bp to
  extend cc_prebuilt_* modules with:
    nocrt: true,
    stl: "none",
    system_shared_libs: [],
    apex_available: ["//apex_available:anyapex"],
    recovery_available: true,
    vendor_available: true,
    ramdisk_available: true,
  Then "m com.android.art.debug". This passes Soong but fails in the
  build step because more members are required.
Bug: 148934017
Merged-In: I2ab8f6aadb1440b325697cae4a8ed761c62d15d2
Change-Id: I2ab8f6aadb1440b325697cae4a8ed761c62d15d2
(cherry picked from commit cd07bce437)
2020-05-06 08:17:10 +01:00
Martin Stjernholm
39978527ce Add cc_prebuilt_object.
To be used for prebuilt object support in SDK snapshots.

Test: m nothing
Bug: 148934017
Merged-In: I53d58100cc1d410c5cf5b7906de7ed6f7add2035
Change-Id: I53d58100cc1d410c5cf5b7906de7ed6f7add2035
(cherry picked from commit 0b92ac8e43)
2020-05-06 08:16:53 +01:00
Jeongik Cha
255a570e6d Remove networkstack-aidl-interfaces-unstable-java from the whitelist
networkstack-aidl-interfaces-*java has explicit apex_available now.
Accordingly, remove it from the whitelist

Bug: 133526962
Test: m nothing
Change-Id: If5427afb2470a7dffbd418e1c405af508577ad93
2020-05-06 05:20:13 +00:00
Yabin Cui
d62f376a36 Merge "Switch to clang-r383902 (11.0.1)." into rvc-dev 2020-05-05 20:36:16 +00:00
Artur Satayev
5e7c32d6cb Introduce flat deps info list.
Compared to full list, flat list drops dependency edges and simply
lists all transitive dependencies for a top-level apex bundle.

Bug: 149622332
Test: m, manually build flatlist
Change-Id: Ibd521c96b7aeab90b95965c1b524e0a0152aaf5a
Merged-In: Ibd521c96b7aeab90b95965c1b524e0a0152aaf5a
Exempt-From-Owner-Approval: cp from aosp
(cherry picked from commit a8bd113a69)
2020-05-05 17:28:41 +00:00
Artur Satayev
334b51730a Export depsInfo into android package.
Move depsInfo into android for easier sharing with APK code.

Bug: 149622332
Test: m, diff'ing outputs for conscrypt module.
Change-Id: If0ee967d37425540e69b4ce9304229d9f2cd86bd
Merged-In: If0ee967d37425540e69b4ce9304229d9f2cd86bd
Exempt-From-Owner-Approval: cp from aosp
(cherry picked from commit 872a144dca)
2020-05-05 16:19:07 +00:00
Paul Duffin
5d5804a81f Merge changes I101fa6b0,Ic1a9bb1e into rvc-dev
* changes:
  Report visibility errors in both check and gather phases
  Reduce duplication in visibility property management
2020-05-05 11:33:11 +00:00
Artur Satayev
b25992b4eb Merge "Ensure APEX's Java deps use stable SDKs." into rvc-dev 2020-05-05 09:59:34 +00:00
Anton Hansson
3292836210 Merge "Treat lint warnings as errors" into rvc-dev 2020-05-05 09:58:51 +00:00
Paul Duffin
b33d21bdaf Report visibility errors in both check and gather phases
Previously, errors that were found when splitting visibility rules were
only reported in the check phase and simply ignored during the gather
phase. That was because every visibility property that was processed in
the gather phase had already been checked in the check phase. However,
that is not strictly true as it has always been possible to add a
mutator between the check and gather phases that creates a module with
invalid visibility properties that will just be ignored. Fortunately,
that has not happened.

A follow up commit will add the capability to create modules after the
defaults have been applied which means the chances of invalid visibility
properties being ignored will increase.

This change makes both phases report any errors they find. It will not
have any impact on existing code as if any errors are reported in the
check phase then the build will exit before the gather phase. It will
prevent any invalid visibility errors from being ignored.

Bug: 155295806
Test: m nothing
Merged-In: I101fa6b03d2530b16e4394a9e466fead48be0ff0
Change-Id: I101fa6b03d2530b16e4394a9e466fead48be0ff0
(cherry picked from commit 0c83aba28e)
2020-05-05 10:34:55 +01:00
Paul Duffin
abc9a647a2 Reduce duplication in visibility property management
Adds a couple of new methods to manage visibility property instances to
reduce duplication and encapsulate the implementation slightly better.

The AddVisibilityProperty method is exported as it will be needed by
other packages in follow up commits.

Bug: 155295806
Test: m nothing
Merged-In: Ic1a9bb1e151fc6ae65761344fd210b4e4ba74fbc
Change-Id: Ic1a9bb1e151fc6ae65761344fd210b4e4ba74fbc
(cherry picked from commit 5ec73ecc08)
2020-05-05 10:34:30 +01:00
Anton Hansson
e714565ce8 Treat lint warnings as errors
Warnings get lost in the build spam and never get fixed. Right now is
the best time to do this, because we only track the warnings/errors
since the last released API. The API has just been frozen, so the number
of warnings is at an all-time low.

Whitelist the car lib and test stubs for now, which produce a lot of
warnings.

Bug: 154317059
Test: presubmit
Change-Id: I9aa7cb1b947c6c664f15e2bd5835d76eaac1237a
2020-05-04 21:47:34 +01:00
Anton Hansson
fc39bd861d Merge "Disable "check last" for test api" into rvc-dev 2020-05-04 17:44:05 +00:00
Artur Satayev
2eedf623ff Ensure APEX's Java deps use stable SDKs.
Test: m
Bug: 153333044
Change-Id: Ib1acf3073e96fe23c92d292ec0b1a91e2cd408db
Merged-In: Ib1acf3073e96fe23c92d292ec0b1a91e2cd408db
Exempt-From-Owner-Approval: cp from aosp
(cherry picked from commit 8cf899afcc)
2020-05-04 16:51:59 +00:00
Anton Hansson
e16ca7d52d Merge "Make prebuilt_sdk support module-lib and system-server" into rvc-dev 2020-05-04 12:51:31 +00:00