Merge "Add a Tag field to dist to dist a tagged output" into rvc-dev am: 84dc13b8de

Change-Id: Ib17eba0f2c03ffe2c7db1da1df009007f5f77a7f
This commit is contained in:
Anton Hansson
2020-03-30 23:35:45 +00:00
committed by Automerger Merge Worker
3 changed files with 59 additions and 1 deletions

View File

@@ -425,6 +425,8 @@ type Module struct {
// list of the xref extraction files
kytheFiles android.Paths
distFile android.Path
}
func (j *Module) OutputFiles(tag string) (android.Paths, error) {
@@ -1782,9 +1784,18 @@ func (j *Module) IsInstallable() bool {
// Java libraries (.jar file)
//
type LibraryProperties struct {
Dist struct {
// The tag of the output of this module that should be output.
Tag *string `android:"arch_variant"`
} `android:"arch_variant"`
}
type Library struct {
Module
libraryProperties LibraryProperties
InstallMixin func(ctx android.ModuleContext, installPath android.Path) (extraInstallDeps android.Paths)
}
@@ -1828,6 +1839,15 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
j.installFile = ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"),
ctx.ModuleName()+".jar", j.outputFile, extraInstallDeps...)
}
// Verify Dist.Tag is set to a supported output
if j.libraryProperties.Dist.Tag != nil {
distFiles, err := j.OutputFiles(*j.libraryProperties.Dist.Tag)
if err != nil {
ctx.PropertyErrorf("dist.tag", "%s", err.Error())
}
j.distFile = distFiles[0]
}
}
func (j *Library) DepsMutator(ctx android.BottomUpMutatorContext) {
@@ -1948,7 +1968,8 @@ func LibraryFactory() android.Module {
&module.Module.properties,
&module.Module.deviceProperties,
&module.Module.dexpreoptProperties,
&module.Module.protoProperties)
&module.Module.protoProperties,
&module.libraryProperties)
android.InitApexModule(module)
android.InitSdkAwareModule(module)