From 3921f0b3560a0dbbac3f5590dc639caf9492a2e8 Mon Sep 17 00:00:00 2001 From: Jihoon Kang Date: Tue, 12 Mar 2024 23:51:37 +0000 Subject: Collect aconfig_declarations of the dependent java_aconfig_library modules droidstubs module require aconfig_declarations modules to be specified when the module depends on the java_aconfig_library module in order to generate the "exportable" stubs. This adds burden to the droidstubs or java_sdk_library module owners, as module should specify both the java_aconfig_library and aconfig_declarations modules to genreate the "exportable" stubs, although the necessary information from the aconfig_declarations module can be provided from the java_aconfig_library modules. In order to resolve such burden, this change enables the intermediate cache files from the associated aconfig_declarations module of a java_aconfig_library module to be propagated to its reverse dependencies without having the specify the aconfig_declarations modules in the droidstubs or java_sdk_library modules definitions. This does not mean that the intermediate cache files of every transitive dependencies of the java_sdk_library or the droidstubs will be passed to aconfig to retrieve the state of the aconfig flags. Specifically, only the java_aconfig_library modules or the java_library modules that have static dependency on java_aconfig_library modules that are passed to droidstubs via `libs` or `srcs` (using ":module_name{.tag}" syntax) will provide the intermediate cache files to generate the "exportable" stubs. For java_sdk_library, all modules listed as `libs`, `static_libs`, `stub_only_libs`, and `apiScope.libs` are passed as `libs` and all modules listed as `api_srcs` and `srcs` are passed as `srcs` to the droidstubs modules dynamically generated in java_sdk_library module per api scope, thus these properties will be affected. Note that the test is being added in the apex package. This is because trying to register the codegen package build components in the java package leads to circular dependency between the codegen and the java package, as codegen package imports the java package. Test: m nothing --no-skip-soong-tests Bug: 329284345 Change-Id: I7953ab64776f6947808321ce8a3598154501bcfe --- java/generated_java_library.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'java/generated_java_library.go') diff --git a/java/generated_java_library.go b/java/generated_java_library.go index e8316ccc4..d5e6d8fec 100644 --- a/java/generated_java_library.go +++ b/java/generated_java_library.go @@ -34,7 +34,7 @@ type GeneratedJavaLibraryCallbacks interface { // Called from inside GenerateAndroidBuildActions. Add the build rules to // make the srcjar, and return the path to it. - GenerateSourceJarBuildActions(module *GeneratedJavaLibraryModule, ctx android.ModuleContext) android.Path + GenerateSourceJarBuildActions(module *GeneratedJavaLibraryModule, ctx android.ModuleContext) (android.Path, android.Path) } // GeneratedJavaLibraryModuleFactory provides a utility for modules that are generated @@ -103,8 +103,10 @@ func (module *GeneratedJavaLibraryModule) GenerateAndroidBuildActions(ctx androi checkPropertyEmpty(ctx, module, "plugins", module.Library.properties.Plugins) checkPropertyEmpty(ctx, module, "exported_plugins", module.Library.properties.Exported_plugins) - srcJarPath := module.callbacks.GenerateSourceJarBuildActions(module, ctx) + srcJarPath, cacheOutputPath := module.callbacks.GenerateSourceJarBuildActions(module, ctx) + module.Library.properties.Generated_srcjars = append(module.Library.properties.Generated_srcjars, srcJarPath) + module.Library.properties.Aconfig_Cache_files = append(module.Library.properties.Aconfig_Cache_files, cacheOutputPath) module.Library.GenerateAndroidBuildActions(ctx) } -- cgit v1.2.3-59-g8ed1b