summaryrefslogtreecommitdiff
path: root/sdk/cc_sdk_test.go
AgeCommit message (Collapse)Author
2020-03-20Add support for using cc_library in sdk/module_exportsPaul Duffin
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-20Add SDK member support for cc_object.Martin Stjernholm
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 Change-Id: I2ab8f6aadb1440b325697cae4a8ed761c62d15d2
2020-03-13Output properties before sets in snapshot modulePaul Duffin
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 Test: m nothing Change-Id: Ia025bfc751f1217d1658de6fb8e15091ea0ea9ff
2020-03-13Remove SdkMemberType.FinalizeModulePaul Duffin
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 Test: m nothing Change-Id: If6400189833d4ff3285e7a7adf63a9b509e2a03b
2020-03-13Copy shared_libs and system_shared_libs to module snapshotPaul Duffin
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-11Disable installation for sdk snapshot versioned prebuiltsPaul Duffin
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-09Add support for multiple os typesPaul Duffin
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 Test: m nothing Change-Id: I08f5fbdd7852b06c9a9a2f1cfdc364338a3d5bac
2020-03-09Copy sdk_version to cc library snapshotsPaul Duffin
Bug: 142935992 Test: m nothing Change-Id: Ib77c548b1971c841749c87115108af8b092bb809
2020-03-05Copy apex_available properties to snapshot modulesPaul Duffin
Bug: 142935992 Test: m nothing Change-Id: I1cdaae5b4e13a89dc46541dacd34ef5a44735b6a
2020-03-02Add CommonOS variant for sdkPaul Duffin
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. Test: m nothing Bug: 150451422 Change-Id: If36be39b06d6910453649f7c288c2d34f688b2f4
2020-02-24Add support for cc_library_headers in sdk/module_exportsPaul Duffin
Bug: 148933848 Test: m nothing Change-Id: Ife6ee0f736238727a11b4421532eaeb29d46c1b7
2020-02-21Allow compile_multilib to be specified on module exportsPaul Duffin
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 Test: m nothing Change-Id: I62d016d97c2df73e5feecf912638f477fedd97c9
2020-02-19Make apex use cc.GatherRequiredDepsForTestsColin Cross
Remove the duplicated native modules from apex_test.go. Test: all soong tests Change-Id: Ib88af058d23cf37446d7a4bb571edfb1e0880854
2020-02-18Add support for cc_binary in module_exportsPaul Duffin
Bug: 142920869 Test: m nothing Change-Id: Ib7e16cb323806782c2186e73e13642e4485fc149
2020-01-16Default apex_available to //apex_available:platformAnton Hansson
This means everything that goes into apexes need to be explicitly labeled to be available for apex. Whitelist the current offenders. This list should be trimmed down. Bug: 147364041 Test: m Test: multiproduct_kati -only-soong Exempt-From-Owner-Approval: cherry-pick from internal Change-Id: I837299c6a15d46f8a5ba544b613776b1cc27d7b8 Merged-In: I837299c6a15d46f8a5ba544b613776b1cc27d7b8 (cherry picked from commit 93488cbb10d4882845abb732f8e53714f0982031)
2019-12-31Restrict SdkMemberTypes that can be used with sdk/sdk_snapshotPaul Duffin
By default SdkMemberTypes are only supported on module_exports module type. Support for sdk module type has to be explicitly specified. The java_header_libs, native_shared_libs and stubs_sources are supported on sdk. The latter is required to provide the stubs source for an API specified in java_header_libs as they should be kept in sync. Bug: 146341462 Test: m nothing Change-Id: I19b9e60792780a797458d4a9e489506602b13144
2019-12-20Differentiate between cc library and binaryPaul Duffin
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-13Use empty string for core image variantColin Cross
Use the empty string for the core image variant so that modules added to imageMutator do not change their build directory. Bug: 142286466 Test: m checkbuild Change-Id: Ida4534d9a4d6176236aaa480fed359ce27acfaa1 Merged-In: Ida4534d9a4d6176236aaa480fed359ce27acfaa1 (cherry picked from commit 72d685ee7f45e5393be44ae4159edf083ac918de)
2019-12-13Improve handling of generated include dirsPaul Duffin
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-13Generalize common property extractionPaul Duffin
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-12Added support for using static libraries in sdk snapshotPaul Duffin
Parameterized the cc.librarySdkMemberType to allow it to support both static and shared libraries. Created two instances, one for shared and one for static libraries. A follow up change will add support for libraries that can be both. Added *librarySdkMemberType to nativeMemberInfo as information from there is needed when generating the snapshot. Made organizeVariants() func a method of *librarySdkMemberType so that it can initialize the new field. Moved it to be with all the other methods of that type. Added host and device tests for the new module type. Bug: 142918168 Test: m nothing Change-Id: I00b1e8424b9d81f7d15edc4883971d10668ec2cc
2019-12-12Discard duplicate operations to copy files to snapshotPaul Duffin
Header include directories are copied into the snapshot separately for each cc library that exports them. However, the same include directories can be exported by multiple libraries which caused ninja error because two separate rules (albeit identical) were defined to create the same files. This avoids the duplicate ninja rules by detecting and discarding duplicate copies, i.e. where the source and destination are the same. It will also report an error if two or more different source files are copied to the same destination. Bug: 142918168 Test: m nothing added test and verified it produced two identical copy rules fixed code and verified duplicate copy rules had been eliminated Change-Id: I39e37405035bee5093f96e03248e9e29ed30962c
2019-12-09Ensure prebuilt modules have same visibility as source modulesPaul Duffin
Exports visibility and package mutator registration functions so they can be used in sdk testing. Updates sdk test to support visibility and package modules. Adds EffectiveVisibility(...)[]string function to make the effective visibility rules available to sdk snapshot creation. Extracts compositeRule.Strings() []string from compositeRule.String() method so that it can be used by above func. Adds visibility property to sdk snapshot and prebuilt modules along with a test to ensure it works properly. Adds dir parameter to CheckSnapshot so that it can check the snapshot generated for a non-root package. That is required in order to ensure that visibility of :__subpackages__ on a source module in package <pkg> is resolved to an effective visibility of //<pkg>:__subpackages__ on its corresponding prebuilt. Test: m conscrypt-module-sdk Bug: 143678475 Change-Id: Icaacac5b9c04726d28e6fec93e49715ac45df7f4
2019-12-06Separate out module type specific test configPaul Duffin
Bug: 143678475 Test: m conscrypt-module-sdk Change-Id: I71433a7c89dfae4c27537f1f66bd677cf9fba0b3
2019-12-06Extract the cc and java sdk related tests out into their own filePaul Duffin
Makes it easier for multiple people to work on different areas without conflicts. Bug: 143678475 Test: m conscrypt-module-sdk Change-Id: I93140450c0b049946a9d0432225bccff82f5a873