Revert "Use OutputFilesProvider on buildinfo_prop and some android test modules"
This reverts commit 89e4ff60d3
.
Reason for revert: build breakage on aosp-main/mainline_modules_sdks-trunk_staging-userdebug
Change-Id: I5ddac59f66a0e7a96fab39647d406499e3875f6a
This commit is contained in:
committed by
Gerrit Code Review
parent
89e4ff60d3
commit
9b21596db4
@@ -36,6 +36,10 @@ type customModule struct {
|
|||||||
data AndroidMkData
|
data AndroidMkData
|
||||||
distFiles TaggedDistFiles
|
distFiles TaggedDistFiles
|
||||||
outputFile OptionalPath
|
outputFile OptionalPath
|
||||||
|
|
||||||
|
// The paths that will be used as the default dist paths if no tag is
|
||||||
|
// specified.
|
||||||
|
defaultDistPaths Paths
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -47,7 +51,6 @@ const (
|
|||||||
func (m *customModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
func (m *customModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
||||||
|
|
||||||
m.base().licenseMetadataFile = PathForOutput(ctx, "meta_lic")
|
m.base().licenseMetadataFile = PathForOutput(ctx, "meta_lic")
|
||||||
var defaultDistPaths Paths
|
|
||||||
|
|
||||||
// If the dist_output_file: true then create an output file that is stored in
|
// If the dist_output_file: true then create an output file that is stored in
|
||||||
// the OutputFile property of the AndroidMkEntry.
|
// the OutputFile property of the AndroidMkEntry.
|
||||||
@@ -59,7 +62,7 @@ func (m *customModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
|||||||
// property in AndroidMkEntry when determining the default dist paths.
|
// property in AndroidMkEntry when determining the default dist paths.
|
||||||
// Setting this first allows it to be overridden based on the
|
// Setting this first allows it to be overridden based on the
|
||||||
// default_dist_files setting replicating that previous behavior.
|
// default_dist_files setting replicating that previous behavior.
|
||||||
defaultDistPaths = Paths{path}
|
m.defaultDistPaths = Paths{path}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Based on the setting of the default_dist_files property possibly create a
|
// Based on the setting of the default_dist_files property possibly create a
|
||||||
@@ -68,40 +71,29 @@ func (m *customModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
|||||||
defaultDistFiles := proptools.StringDefault(m.properties.Default_dist_files, defaultDistFiles_Tagged)
|
defaultDistFiles := proptools.StringDefault(m.properties.Default_dist_files, defaultDistFiles_Tagged)
|
||||||
switch defaultDistFiles {
|
switch defaultDistFiles {
|
||||||
case defaultDistFiles_None:
|
case defaultDistFiles_None:
|
||||||
m.setOutputFiles(ctx, defaultDistPaths)
|
// Do nothing
|
||||||
|
|
||||||
case defaultDistFiles_Default:
|
case defaultDistFiles_Default:
|
||||||
path := PathForTesting("default-dist.out")
|
path := PathForTesting("default-dist.out")
|
||||||
defaultDistPaths = Paths{path}
|
m.defaultDistPaths = Paths{path}
|
||||||
m.setOutputFiles(ctx, defaultDistPaths)
|
|
||||||
m.distFiles = MakeDefaultDistFiles(path)
|
m.distFiles = MakeDefaultDistFiles(path)
|
||||||
|
|
||||||
case defaultDistFiles_Tagged:
|
case defaultDistFiles_Tagged:
|
||||||
// Module types that set AndroidMkEntry.DistFiles to the result of calling
|
// Module types that set AndroidMkEntry.DistFiles to the result of calling
|
||||||
// GenerateTaggedDistFiles(ctx) relied on no tag being treated as "" which
|
// GenerateTaggedDistFiles(ctx) relied on no tag being treated as "" which
|
||||||
// meant that the default dist paths would be the same as empty-string-tag
|
// meant that the default dist paths would be whatever was returned by
|
||||||
// output files. In order to preserve that behavior when treating no tag
|
// OutputFiles(""). In order to preserve that behavior when treating no tag
|
||||||
// as being equal to DefaultDistTag this ensures that DefaultDistTag output
|
// as being equal to DefaultDistTag this ensures that
|
||||||
// will be the same as empty-string-tag output.
|
// OutputFiles(DefaultDistTag) will return the same as OutputFiles("").
|
||||||
defaultDistPaths = PathsForTesting("one.out")
|
m.defaultDistPaths = PathsForTesting("one.out")
|
||||||
m.setOutputFiles(ctx, defaultDistPaths)
|
|
||||||
|
|
||||||
// This must be called after setting defaultDistPaths/outputFile as
|
// This must be called after setting defaultDistPaths/outputFile as
|
||||||
// GenerateTaggedDistFiles calls into outputFiles property which may use
|
// GenerateTaggedDistFiles calls into OutputFiles(tag) which may use those
|
||||||
// those fields.
|
// fields.
|
||||||
m.distFiles = m.GenerateTaggedDistFiles(ctx)
|
m.distFiles = m.GenerateTaggedDistFiles(ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *customModule) setOutputFiles(ctx ModuleContext, defaultDistPaths Paths) {
|
|
||||||
ctx.SetOutputFiles(PathsForTesting("one.out"), "")
|
|
||||||
ctx.SetOutputFiles(PathsForTesting("two.out", "three/four.out"), ".multiple")
|
|
||||||
ctx.SetOutputFiles(PathsForTesting("another.out"), ".another-tag")
|
|
||||||
if defaultDistPaths != nil {
|
|
||||||
ctx.SetOutputFiles(defaultDistPaths, DefaultDistTag)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *customModule) AndroidMk() AndroidMkData {
|
func (m *customModule) AndroidMk() AndroidMkData {
|
||||||
return AndroidMkData{
|
return AndroidMkData{
|
||||||
Custom: func(w io.Writer, name, prefix, moduleDir string, data AndroidMkData) {
|
Custom: func(w io.Writer, name, prefix, moduleDir string, data AndroidMkData) {
|
||||||
@@ -110,6 +102,25 @@ func (m *customModule) AndroidMk() AndroidMkData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *customModule) OutputFiles(tag string) (Paths, error) {
|
||||||
|
switch tag {
|
||||||
|
case DefaultDistTag:
|
||||||
|
if m.defaultDistPaths != nil {
|
||||||
|
return m.defaultDistPaths, nil
|
||||||
|
} else {
|
||||||
|
return nil, fmt.Errorf("default dist tag is not available")
|
||||||
|
}
|
||||||
|
case "":
|
||||||
|
return PathsForTesting("one.out"), nil
|
||||||
|
case ".multiple":
|
||||||
|
return PathsForTesting("two.out", "three/four.out"), nil
|
||||||
|
case ".another-tag":
|
||||||
|
return PathsForTesting("another.out"), nil
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (m *customModule) AndroidMkEntries() []AndroidMkEntries {
|
func (m *customModule) AndroidMkEntries() []AndroidMkEntries {
|
||||||
return []AndroidMkEntries{
|
return []AndroidMkEntries{
|
||||||
{
|
{
|
||||||
|
@@ -15,6 +15,8 @@
|
|||||||
package android
|
package android
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -39,10 +41,20 @@ type buildinfoPropModule struct {
|
|||||||
installPath InstallPath
|
installPath InstallPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ OutputFileProducer = (*buildinfoPropModule)(nil)
|
||||||
|
|
||||||
func (p *buildinfoPropModule) installable() bool {
|
func (p *buildinfoPropModule) installable() bool {
|
||||||
return proptools.BoolDefault(p.properties.Installable, true)
|
return proptools.BoolDefault(p.properties.Installable, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OutputFileProducer
|
||||||
|
func (p *buildinfoPropModule) OutputFiles(tag string) (Paths, error) {
|
||||||
|
if tag != "" {
|
||||||
|
return nil, fmt.Errorf("unsupported tag %q", tag)
|
||||||
|
}
|
||||||
|
return Paths{p.outputFilePath}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func shouldAddBuildThumbprint(config Config) bool {
|
func shouldAddBuildThumbprint(config Config) bool {
|
||||||
knownOemProperties := []string{
|
knownOemProperties := []string{
|
||||||
"ro.product.brand",
|
"ro.product.brand",
|
||||||
@@ -103,8 +115,6 @@ func (p *buildinfoPropModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
|||||||
|
|
||||||
p.installPath = PathForModuleInstall(ctx)
|
p.installPath = PathForModuleInstall(ctx)
|
||||||
ctx.InstallFile(p.installPath, p.Name(), p.outputFilePath)
|
ctx.InstallFile(p.installPath, p.Name(), p.outputFilePath)
|
||||||
|
|
||||||
ctx.SetOutputFiles(Paths{p.outputFilePath}, "")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *buildinfoPropModule) AndroidMkEntries() []AndroidMkEntries {
|
func (p *buildinfoPropModule) AndroidMkEntries() []AndroidMkEntries {
|
||||||
|
@@ -1183,6 +1183,9 @@ type pathForModuleSrcOutputFileProviderModule struct {
|
|||||||
Outs []string
|
Outs []string
|
||||||
Tagged []string
|
Tagged []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
outs Paths
|
||||||
|
tagged Paths
|
||||||
}
|
}
|
||||||
|
|
||||||
func pathForModuleSrcOutputFileProviderModuleFactory() Module {
|
func pathForModuleSrcOutputFileProviderModuleFactory() Module {
|
||||||
@@ -1193,17 +1196,24 @@ func pathForModuleSrcOutputFileProviderModuleFactory() Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *pathForModuleSrcOutputFileProviderModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
func (p *pathForModuleSrcOutputFileProviderModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
||||||
var outs, taggedOuts Paths
|
|
||||||
for _, out := range p.props.Outs {
|
for _, out := range p.props.Outs {
|
||||||
outs = append(outs, PathForModuleOut(ctx, out))
|
p.outs = append(p.outs, PathForModuleOut(ctx, out))
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tagged := range p.props.Tagged {
|
for _, tagged := range p.props.Tagged {
|
||||||
taggedOuts = append(taggedOuts, PathForModuleOut(ctx, tagged))
|
p.tagged = append(p.tagged, PathForModuleOut(ctx, tagged))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ctx.SetOutputFiles(outs, "")
|
func (p *pathForModuleSrcOutputFileProviderModule) OutputFiles(tag string) (Paths, error) {
|
||||||
ctx.SetOutputFiles(taggedOuts, ".tagged")
|
switch tag {
|
||||||
|
case "":
|
||||||
|
return p.outs, nil
|
||||||
|
case ".tagged":
|
||||||
|
return p.tagged, nil
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("unsupported tag %q", tag)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type pathForModuleSrcTestCase struct {
|
type pathForModuleSrcTestCase struct {
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
package android
|
package android
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
@@ -493,6 +494,7 @@ type prebuiltModule struct {
|
|||||||
properties struct {
|
properties struct {
|
||||||
Srcs []string `android:"path,arch_variant"`
|
Srcs []string `android:"path,arch_variant"`
|
||||||
}
|
}
|
||||||
|
src Path
|
||||||
}
|
}
|
||||||
|
|
||||||
func newPrebuiltModule() Module {
|
func newPrebuiltModule() Module {
|
||||||
@@ -508,17 +510,24 @@ func (p *prebuiltModule) Name() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *prebuiltModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
func (p *prebuiltModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
||||||
var src Path
|
|
||||||
if len(p.properties.Srcs) >= 1 {
|
if len(p.properties.Srcs) >= 1 {
|
||||||
src = p.prebuilt.SingleSourcePath(ctx)
|
p.src = p.prebuilt.SingleSourcePath(ctx)
|
||||||
}
|
}
|
||||||
ctx.SetOutputFiles(Paths{src}, "")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *prebuiltModule) Prebuilt() *Prebuilt {
|
func (p *prebuiltModule) Prebuilt() *Prebuilt {
|
||||||
return &p.prebuilt
|
return &p.prebuilt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *prebuiltModule) OutputFiles(tag string) (Paths, error) {
|
||||||
|
switch tag {
|
||||||
|
case "":
|
||||||
|
return Paths{p.src}, nil
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type sourceModuleProperties struct {
|
type sourceModuleProperties struct {
|
||||||
Deps []string `android:"path,arch_variant"`
|
Deps []string `android:"path,arch_variant"`
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user