summaryrefslogtreecommitdiff
path: root/android/sdk.go
AgeCommit message (Collapse)Author
2024-09-11Add HasMutatorFinished Cole Faust
To enforce that selects are only evaluated after a certain point in a followup cl. Bug: 323382414 Test: m nothing --no-skip-soong-tests Change-Id: Ib215fedb904aa2e5f4d65cfd26a23f527eb4983e
2024-09-11Rename ConfigAndErrorContext to ConfigurableEvaluatorContext Cole Faust
I'm going to be adding some methods to this interface, give it a name based on how it's going to be used, not based on what methods it contains. Bug: 323382414 Test: m nothing --no-skip-soong-tests Change-Id: I9bba04ba756c4dbe00625e2d04af81e78a11cae9
2024-08-19Make the WholeStatic/Static/Shared libs properties configurable Cole Faust
So that you can use selects with them. Bug: 342006386 Bug: 358377461 Test: m nothing --no-skip-soong-tests Change-Id: I5a8350f670d51b7da411ad5c3cdbf5f2d6cdd63b
2024-07-05Add "strip: {none: true}" for cc_prebuilt_library_shared in sdk snapshot. Alyssa Ketpreechasawat
Prebuilt cannot be stripped in older platform. Therefore, we set stripper to none to skip the call to strip.sh. Bug: 350050115 Test: SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE=Tiramisu m art-module-sdk Test: Create module sdk from this and drop into tm-dev Change-Id: I911ce24ca18435f95395c43fc5e73110a50b3067
2024-03-27Reland "Migrate buildinfo.sh script into Soong" Inseob Kim
To build system.img in Soong, we need all artifacts including build.prop. This fully migrates buildinfo.prop file into Soong as a first step to build build.prop on Soong. This fixes an error caused by an incorrect path to build thumbprint file. Bug: 322090587 Test: compare build.prop before and after Test: build multiple times and see build.prop isn't rebuilt Change-Id: Id4fa830009538856c30825ff47268b11fa6cb5d6
2024-03-26Revert "Migrate buildinfo.sh script into Soong" Gina Ko
Revert submission 3004875-buildinfo_prop_soong Reason for revert: DroidMonitor-triggered revert due to breakage b/331462869 Reverted changes: /q/submissionid:3004875-buildinfo_prop_soong Bug: 331462869 Change-Id: Ib8bbbad29a4ad7b800e6bd1a67a401c2225b78cb
2024-03-26Migrate buildinfo.sh script into Soong Inseob Kim
To build system.img in Soong, we need all artifacts including build.prop. This fully migrates buildinfo.prop file into Soong as a first step to build build.prop on Soong. Bug: 322090587 Test: compare build.prop before and after Test: build multiple times and see build.prop isn't rebuilt Change-Id: Icaa7e1fdab2a8c169ac00949d3aaf6c8212a1872
2023-12-14Convert NewProvider/NewMutatorProvider to generic providers API Colin Cross
Convert all of the callers to NewProvider and NewMutatorProvider to use a generic type parameter instead of an example object. Bug: 316410648 Test: builds Change-Id: Ic9cdafc87336e26730d3fd596df05de0e7267542
2023-05-02Use api_levels_released_versions from starlark Cole Faust
Instead of exporting it to soong_injection. Bug: 279095899 Test: m nothing Change-Id: I7b93af233b7450848a475512b5f5682ece773c09 Merged-In: I7b93af233b7450848a475512b5f5682ece773c09
2023-03-22Update min_sdk_version from SdkSpec to ApiLevel Spandan Das
This relands aosp/2457063. The original change broke T and U since those branches still contain soong modules of type (kind+level). Those soong modules have been cleaned up now Test: Used go/abtd to test T and U branches with this change Bug: 208456999 Change-Id: I0ef7933c055f88cb512a02108f1173e51156ef1c
2023-03-21Revert "Update min_sdk_version from SdkSpec to ApiLevel" Spandan Das
Revert submission 2457063 Reason for revert: Broken udc-dev Reverted changes: /q/submissionid:2457063 Change-Id: Id6349fc1318877044af713c914a0afd437d3d2d5
2023-03-20Update min_sdk_version from SdkSpec to ApiLevel Spandan Das
min_sdk_version signifies device version and does not need an sdkKind to describe it fully. Update the type and cleanup existing usages. As a side benefit, we also get better error handling since users can no longer enter something like `public_30` as a valid min_sdk_version in bp files Will do a similar cleanup for targetSdkVersion and maxSdkVersion in a followup CL Test: m nothing Test: no change in ninja files (this should be a no-op) Bug: 208456999 Change-Id: Ie6ae7e267d093c5e4787e82685daaca1021d202e
2022-12-12Remove memberDepsMutator, SdkAware et al Paul Duffin
Previously, the memberDepsMutator was responsible for tracking the membership of modules in an sdk/module_exports (or corresponding snapshot). That was only used to determine whether a module was in a versioned sdk snapshot so that it could be treated differently by the build. As there are no versioned sdk snapshots these can now be removed. This change removes the memberDepsMutator, along with SdkAware and related types that are no longer used. Bug: 260237150 Test: m nothing Change-Id: I2668679a42d5b3f33f9e06d5b59804dfdae5f6da
2022-12-12Replace usages of SdkAware in sdk module with Module Paul Duffin
Previously, the sdk snapshot code used SdkAware instead of Module to ensure that all its members had implemented SdkAware. However, it never used any of the methods provided by SdkAware, or if it did it no longer does. So, this change replaces usages of SdkAware with Module in preparation for deleting it completely. Bug: 260237150 Test: m nothing Change-Id: Ia89e02394f27b2da776f0cf0f0bc86835a03433a
2022-12-12Remove SdkAware.SdkMemberComponentName Paul Duffin
That method was provided to allow a java_sdk_library_import that was part of a versioned sdk snapshot to create the name of its component modules consistent with the way in which modules were named within the sdk snapshot. As versioned sdk snapshots have all been removed this is no longer necessary. Bug: 260237150 Test: m nothing Change-Id: Iee35abd6d210d9a33dfd8ef2f9c77a53329fda24
2022-12-12Remove IsModuleInVersionedSdk Paul Duffin
Previously, as all versioned sdk snapshots have been removed from Android.bp files this method would always return false. This change effectively replaces all calls to it with false, and then optimizes away any unused code. Bug: 260237150 Test: m nothing Change-Id: I1b717ee8345e807bd888451f6e7e3c3a0d391ee2
2022-11-21Revert "Improve error reporting when depending on prebuilt implementation jar" Paul Duffin
This reverts commit c61783b20d70789d657dcb82050369480cc443c7. Bug: 257969510 Reason for revert: b/255275437 - breaks checkbuild target Change-Id: I01f88053cc24dbc1a4eb5c009f15473bdff3d565
2022-11-14Improve error reporting when depending on prebuilt implementation jar Paul Duffin
The sdk snapshot must not be including implementation code for boot libraries, the implementation is provided by dex jars within the corresponding APEX. However, the snapshot does need a module for each boot library so that the build can seamlessly access the dex files from the APEX. A java_library boot library (like core-oj) is represented in the snapshot by a java_import module which requires a jar file to be provided, otherwise it is disabled. However, that is provided purely to keep Soong happy and should never be used. Previously, the snapshot would contain an empty file for the jar. As an empty file is an invalid jar any tool (like compiler) that tried to consume it would fail which was the correct behavior. Unfortunately, the error message that was produced was not very helpful, it was just some variant on `invalid file` which lead to a lot of bugs being raised. This change replaces that empty file with a reference to the output from a genrule which runs a script which produces a more useful error message, with information on how to fix the issue, and fails the build. It also adds a Name() method to the SdkMemberProperties type as that is needed in AddInternalModule() to construct the name of the additional module. Tested as follows: In AOSP/master make the following changes: 1. Temporarily set visibility on core-oj and core-libart to //visibility:public. 2. Run packages/modules/common/build/mainline_modules_sdks.py to create the snapshots. For each of the S, T and latest snapshots I did the following in the s-aml-prebuilt-test, t-aml-prebuilt-test and aosp/master branches: 1. Created an Android.bp file containing the following: java_library { name: "broken", static_libs: [ "prebuilt_core-libart", "prebuilt_core-oj", ], } 2. Fix the visibility issues and run `m broken` where it fails with an invalid file. 3. Delete the contents of the prebuilts/module_sdk/art/current/sdk directory. 4. Unpack the relevant version of the art-module-sdk snapshot into the directory. 5. Run `m broken` where it fails with the helpful message. 6. Test the instructions on how to use the ninja -t path tool to identify the cause of the problem and fix it. Bug: 257969510 Test: See above. Change-Id: I125bde2d7202afff84c97daebcef37e21c548a3a
2022-09-26Add sdk:"keep" tag support Paul Duffin
Fields tagged with `sdk:"keep"` will keep the value even if it would normally be cleared because it was common across a number of structs. This will allow a module type to specify the same value across all structs populated directly from variants and have it be copied into all common property structs without clearing it from the variant specific structs. Bug: 248258460 Test: m nothing Change-Id: I147d946b11fd8766a7d875d9206e8f5034f585d6
2022-09-26Rename sdk field tag "keep" to "ignore" Paul Duffin
"ignore" is a better description of the effect that this tag has on the optimization that is done as part of the sdk snapshot generation. "keep" implies that something special is done with the field during the optimization process but actually the optimization process completely ignores the property, just as it does with unexported fields. Bug: 248258460 Test: m nothing Change-Id: Idfdfd87f927d641d4d301cbbde72b463c89155bf
2022-09-14Exclude unsupported libraries from sdk snapshot Paul Duffin
When an sdk snapshot is targeted at release X then it cannot include bootclasspath fragment libraries which are not present in that build as otherwise it causes build failures. It should also not include any unsupported libraries, i.e. libraries that cannot work on that release. This change causes sdk snapshot to exclude libraries that have a min_sdk_version > target build release It also ensures that hidden API flags do not include any information from excluded libraries. Bug: 240406019 Test: BUILD_NUMBER=fixed packages/modules/common/build/mainline_modules_sdks.sh # Ran the previous command with and without this change to make # sure that this change excludes framework-connectivity-t library from the # tethering sdk snapshot for S, including from the hidden API flag files. Change-Id: I57969b85a12e9e5a3fc76c055b260cec5d5f7d7f
2022-08-17Reformat build/soong for go 1.19 Colin Cross
Test: none Change-Id: I132368f0fcbdb5ea088b5b84dbe4ccfdd9e94cad
2022-07-15Use implementation jar for updatable-media in snapshot for S Paul Duffin
While enabling prebuilts in T we hit b/229932396 which was caused by some parts of the build depending on the prebuilt updatable-media jar which used to be a full implementation jar but which is now an invalid jar as the snapshot must not be including implementation details. We fixed the issue in T but we are hitting the same problem in S with the M-2022-07. That is the first train in which the prebuilt updatable-media module provides an invalid jar, prior to that it was always providing an implementation jar. This change tweaks the sdk snapshot generation code to use an implementation jar for updatable-media in the S snapshot to avoid partners having to cherry pick changes similar to those needed to fix b/229932396 in T. Bug: 239121291 Test: packages/modules/common/build/mainline_modules_sdks.sh # Check that S media snapshot includes implementation jar. # Check that S art snapshot includes invalid jar. # Check that T media snapshot includes invalid jar. Change-Id: Ib49484d00a60b4ed7f8268e04f9c10a3498edb56
2022-07-06Add apexes property to sdk Paul Duffin
Specifying an apex in the apexes propety will cause all the *classpath_fragments that are contents of the APEX to be automatically added as members of the sdk and appear in the snapshot. The purpose of this change is to dedup the APEX and sdk definitions and try and avoid some of the issues that we have been finding while attempting to build against the prebuilts. Two tests, one each for bootclasspath_fragment and systemserverclasspath_fragment, have been refactored to compare the output when adding the *fragment to the sdk directly of via the APEX. That ensures switching to use the APEX will not change the sdk snapshot unless it was previously missing a *fragment. There was also a slight difference in where the hidden API flags were copied from. That should have no impact on the output as the flags are identical. The sdk snapshot generation needed some tweaks to avoid generating a prebuilt for the APEX. Bug: 232401814 Test: m nothing Change-Id: I7aaf16a3a0ab4bebf97765d1484215cc008dc4b8
2022-07-05Stop exporting systemserverclasspath_fragment when targeting S Paul Duffin
Previously, when targeting the S release the generated sdk snapshot would contain prebuilt_systemserverclasspath_fragment modules even though they were only added in T. This allows SdkMemberTypes to specify the set of target build releases they support and ignores them when targeting an unsupported target build release. Test: m nothing packages/modules/common/build/mainline_modules_sdks.sh # Check that the for-S-build snapshots do not include SSCPFs. Bug: 237718221 Change-Id: I2df08c2fcebf9b866695d691572a9d3783758b17
2022-05-24Merge "Handle multiple linkages in sdk snapshots" Liz Kammer
2022-05-23Handle multiple linkages in sdk snapshots Liz Kammer
Currently, if the same library is specified for multiple of native_libs, native_shared_libs, and native_static_libs for different arch/oses, there can be a few errors: 1. specifying a .so file as `srcs` within a cc_prebuilt_library rather than being specified only for shared 2. the final type of prebuilt library is dependent on the arch/os This change introduces: * an ability for a member type to override the type for specified properties * checks for a library being used with incompatible member types * basing linkage nesting on the member type in addition to variants This will ensure that the correct library type is used, regardless of the order of iteration over oses/arches, and support nesting linkages where necessary but only one linkage variant exists. Test: soong tests Test: CI Change-Id: I81dee013b09b99c34ca6c18f9cfcc12ee56d33d1
2022-05-16Add custom java_sdk_library info to the SDK info file Paul Duffin
Previously the SDK info file only contained basic common information about each member. This change adds support for each member to provide custom information to add to the info file. It uses that mechanism to add the following: * "dist_stem" * "scopes" object containing: * for each scope a: "<scope>" object containing: * "current_api" - the path within the snapshot for the API's .txt file. * "removed_api" - the path within the snapshot for the removed API's .txt file. * "latest_api" - the path within the build to the latest finalized API .txt file. * "latest_removed_api" - the path within the build to the latest finalized removed API .txt file. In order to access the latest API files it was necessary to add and resolve dependencies on the module that makes them available. In order to do that safely the code for creating the names of the modules was refactored to avoid duplicating the name creation logic. Bug: 204763318 Test: m nothing Change-Id: Ica68abbd2b2c7c2b2b7877b502f96cc89f06fd68
2022-04-21Remove unused uses_sdks property for apexes Liz Kammer
Test: m nothing & compare build.ninja before/after Change-Id: I3f1199af338e1d2e48ec29cf9f59b6b36236c4cc
2021-09-23Detect duplicates in sdkRegistry Paul Duffin
Bug: 195754365 Test: m nothing Change-Id: I67c5022b7cc61891fd6b90365f8271d97d7bcd98
2021-09-23Dedup SdkMemberType/TraitRegistry Paul Duffin
Bug: 195754365 Test: m nothing Change-Id: I3baa2535fd21a47bea2229f13cf5eb166396fe79
2021-09-23Removes usages of SdkMemberTrait/TypeRegistry outside android/sdk.go Paul Duffin
In preparation for a refactoring that will dedup the registry code. Bug: 195754365 Test: m nothing Change-Id: I93e8485d588f5b4d6b5e2967da5dbef7b6c831ad
2021-09-23Add support to sdk/module_exports to specify required traits Paul Duffin
Currently, every sdk member of a specific module type has to be treated in the same way as every other sdk member of that type. e.g. it is not possible for an sdk member to use different variants to other members of the same type. Adding a new member type for each different way to treat the members is not scalable as if there were N different ways treat a member then it would require 2^N types for all the possible combinations. This adds a new traits mechanism that allows the behavior of member types to be customized per sdk member. Each member type can specify a list of supported traits and customize its behavior based on which traits are required for each member. A trait can be supported by multiple different member types. Bug: 195754365 Test: m nothing Change-Id: I165ac80d208c0402d2a9ffa8085bba29562c19b7
2021-09-16Improve the documentation in the android/sdk.go file Paul Duffin
Makes it adhere to the go standard practice of prefixing documentation comments with the name of the type/func/method. Bug: 195754365 Test: m nothing Change-Id: Idf3fe827edc9b6d67d12a99a4b27539ac938ea95
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-08-31Refactor SdkMemberType.AddDependencies() Paul Duffin
Replaces the BottomUpMutatorContext parameter with a new SdkDependencyContext type that extends BottomUpMutatorContext. This is to allow the sdk to pass additional information to the implementations of that method to allow the behavior to be more finely tuned. Bug: 195754365 Test: m nothing Change-Id: I69c6d2c523934eb67d7a7e6c55c241e9b8a81773
2021-08-25Remove unused key field from SdkMemberTypesRegistry Paul Duffin
Bug: 195754365 Test: m nothing Change-Id: I48ba50f009d53024ecb89d8d59309d49989c39fb
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-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-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-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-05-06Make licenseModule SdkAware Paul Duffin
Making licenseModule SdkAware caused two breakages in the build. The breakages were both caused by having an SdkAware module that was depended upon by a versioned sdk snapshot but which was not itself versioned and so did not have the member_name property set. That occured because some default licenses have been added to the packages containing prebuilts, e.g. prebuilts_runtime_license in prebuilts/runtime/Android.bp. They apply to both the versioned and unversioned members. Once license support has been added to the sdk most of those will be removed and replaced with properly versioned license modules. However, in the meantime it is necessary to support that. This change avoids the issue by checking to see whether the module is itself versioned before relying on the member_name property. It also improves the error message when a panic is recovered to make it easier to identify where it originates. Bug: 181569894 Test: m nothing Change-Id: I0e7da2e0c4a30a6f814c2faab821b185aaed2135
2021-05-06Make sdk tests more realistic Paul Duffin
The tests use <sdk>_<module>_<version> as the format for a versioned sdk member name but the format should be <sdk>_<module>@<version>. This change corrects it and also fixes a similar issue in an error message. Bug: 181569894 Test: m nothing Change-Id: I8be0db4bcd0b6f4d6fbdf9e402ef7257fae8e18b
2021-04-28Extract IsModuleInVersionedSdk Paul Duffin
Bug: 177892522 Test: m nothing Change-Id: I348d380a0d29abdd6a84420be52cc1b674f2a7ab
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