Commit Graph

255 Commits

Author SHA1 Message Date
Colin Cross 81ca6cd407 Add alias variations to linkageMutator
Alias the shared variation if it exists, otherwise the static variation.
This allows modules that are not aware of shared library variations
(like cc_genrule) to depend on shared libraries by depending on
just the normal image, os and arch variations.

Bug: 162437057
Test: TestLibraryGenruleCmd
Change-Id: Icec57d43538e01ab05cc50d4e3f9a11cc55f0162
2020-08-06 18:46:06 -07:00
Colin Cross 094faa5b26 Use local variations for versionsMutator
Use local variations and an alias for the "" variation for
versionMutator.  Local variations are used here because the variation
of one module doesn't affect the variation it should depend on - a
module with variation version:29 will manually link against dependencies
with the correct version variation, and don't need it to be automatically
resolved.  The alias allows other modules to depend on a module
mutated by the version mutator without specifying the version: ""
variation.  This allows removing the variation on genrule modules.

The motiviation here is to make sure versionMutator calls AliasVariation,
which will allow the previous linkageMutator to also use AliasVariation.

Bug: 162437057
Test: no change to build.ninja, make_vars-aosp_crosshatch.mk, Android-aosp_crosshatch.mk or late-aosp_crosshatch.mk
Change-Id: Ibb030cc4334e47511b8ab5bc3eb8a5ae39ad0023
2020-08-06 18:46:06 -07:00
Colin Cross 6e511a9a9f Add libraryDependencyTag to track dependencies on static and shared libraries
dependencyTag uses a set of predefined tags to identify different types
of dependencies.  There are already multiple bits of metadata stored
in the dependency tag (Library, Shared, ReexportFlags), and supporting
them all requires a combinatorial explosion of predefined tags and
causes issues when using equality comparisons if a new bit of metadata
is added.

Add a new libraryDependencyTag type that will contain the metadata
bits, and replace the quality comparisons with checks on the metadata
bits.

There are 5 TODOs where modifying the checks identified problems with
the existing checks.  These were left in place to produce identical
build output and will be fixed separately.

Bug: 162437057
Test: no change to build.ninja or {Android,make_vars,late}-${TARGET_PRODUCT}.mk
Change-Id: I72d4207dcf381c07c92e00e5a03968ebb5ed8d30
2020-07-29 13:22:30 -07:00
Jingwen Chen 40fd90ae52 Support multiple dists per Android.bp module, and dist output selection.
This CL adds "dists" to the base property struct to support multiple
dist file configurations, and generic tag support to dist tagged outputs
of modules.

Fixes: b/152834186
Test: soong tests and `m sdk dist`

Change-Id: I80c86bc9b7b09e671f640a4480c45d438bdd9a2a
Signed-off-by: Jingwen Chen <jingwen@google.com>
2020-06-25 12:42:07 +00:00
Treehugger Robot 6116ffdcf5 Merge "Don't create version variants for SDK variants" 2020-06-17 04:19:04 +00:00
Jiyong Park 2286afd0ef Don't create version variants for SDK variants
When a lib has sdk_version set, an SDK variant and a platform variant
are created by the sdkMutator. Then by the versionMutator, if the
library had 'stubs.versions' property, one or more versioned variants
and one impl variant are created for each of the two (SDK and platform)
variants. As a concrete example,

cc_library {
    name: "foo",
    sdk_version: "current",
    stubs: { versions: ["1", "2"], },
}

would create 6 variants:

1) (sdk: "", version: "")
2) (sdk: "", version: "1")
3) (sdk: "", version: "2")
4) (sdk: "sdk", version: "")
5) (sdk: "sdk", version: "1")
6) (sdk: "sdk", version: "2")

This is somewhat uncessary because the need for the SDK mutator is to
have the platform variant (sdk:"") of a lib where sdk_version is unset,
which actually makes sens for the impl variant (version:""), but not
the versioned variants (version:"1" or version:"2").

This is not only unncessary, but also causes duplicate module
definitions in the Make side when doing an unbundled build. Specifically,
The #1 and #4 above both are emitted to Make and get the same name
"foo".

To fix the problem and not to create unnecessary variants, the versioned
variants are no longer created for the sdk variant. So, foo now has
the following variants only.

1) (sdk: "", version: "") // not emitted to Make (by versionMutator)
2) (sdk: "", version: "1") // not emitted to Make (by versionMutator)
3) (sdk: "", version: "2") // emitted to Make (by versionMutator)
4) (sdk: "sdk", version: "") // not emitted to Make (by versionMutator)

Bug: 159106705
Test: Add sdk_version:"minimum" to libnativehelper in libnativehelper/Android.bp.
m SOONG_ALLOW_MISSING_DEPENDENCIES=true TARGET_BUILD_UNBUNDLED=true libnativehelper

Change-Id: I6f02f4189e5504286174ccff1642166da82d00c9
2020-06-17 04:18:21 +00:00
Inseob Kim 96f17f0eed Choose SAbi files with module's vndk version
No matter what BOARD_VNDK_VERSION is set to, VNDKs should be regarded as
PLATFORM_VNDK_VERSION. This fixes an abidiff error due to the version
mismatch.

Bug: 157106227
Test: manual test with BOARD_VNDK_VERSION
Change-Id: I0d262b8ee5ac6f40fea7c2fb18322531434c0b4b
2020-06-09 22:05:09 +09:00
Inseob Kim 04f2d6a675 Capture libeigen's header correctly
libeigen exports entire directory, but only two directories contain
actual exported headers. And some of headers have no extension. This
adds a special behaviour for external/eigen when capturing snapshot.

Exempt-From-Owner-Approval: cherry-pick from internal branch

Bug: 157106227
Test: m vendor-snapshot captures libeigen's headers
Change-Id: I82f27d4c6c4d472f47d54c545328150697b8cda3
Merged-In: I82f27d4c6c4d472f47d54c545328150697b8cda3
(cherry picked from commit 67f3dbca2f)
2020-06-01 01:07:48 +00:00
Martin Stjernholm 391d94c283 Append whole_static_libs deps from .a files instead of the list of
objects.

Necessary to make whole_static_libs work with
cc_prebuilt_library_static since it doesn't propagate the list of
object files.

Test: Build & boot
Test: m libsigchain && \
  ar t out/soong/.intermediates/art/sigchainlib/libsigchain/android_arm64_armv8-a_cortex-a73_static/libsigchain.a
  (Check that the list is sigchain.o followed by async_safe_log.o, both
  in a normal build and in one where async_safe is a prebuilt static
  lib.)
Bug: 154248570
Change-Id: Iaada8490ce713c13804b5771ad606f4a27e72a2f
2020-05-14 17:54:20 +01:00
Hsin-Yi Chen 9105fa385a Merge "Add check_all_apis option for header ABI checker" 2020-04-27 03:34:08 +00:00
Jooyung Han 28a49820e4 Merge "Apex: support codenames for min_sdk_version" 2020-04-25 04:41:44 +00:00
Jooyung Han 624d35cb4d Skip version mutator for host/ramdisk/recovery
"version" mutator creates stubs variants for "cc" libraries with
"stubs.versions". These stubs are for APEX-APEX or APEX-Platform
boundaries.

For host/ramdisk/recovery variants, stubs are not necessary.

Exempt-From-Owner-Approval: cp from internal

Bug: 153698496
Test: m
Merged-In: Id576c4318d9d69246a4a7e2fb4145d5fd2ab9416
Change-Id: Id576c4318d9d69246a4a7e2fb4145d5fd2ab9416
(cherry picked from commit c40b5193fe)
2020-04-23 03:46:09 +00:00
Treehugger Robot e152ada4e7 Merge "Fix missing NOTICE targets for static libs that aren't available to platform." 2020-04-14 13:43:46 +00:00
Jooyung Han aed150d6ed Apex: support codenames for min_sdk_version
Apex can use codenames like "Q", "R" for its min_sdk_version property.
Also, cc_library can use codenames for its stubs.versions.

Bug: 152655956
Test: m
Merged-In: I077ad7b2ac5d90b4c8708921e43846206f05ba70
Change-Id: I077ad7b2ac5d90b4c8708921e43846206f05ba70
(cherry picked from commit 29e91d2121)
2020-04-09 16:04:17 +09:00
Colin Cross ff550f3e13 Merge "Revert^2 "Add sdk mutator for native modules"" 2020-04-08 18:29:30 +00:00
Colin Cross c511bc50dc Revert^2 "Add sdk mutator for native modules"
f8e80229fe

Change-Id: Ic30ab6b844684bfc3e8ece5a1913980d5fbf8de2
2020-04-07 16:50:32 +00:00
Colin Cross f8e80229fe Revert "Add sdk mutator for native modules"
Revert submission 1242911-sdk_version_variant

Reason for revert: b/153394225
Reverted Changes:
Ife99745fb:Use libnativewindow for platform variant of libagq...
I1bae84c43:Use libnativewindow for platform variant of androi...
I6e6021ed3:Use stl to depend on libc++
Ife99745fb:Use libnativewindow for platform variant of libRSS...
I2c9f439b9:Fix static dependency on libprotobuf-cpp-lite-ndk
Iff2aff9cf:Set sdk_version for cc_genrules used by modules wi...
I7d72934aa:Add sdk mutator for native modules
Ief378a007:Use sdk variant of Soong modules when LOCAL_SDK_VE...

Bug: 149591340
Change-Id: I798fa902c779469c6382b6699351e5d12bf14785
Fixes: 153394225
2020-04-07 04:21:21 +00:00
Martin Stjernholm bdd0dffc1b 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
Change-Id: Ic79f89bc6d11d0b6552fa20791f5680ff9a40c0d
2020-04-06 23:03:53 +01:00
Martin Stjernholm c5dd4f7c1f 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
Change-Id: I31b928e6261198b6dd6f6b17196e714f07b64172
2020-04-02 22:39:12 +01:00
Colin Cross 82e192c3ae Add sdk mutator for native modules
Compiling native modules against the NDK disables platform features
like ASAN.  For anything shipped on the system image there is no
reason to compile against the NDK.  Add a new mutator to Soong that
creates a platform and an SDK variant for modules that set
sdk_version, and ignore sdk_version for the platform variant.  The
SDK variant will be used for embedding in APKs that may be installed
on older platforms.  Apexes use their own variants that enforce
backwards compatibility.

Test: sdk_test.go
Test: TestJNIPackaging
Bug: 149591340
Change-Id: I7d72934aaee2e1326cc0ba5f29f51f14feec4521
2020-04-01 16:09:05 -07:00
Martin Stjernholm bf37d165f0 Fix missing NOTICE targets for static libs that aren't available to
platform.

The NOTICE file generation depends on the NOTICE targets for all static
library dependencies. If such a dependency didn't have
//apex_available:platform it didn't get any AndroidMk entry and hence
no NOTICE target via soong_cc_prebuilt.mk. If it was then depended upon
by a binary or library that is accessible to platform, the NOTICE
dependency failed.

Normally such a dependency is invalid, but there are corner cases where
binaries go neither into platform nor any APEX module, and they can
legitimately have such dependencies (cf. b/152241137).

With this CL requests to skip installation of such a static libraries
are ignored so that they get AndroidMk entries, which will always have
LOCAL_UNINSTALLABLE_MODULE set.

Test: "m simpleperf_ndk" with https://r.android.com/1273016, which
  removes //apex_available:platform from libs that simpleperf_ndk
  depends on statically.
Bug: 152241137
Bug: 149217815
Change-Id: If36e85dd16ade56d4ec1d6744811df5a15b6242c
2020-04-01 11:08:41 +01:00
Hsin-Yi Chen 74b2c7cb38 Merge "Fix the logic for selecting ABI dump paths" 2020-03-31 02:30:55 +00:00
Hsin-Yi Chen 27d235f918 Fix the logic for selecting ABI dump paths
A library may have both VNDK variant and stubs. getRefAbiDumpFile should
differentiate its vendor and core variants.

Bug: 152277104
Test: Add dumps to platform/ and vndk/ ; make libselinux.vendor libselinux
Change-Id: Iad038cf4cd3eccc3dfbef13fab67da044498ce77
2020-03-26 18:09:30 +08:00
Treehugger Robot d9578f563e Merge "Propagate empty vs unspecified system_shared_libs correctly." 2020-03-26 09:40:15 +00:00
Martin Stjernholm 10566a035f 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
Change-Id: If2e8a5296223e6281d833312660e8e9e4cd184c0
2020-03-25 23:19:37 +00:00
Jooyung Han 61b66e9b34 Revert "Revert "Enforce min_sdk_version of apex(use_vendor:true)""
This reverts commit bacf34d986.

Reason for revert: reland with fix

Change-Id: Ia03f2808353f5640597ae7ecbf2e06fc903c6977
2020-03-21 23:23:14 +09:00
Jooyung Han b1eb4d4a94 Merge "Revert "Enforce min_sdk_version of apex(use_vendor:true)"" 2020-03-21 14:00:24 +00:00
Jooyung Han bacf34d986 Revert "Enforce min_sdk_version of apex(use_vendor:true)"
This reverts commit 380fc3615c.

Reason for revert: breaking one of internal targets

Change-Id: Ica96c44078e5a7f674410828af3ba851317775dd

Exempt-From-Owner-Approval: revert to fix build failure
2020-03-21 13:59:12 +00:00
Paul Duffin 3dcf75d343 Merge "Add support for using cc_library in sdk/module_exports" 2020-03-21 09:50:28 +00:00
Paul Duffin 9b76c0b65a Add support for using cc_library in sdk/module_exports
Added link type support in module creation code as cc_prebuilt_library
has to provide both shared and static libraries.

Had to add some calls to FirstUniquePaths() around the include dirs
settings in library_sdk_member as otherwise the shared variant contains
duplicate include dirs (presumably because it gets one set from its
dependency on the static variant and one set of its own). That
difference in include dirs causes problems in the generated
cc_prebuilt_library.

Test: m nothing
Bug: 142918168
Change-Id: Ie7f23fc2341c83c7814cc98e3970df4f5d4c8423
2020-03-20 16:55:24 +00:00
Jooyung Han 380fc3615c Enforce min_sdk_version of apex(use_vendor:true)
Even though use_vendor:true is prohibited, there is media.swcodec apex
which is still use_vendor: true and also needs to support Android10.
(min_sdk_version: 29)

Because LLNDK stubs were provided only for the current VNDK version,
media.swcodec couldn't be built against min_sdk_version: 29.

This change introduces additional versions for LLNDK stubs which are
enforced when an apex with use_vendor: true sets min_sdk_version.

To make things easier, the versions of LLNDK stubs are borrowed from its
implementation libraries.

Bug: 147450930
Bug: 149591522
Test: TARGET_BUILD_APPS=com.android.media.swcodec m
      (with min_sdk_version: 29 set)
      check if liblog/libc/libm/libdl stubs are 29
      check if 29 stubs don't have new symbols.

Change-Id: I79946cbb4da6617138a96d2b254349d3a298e77b
2020-03-17 15:36:39 +09:00
Jooyung Han b04a4997b8 cc: fix a utility to make C macro name
Use the result of regex.ReplaceAllString()

Bug: 149591522 (not directly related to this)
Test: m (with new unit test)
Change-Id: Ifce07547ccc067f1ee5bd8467c2fb7d7f8387b8e
2020-03-17 15:36:39 +09:00
Paul Duffin 13f0271478 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
Test: m nothing
Change-Id: Ia8509ffe79b208c23beba1880fe9c8a92b732685
2020-03-13 11:14:07 +00:00
Paul Duffin 0cb37b9ce1 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
Test: m nothing
Change-Id: I4cb294c2b0c8a3f411eea569775835d9e41726d6
2020-03-11 18:31:45 +00:00
Jooyung Han ad4c18765e Add version suffix for stub modules' Android.mk
Becase there can be more than one stub libraries, LOCAL_MODULE should be
suffixed with SubName just like NDK stub.

Note that suffix should not be appended to the latest version if the
library is provided by APEX, Otherwise, those libs always need to be
referenced with suffix in .mk files.

Bug: 145796956
Test: m
Change-Id: If503fa651a63b0b215742553b250ecf5e0a30971
2020-03-07 03:12:45 +09:00
Inseob Kim eda2e9c728 Capture snapshot headers in parallel
VNDK and vendor snapshot singleton work in a single thread, so globbing
in singleton results in ridiculus running time. Moving codes to
GenerateAndroidBuildActions to reduce running time.

Bug: 150406226
Test: VNDK_SNAPSHOT_BUILD_ARTIFACTS=true m dist vndk vendor-snapshot
Test: vendorSnapshotSingleton build time became 0.56s (from 10s)
Test: build.ninja building time became 1m11s (from 1m21s)
Change-Id: I4a081eef5847c62ca00280ca426f5b4e10f87b59
2020-03-04 23:39:42 +09:00
Logan Chien 2a65dda27d Add check_all_apis option for header ABI checker
This commit adds a header ABI checker option to check all APIs that can
be found.  Without this option, the checker by default only checks the
class/struct/enum that are directly or indirectly referred by one of the
exported symbols.  With `check_all_apis: true,`, the checker will check
all class/struct/enum.

Bug: 141709599
Test: Add `header_abi_checker: { check_all_apis: true, }` to a library
      and see breakage if I change some enum.
Change-Id: I61f90e07b60a6752fc6be4398420c1ad1291102f
2020-02-26 09:25:40 +00:00
Paul Duffin f5ea9e1f76 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
Test: m nothing
Change-Id: Idd50ed38bc90d1d93551f78e6310f167941487d9
2020-02-24 14:49:22 +00:00
Paul Duffin 1c6c1c7251 Separate cc_library_headers to its own file and add tests
Preparation for adding cc_library_headers to sdk.

Bug: 148933848
Test: m nothing
Change-Id: Icbc86b21f44dc79393b82be339cf3b133cbf9d8c
2020-02-24 14:49:22 +00:00
Jaewoong Jung 3aff5787e2 Simple refactoring of prefix related functions.
Rename the two prefix-in-list funcs so that their usages are clearer.
Also find and replace all the code that essentially does either.

This introduces additional loops in some places, but I think the added
readability and simplicity outweighs the performance degradation, which
should be negligible anyway.

Test: m nothing
Test: TreeHugger
Change-Id: I37e2276ca0c815105ed0031f23c0b1264b480e4f
2020-02-14 14:33:49 -08:00
Vic Yang 1a5812a262 Disable no-vendor-variant VNDK for CFI modules
If CFI is enabled for a module, no-vendor-variant VNDK will fail
because CFI is not used for the vendor variant.

Bug: 148638729
Test: Remove libstagefright_bufferpool@2.0 from the whitelist. Build on
      crosshatch is successful. Build on a ARM32 device with
      TARGET_VNDK_USE_CORE_VARIANT set and check no-vendor-variant VNDK
      is still enabled for libstagefright_bufferpool@2.0.

Change-Id: Ib0a411d7ea769097186afa802751b0796527ec76
2020-01-31 10:41:27 -08:00
Steven Laver 025d98162b Don't check library variant identicalness for VNDK extensions
These libraries don't have a core variant against which to check
for identicalness.

Bug: 148526685
Test: built a previously failing target with this change (succeeded)
Change-Id: Ide8ec58df1868175f52c005bf73bb81fc196a571
2020-01-29 08:23:09 -08:00
Yifan Hong cf4832c8bc Add target.ramdisk
Add the following:
- exclude_shared_libs
- exclude_static_libs
- static_libs

Allow to customize linking for ramdisk variant.

Test: pass
Bug: 147347110
Change-Id: I6f55f11a6fdad8029d85833a3eedc2e95a712d51
2020-01-22 16:54:18 -08:00
Yifan Hong 1b3348d50a Add ramdisk image.
It is similar to recovery image.
Test: m nothing -j

Change-Id: I11389777c6bfb0c0d73bbb4c70091c1e70f44077
2020-01-22 16:54:18 -08:00
Vic Yang d92090fb29 Emit LOCAL_CHECK_SAME_VNDK_VARIANTS
If a VNDK library does not require using different core and vendor
variants, emit LOCAL_CHECK_SAME_VNDK_VARIANTS so that the two variants
can be checked for identicalness.

Bug: 145157349
Test: With the corresponding change in build/make, remove libbinder
      from build/soong/cc/config/vndk.go and check a build fails
      even without TARGET_VNDK_USE_CORE_VARIANT set.

Change-Id: I7698edf9a24b0df150c0e4f7d8dd4926f053eee8
2020-01-08 14:44:38 -08:00
Paul Duffin a0843f6a6f Differentiate between cc library and binary
The cc library and cc binary (and other cc module types) are all
instances of cc.Module. So, to differentiate between them and make
sure that only appropriate library instances can be added to
native_shared/static_libs this adds a special sdkMemberTypes field to
Module which if set specifies the SdkMemberTypes the module supports.
If it is not set then the module type cannot be used in the sdk at all.

Corrects an issue with one of the tests where a prebuilt cc
library was added to the sdk instead of a source cc library.

Adds a new test to ensure that cc_library_(shared|static)_host module
types work with the sdk as well and another test to ensure that
cc_library can be used as either.

Bug: 142918168
Test: m checkbuild
Change-Id: I359cdbdd15328ca571f276d2b6ce9a229ebb2c86
2019-12-20 15:45:17 +00:00
Paul Duffin 6c26dc7392 Dedup cc library module type registration
Test: m checkbuild
Bug: 146540677
Change-Id: I6685338550f587212e70f3eba8d4342b66f566e2
2019-12-20 15:22:52 +00:00
Paul Duffin 2f6bc09fee Separate sdk membership support out of cc/library.go
Bug: 142918168
Test: m checkbuild
Change-Id: I4a7f2af8e0b41feca2b5a431b42ad03bbfe94b0c
2019-12-13 10:43:10 +00:00
Paul Duffin 57b9e1da75 Improve handling of generated include dirs
The exported include dirs includes both source and generated
directories (e.g. containing aidl generated headers). The latter are
always arch specific so if they are present they make all the include
directories arch specific.

This change separates the source and generated include dirs so that
the source include dirs (which are probably not arch specific) can be
optimized separately from the arch specific generated include dirs.

The FilterPathList() func was refactored to extract the more general
FilterPathListPredicate() func.

A number of tests needed to be updated to reflect the more optimal
snapshot creation.

Bug: 142918168
Test: m checkbuild
Change-Id: Id1a23d35a45b250ae2168834f9c2a65c86a5fd77
2019-12-13 09:59:48 +00:00
Paul Duffin a7cd8c8344 Generalize common property extraction
Previously, code that attempted to optimize the generated .bp rules
treated the properties structure as a single entity. So, a single arch
specific value would cause all properties to be treated as arch
specific. Also, that code was specific to one structure type.

This generalizes the optimization to work with any properties structure
which will be helpful for other multi-variant module types. It also
treats each property separately.

The hasArchSpecificFlags field has been removed from nativeLibInfo and
a commonProperties field has been added instead into which the common
values will be found. File path creation that conditionally prefixed a
path with archType has been replaced with general code that relies on
archType being "" for common properties and filepath.Join(..) ignoring
empty string components.

The common and arch variant properties are always processed. The first
within the context of the .bp module's property set and the latter
within an arch specific property set. There are always some properties
that are arch specific, e.g. outputFile, so there is no need to worry
about an empty arch property set being created.

The archSpecificNativeLibInfo type was renamed nativeLibInfoProperties
as it may not be arch specific.

The printExportedDirCopyCommandsForNativeLibs variable was renamed to
addExportedDirCopyCommandsForNativeLibs as it no longer does any
printing.

Bug: 142918168
Test: m checkbuild
Change-Id: Iad45913299c37fd76fe03ed0ca68bdc68ed76431
2019-12-13 09:59:48 +00:00