74f05598eb
Change https://r.android.com/1335521 added tag property to the Dist struct so that it could be used to select one of a number of different output files to copy to the dist instead of the single file that the module type made available for dist. The output files were selected by passing the tag to OutputFiles(tag). Module types that wanted to support this new approach had to explicitly set AndroidMkEntries.DistFiles = GenerateTaggedDistFiles(module). Unfortunately, doing that had a side effect of changing the behavior of dist entries without a tag. That was because the change treated a tag that was not specified, as being the same as "". So, prior to the change no tag meant use the default dist file but after it meant use the paths returned by OutputFiles(""). That changed the behavior of the java.Library type which affected the behavior of the android_app module type. Prior to the change the java_library would make the Library.outputFile available for dist when no tag was specified. After that change it would make Library.outputFile plus Library.extraOutputFiles. The latter is usually empty except for android_app which adds some extra files into there which will now be copied to the dist. That change may have been intentional but there was no mention of it in the change or the bug. Even if it wasn't intentional it may still be beneficial. Any module type that wants to add support for tags in dist runs the risk of introducing similar changes in behavior. This change differentiates between the tag not being set and the tag being set to "" to avoid that possibility and to make the default behavior explicit for those module types that have switched. It does so as follows: * Adds a DefaultDistTag constant that is used when the tag is not set. It is a string that is unlikely to be used as an actual tag as it does not start with a . and uses some special characters. * The DefaultDistTag is used in MakeDefaultDistFiles(paths) to indicate that the supplied paths are the default ones and and also in GenerateTaggedDistFiles() for Dist structures that have no tag property set. * The DefaultDistTag is passed to OutputFiles(tag) just in case the module type has explicitly defined the paths to associate with that tag in there. If it has then it overrides the legacy behavior. If it has not then it is just ignored and falls back to using the previous behavior. * The java.Library.OutputFiles(tag) method explicitly handles the DefaultDistTag and returns Library.outputFile for it which restores the behavior from before the change that added dist.tag support. * Similar change was made to apexBundle.OutputFiles(tag) in order to preserve its previous behaviour. * The customModule used by TestGetDistContributions has been modified to also preserve its previous behavior after this change. Test: m nothing m dist sdk - before and after this change, compare result to make sure that there are no significant differences. Test the effect on the apex by following instructions in http://b/172951145 Bug: 174226317 Change-Id: Ib8f0d9307751cc2ed34e3d9a5538d3c144666f6d |
||
---|---|---|
.. | ||
soongconfig | ||
Android.bp | ||
android_test.go | ||
androidmk.go | ||
androidmk_test.go | ||
apex.go | ||
apex_test.go | ||
api_levels.go | ||
arch.go | ||
arch_list.go | ||
arch_test.go | ||
bazel_handler.go | ||
config.go | ||
config_test.go | ||
csuite_config.go | ||
csuite_config_test.go | ||
defaults.go | ||
defaults_test.go | ||
defs.go | ||
depset.go | ||
depset_test.go | ||
deptag.go | ||
deptag_test.go | ||
env.go | ||
expand.go | ||
expand_test.go | ||
filegroup.go | ||
hooks.go | ||
image.go | ||
makefile_goal.go | ||
makevars.go | ||
metrics.go | ||
module.go | ||
module_test.go | ||
mutator.go | ||
mutator_test.go | ||
namespace.go | ||
namespace_test.go | ||
neverallow.go | ||
neverallow_test.go | ||
ninja_deps.go | ||
ninja_deps_test.go | ||
notices.go | ||
onceper.go | ||
onceper_test.go | ||
override_module.go | ||
package.go | ||
package_ctx.go | ||
package_test.go | ||
packaging.go | ||
packaging_test.go | ||
path_properties.go | ||
path_properties_test.go | ||
paths.go | ||
paths_test.go | ||
phony.go | ||
prebuilt.go | ||
prebuilt_build_tool.go | ||
prebuilt_test.go | ||
proto.go | ||
queryview.go | ||
register.go | ||
rule_builder.go | ||
rule_builder_test.go | ||
sandbox.go | ||
sdk.go | ||
singleton.go | ||
soong_config_modules.go | ||
soong_config_modules_test.go | ||
test_suites.go | ||
testing.go | ||
util.go | ||
util_test.go | ||
variable.go | ||
variable_test.go | ||
visibility.go | ||
visibility_test.go | ||
writedocs.go |