Commit graph

20458 commits

Author SHA1 Message Date
Paul Duffin
206433a1fa Copy shared_libs and system_shared_libs to module snapshot
This change ensures that the runtime dependencies between a
binary/shared library are correctly specified in the snapshot so that
the build can ensure that shared libraries are built before the targets
that use them.

It adds support for differentiating between references that are
required to refer to another sdk member (required) and those that may
refer to either an sdk member or a non-sdk member (optional). The
latter is used for shared library references as the libraries used by
an sdk member may be provided from outside the sdk. e.g. liblog is not
part of the ART module but is used by some members of the ART sdk.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Ia8509ffe79b208c23beba1880fe9c8a92b732685
Change-Id: Ia8509ffe79b208c23beba1880fe9c8a92b732685
2020-04-22 12:51:38 +01:00
Paul Duffin
49096815fe Support extracting common values from embedded structures
This change also added support for excluding properties from common
value extraction by using a struct tag of `sdk:"keep"` That was needed
to prevent the fields in SdkMemberPropertiesBase from having their
values cleared.

The purpose of this change is to make it easier to share functionality
across sdk member types.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Ie5160a8f854056920e411801ca20721eab7c8578
Change-Id: Ie5160a8f854056920e411801ca20721eab7c8578
2020-04-22 12:51:38 +01:00
Paul Duffin
89937326ab Refactor common value extraction
This change pulled the common value extraction functionality out into
its own structure that can be used to extract common values from
multiple sets of properties.

Precursor to follow up changes that will allow properties to contain
embedded structures making it easier to share functionality across
sdk member types.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Ic902ed61e40ced7a2c2fa4b5f793f532c6fc0034
Change-Id: Ic902ed61e40ced7a2c2fa4b5f793f532c6fc0034
2020-04-22 12:51:37 +01:00
Paul Duffin
404db3f4e8 Copy white listed apex available settings into snapshot
Makes sure that the module snapshots do not rely on the white list
of apex available settings so that when those lists are removed it is
not necessary to update any snapshots.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Iedcff7dfc2646a4da77258d16e06657dd2f411f9
Change-Id: Iedcff7dfc2646a4da77258d16e06657dd2f411f9
2020-04-22 12:51:37 +01:00
Paul Duffin
f51768abce Disable installation for sdk snapshot versioned prebuilts
The sdk snapshot creates two prebuilts for each member one that is
versioned and one that is not. If they are both installed then they
lead to duplicate rules in make for creating the same installed file.

This change adds an installable property to cc modules that will
prevent the installation of the file and then adds installable: false
on the versioned prebuilt for cc modules.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: I4cb294c2b0c8a3f411eea569775835d9e41726d6
Change-Id: I4cb294c2b0c8a3f411eea569775835d9e41726d6
2020-04-22 12:51:36 +01:00
Paul Duffin
37a9aa24cc Remove special handling of test_ apexes
Test apexes no longer check to see whether their contents are available
so the special handling is no longer necessary.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Iecae7dcbb87908d19c672f74d3c1ed8810d4485b
Change-Id: Iecae7dcbb87908d19c672f74d3c1ed8810d4485b
2020-04-22 12:51:36 +01:00
Paul Duffin
c23d9f652b Remove special handling of com.android.art.debug/release
The whitelistedApexAvailable used to map references to
com.android.art.debug/release to com.android.art before looking it up
in the white list. This change removed that mapping and simply added
both to the white list.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Ibad76fb73988688eb303e056197986ee9a6119ae
Change-Id: Ibad76fb73988688eb303e056197986ee9a6119ae
2020-04-22 12:51:35 +01:00
Paul Duffin
acdd308344 Allow sdk members to vary by os type
Adds support for specifying separate members to an sdk/module_exports
for different os types, e.g. separate ones for android and host.

Adds 'android:"arch_variant"' tag to the dynamically generated fields
for the sdk member types.

Merges the exported members from all variants together.

Determines the device/host_supported flags of the member snapshots by
whether the OsClasses used by their variants rather than the sdk's
host/device supported properties as they may be different.

Bug: 150451422
Bug: 153306490
Test: m nothing
Merged-In: I41fbbcd8723aafd54826aad9b78eced9f66ef51c
Change-Id: I41fbbcd8723aafd54826aad9b78eced9f66ef51c
2020-04-22 12:51:35 +01:00
Paul Duffin
9b358d7a58 Add support for multiple os types
Updates the member snapshot creation code to support multiple os types.
It basically sorts the variants by os type, then applies the code to
optimize the arch properties and then it optimizes the properties that
are common across architectures and extracts any properties that are
common across os types.

The java and cc member types needed to be modified to make the location
of the generated files within the snapshot os type dependent when there
is more than one os type. That was done by adding an OsPrefix() method
to the SdkMemberPropertiesBase which returns the os prefix to use when
there is > 1 os type and otherwise returns an empty string.

Added three tests, one for cc shared libraries, one for cc binary and
one for java header libraries.

Bug: 150451422
Bug: 153306490
Test: m nothing
Merged-In: I08f5fbdd7852b06c9a9a2f1cfdc364338a3d5bac
Change-Id: I08f5fbdd7852b06c9a9a2f1cfdc364338a3d5bac
2020-04-22 12:51:34 +01:00
Paul Duffin
8fa6acf002 Copy sdk_version to cc library snapshots
Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Ib77c548b1971c841749c87115108af8b092bb809
Change-Id: Ib77c548b1971c841749c87115108af8b092bb809
2020-04-22 12:51:34 +01:00
Paul Duffin
d76209b690 Refactor java_library/java_test snapshot processing
Adds support for handling the common arch to the sdk module type
snapshot generation code and then refactors the java_library
and java_test snapshot processing to take advantage of that.

Bug: 150451422
Bug: 153306490
Test: m nothing
Merged-In: If746f375f1c4288ab6b67c7d216593b70258b043
Change-Id: If746f375f1c4288ab6b67c7d216593b70258b043
2020-04-22 12:51:33 +01:00
Paul Duffin
33cedcc421 Refactor snapshot module creation
Generalize the processing of arch specific properties to reduce
duplication in snapshot module creation and simplify addition of
support for handling multiple os types.

Supporting multiple os types with the current method for building
snapshot modules would require every affected module type to add
support for it. Rather than duplicate multiple os type handling code
across those module types this work generalizes the process cc modules
use for handling arch types as it can be used as a basis for handling
multiple os types. Migrating module types over to this new process
will insulate them from having to handle multiple os types.
OB
SdkMemberType changes:
* BuildSnapshot is deprecated in favour of the new AddPrebuiltModule()
  method.
* Additional methods, CreateVariantPropertiesStruct() and
  FinalizeModule() are added.
* A new interface SdkMemberProperties, is defined that handles
  extracting information from the variant (prior to common value
  optimization) and adding properties to a property set.

The sdk module type uses these new methods and types to delegate the
member type specific processing to the relevant member types while
handling the behavior that is common across all members types, e.g.
extracting common values across multiple architectures. A future change
will leverage this processing to add support for multiple os types.

This change also refactors the cc module processing to use the new
process.

Bug: 150451422
Bug: 153306490
Test: m nothing
Merged-In: If6ab2498407b17f50391d062cd9afc01b5e01af4
Change-Id: If6ab2498407b17f50391d062cd9afc01b5e01af4
2020-04-22 12:51:33 +01:00
Paul Duffin
22595f9370 Enable androidmk processing in sdk testing
Previously, while sdk tests would pass the sdk code would often fail
in androidmk processing. This change makes the tests more realistic
and will catch the errors earlier.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Ifd0b2d7cf24e941c919f6b6e0beb2403a67d4308
Change-Id: Ifd0b2d7cf24e941c919f6b6e0beb2403a67d4308
2020-04-22 12:51:32 +01:00
Nicolas Geoffray
a40f0b5db9 Add a nice install paths for module SDKs and exports.
Following how NDK also creates its own install path.

Bug: 142935992
Bug: 153306490
Test: cc_sdk_test.go, java_sdk_test.go
Merged-In: I98a3656903f37f6d7c90e6cf609431b2461a6161
Change-Id: I98a3656903f37f6d7c90e6cf609431b2461a6161
2020-04-22 12:51:31 +01:00
Paul Duffin
3a6c095145 Copy apex_available properties to snapshot modules
Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: I1cdaae5b4e13a89dc46541dacd34ef5a44735b6a
Change-Id: I1cdaae5b4e13a89dc46541dacd34ef5a44735b6a
2020-04-22 12:51:30 +01:00
Paul Duffin
28d70c74db Improve documentation of CompileMultiTargets and related properties
Bug: 153306490
Test: m nothing
Merged-In: I1e3f0bf7e2a1303d2519d8405a228e9234235514
Change-Id: I1e3f0bf7e2a1303d2519d8405a228e9234235514
2020-04-22 12:51:30 +01:00
Paul Duffin
45e9dbd970 Only check copy rules into the snapshot directory
Bug: 153306490
Test: m nothing
Merged-In: I6d9ab5a9f003193c5791a4ee6d3ee35730ddf96c
Change-Id: I6d9ab5a9f003193c5791a4ee6d3ee35730ddf96c
2020-04-22 12:51:29 +01:00
Paul Duffin
2b9e3d39d9 Simplify java library sdk member code
Adds the accessor function for retrieving the impl/header jars to the
librarySdkMemberType structure instead of passing it into its
buildSnapshot() method.

That enabled:
* The removal of the [header/impl]LibrarySdkMemberType structs.
* The removal of their implementations of BuildSnapshot.
* Replacing buildSnapshot() with BuildSnapshot()

This will make subsequent refactoring of the SdkMemberType interface
a little simpler.

Bug: 153306490
Test: m nothing
Bug: 150451422
Merged-In: I1f96986bb497cf9d9df9916e40065f66b35a4704
Change-Id: I1f96986bb497cf9d9df9916e40065f66b35a4704
2020-04-22 12:51:29 +01:00
Paul Duffin
b0cbec3ada Add CommonOS variant for sdk
Adds a CommonOS variant for sdk that depends on the os specific
variants and is used to generate a single sdk for multiple OsTypes,
e.g. host linux and android.

At the minute the member types only support a single OsType but the
basic mechanism for managing the CommonOS variant and collating the
variants across all of them is there.

The only visible effect of this change is that the location of the
generated snapshot is changed, it is no longer os specific and instead
is in the same location irrespective of which os it is built for.

A lot of tests needed to be changed to specify "common_os" as the
variant type instead of the specific os type. As that is the same across
all tests it is hard coded in CheckSnapshot method.

Bug: 153306490
Test: m nothing
Bug: 150451422
Merged-In: If36be39b06d6910453649f7c288c2d34f688b2f4
Change-Id: If36be39b06d6910453649f7c288c2d34f688b2f4
2020-04-22 12:51:28 +01:00
Paul Duffin
290334dd7d Fix bug in error reporting when adding duplicate properties
Bug: 150451422
Bug: 153306490
Test: m nothing
Merged-In: Ia557992d71537aca0757866e9114b30bdf52bb6b
Change-Id: Ia557992d71537aca0757866e9114b30bdf52bb6b
2020-04-22 12:51:28 +01:00
Paul Duffin
bdd47a863a Avoid invoking sdk member to add empty list of dependencies
Simplifies debugging sdk membership code when it is only called if an
appropriate member is present.

Bug: 153306490
Test: m nothing
Merged-In: I32bc93e0484c829bdbd6b050822249feb6404f89
Change-Id: I32bc93e0484c829bdbd6b050822249feb6404f89
2020-04-22 12:51:27 +01:00
Paul Duffin
c2e3206507 Add windows to the list of available OS's in sdk tests
Makes the tests more realistic as they cover what happens when an sdk
OS specific variant is disabled (Windows is disabled by default). This
will allow issues around disabled variants to be detected early during
Soong bootstrapping.

Bug: 153306490
Test: m nothing
Merged-In: I7ec47dbca52e38750166d755daf706aadea12d15
Change-Id: I7ec47dbca52e38750166d755daf706aadea12d15
2020-04-22 12:51:27 +01:00
Paul Duffin
132e66f1b9 Add support for cc_library_headers in sdk/module_exports
Bug: 148933848
Bug: 153306490
Test: m nothing
Merged-In: Ife6ee0f736238727a11b4421532eaeb29d46c1b7
Change-Id: Ife6ee0f736238727a11b4421532eaeb29d46c1b7
2020-04-22 12:51:26 +01:00
Paul Duffin
5b47358ccc Prune any empty property sets from the modules before transforming
Ensures that the generated prebuilt modules do not contain empty
property sets.

Bug: 148933848
Bug: 153306490
Test: m nothing
Merged-In: I99d5da1c4e3a72836e81e021ef043df53888e66b
Change-Id: I99d5da1c4e3a72836e81e021ef043df53888e66b
2020-04-22 12:51:26 +01:00
Paul Duffin
ce5881f0a4 Simplify cc library sdk snapshot handling of include dirs/headers
Previously, the code for generating a snapshot of a cc library was
split into two separate phases. The first phase copied the files that
needed copying and the second phase added the properties for the
include dirs. This separation made it difficult to make sure that the
two phases were in sync.

This change merges those two phases together so the same paths used to
copy the files are used in the properties ensuring consistency. As the
various type of include dir and header were treated slightly different
to each other this parameterizes that behavior.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: I7877464987bbdae9662e5e3f02bb5e5a75dca5a3
Change-Id: I7877464987bbdae9662e5e3f02bb5e5a75dca5a3
2020-04-22 12:51:25 +01:00
Paul Duffin
28246ac9ee Add support for transforming a property set after its contents
This change adds support for transforming a property set after its
contents. This allows a transform to recursively prune empty property
sets that were created for a module.

The transformPropertySet method was renamed to
transformPropertySetBeforeContents and a new
transformPropertySetAfterContents method was added.

Bug: 148933848
Bug: 153306490
Test: m nothing
Merged-In: Ia198d47e042b98c69406db4bc12859869816a387
Change-Id: Ia198d47e042b98c69406db4bc12859869816a387
2020-04-22 12:51:25 +01:00
Paul Duffin
853b8dbe0e Add cc_prebuilt_library_headers
In preparation for adding cc_library_headers support to
sdk/module_exports.

Two changes were needed to make the prebuilt version work.
1) Had to stop the prebuilt version of the library from creating static
   and shared variants for header only.
2) Had to allow the code to export/reexport include dirs to run even
   when no src is provided.

Bug: 148933848
Bug: 153306490
Test: m nothing
Merged-In: Idd50ed38bc90d1d93551f78e6310f167941487d9
Change-Id: Idd50ed38bc90d1d93551f78e6310f167941487d9
2020-04-22 12:51:24 +01:00
Paul Duffin
598e1e0255 Fix issues with bp transformation
Returning nil from transformPropertySet in order to remove it did
not work because it ends up comparing as (*bpPropertySet, nil) and
not an untyped nil which causes the test against nil to fail.

This change adds tests to check that returning nil will delete a
property/property set from the containing property set and fixes the
code so that it passes the tests. It extracts common code to transform
a property set and its contents as well as code for creating new
property sets.

Bug: 148933848
Bug: 153306490
Test: m nothing
Merged-In: I35dc3c39c76e701821891622615c09b094cf697f
Change-Id: I35dc3c39c76e701821891622615c09b094cf697f
2020-04-22 12:51:24 +01:00
Paul Duffin
246ac3092f Separate cc_library_headers to its own file and add tests
Preparation for adding cc_library_headers to sdk.

Bug: 148933848
Bug: 153306490
Test: m nothing
Merged-In: Icbc86b21f44dc79393b82be339cf3b133cbf9d8c
Change-Id: Icbc86b21f44dc79393b82be339cf3b133cbf9d8c
2020-04-22 12:51:09 +01:00
Paul Duffin
ac897cfdf7 Allow compile_multilib to be specified on module exports
This is needed to allow the art-host-module-exports to restrict itself
to just managing the linux 64 bit version of the host tools as that is
the only variant that is currently supported by all host tools. This
greatly simplifies that process and allows us to make progress on the
unbundling.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: I62d016d97c2df73e5feecf912638f477fedd97c9
Change-Id: I62d016d97c2df73e5feecf912638f477fedd97c9
2020-04-22 12:51:06 +01:00
Inseob Kim
eb59165dee Add C++ Host support on sysprop_library
With Host_supported: true, C++ part of sysprop_library will create host
variant which can be used from host modules. As there are no native
system property support on host, libbase functions will be used instead.
Adding support on host will help reduce code complexity of other
host_supported modules.

Bug: 147708854
Bug: 153306490
Test: m, sysprop_test, manually test host binary
Merged-In: I850d91fea298ef1a0c16c6a7a9ec1aca5cf37e69
Change-Id: I850d91fea298ef1a0c16c6a7a9ec1aca5cf37e69
2020-04-22 12:50:22 +01:00
TreeHugger Robot
d50865fcec Merge "Skip version mutator for host/ramdisk/recovery" into rvc-dev 2020-04-22 09:08:17 +00:00
TreeHugger Robot
077630ad2c Merge "Make sure car-lib system APIs are not changing unintentionally" into rvc-dev 2020-04-21 23:21:07 +00:00
Stephen Hines
2cc74a9621 Merge "Switch to clang-r377782d (10.0.6)." into rvc-dev 2020-04-21 21:43:18 +00:00
Oliver Nguyen
6f641c1cac Only package gcno files for gcov coverage builds.
Bug: 154550223
Test: m -j NATIVE_COVERAGE=true droid dist tests
Test: m -j CLANG_COVERAGE=true droid dist tests
Change-Id: I81598bcab8db105de6692156c001fc961409ce63
2020-04-21 12:40:27 -07:00
Makoto Onuki
91ec494500 Make sure car-lib system APIs are not changing unintentionally
Soon had a special rule to skip the "released-api" compatibility
check on the car-lib system API. We should enable it.

Bug: 154632388
Test: m droid
Change-Id: Ib4e584def7e786e3e129cd2bfb23958ac9b4b72d
2020-04-21 12:01:04 -07:00
Artur Satayev
695ddadcb4 Merge "Remove Android compat annotations on jarjar transform." into rvc-dev 2020-04-21 10:42:10 +00:00
Artur Satayev
a479d943dd Remove Android compat annotations on jarjar transform.
Set a system property to enable Android specific transformer that drops
UnsupportedAppUsage annotation for repackaged classes to avoid adding
unneeded hidden api symbols on jarjar.

Bug: 146418363
Test: m, manual diff hiddenapi-flags.csv
Exempt-From-Owner-Approval: patch approved by owner
Change-Id: I10b49feb15257301574162b5d389cbc30277f672
Merged-In: I10b49feb15257301574162b5d389cbc30277f672
(cherry picked from commit 762d9f38af)
2020-04-20 16:22:42 +01:00
Jeongik Cha
8691f3f75c Apply EnforceRROExemptedTargets in Soong
As PRODUCT_ENFORCE_RRO_EXEMPTED_TARGETS is defined in make, define it in
soong accordingly

Bug: 150820813
Test: m
Change-Id: I309482b6ad439a7602127f68f2f7ffa856b9e192
Merged-In: I309482b6ad439a7602127f68f2f7ffa856b9e192
2020-04-20 14:02:23 +00:00
Jiyong Park
d5e0ea25d1 Don't run apex_available check for coverage builds
Coverage build adds extra dependencies for the runtime libs. Marking
them and their transitive dependenciese with apex_available doesn't make
any value; it instead adds noise.

Exempt-From-Owner-Approval: cherry-pick from AOSP

Bug: 150999716
Test: m
Merged-In: I08e51cec1de6ded624ef9d4c41c1e5b2e611ff38
(cherry picked from commit 58d1090032)
Change-Id: I08e51cec1de6ded624ef9d4c41c1e5b2e611ff38
2020-04-20 16:26:18 +09:00
Jiyong Park
d182e5512f Remove some apex_available whitelist for the adbd APEX
The marked library(ies) were available to the adbd APEX via the
hand-written whitelist in build/soong/apex/apex.go. Trying to remove the
whitelist by adding apex_available property to the Android.bp of the
libraries.

Exempt-From-Owner-Approval: cherry-pick from AOSP

Bug: 150999716
Test: m
Merged-In: I6afbe905dda11056559521b937803dcd85b32fe5
(cherry picked from commit 3a0db5ef4e)
Change-Id: I6afbe905dda11056559521b937803dcd85b32fe5
2020-04-20 16:24:20 +09:00
Jiyong Park
24eec07f47 Make ndk_prebuilt_* be available to any apex
The NDK prebuilts are implicitly used when building with sdk_version set.
Make the module types be available to any apex so that we don't need to
manually add apex_available property to the module definitions manually.

Exempt-From-Owner-Approval: cherry-pick from AOSP

Bug: 150999716
Test: m

Merged-In: I0870afa4c74b4a06ab1273dff84615778561ecc9
(cherry picked from commit e01e228270)
Change-Id: I0870afa4c74b4a06ab1273dff84615778561ecc9
2020-04-20 16:23:46 +09:00
Jiyong Park
2416c2903e Remove some apex_available whitelist
The marked library(ies) were available to the APEXes via the hand-written
whitelist in build/soong/apex/apex.go. Trying to remove the whitelist
by adding apex_available property to the Android.bp of the libraries.

Exempt-From-Owner-Approval: cherry-pick from AOSP

Bug: 150999716
Test: m
Merged-In: I91d1b1076733a949ca2a959ba640ce34d0233492
(cherry picked from commit 541142ce6b)
Change-Id: I91d1b1076733a949ca2a959ba640ce34d0233492
2020-04-20 16:22:56 +09:00
Anton Hansson
39a06440cd Merge "Remove _API_FILE variables" into rvc-dev 2020-04-19 07:54:27 +00:00
Anton Hansson
336f63cfb2 Remove _API_FILE variables
There are no known usages of these variables, and many have been
incorrectly set for a long time.

Also convert the <module> phony for api txt to androidmk.

Bug: 152479829
Test: m
Change-Id: Iff355041d88eb59ac47dd19a03e993cf1ce3927e
Merged-In: Iff355041d88eb59ac47dd19a03e993cf1ce3927e
2020-04-18 10:15:11 +01:00
Stephen Hines
57a45f1304 Switch to clang-r377782d (10.0.6).
Bug: http://b/153164546
Test: Built aosp_blueline successfully. Kernel also verified without
needing workarounds from LLD crash.

Change-Id: I41ae5a5be0065da98dd941b16196a3f4888b86b1
Merged-In: I41ae5a5be0065da98dd941b16196a3f4888b86b1
(cherry picked from commit 883a0fdfd9)
2020-04-17 17:39:04 -07:00
TreeHugger Robot
5d42863476 Merge "Don't check elf properties of python prebuilts" into rvc-dev 2020-04-16 17:13:33 +00:00
Artur Satayev
735be9a37a Merge "Allow defining neverallow in packages other than android." into rvc-dev 2020-04-16 13:34:40 +00:00
Artur Satayev
0f43edcfc7 Merge "Check updatable APKs compile against managed SDKs." into rvc-dev 2020-04-16 13:34:39 +00:00
Artur Satayev
b39ea9b61c Allow defining neverallow in packages other than android.
This exposes test func on ValueMatcher and helpers relevant for testing neverallows.

Bug: 153333044
Test: m
Change-Id: Ied07cd33afa537f9d7aa3c33e59f4ac985901a0f
Merged-In: Ied07cd33afa537f9d7aa3c33e59f4ac985901a0f
Exempt-From-Owner-Approval: clean cherry-pick
(cherry picked from commit c5570ac9b1)
2020-04-16 13:34:31 +00:00