platform_build_soong/android
Paul Duffin 74f05598eb Differentiate between no dist tag and an empty dist tag
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
2020-11-27 15:17:44 +00:00
..
soongconfig Revert "Make lots of tests run in parallel" 2020-10-09 18:34:24 -07:00
Android.bp Merge changes I8af00c8c,Ia526ae89 2020-11-24 19:27:35 +00:00
android_test.go Share buildDir for android/soong/android tests 2019-06-10 15:51:06 -07:00
androidmk.go Differentiate between no dist tag and an empty dist tag 2020-11-27 15:17:44 +00:00
androidmk_test.go Differentiate between no dist tag and an empty dist tag 2020-11-27 15:17:44 +00:00
apex.go Documenting android/apex.go 2020-11-20 10:07:19 +09:00
apex_test.go Revert "Make lots of tests run in parallel" 2020-10-09 18:34:24 -07:00
api_levels.go Replace android.WriteFile rule with android.WriteFileRule 2020-11-14 16:26:00 -08:00
arch.go Annotate dependency tags for dependencies of installed files 2020-11-23 18:06:08 -08:00
arch_list.go Add more comments to arch.go 2020-11-19 11:20:05 -08:00
arch_test.go Pass Config to NewTestContext instead of ctx.Register 2020-11-12 10:07:49 -08:00
bazel_handler.go Merge "Use packagepath and local_repository for mixed builds" 2020-11-18 16:06:35 +00:00
config.go Merge "Comment android/config.go" 2020-11-25 04:18:56 +00:00
config_test.go Retry: Make ConfiguredJarList immutable 2020-10-27 17:37:20 +00:00
csuite_config.go Convert csuite config to use AndroidMkEntries 2020-11-24 13:41:28 -08:00
csuite_config_test.go Pass Config to NewTestContext instead of ctx.Register 2020-11-12 10:07:49 -08:00
defaults.go Add more comments to arch.go 2020-11-19 11:20:05 -08:00
defaults_test.go Pass Config to NewTestContext instead of ctx.Register 2020-11-12 10:07:49 -08:00
defs.go Replace android.WriteFile rule with android.WriteFileRule 2020-11-14 16:26:00 -08:00
depset.go Start using Providers instead of direct module access 2020-10-12 16:55:47 -07:00
depset_test.go Revert "Make lots of tests run in parallel" 2020-10-09 18:34:24 -07:00
deptag.go Annotate dependency tags for dependencies of installed files 2020-11-23 18:06:08 -08:00
deptag_test.go Annotate dependency tags for dependencies of installed files 2020-11-23 18:06:08 -08:00
env.go Teach Soong to use a custom Delve binary. 2020-11-06 10:46:01 +01:00
expand.go Fix android.Expand and ninja escaping 2019-07-11 14:52:17 -07:00
expand_test.go Revert "Make lots of tests run in parallel" 2020-10-09 18:34:24 -07:00
filegroup.go Move bazel_module property to a common file, and add it to filegroup. 2020-11-22 22:01:44 -05:00
hooks.go Add SrcPath to InstallHookContext 2020-06-04 01:26:16 +01:00
image.go Add vendor-ramdisk image to Soong. 2020-10-22 10:26:26 -07:00
makefile_goal.go makefile_goal: not arch specific. 2020-10-21 14:09:14 -07:00
makevars.go Refactor 'in_make' to mean Kati is not skipped. 2020-11-23 00:29:18 -05:00
metrics.go Collect metrics from inside soong_build 2020-02-25 20:50:00 +00:00
module.go Differentiate between no dist tag and an empty dist tag 2020-11-27 15:17:44 +00:00
module_test.go Expand dist property checks to cover dists 2020-11-27 15:17:44 +00:00
mutator.go Add providers support 2020-09-17 18:57:03 -07:00
mutator_test.go Pass Config to NewTestContext instead of ctx.Register 2020-11-12 10:07:49 -08:00
namespace.go Simplify vendor conditionals 2020-01-24 16:43:40 -08:00
namespace_test.go Pass Config to NewTestContext instead of ctx.Register 2020-11-12 10:07:49 -08:00
neverallow.go Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709) 2020-08-29 01:17:45 -07:00
neverallow_test.go Pass Config to NewTestContext instead of ctx.Register 2020-11-12 10:07:49 -08:00
ninja_deps.go Store ninja file deps from PackageVarContext in the config 2020-11-17 10:50:19 -08:00
ninja_deps_test.go Store ninja file deps from PackageVarContext in the config 2020-11-17 10:50:19 -08:00
notices.go Make a soong-only copy of generate-notice-files.py 2020-03-03 13:50:53 -08:00
onceper.go Convert droidstubs to android.RuleBuilder 2019-07-18 14:28:14 -07:00
onceper_test.go Revert "Make lots of tests run in parallel" 2020-10-09 18:34:24 -07:00
override_module.go Capture list of unused methods when shrinking in R8 2020-08-19 11:19:14 -07:00
package.go Simplify package by using LoadHook instead of mutators 2020-05-06 08:21:39 +01:00
package_ctx.go Store ninja file deps from PackageVarContext in the config 2020-11-17 10:50:19 -08:00
package_test.go Pass Config to NewTestContext instead of ctx.Register 2020-11-12 10:07:49 -08:00
packaging.go Introduce PackagingBase 2020-11-19 08:58:06 +09:00
packaging_test.go Introduce PackagingBase 2020-11-19 08:58:06 +09:00
path_properties.go Add more comments to path_properties.go 2020-11-19 14:28:46 -08:00
path_properties_test.go Pass Config to NewTestContext instead of ctx.Register 2020-11-12 10:07:49 -08:00
paths.go Refactor 'in_make' to mean Kati is not skipped. 2020-11-23 00:29:18 -05:00
paths_test.go Pass Config to NewTestContext instead of ctx.Register 2020-11-12 10:07:49 -08:00
phony.go Refactor 'in_make' to mean Kati is not skipped. 2020-11-23 00:29:18 -05:00
prebuilt.go Support asan/hwasan versions of prebuilts. 2020-10-13 03:37:32 +00:00
prebuilt_build_tool.go Handle absolute source paths correctly. 2020-09-22 01:17:32 +01:00
prebuilt_test.go Pass Config to NewTestContext instead of ctx.Register 2020-11-12 10:07:49 -08:00
proto.go Add method to determine variations from a Target 2019-10-16 14:52:30 -07:00
queryview.go Add 'pre-production' description to queryview action. 2020-11-13 10:06:40 -05:00
register.go Store ninja file deps from PackageVarContext in the config 2020-11-17 10:50:19 -08:00
rule_builder.go Reland: Rewrite sbox to use a textproto manifest 2020-11-20 15:45:04 -08:00
rule_builder_test.go Reland: Rewrite sbox to use a textproto manifest 2020-11-20 15:45:04 -08:00
sandbox.go Sandbox soong_build by changing to root directory 2020-01-11 01:11:46 +00:00
sdk.go Handle property structs and BpPropertySets as values to AddProperty. 2020-09-25 00:33:04 +01:00
singleton.go Add symlink_outputs support to Soong. 2020-10-19 01:26:50 -04:00
soong_config_modules.go Merge "soong config: add value_variable substitution" into rvc-dev 2020-04-11 17:24:57 +00:00
soong_config_modules_test.go Pass Config to NewTestContext instead of ctx.Register 2020-11-12 10:07:49 -08:00
test_suites.go Expose android.filesToInstall 2020-09-29 20:17:22 +09:00
testing.go Refactor 'in_make' to mean Kati is not skipped. 2020-11-23 00:29:18 -05:00
util.go Use common helper functions for getting sorted map keys. 2020-08-20 12:37:03 +01:00
util_test.go Revert "Make lots of tests run in parallel" 2020-10-09 18:34:24 -07:00
variable.go Merge "Revert "Always turn on compatible property"" 2020-11-18 11:13:59 +00:00
variable_test.go Pass Config to NewTestContext instead of ctx.Register 2020-11-12 10:07:49 -08:00
visibility.go Merge "Error if visibility specifies a module" 2020-10-19 19:06:49 +00:00
visibility_test.go Pass Config to NewTestContext instead of ctx.Register 2020-11-12 10:07:49 -08:00
writedocs.go Add dependency on dexpreopt.config to soong_build doc generation. 2020-11-04 01:51:40 -05:00