Merge "Support tagged module references" am: b4c35f3378

am: a360b2b335

Change-Id: I61cff6302236ed5c67b86682563eaeae9d0e3363
This commit is contained in:
Colin Cross
2019-06-05 10:34:40 -07:00
committed by android-build-merger
14 changed files with 408 additions and 87 deletions

View File

@@ -130,8 +130,12 @@ func TestAppSplits(t *testing.T) {
foo.Output(expectedOutput)
}
if g, w := foo.Module().(*AndroidApp).Srcs().Strings(), expectedOutputs; !reflect.DeepEqual(g, w) {
t.Errorf("want Srcs() = %q, got %q", w, g)
outputFiles, err := foo.Module().(*AndroidApp).OutputFiles("")
if err != nil {
t.Fatal(err)
}
if g, w := outputFiles.Strings(), expectedOutputs; !reflect.DeepEqual(g, w) {
t.Errorf(`want OutputFiles("") = %q, got %q`, w, g)
}
}

View File

@@ -497,8 +497,13 @@ type Javadoc struct {
stubsSrcJar android.WritablePath
}
func (j *Javadoc) Srcs() android.Paths {
return android.Paths{j.stubsSrcJar}
func (j *Javadoc) OutputFiles(tag string) (android.Paths, error) {
switch tag {
case "":
return android.Paths{j.stubsSrcJar}, nil
default:
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
}
}
func JavadocFactory() android.Module {
@@ -519,7 +524,7 @@ func JavadocHostFactory() android.Module {
return module
}
var _ android.SourceFileProducer = (*Javadoc)(nil)
var _ android.OutputFileProducer = (*Javadoc)(nil)
func (j *Javadoc) sdkVersion() string {
return String(j.properties.Sdk_version)

View File

@@ -351,15 +351,20 @@ type Module struct {
dexpreopter
}
func (j *Module) Srcs() android.Paths {
return append(android.Paths{j.outputFile}, j.extraOutputFiles...)
func (j *Module) OutputFiles(tag string) (android.Paths, error) {
switch tag {
case "":
return append(android.Paths{j.outputFile}, j.extraOutputFiles...), nil
default:
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
}
}
func (j *Module) DexJarFile() android.Path {
return j.dexJarFile
}
var _ android.SourceFileProducer = (*Module)(nil)
var _ android.OutputFileProducer = (*Module)(nil)
type Dependency interface {
HeaderJars() android.Paths
@@ -813,8 +818,6 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
}
default:
switch tag {
case android.DefaultsDepTag, android.SourceDepTag:
// Nothing to do
case systemModulesTag:
if deps.systemModules != nil {
panic("Found two system module dependencies")
@@ -824,8 +827,6 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
panic("Missing directory for system module dependency")
}
deps.systemModules = sm.outputFile
default:
ctx.ModuleErrorf("depends on non-java module %q", otherName)
}
}
})