Extract dist properties from commonProperties
Common properties are automatically inherited from a parent module (i.e. one that calls CreateModule()) to the child module that it creates. This makes no sense for dist/dists properties so this change extracts them into their own structure separate to the commonProperties. Test: m checkbuild and TreeHugger Bug: 160448975 Change-Id: Icceb20455e13394dd3b3bce464fb9bb34882d6c3
This commit is contained in:
parent
4f78c512d4
commit
ed87513b0b
|
@ -195,7 +195,8 @@ func InitDefaultsModule(module DefaultsModule) {
|
||||||
module.AddProperties(
|
module.AddProperties(
|
||||||
&hostAndDeviceProperties{},
|
&hostAndDeviceProperties{},
|
||||||
commonProperties,
|
commonProperties,
|
||||||
&ApexProperties{})
|
&ApexProperties{},
|
||||||
|
&distProperties{})
|
||||||
|
|
||||||
initAndroidModuleBase(module)
|
initAndroidModuleBase(module)
|
||||||
initProductVariableModule(module)
|
initProductVariableModule(module)
|
||||||
|
|
|
@ -490,14 +490,6 @@ type commonProperties struct {
|
||||||
// relative path to a file to include in the list of notices for the device
|
// relative path to a file to include in the list of notices for the device
|
||||||
Notice *string `android:"path"`
|
Notice *string `android:"path"`
|
||||||
|
|
||||||
// configuration to distribute output files from this module to the distribution
|
|
||||||
// directory (default: $OUT/dist, configurable with $DIST_DIR)
|
|
||||||
Dist Dist `android:"arch_variant"`
|
|
||||||
|
|
||||||
// a list of configurations to distribute output files from this module to the
|
|
||||||
// distribution directory (default: $OUT/dist, configurable with $DIST_DIR)
|
|
||||||
Dists []Dist `android:"arch_variant"`
|
|
||||||
|
|
||||||
// The OsType of artifacts that this module variant is responsible for creating.
|
// The OsType of artifacts that this module variant is responsible for creating.
|
||||||
//
|
//
|
||||||
// Set by osMutator
|
// Set by osMutator
|
||||||
|
@ -566,6 +558,16 @@ type commonProperties struct {
|
||||||
ImageVariation string `blueprint:"mutated"`
|
ImageVariation string `blueprint:"mutated"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type distProperties struct {
|
||||||
|
// configuration to distribute output files from this module to the distribution
|
||||||
|
// directory (default: $OUT/dist, configurable with $DIST_DIR)
|
||||||
|
Dist Dist `android:"arch_variant"`
|
||||||
|
|
||||||
|
// a list of configurations to distribute output files from this module to the
|
||||||
|
// distribution directory (default: $OUT/dist, configurable with $DIST_DIR)
|
||||||
|
Dists []Dist `android:"arch_variant"`
|
||||||
|
}
|
||||||
|
|
||||||
// A map of OutputFile tag keys to Paths, for disting purposes.
|
// A map of OutputFile tag keys to Paths, for disting purposes.
|
||||||
type TaggedDistFiles map[string]Paths
|
type TaggedDistFiles map[string]Paths
|
||||||
|
|
||||||
|
@ -661,7 +663,8 @@ func InitAndroidModule(m Module) {
|
||||||
|
|
||||||
m.AddProperties(
|
m.AddProperties(
|
||||||
&base.nameProperties,
|
&base.nameProperties,
|
||||||
&base.commonProperties)
|
&base.commonProperties,
|
||||||
|
&base.distProperties)
|
||||||
|
|
||||||
initProductVariableModule(m)
|
initProductVariableModule(m)
|
||||||
|
|
||||||
|
@ -752,6 +755,7 @@ type ModuleBase struct {
|
||||||
|
|
||||||
nameProperties nameProperties
|
nameProperties nameProperties
|
||||||
commonProperties commonProperties
|
commonProperties commonProperties
|
||||||
|
distProperties distProperties
|
||||||
variableProperties interface{}
|
variableProperties interface{}
|
||||||
hostAndDeviceProperties hostAndDeviceProperties
|
hostAndDeviceProperties hostAndDeviceProperties
|
||||||
generalProperties []interface{}
|
generalProperties []interface{}
|
||||||
|
@ -861,13 +865,13 @@ func (m *ModuleBase) visibilityProperties() []visibilityProperty {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ModuleBase) Dists() []Dist {
|
func (m *ModuleBase) Dists() []Dist {
|
||||||
if len(m.commonProperties.Dist.Targets) > 0 {
|
if len(m.distProperties.Dist.Targets) > 0 {
|
||||||
// Make a copy of the underlying Dists slice to protect against
|
// Make a copy of the underlying Dists slice to protect against
|
||||||
// backing array modifications with repeated calls to this method.
|
// backing array modifications with repeated calls to this method.
|
||||||
distsCopy := append([]Dist(nil), m.commonProperties.Dists...)
|
distsCopy := append([]Dist(nil), m.distProperties.Dists...)
|
||||||
return append(distsCopy, m.commonProperties.Dist)
|
return append(distsCopy, m.distProperties.Dist)
|
||||||
} else {
|
} else {
|
||||||
return m.commonProperties.Dists
|
return m.distProperties.Dists
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1344,20 +1348,20 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
||||||
ctx.Variable(pctx, "moduleDescSuffix", s)
|
ctx.Variable(pctx, "moduleDescSuffix", s)
|
||||||
|
|
||||||
// Some common property checks for properties that will be used later in androidmk.go
|
// Some common property checks for properties that will be used later in androidmk.go
|
||||||
if m.commonProperties.Dist.Dest != nil {
|
if m.distProperties.Dist.Dest != nil {
|
||||||
_, err := validateSafePath(*m.commonProperties.Dist.Dest)
|
_, err := validateSafePath(*m.distProperties.Dist.Dest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.PropertyErrorf("dist.dest", "%s", err.Error())
|
ctx.PropertyErrorf("dist.dest", "%s", err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if m.commonProperties.Dist.Dir != nil {
|
if m.distProperties.Dist.Dir != nil {
|
||||||
_, err := validateSafePath(*m.commonProperties.Dist.Dir)
|
_, err := validateSafePath(*m.distProperties.Dist.Dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.PropertyErrorf("dist.dir", "%s", err.Error())
|
ctx.PropertyErrorf("dist.dir", "%s", err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if m.commonProperties.Dist.Suffix != nil {
|
if m.distProperties.Dist.Suffix != nil {
|
||||||
if strings.Contains(*m.commonProperties.Dist.Suffix, "/") {
|
if strings.Contains(*m.distProperties.Dist.Suffix, "/") {
|
||||||
ctx.PropertyErrorf("dist.suffix", "Suffix may not contain a '/' character.")
|
ctx.PropertyErrorf("dist.suffix", "Suffix may not contain a '/' character.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue