summaryrefslogtreecommitdiff
path: root/sdk/update.go
AgeCommit message (Collapse)Author
2021-09-16Remove unnecessary archTypeSpecificInfo.optimizableProperties() Paul Duffin
The method is provided by an embedded type. Bug: 195754365 Test: m nothing Change-Id: I08ede08a393dbabf40f064befaf73ef2947380bd
2021-09-16Move setting of link type properties to linkPropertyInfo Paul Duffin
Bug: 195754365 Test: m nothing Change-Id: Ica90a42cd8e4a79251271164f137dcdf60b3bd55
2021-09-14Rename SdkMemberTypeDependencyTag to SdkMemberDependencyTag Paul Duffin
Bug: 195754365 Test: m nothing Change-Id: Id4ef6f8be54c60a1f269d7e7c46a8dcb715fcca4
2021-08-31Make sdk member type related types and vars type specific Paul Duffin
Previously, some of the sdk member type related types and variables included the words "member type" whereas others only used the word "member" and did not include "type". This changes makes them all include the word "type" to differentiate them from other types related to sdk members. Bug: 195754365 Test: m nothing Change-Id: I913daaa1d436fd5dc857c2af0ffdee6471dcc6ed
2021-07-21Remove Fuchsia support from Soong Colin Cross
Bug: 194215932 Test: m checkbuild Change-Id: Id7d3964d9417f8b0938af9b168bb4c00cebe9390
2021-07-16Revert "Export implementation class jars for java_boot_libs" Paul Duffin
This reverts commit 22ff0aaf51bdd9409eafe74151decb58f47308bc. The workaround to support hidden API generation with prebuilts by passing the full implementation jars through to the SDK snapshot is no longer needed as the monolithic hidden API flag generation uses the prebuilt flag files that are already part of the snapshot. This change reverts that previous workaround. Bug: 192868581 Test: - Update the prebuilts DIST_DIR=$PWD/dist TARGET_BUILD_VARIANT=userdebug art/build/build-art-module.sh --skip-apex packages/modules/ArtPrebuilt/update-art-module-prebuilts.py --local-dist=dist --skip-cls --skip-apex - Build hidden API flags to make sure it does not fail Change-Id: Idb3fde6f7dcb171677316d8794a4af91ede1f7e0
2021-07-14Support generating sdk snapshots that can be selected by Soong config vars Paul Duffin
Allows the builder of an sdk snapshot to specify a Soong config variable that can be used to control whether the snapshot's prebuilts are used or not. Bug: 193523070 Test: m nothing Change-Id: Ib09500ba61befc1202dff61dc06847c730ba9253
2021-07-07Revert "Flag to control if generated SDK prebuilts are preferred." Mathew Inwood
This reverts commit d0b99cea0ac389e831dfddbd3cb10fa09a040d2c. Reason for revert: Not needed anymore. We will simple exclude the gernated Android.bp files from prebuilt drops instead, it keeps things simpler. Change-Id: I5b01b2e01197f9fceb4630c8ade95f0d1d0f33f4
2021-06-29Flag to control if generated SDK prebuilts are preferred. Mathew Inwood
This is needed because: - the SDK prebuilt drop is being automated, including the Android.bp - We want to control the prefer flag on a per-module level It augments the existing SOONG_SDK_SNAPSHOT_PREFER which now overrides this new flag when set to true. Bug: 188427719 Test: m nothing Change-Id: Ieb5ab9fab53a34c615345b7a9d19cadf713eec26
2021-06-25Support hidden API processing for modules that use platform APIs Paul Duffin
Previously, hidden API processing could only be done by those bootclasspath_fragment modules that either did not depend on any other fragments (e.g. art-bootclasspath-fragment) or only depended on APIs provided by other fragments (e.g. i18n-bootclasspath-fragment). That meant that modules like com.android.os.statsd-bootclasspath-fragment that depended on APIs provided by parts of the platform which are not yet part of another bootclasspath_fragment could not perform hidden API processing. This change adds support for a bootclasspath_fragment to specify the additional stubs needed to perform hidden API processing. It adds a new additional_stubs property that can be used to specify the additional stub libraries. Most bootclasspath_fragments that need to use the property will need access to the APIs provided by the android-non-updatable.* libraries. Rather than have each fragment explicitly specify the correct module for each scope it treats "android-non-updatable" as if it was a java_sdk_library that can provide different jars for each scope. Soong will handle mapping that to the correct android-non-updatable.* module. Bug: 179354495 Test: m out/soong/hiddenapi/hiddenapi-flags.csv \ out/soong/hiddenapi/hiddenapi-index.csv \ out/soong/hiddenapi/hiddenapi-stub-flags.txt \ out/soong/hiddenapi/hiddenapi-unsupported.csv - make sure that this change does not change the contents. m TARGET_BUILD_APPS=Calendar nothing Change-Id: Ia8b79830ed0e6d42100de03d76b0c51b7f6c8ade
2021-06-23Remove duplicate component from sdk snapshot Paul Duffin
Previously, an sdk snapshot could contain the following: * A java_sdk_library_import module, e.g. "foo" which creates component modules "foo.stubs", etc. * A corresponding versioned module, e.g. "sdk_foo@current" which created component modules "sdk_foo@current.stubs", etc. * An internal (to the sdk snapshot) java_import for one of "foo"'s components, e.g. "sdk_foo.stubs" * A corresponding versioned module, e.g. "sdk_foo.stubs@current". That causes a few problems: 1. The "foo.stubs" is duplicated. 2. The names of the components created by the versioned java_sdk_library_import are invalid, as they append the component's suffix to the version and not the name before the version. The latter causes problems when building against prebuilts and fixing that causes the generated snapshot to be invalid because it contains duplicate definitions of the "sdk_foo.stubs@current" module. One explicitly in the Android.bp file and one created by the "sdk_foo@current" module. Removing the duplicates from the snapshot causes errors as the name generated by the snapshot for the component module, i.e. "sdk_foo.stubs@current" does not match the name generated by the "sdk_foo@current", i.e. "sdk_foo@current.stubs". This change fixes them together. Bug: 179354495 Test: m nothing Merged-In: I515f235fe21755b5275af12366e96c24c94c0273 Change-Id: I515f235fe21755b5275af12366e96c24c94c0273 (cherry picked from commit a1aa7387f74a49c8c974ba2198def0e081488624)
2021-06-23Output bootclasspath_fragment's fragments property to sdk snapshot Paul Duffin
Adds support for printing a PropertySet that has a property whose value is an array of structs. Bug: 179354495 Test: m nothing m conscrypt-module-sdk - check generated Android.bp file Change-Id: I71be04188465610bcbea4d3c9a5e8204171a1eeb
2021-06-22Refactor the printing of an sdk snapshot's Android.bp contents Paul Duffin
Previously, all of the supported types were handled explicitly using type switches. This change switches to use reflection instead to allow it to work with unknown types such as custom structures, support for which will be added in a follow up change. Bug: 179354495 Test: m nothing Change-Id: I197f3f1dbce6d80c0127c99bbe6f836d422a8db9
2021-05-12Add SOONG_SDK_SNAPSHOT_VERSION support Paul Duffin
SOONG_SDK_SNAPSHOT_VERSION=current will generate unversioned and versioned prebuilts and a versioned snapshot module. This is the default behavior. The zip file containing the generated snapshot will be <sdk name>-current.zip. SOONG_SDK_SNAPSHOT_VERSION=unversioned will generate unversioned prebuilts only and the zip file containing the generated snapshot will be <sdk name>.zip. SOONG_SDK_SNAPSHOT_VERSION=<number> will generate versioned prebuilts and a versioned snapshot module only. The zip file containing the generated snapshot will be <sdk name>-<number>.zip. Bug: 157884619 Test: m nothing m SOONG_SDK_SNAPSHOT_VERSION=current art-module-sdk - check that the generated Android.bp file has not changed from the default. m SOONG_SDK_SNAPSHOT_VERSION=none art-module-sdk - check that the generated Android.bp file does not contain versioned modules. m SOONG_SDK_SNAPSHOT_VERSION=2 art-module-sdk - check that the generated Android.bp file only contains version 2 of each module. Change-Id: I087e9d7d3ad110508a3d6a39bca50cbb46b3ce82
2021-05-11Add package module to sdk snapshot that contains licenses Paul Duffin
This ensures that the LSC license tool does not attempt to add a package module to an sdk snapshot Android.bp. Bug: 181569894 Test: m nothing Change-Id: I37b66e0df56c5b9ec255f66cb4f2a066ea96a738
2021-05-11Add license modules to the sdk Paul Duffin
Adds initial support for adding license modules to the sdk, along with any referenced license text files. There is a number of minor improvements to be made but the core of the support is there and it works for ART sdks. Basically, this change will automatically add license modules referenced from any sdk member module as an internal sdk member. An internal module has an sdk snapshot specific name that will not conflict with the source module and which cannot be referenced from outside the sdk snapshot. Bug: 181569894 Test: m art-module-sdk art-module-host-exports art-module-test-exports - diff output before and after this change made sure that every prebuilt had a licenses field and that the license modules were added Change-Id: I0c5ccabf58f4ef487e42ef8e61a5b2a74c0e81af
2021-05-11Add support for name-less modules and property comments Paul Duffin
Bug: 181569894 Test: m nothing Change-Id: Ia4da1d2a55a924db82ae999da455adedbaca47c0
2021-05-11Allow an sdk member type not to provide a bp property Paul Duffin
Bug: 181569894 Test: m nothing Change-Id: I7e98f14cb377683457fba32fd05d6c614f78ffeb
2021-05-11Allow sdk snapshot to contain source module type Paul Duffin
Bug: 181569894 Test: m nothing Change-Id: I30513dd22e2719099a1a1ef63cacc98336d02e9f
2021-05-11Move setting of prefer to createMemberSnapshot Paul Duffin
Test: m nothing Change-Id: Iab1c048fe74a5e474f68ce4acc6c1b41381368ca
2021-05-07Add SOONG_SDK_SNAPSHOT_PREFER support Paul Duffin
By default the generated snapshot has prefer: false. Building it with SOONG_SDK_SNAPSHOT_PREFER=true will force it to generate prefer: true. Bug: 157884619 Test: m nothing m SOONG_SDK_SNAPSHOT_PREFER=true art-module-sdk - check the generated Android.bp file to make sure it contains prefer: true Change-Id: Ied297b32d9bd4822a140fa99016f38e234c50f64
2021-05-06Make all SdkMemberTypes support transitive member deps Paul Duffin
Previously, only those SdkMemberTypes which had specific need to automatically add some of their dependencies as sdk members would cause the sdk to visit their transitive dependencies. However, as any module can have dependencies on license modules and license modules need to be included in the sdk then it needs to visit transitive dependencies of all members. So, this change removes the support for allowing an SdkMemberType to control whether its transitive dependencies are visited and just visits them all. This does not have any effect on sdk snapshots as in order for a dependency to be added to an sdk it needs to be added with a tag that implements SdkMemberTypeDependencyTag and the only tags that implement this are used by SdkMemberTypes that had enabled transitive members. Bug: 181569894 Test: m art-module-sdk art-module-host-exports art-module-test-exports - verify that this change has no effect on the generated snapshots Change-Id: If0293af0237aa7e39335e5b8383a41c023ff5853
2021-04-27Pass module to SdkMemberTypeDependencyTag.SdkMemberType Paul Duffin
This change allows an SdkMemberTypeDependencyTag to select the SdkMemberType to use to add a dependency based on the module. Bug: 177892522 Test: m nothing Change-Id: I2d6e51b615636dc7cd41da65808ef851dd8ae6ac
2021-04-24Generate snapshot member list properties from dependencies Paul Duffin
Previously, the snapshot member list properties were simply copied from the sdk variants. That worked because the snapshot member list properties must include all exported (i.e. visible outside the sdk snaphot) members and only members explicitly specified in the sdk member list properties were exported. However, a preceding change allowed members that were transitively added (and so not explicitly specified on the sdk) to be exported. This change ensures that those exported members are added to the snapshot member properties which means that they will now work properly with the sdk version mutators. This does not add tests for this because no existing SdkMemberType exports its transitive dependencies and there is currently no way to register an SdkMemberType for testing only. A following change will exercise this functionality. Bug: 186290299 Test: m nothing Change-Id: Iadbdd86f6dcdd183fa99f647222a43d412271501
2021-04-24Allow exporting of sdk members to be done per tag Paul Duffin
Previously, every module added to an sdk directly through one of the SdkMemberType specific properties, e.g. java_libs, was exported and every module added automatically via a transitive dependencies was not exported. This change allows that behavior to be customized per tag. Bug: 186290299 Test: m art-module-sdk - verify that this change does not affect its contents. Change-Id: I563b5bcd823e61c23cdb706cfcbb13337963d550
2021-04-24Extract the os specific snapshot module properties handling Paul Duffin
Previously, the code was inlined in the addSnapshotModule() method which made it difficult to follow, did not have clear separation between the different pieces and duplicated functionality. This change combines the dynamic and static properties together and then separates the processing into collation, optimization and property set updating methods. Bug: 186290299 Test: m nothing Change-Id: I311eebca2337cb67634e63d71da12305f4370c07
2021-04-24Dedup snapshot module property set initialization Paul Duffin
Previously, the code to add the compile_multilib property was duplicated. This change moves the logic into the existing addMemberPropertiesToPropertySet method, renames it to reflect new behavior and renames and promotes the variantProperties struct from the addSnapshotModule() method to the package level scope. Bug: 186290299 Test: m nothing Change-Id: I832a7fd89a3cf95467a1ff0807902c9be34c50b9
2021-04-24Make order of properties in snapshot module consistent Paul Duffin
Previously the compile_multilib property was added after the member list properties at the top level but before them in the target.os level. This change makes it always be added before them. Bug: 186290299 Test: m nothing Change-Id: I01fe272933fd11f7f730cc379f60fb2ce70f2114
2021-04-24Clarify behavior around handling of sdk members Paul Duffin
Renames some types and adds some documentation to try and clarify how the sdk handles the members. Bug: 186290299 Test: m nothing Change-Id: I4038276f5f4c473a96fe06aedc43050c90416877
2021-04-24Rename sdkMemberRef to sdkMemberVariantDep Paul Duffin
Previously, there were two types sdkMemberRef and sdkMember that seemed as though the former was referring to the latter but that was not the case. The former was actually information about the dependency the sdk had on a specific member variant. The latter is all the information about a specific member, including all its variants. This change attempts to clarify that relationship, both through a better type name and through some improved documentation. Bug: 186290299 Test: m nothing Change-Id: I1dcc0ddf3333da9e797bb23ae945d04729839014
2021-04-24Extract addSnapshotModule from buildSnapshot Paul Duffin
Bug: 186290299 Test: m nothing Change-Id: I297d63366d71f692572e8e40f1e510b6e41859e6
2021-04-20Do not output two trailing newlines in generated bp files. Martin Stjernholm
Test: m platform-mainline-sdk Check Android.bp in the generated platform-mainline-sdk-current.zip. Bug: 156286550 Change-Id: Ifb99288f3b85c3b986270d48e2dc7d9e15fa7536
2021-04-05Export OsTypeList through a function. Jingwen Chen
This is a cleanup CL to make the OsTypeList accessor consistent with ArchTypeList by creating a function that creates a copy of the underlying slice. Test: TH Change-Id: I346c5c3937bbdb8a373e4d7135b896a5274cc1f1
2021-02-22Support testing versioned/unversioned sdk Android.bp files separately Paul Duffin
Previously, the only way to test the Android.bp file generated by the sdk module was to test both the unversioned and versioned parts together. This change allows them to be tested separately. Bug: 180479010 Test: m nothing Change-Id: I3d695bcfbff030a6da393283ab30ec0979fb2826
2021-02-05Export implementation class jars for java_boot_libs Paul Duffin
Hiddenapi processing currently requires access to the class implementation jars for libraries on the bootclasspath which means that they need to be provided as part of the prebuilts. This change modifies the java_boot_libs property on the sdk to make those files available. Modularization of the hiddenapi processing will hopefully remove the need for these to be exported so this should be temporary. Bug: 178361284 Test: m art-module-sdk check generated snapshot zip contains implementation jars Change-Id: I9e94662dddb0ddb85a477ae6d27e533085147e88
2021-01-15Add java_boot_libs to sdk Paul Duffin
The build has some implicit dependencies (via the boot jars configuration) on a number of modules, e.g. core-oj, apache-xml, that are part of the java boot class path and which are provided by mainline modules (e.g. art, conscrypt, runtime-i18n) but which are not otherwise used outside those mainline modules. As they are not needed outside the mainline modules adding them to the sdk/module-exports as either java_libs, or java_header_libs would end up exporting more information than was strictly necessary. This change adds the java_boot_libs property to allow those modules to be exported as part of the sdk/module_exports without exposing any unnecessary information. Some points to note: * The java_import has to have a valid file for the src property otherwise it will be disabled. * The src property is supposed to reference a jar file but the java_boot_libs property will make it reference an empty file (not an empty jar) so that any attempt to use that file as a jar, e.g. compiling against it, will cause a build failure. * The name of the file passed to the src property should make it clear that the file is not intended to be used. * The test makes sure that only the jar file is copied to the snapshot. Test: m nothing Bug: 171061220 Change-Id: I175331e4c8e3874ab70a67cdc2f76ed1576e41eb
2020-12-01Pass pctx and ctx to NewRuleBuilder Colin Cross
Enable the RuleBuilder and RuleBuilderCommand methods to access the BuilderContext by passing it to NewRuleBuilder instead of RuleBuilder.Build. Test: genrule_test.go Test: rule_builder_test.go Test: m checkbuild Change-Id: I63e6597e19167393876dc2259d6f521363b7dabc
2020-11-04Always set apex_available in SDK snapshots. Martin Stjernholm
Also fix //apex_available:platform that could get lost in the generated apex_available properties. It only happened if a module didn't specify an apex_available setting and then got extra entries from apex.BaselineApexAvailable. Test: Build ART SDK with libnativeloader_lazy in the SDK, and check that the generated prebuilt module has //apex_available:platform (before https://r.android.com/1480559). Change-Id: I9df20aee63455932a7e558993f0f26769cb02792
2020-10-23Enable sdk and sdk members in os_arch granularity Jiyong Park
This amends Idad7ef138cdbcbd209d390bf6c10ca8365d4619f. With the change, when there is a member that returns IsHostOsDependent() == true, the sdk having the member and the member itself are disable for host and only the os that the member supports is explicitly enabled. However, that change will cause a problem when we add the support for the linux_bionic_arm64 target. The target is not enabled when building sdk snapshots. The only linux_bionic target that is enabled is 'linux_bionic_x86_64'. However, since the granularity is os which is linux_bionic, the snapshot is generated as follows. cc_prebuilt_binary { target: { host: { enabled: false, }, linux_bionic: { enabled: true, }, linux_bionic_x86_64: { srcs: ["x86_64/bin/..."], }, // no srcs for linux_bionic_arm64 }, } Above is a problem for linux_bionic_arm64 target because the target is enabled (via linux_bionic.enabled: true), but srcs is not provided. To fix the problem, the enabling of a target is done in a target (os_arch) granularity, rather than os granularity. For example, above now becomes ... cc_prebuilt_binary { target: { host: { enabled: false, }, linux_bionic_x86_64: { enabled: true, srcs: ["x86_64/bin/..."], }, }, } Only the targets that the snapshot actually can provide srcs are enabled and the rest of the host targets are disabled. Bug: 159685774 Test: m nothing Test: build/soong/scripts/build-aml-prebuilts.sh runtime-module-host-exports Change-Id: Ibca48c40f6dc4628b5f4bfa4ceb68ebe0973cc81
2020-10-02Add prebuilt_visibility property Paul Duffin
Some mainline modules provide an `sdk` and one or more set of module_exports. When the snapshots are unpacked into separate prebuilts directories (one per snapshot) then any dependencies from a member of one snapshot to a member of another may require the latter to have additional visibility rules. Previously, these rules had to be added to each source module. This change allows additional visibility rules to be specified on the sdk/module_exports that are added to all the prebuilts in its snapshot. Bug: 155921753 Bug: 168301990 Test: m nothing Change-Id: Ia3eacb5749981f04770ae9872a8013e43c5c6ef1
2020-09-29Merge "Propagate all sanitizer flags in SDK snapshots." Martin Stjernholm
2020-09-25Propagate all sanitizer flags in SDK snapshots. Martin Stjernholm
liblog snapshot needs to sanitizer.address=false to avoid cycle in asan builds. Adding that separately in library_sdk_member.go would start to feel like whack-a-mole, so the snapshot generation is instead extended to handle nested property structs. This uses the BpPropertySet.AddProperty extension in https://r.android.com/1423510, and common value optimisation now recurses into non-anonymous structs, instead of comparing them as a whole. Test: m nothing Test: `m SANITIZE_TARGET=address nothing` with prebuilts/runtime present in the manifest and a fresh snapshot made with this Bug: 151303681 Change-Id: I472554117a488e6c800045cb2ed59377778571a4
2020-09-24HostCross is an attribute of a Target, not OsType Jiyong Park
A host target is considered as being cross-compiled when the target can't run natively on the build machine. For example, linux_glibc/x86_64 is a non-cross target on a standard x86/Linux machine, but is a cross host on Mac. Previously, whether cross or not was a static attribute of an OsType. For example, Windows was always considered as cross host, while linux_bionic was not. This becomes a problem when we support more host targets like linux_bionic/arm64 which should be cross-host on standard x86/Linux machines. This change removes HostCross from the OsClass type and instead adds a property HostCross to the Target type. When a target is being added, it is initialized to true when the target can't run natively on the current build machine. Bug: 168086242 Test: m Change-Id: Ic37c8db918873ddf324c86b12b5412952b0f2be2
2020-08-19Support ninja rsp files in soong_zip Colin Cross
Add a -r argument to soong_zip that reads a list of files from a file like the -l argument but treats it as a Ninja rsp file with escaping. Replace the -l arguments in Soong that are using rsp files with -r. Fixes: 162435077 Test: TestReadRespFile, TestZip Change-Id: I4605312e99406ab1bd0c37af9c5ad212393f0403
2020-08-03Disable all host OS variants except those explicitly included. Martin Stjernholm
Necessary to avoid problems with implicitly enabled host OS'es, e.g. linux_glibc getting enabled when we only supply a linux_bionic linker in runtime-module-host-exports. That will then cause a non-functional prebuilt to take precedence over source if the prebuilt is preferred. We don't do this for device since we so far only support a single device OS (android). This introduces the notion that SDK member types can be host OS dependent or not. That way java members with host prebuilts don't get restricted to a specific host OS. Test: m nothing Test: build/soong/scripts/build-aml-prebuilts.sh runtime-module-host-exports Check that the generated Android.bp correctly disables the bionic linker prebuilt for linux_glibc. Test: art/build/apex/runtests.sh on master-art with an updated runtime SDK snapshot Test: art/tools/buildbot-build.sh {--host,--target} on master-art with an updated runtime SDK snapshot Bug: 160349757 Change-Id: Idad7ef138cdbcbd209d390bf6c10ca8365d4619f
2020-07-17Set compile_multilib for SDK snapshots for device. Martin Stjernholm
Previously compile_multilib was ignored for device and defaulted to "both", which could lead to an internal inconsistency in the snapshot if a member was 32- or 64-only. This also implements common property optimisation for compile_multilib, by adding a struct that can be extended to other properties in the future. Test: m nothing Bug: 151303681 Change-Id: I3e96222858e5e755173aca03508a23c431977e2a
2020-07-17Add compile_multilib properties to all native prebuilts (reland). Martin Stjernholm
There was a special case in cc_prebuilt_binary only, which resulted in prebuilt libraries getting both 32 and 64 bit variants even when their sources only had one of them, and the other variant would be defunct since it wouldn't get any prebuilt artefact. This moves the handling of compile_multilib completely to the common update code, so that SDK members don't need to deal with it. It doesn't take SDK member defaults into account, which means a bit more boilerplate in the snapshots, but it's simpler and less error prone (different SDK member types have different defaults). This relands https://r.android.com/1359962 after disabling the SDK tests on mac once and for all. Bug: 151303681 Test: `go test -v ./sdk` in build/soong on mac and linux Change-Id: I05f6603b2ac9b8676b25c3e297165ca23284e9cc
2020-07-15Merge "Revert "Add compile_multilib properties to all native prebuilts."" Jakub Pawlowski
2020-07-15Revert "Add compile_multilib properties to all native prebuilts." Charles Chen
This reverts commit 1e9c2677fdb3f1d615863d87c64ad9ea2fc9007b. Reason for revert: Break build Bug: 161315642 Change-Id: Ibf3d5e88412327e8f08d08272b75cd3df34a71e5
2020-07-15Merge "Add compile_multilib properties to all native prebuilts." Treehugger Robot