Prevent bootImageVariant.licenseMetadataFile being set twice

Previously, in a build containing source and prebuilt art
bootclasspath_fragments, the bootImageVariant.licenseMetadataFile was
set twice with the source always being set after the prebuilt and
so winning.

This change only sets bootImageVariant.licenseMetadataFile for the
active module so it will use the prebuilt's license file if that is
preferred.

Bug: 245956352
Test: m nothing
Change-Id: I948c7e5123169452f67c85ad98c4bbdb90a5d2de
This commit is contained in:
Paul Duffin
2022-10-04 20:01:04 +01:00
parent 8eb4573b23
commit 20d90e3e51
2 changed files with 7 additions and 3 deletions

View File

@@ -803,10 +803,15 @@ func buildBootImageVariant(ctx android.ModuleContext, image *bootImageVariant, p
rule.Build(image.name+"JarsDexpreopt_"+image.target.String(), "dexpreopt "+image.name+" jars "+arch.String())
// save output and installed files for makevars
// TODO - these are always the same and so should be initialized in genBootImageConfigs
image.installs = rule.Installs()
image.vdexInstalls = vdexInstalls
image.unstrippedInstalls = unstrippedInstalls
image.licenseMetadataFile = android.OptionalPathForPath(ctx.LicenseMetadataFile())
// Only set the licenseMetadataFile from the active module.
if isActiveModule(ctx.Module()) {
image.licenseMetadataFile = android.OptionalPathForPath(ctx.LicenseMetadataFile())
}
return bootImageVariantOutputs{
image,