Commit graph

20277 commits

Author SHA1 Message Date
Paul Duffin
3c7c34769d Parameterize scopes with additional droidstubs args
Added droidstubsArgs field to the apiscope structure to avoid
switching on api scope type.

Bug: 153443117
Bug: 153306490
Test: m nothing
Merged-In: I96f0eb033d44c6a74787ba7f1523799b05a58092
Change-Id: I96f0eb033d44c6a74787ba7f1523799b05a58092
2020-04-22 12:51:49 +01:00
Paul Duffin
cbcfcaa113 Replace references to droiddoc with droidstubs
The java_sdk_library code used to create droiddoc and now it creates
droidstubs but it still referenced droiddoc internally. This change
removed all the remaining references except the ones that are visible
externally.

Bug: 153443117
Bug: 153306490
Test: m nothing
Merged-In: Ie883eb4590f9c091d4149d7b17d7d3d91b1b5c6a
Change-Id: Ie883eb4590f9c091d4149d7b17d7d3d91b1b5c6a
2020-04-22 12:51:49 +01:00
Paul Duffin
133608f602 Allow walkPayloadDeps visitor to control walk flow
Delegate the responsibility for determining whether the
walkPayloadDeps() should visit a child dependency to its do function.
This is needed to allow the visitor in checkApexAvailability() to avoid
checking the apex_available setting after crossing the APEX boundary.

Bug: 152878661
Bug: 153306490
Test: m droid
Merged-In: If46a2f74b6eca670befc3aeae430650e85542346
Change-Id: If46a2f74b6eca670befc3aeae430650e85542346
2020-04-22 12:51:48 +01:00
Paul Duffin
ebb7af6969 Add apex_available to sysprop_library
Added apex_available support to sysprop_library and copied it onto the
underlying cc_library.

Bug: 152762638
Bug: 153306490
Test: m nothing
Merged-In: I8f4c539532b48f3a45c1fbf0f7287db11df69d2f
Change-Id: I8f4c539532b48f3a45c1fbf0f7287db11df69d2f
2020-04-22 12:51:48 +01:00
Paul Duffin
868ecfde70 Improve missing apex_available message
The apex available check can traverse quite a long path (5+ steps) to
get from the apex to a module that is missing the apex from its
apex_available property. Understanding where that dependency came from
can often require examining the dependency path which can be difficult.
This change adds the path to the error to simplify that process.

Bug: 153306490
Test: m nothing
Bug: 152762638
Merged-In: Ic4eb169dc2026cd8339d49e23b25d6d1c3879750
Change-Id: Ic4eb169dc2026cd8339d49e23b25d6d1c3879750
2020-04-22 12:51:47 +01:00
Paul Duffin
de7464cddc Split TestApexAvailable into separate tests
Having multiple tests within one method makes debugging specific
failures more difficult so this change split the TestApexAvailable
test into multiple separate tests.

Bug: 153306490
Test: m nothing
Bug: 152762638
Merged-In: I2b2408ef515fd79c078686ef29a6ee8fb0407e7e
Change-Id: I2b2408ef515fd79c078686ef29a6ee8fb0407e7e
2020-04-22 12:51:46 +01:00
Paul Duffin
88bc97a669 Use reflect.Zero(type) to get value to clear field
Previously, the common value extraction code used an empty structure
to get the value to use to clear a field whose value is common. This
change removed the structure and used reflect.Zero(..) to get the
value instead.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Ibd5103dacb86e7754a786356c0d15ffbde7f98bf
Change-Id: Ibd5103dacb86e7754a786356c0d15ffbde7f98bf
2020-04-22 12:51:46 +01:00
Paul Duffin
2b5887a8f9 Sdk snapshot set compile_multilib per OsType
Previously, when an sdk snapshot only supported a single os type the
compile_multilib was set based on the multilib usages by the members
of that variant. After the change to support multiple os types per
snapshot the multilib setting was based on the multilib usages across
all the members of all sdk variants. That meant that if one os type
used only "64" and the other used "both" then they would both be
treated as "both" leading to missing variants when the snapshot was
unpacked.

This change tracks the multilib usages per os type and adds a property
for each one.

It intentionally changes a couple of tests:
1) Either by adding compile_multilib that is missing.
2) By targeting it at a specific os type instead of host.

The latter change is important to prevent the snapshot from being
used on a host platform (which will match the host target section)
but which is a different os type to the ones supported by the
snapshot.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: I883919b644292c3d019db223bb4fd5c11b39591f
Change-Id: I883919b644292c3d019db223bb4fd5c11b39591f
2020-04-22 12:51:45 +01:00
Paul Duffin
93520edca2 Remove old SdkMemberType API for creating snapshot modules
Migrates system modules and droid stubs over to use the new API for
creating the snapshot modules and removes the old API.

Bug: 153306490
Test: m nothing
Merged-In: Ia825767f1f7ee77f68cfe00f53e09e6f6bfa027f
Change-Id: Ia825767f1f7ee77f68cfe00f53e09e6f6bfa027f
2020-04-22 12:51:45 +01:00
Paul Duffin
c9103930a4 Improve consistency of handling java snapshot properties
Previously, java snapshot properties (java_library and java_test)
relied on the properties not being optimized when there was a single os
type and instead being added directly to the common os type properties.
However, that means that the behavior is inconsistent for other member
types depending on whether there was one os type or not.

This change updates the java sdk member handling to support
optimization. This involved:
1) Adding AidlIncludeDirs field to librarySdkMemberProperties to
   specify the aidl include dirs instead of extracting that from the
   library field.

2) Renaming jarToExport to JarToExport (in both
   library/testSdkMemberProperties)to allow it to be optimized.

3) Adding MemberType() and Name() methods to SdkMemberPropertiesContext
   to avoid having to store the former in the properties struct and
   retrieve the latter from the library/test fields.

4) Removing the now unused library/test fields from the properties
   structures.

5) Separating the processing of the jar/test config in
   AddToPropertySet(...) as they may be optimized separately.

6) Ditto for the jar/aidl include dirs.

7) While doing this work I noticed that although the contents of the
   aidl include dirs are copied into the snapshot the java_import does
   not make use of them. Raised bug 151933053 and added TODO to track
   that work.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Iba9799e111ca5672b2133568163d8c49837ba9cd
Change-Id: Iba9799e111ca5672b2133568163d8c49837ba9cd
2020-04-22 12:51:44 +01:00
Paul Duffin
17ab883cb0 Make new module creation API more flexible
Previously passing additional information to the implementations of
AddPrebuiltModule() or the SdkMemberProperties interface would have
required making changes to the API. This change added an
SdkMemberContext object into which additional information can easily
be added without requiring changes to existing implementations.

The BuildSnapshot() method was not modified because it is deprecated
and will be removed in a follow up change.

It also switches the API from passing variants as android.SdkAware to
android.Module. That is for a couple of reasons:
1) SdkAware is designed for managing the relationship between the
   module and the SDK, not for generating the output snapshot. As such
   there is nothing in SdkAware that is needed for generating the
   output snapshot.
2) Accepting android.Module instead makes it easier to use the
   underlying code for generating the snapshot module as well as the
   individual member modules.

This is in preparation for a number of improvements and bug fixes in
both the snapshot creation code and implementations to address found
while trying to built the platform against ART prebuilts.

Bug: 151937654
Bug: 153306490
Test: m nothing
Merged-In: Iac10f1200c0f283aa35402167eec8f9aeb65a38e
Change-Id: Iac10f1200c0f283aa35402167eec8f9aeb65a38e
2020-04-22 12:51:44 +01:00
Paul Duffin
5e2e0fd191 Add abstraction for tracking compile multilib usages
Ensures consistent tracking of multilib usages.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: I82ba4a53a21a0823503cb98f7edfde449b48b440
Change-Id: I82ba4a53a21a0823503cb98f7edfde449b48b440
2020-04-22 12:51:43 +01:00
Paul Duffin
6cb8f172b8 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.

Bug: 153306490
Test: m nothing
Bug: 142918168
Merged-In: Ie7f23fc2341c83c7814cc98e3970df4f5d4c8423
Change-Id: Ie7f23fc2341c83c7814cc98e3970df4f5d4c8423
2020-04-22 12:51:43 +01:00
Paul Duffin
57ee1774cb Extract the osTypeSpecificInfo code from module creation loop
Extract the functionality to create an osTypeSpecificInfo struct,
to optimize the properties, and add its properties to a property set
into methods of the *osTypeSpecificInfo struct.

This change is in preparation for adding support for link type which
is another dimension within arch type which itself sits within os type.

Bug: 153306490
Test: m nothing
Bug: 142918168
Merged-In: I025ee90e1461f7389bf4a9d056b281453068cf87
Change-Id: I025ee90e1461f7389bf4a9d056b281453068cf87
2020-04-22 12:51:42 +01:00
Paul Duffin
4a4b2d0b1b Extract archTypeSpecificInfo code from module creation loop
Extract the functionality to create an archTypeSpecificInfo struct and
to add its properties to a property set into methods of the
*archTypeSpecificInfo struct.

Bug: 153306490
Test: m nothing
Bug: 142918168
Merged-In: I2a9e0327b61bce7ad7699cd75de17aa0e5f1ebbb
Change-Id: I2a9e0327b61bce7ad7699cd75de17aa0e5f1ebbb
2020-04-22 12:51:41 +01:00
Paul Duffin
6562ce1457 Clean up the main module creation loop
This change reorganizes the code within the main module creation loop
in preparation for delegating the work to separate types. It has been
split out into its own change to make it easier to review by keeping
the functional changes localized.

Renames the osTypeSpecificInfo archTypes field to archInfos as the
latter is more accurate.

Cleans up the arch variants handling:
1) Groups them by arch type to make them easier to process.
2) Fails fast when there is not exactly one variant per arch type as
   otherwise it results in a confusing failure later on.
3) Removes the commonArch flags and instead uses the fact that
   osInfo.archInfos is empty when the common architecture variant is
   available.

Cleans up the arch type specific property set handling.
1) Adds new archPropertySet variable to allow the choice of where the
   arch specific properties are added to be made alongside the choice
   of where the os specific properties are to be added.
2) Removes unnecessary check for commonArch around the loop to add
   properties from archInfos as the archInfos will be empty when the
   common architecture is present.

A number of other changes to make it easier to extract the code into
their own methods.

Bug: 153306490
Test: m nothing
Bug: 142918168
Merged-In: I16a5fa79efff0d08c22916449eb46a5bd910723a
Change-Id: I16a5fa79efff0d08c22916449eb46a5bd910723a
2020-04-22 12:51:41 +01:00
Paul Duffin
b8a89a4676 Add support for cc_prebuilt_library
Bug: 153306490
Test: m nothing
Bug: 142918168
Merged-In: I8aacc0052812208e1892ef533545ae53bb387a0d
Change-Id: I8aacc0052812208e1892ef533545ae53bb387a0d
2020-04-22 12:51:41 +01:00
Paul Duffin
406ea1c393 Refactor prebuilt to use srcs supplier function
Previously, prebuilt had two ways to provide the src value, as a
pointer to an []string and using reflection. That meant that any code
that needed to check the src to use had to understand the two ways of
accessing it.

This change refactors the code to abstract the origin of the src values
being a supplier function. That insulates the callers from having to
know the details and makes it easy to add new suppliers in future.

Bug: 153306490
Test: m nothing
Bug: 142918168
Merged-In: I5cc7517c46cce96924c9f34ba1b046b468f7684a
Change-Id: I5cc7517c46cce96924c9f34ba1b046b468f7684a
2020-04-22 12:51:40 +01:00
Paul Duffin
35dbafcf54 Output properties before sets in snapshot module
This ensures a consistent output irrespective of whether property sets
are created before or after the properties are added. This provides a
little more flexibility in the creation code which allows that to be
simplfied.

Also switches from using reflection to a type switch.

Bug: 142918168
Bug: 153306490
Test: m nothing
Merged-In: Ia025bfc751f1217d1658de6fb8e15091ea0ea9ff
Change-Id: Ia025bfc751f1217d1658de6fb8e15091ea0ea9ff
2020-04-22 12:51:40 +01:00
Paul Duffin
2bdbe83ec9 Remove SdkMemberType.FinalizeModule
This was only being used to set the "stl" property for cc library sdk
member type and so that functionality was moved to AddPrebuiltModule()
and FinalizeModule was removed.

Required a few test changes to move the property to the correct
position in the generated module.

Bug: 142918168
Bug: 153306490
Test: m nothing
Merged-In: If6400189833d4ff3285e7a7adf63a9b509e2a03b
Change-Id: If6400189833d4ff3285e7a7adf63a9b509e2a03b
2020-04-22 12:51:39 +01:00
Paul Duffin
81535b4971 Follow up a review comment that was missed
Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: I45b3b7dd3bde3042d67f647c188d61070864f3cc
Change-Id: I45b3b7dd3bde3042d67f647c188d61070864f3cc
2020-04-22 12:51:39 +01:00
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
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
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
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