Enable from-text stub generation in non-sdk java_sdk_library
This change allows from-text stubs to be generated for all java_sdk_library modules, unlike how it is currently limited to the modules that contribute to the api surfaces (i.e. the SDK). This change accomplish this by modifying the dependency of the from-text stubs generation, so that the sdk_library generated from-text stubs generating java_api_library modules no longer depend on the full api surface stubs, but generate the stubs in the module level, and combined later to generate the full api surface stubs. This change also removes the java_api_library modules defined in core-libraries/Android.bp, which are passed to generate the system modules. Given that the from-text vs from-source toggle is done within the java_sdk_library stubs level, these modules no longer need to exist. Implementation details: - Allow sdk_version to be specified in java_api_library modules. For java_sdk_library-generated java_api_library modules, they inherit that of the sdk_library module. Some java_sdk_library modules that do not contribute to the api surface are allowed to set sdk_version to something other than "none" or "core". - Implement java_api_library to implement `SdkContext`. This allows java_api_library to collect required deps from sdk_version (classpath, bootclasspath, system modules), and pass the collected jars when generating the stubs srcjar in metalava and compiling the stubs srcjar in javac. - Remove hardcoded list of sdk_library modules that are allowed to genereate stubs from the api signature files, and allow from-text stubs generation by default. Modules that are not able to generate stubs from the api signature files are specified by setting the newly introduced `Build_from_text_stubs` property to `false`. Test: ENABLE_HIDDENAPI_FLAGS=true m Bug: 327507877 Change-Id: Ia35d2f3cf9fae48fc8c4bd99a84ae18d7c0e7bee
Loading
Please register or sign in to comment