Refactor factories
Change module factories from returning a blueprint.Module and a list of property structs to returning an android.Module, which holds the list of property structs. Test: build.ninja identical except for Factory: comment lines Change-Id: Ica1d823f009db812c518f271a386fbff39c9766f
This commit is contained in:
@@ -20,7 +20,6 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -491,13 +490,11 @@ func createArchType(props reflect.Type) reflect.Type {
|
|||||||
|
|
||||||
var archPropTypeMap OncePer
|
var archPropTypeMap OncePer
|
||||||
|
|
||||||
func InitArchModule(m Module,
|
func InitArchModule(m Module) {
|
||||||
propertyStructs ...interface{}) (blueprint.Module, []interface{}) {
|
|
||||||
|
|
||||||
base := m.base()
|
base := m.base()
|
||||||
|
|
||||||
base.generalProperties = append(base.generalProperties,
|
base.generalProperties = m.GetProperties()
|
||||||
propertyStructs...)
|
|
||||||
|
|
||||||
for _, properties := range base.generalProperties {
|
for _, properties := range base.generalProperties {
|
||||||
propertiesValue := reflect.ValueOf(properties)
|
propertiesValue := reflect.ValueOf(properties)
|
||||||
@@ -524,17 +521,13 @@ func InitArchModule(m Module,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var allProperties []interface{}
|
|
||||||
allProperties = append(allProperties, base.generalProperties...)
|
|
||||||
for _, asp := range base.archProperties {
|
for _, asp := range base.archProperties {
|
||||||
if asp != nil {
|
if asp != nil {
|
||||||
allProperties = append(allProperties, asp)
|
m.AddProperties(asp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
base.customizableProperties = allProperties
|
base.customizableProperties = m.GetProperties()
|
||||||
|
|
||||||
return m, allProperties
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var variantReplacer = strings.NewReplacer("-", "_", ".", "_")
|
var variantReplacer = strings.NewReplacer("-", "_", ".", "_")
|
||||||
|
@@ -50,14 +50,11 @@ type Defaultable interface {
|
|||||||
|
|
||||||
var _ Defaultable = (*DefaultableModule)(nil)
|
var _ Defaultable = (*DefaultableModule)(nil)
|
||||||
|
|
||||||
func InitDefaultableModule(module Module, d Defaultable,
|
func InitDefaultableModule(module Module, d Defaultable) {
|
||||||
props ...interface{}) (blueprint.Module, []interface{}) {
|
|
||||||
|
|
||||||
d.setProperties(props)
|
d.setProperties(module.GetProperties())
|
||||||
|
|
||||||
props = append(props, d.defaults())
|
module.AddProperties(d.defaults())
|
||||||
|
|
||||||
return module, props
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type DefaultsModule struct {
|
type DefaultsModule struct {
|
||||||
@@ -79,21 +76,18 @@ func (d *DefaultsModule) properties() []interface{} {
|
|||||||
return d.defaultableProperties
|
return d.defaultableProperties
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitDefaultsModule(module Module, d Defaults, props ...interface{}) (blueprint.Module, []interface{}) {
|
func InitDefaultsModule(module Module, d Defaults) {
|
||||||
props = append(props,
|
module.AddProperties(
|
||||||
&hostAndDeviceProperties{},
|
&hostAndDeviceProperties{},
|
||||||
&commonProperties{},
|
&commonProperties{},
|
||||||
&variableProperties{})
|
&variableProperties{})
|
||||||
|
|
||||||
_, props = InitArchModule(module, props...)
|
InitArchModule(module)
|
||||||
|
InitDefaultableModule(module, d)
|
||||||
|
|
||||||
_, props = InitDefaultableModule(module, d, props...)
|
module.AddProperties(&module.base().nameProperties)
|
||||||
|
|
||||||
props = append(props, &module.base().nameProperties)
|
|
||||||
|
|
||||||
module.base().module = module
|
module.base().module = module
|
||||||
|
|
||||||
return module, props
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ Defaults = (*DefaultsModule)(nil)
|
var _ Defaults = (*DefaultsModule)(nil)
|
||||||
|
@@ -108,6 +108,9 @@ type Module interface {
|
|||||||
InstallInData() bool
|
InstallInData() bool
|
||||||
InstallInSanitizerDir() bool
|
InstallInSanitizerDir() bool
|
||||||
SkipInstall()
|
SkipInstall()
|
||||||
|
|
||||||
|
AddProperties(props ...interface{})
|
||||||
|
GetProperties() []interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
type nameProperties struct {
|
type nameProperties struct {
|
||||||
@@ -194,24 +197,18 @@ const (
|
|||||||
NeitherHostNorDeviceSupported
|
NeitherHostNorDeviceSupported
|
||||||
)
|
)
|
||||||
|
|
||||||
func InitAndroidModule(m Module,
|
func InitAndroidModule(m Module) {
|
||||||
propertyStructs ...interface{}) (blueprint.Module, []interface{}) {
|
|
||||||
|
|
||||||
base := m.base()
|
base := m.base()
|
||||||
base.module = m
|
base.module = m
|
||||||
|
|
||||||
propertyStructs = append(propertyStructs,
|
m.AddProperties(
|
||||||
&base.nameProperties,
|
&base.nameProperties,
|
||||||
&base.commonProperties,
|
&base.commonProperties,
|
||||||
&base.variableProperties)
|
&base.variableProperties)
|
||||||
|
|
||||||
return m, propertyStructs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib Multilib,
|
func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib Multilib) {
|
||||||
propertyStructs ...interface{}) (blueprint.Module, []interface{}) {
|
InitAndroidModule(m)
|
||||||
|
|
||||||
_, propertyStructs = InitAndroidModule(m, propertyStructs...)
|
|
||||||
|
|
||||||
base := m.base()
|
base := m.base()
|
||||||
base.commonProperties.HostOrDeviceSupported = hod
|
base.commonProperties.HostOrDeviceSupported = hod
|
||||||
@@ -225,10 +222,10 @@ func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib
|
|||||||
base.hostAndDeviceProperties.Device_supported = boolPtr(true)
|
base.hostAndDeviceProperties.Device_supported = boolPtr(true)
|
||||||
fallthrough
|
fallthrough
|
||||||
case HostAndDeviceDefault:
|
case HostAndDeviceDefault:
|
||||||
propertyStructs = append(propertyStructs, &base.hostAndDeviceProperties)
|
m.AddProperties(&base.hostAndDeviceProperties)
|
||||||
}
|
}
|
||||||
|
|
||||||
return InitArchModule(m, propertyStructs...)
|
InitArchModule(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
// A ModuleBase object contains the properties that are common to all Android
|
// A ModuleBase object contains the properties that are common to all Android
|
||||||
@@ -250,7 +247,6 @@ func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib
|
|||||||
//
|
//
|
||||||
// import (
|
// import (
|
||||||
// "android/soong/android"
|
// "android/soong/android"
|
||||||
// "github.com/google/blueprint"
|
|
||||||
// )
|
// )
|
||||||
//
|
//
|
||||||
// type myModule struct {
|
// type myModule struct {
|
||||||
@@ -260,9 +256,11 @@ func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// func NewMyModule() (blueprint.Module, []interface{}) {
|
// func NewMyModule() android.Module) {
|
||||||
// m := &myModule{}
|
// m := &myModule{}
|
||||||
// return android.InitAndroidModule(m, &m.properties)
|
// m.AddProperties(&m.properties)
|
||||||
|
// android.InitAndroidModule(m)
|
||||||
|
// return m
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// func (m *myModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
// func (m *myModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
@@ -274,6 +272,7 @@ func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib
|
|||||||
type ModuleBase struct {
|
type ModuleBase struct {
|
||||||
// Putting the curiously recurring thing pointing to the thing that contains
|
// Putting the curiously recurring thing pointing to the thing that contains
|
||||||
// the thing pattern to good use.
|
// the thing pattern to good use.
|
||||||
|
// TODO: remove this
|
||||||
module Module
|
module Module
|
||||||
|
|
||||||
nameProperties nameProperties
|
nameProperties nameProperties
|
||||||
@@ -295,6 +294,16 @@ type ModuleBase struct {
|
|||||||
blueprintDir string
|
blueprintDir string
|
||||||
|
|
||||||
hooks hooks
|
hooks hooks
|
||||||
|
|
||||||
|
registerProps []interface{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *ModuleBase) AddProperties(props ...interface{}) {
|
||||||
|
a.registerProps = append(a.registerProps, props...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *ModuleBase) GetProperties() []interface{} {
|
||||||
|
return a.registerProps
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name returns the name of the module. It may be overridden by individual module types, for
|
// Name returns the name of the module. It may be overridden by individual module types, for
|
||||||
|
@@ -123,8 +123,8 @@ func TestPrebuilts(t *testing.T) {
|
|||||||
for _, test := range prebuiltsTests {
|
for _, test := range prebuiltsTests {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
ctx := NewContext()
|
ctx := NewContext()
|
||||||
ctx.RegisterModuleType("prebuilt", newPrebuiltModule)
|
ctx.RegisterModuleType("prebuilt", ModuleFactoryAdaptor(newPrebuiltModule))
|
||||||
ctx.RegisterModuleType("source", newSourceModule)
|
ctx.RegisterModuleType("source", ModuleFactoryAdaptor(newSourceModule))
|
||||||
ctx.MockFileSystem(map[string][]byte{
|
ctx.MockFileSystem(map[string][]byte{
|
||||||
"Blueprints": []byte(`
|
"Blueprints": []byte(`
|
||||||
source {
|
source {
|
||||||
@@ -183,9 +183,11 @@ type prebuiltModule struct {
|
|||||||
prebuilt Prebuilt
|
prebuilt Prebuilt
|
||||||
}
|
}
|
||||||
|
|
||||||
func newPrebuiltModule() (blueprint.Module, []interface{}) {
|
func newPrebuiltModule() Module {
|
||||||
m := &prebuiltModule{}
|
m := &prebuiltModule{}
|
||||||
return InitAndroidModule(m, &m.prebuilt.Properties)
|
m.AddProperties(&m.prebuilt.Properties)
|
||||||
|
InitAndroidModule(m)
|
||||||
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *prebuiltModule) Name() string {
|
func (p *prebuiltModule) Name() string {
|
||||||
@@ -210,9 +212,11 @@ type sourceModule struct {
|
|||||||
dependsOnSourceModule, dependsOnPrebuiltModule bool
|
dependsOnSourceModule, dependsOnPrebuiltModule bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func newSourceModule() (blueprint.Module, []interface{}) {
|
func newSourceModule() Module {
|
||||||
m := &sourceModule{}
|
m := &sourceModule{}
|
||||||
return InitAndroidModule(m, &m.properties)
|
m.AddProperties(&m.properties)
|
||||||
|
InitAndroidModule(m)
|
||||||
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *sourceModule) DepsMutator(ctx BottomUpMutatorContext) {
|
func (s *sourceModule) DepsMutator(ctx BottomUpMutatorContext) {
|
||||||
|
@@ -41,8 +41,19 @@ type mutator struct {
|
|||||||
|
|
||||||
var mutators []*mutator
|
var mutators []*mutator
|
||||||
|
|
||||||
func RegisterModuleType(name string, factory blueprint.ModuleFactory) {
|
type ModuleFactory func() Module
|
||||||
moduleTypes = append(moduleTypes, moduleType{name, factory})
|
|
||||||
|
// ModuleFactoryAdapter Wraps a ModuleFactory into a blueprint.ModuleFactory by converting an Module
|
||||||
|
// into a blueprint.Module and a list of property structs
|
||||||
|
func ModuleFactoryAdaptor(factory ModuleFactory) blueprint.ModuleFactory {
|
||||||
|
return func() (blueprint.Module, []interface{}) {
|
||||||
|
module := factory()
|
||||||
|
return module, module.GetProperties()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterModuleType(name string, factory ModuleFactory) {
|
||||||
|
moduleTypes = append(moduleTypes, moduleType{name, ModuleFactoryAdaptor(factory)})
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterSingletonType(name string, factory blueprint.SingletonFactory) {
|
func RegisterSingletonType(name string, factory blueprint.SingletonFactory) {
|
||||||
|
@@ -17,7 +17,6 @@ package cc
|
|||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
@@ -55,13 +54,13 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Module factory for binaries
|
// Module factory for binaries
|
||||||
func binaryFactory() (blueprint.Module, []interface{}) {
|
func binaryFactory() android.Module {
|
||||||
module, _ := NewBinary(android.HostAndDeviceSupported)
|
module, _ := NewBinary(android.HostAndDeviceSupported)
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module factory for host binaries
|
// Module factory for host binaries
|
||||||
func binaryHostFactory() (blueprint.Module, []interface{}) {
|
func binaryHostFactory() android.Module {
|
||||||
module, _ := NewBinary(android.HostSupported)
|
module, _ := NewBinary(android.HostSupported)
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
37
cc/cc.go
37
cc/cc.go
@@ -304,36 +304,38 @@ type Module struct {
|
|||||||
flags Flags
|
flags Flags
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) Init() (blueprint.Module, []interface{}) {
|
func (c *Module) Init() android.Module {
|
||||||
props := []interface{}{&c.Properties, &c.unused}
|
c.AddProperties(&c.Properties, &c.unused)
|
||||||
if c.compiler != nil {
|
if c.compiler != nil {
|
||||||
props = append(props, c.compiler.compilerProps()...)
|
c.AddProperties(c.compiler.compilerProps()...)
|
||||||
}
|
}
|
||||||
if c.linker != nil {
|
if c.linker != nil {
|
||||||
props = append(props, c.linker.linkerProps()...)
|
c.AddProperties(c.linker.linkerProps()...)
|
||||||
}
|
}
|
||||||
if c.installer != nil {
|
if c.installer != nil {
|
||||||
props = append(props, c.installer.installerProps()...)
|
c.AddProperties(c.installer.installerProps()...)
|
||||||
}
|
}
|
||||||
if c.stl != nil {
|
if c.stl != nil {
|
||||||
props = append(props, c.stl.props()...)
|
c.AddProperties(c.stl.props()...)
|
||||||
}
|
}
|
||||||
if c.sanitize != nil {
|
if c.sanitize != nil {
|
||||||
props = append(props, c.sanitize.props()...)
|
c.AddProperties(c.sanitize.props()...)
|
||||||
}
|
}
|
||||||
if c.coverage != nil {
|
if c.coverage != nil {
|
||||||
props = append(props, c.coverage.props()...)
|
c.AddProperties(c.coverage.props()...)
|
||||||
}
|
}
|
||||||
if c.sabi != nil {
|
if c.sabi != nil {
|
||||||
props = append(props, c.sabi.props()...)
|
c.AddProperties(c.sabi.props()...)
|
||||||
}
|
}
|
||||||
for _, feature := range c.features {
|
for _, feature := range c.features {
|
||||||
props = append(props, feature.props()...)
|
c.AddProperties(feature.props()...)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, props = android.InitAndroidArchModule(c, c.hod, c.multilib, props...)
|
android.InitAndroidArchModule(c, c.hod, c.multilib)
|
||||||
|
|
||||||
return android.InitDefaultableModule(c, c, props...)
|
android.InitDefaultableModule(c, c)
|
||||||
|
|
||||||
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true for dependency roots (binaries)
|
// Returns true for dependency roots (binaries)
|
||||||
@@ -1108,14 +1110,15 @@ func (*Defaults) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
func (d *Defaults) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (d *Defaults) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func defaultsFactory() (blueprint.Module, []interface{}) {
|
func defaultsFactory() android.Module {
|
||||||
return DefaultsFactory()
|
return DefaultsFactory()
|
||||||
}
|
}
|
||||||
|
|
||||||
func DefaultsFactory(props ...interface{}) (blueprint.Module, []interface{}) {
|
func DefaultsFactory(props ...interface{}) android.Module {
|
||||||
module := &Defaults{}
|
module := &Defaults{}
|
||||||
|
|
||||||
props = append(props,
|
module.AddProperties(props...)
|
||||||
|
module.AddProperties(
|
||||||
&BaseProperties{},
|
&BaseProperties{},
|
||||||
&BaseCompilerProperties{},
|
&BaseCompilerProperties{},
|
||||||
&BaseLinkerProperties{},
|
&BaseLinkerProperties{},
|
||||||
@@ -1134,7 +1137,9 @@ func DefaultsFactory(props ...interface{}) (blueprint.Module, []interface{}) {
|
|||||||
&SAbiProperties{},
|
&SAbiProperties{},
|
||||||
)
|
)
|
||||||
|
|
||||||
return android.InitDefaultsModule(module, module, props...)
|
android.InitDefaultsModule(module, module)
|
||||||
|
|
||||||
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@@ -16,6 +16,7 @@ package cc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -108,41 +108,41 @@ func init() {
|
|||||||
|
|
||||||
// Module factory for combined static + shared libraries, device by default but with possible host
|
// Module factory for combined static + shared libraries, device by default but with possible host
|
||||||
// support
|
// support
|
||||||
func libraryFactory() (blueprint.Module, []interface{}) {
|
func libraryFactory() android.Module {
|
||||||
module, _ := NewLibrary(android.HostAndDeviceSupported)
|
module, _ := NewLibrary(android.HostAndDeviceSupported)
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module factory for static libraries
|
// Module factory for static libraries
|
||||||
func libraryStaticFactory() (blueprint.Module, []interface{}) {
|
func libraryStaticFactory() android.Module {
|
||||||
module, library := NewLibrary(android.HostAndDeviceSupported)
|
module, library := NewLibrary(android.HostAndDeviceSupported)
|
||||||
library.BuildOnlyStatic()
|
library.BuildOnlyStatic()
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module factory for shared libraries
|
// Module factory for shared libraries
|
||||||
func librarySharedFactory() (blueprint.Module, []interface{}) {
|
func librarySharedFactory() android.Module {
|
||||||
module, library := NewLibrary(android.HostAndDeviceSupported)
|
module, library := NewLibrary(android.HostAndDeviceSupported)
|
||||||
library.BuildOnlyShared()
|
library.BuildOnlyShared()
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module factory for host static libraries
|
// Module factory for host static libraries
|
||||||
func libraryHostStaticFactory() (blueprint.Module, []interface{}) {
|
func libraryHostStaticFactory() android.Module {
|
||||||
module, library := NewLibrary(android.HostSupported)
|
module, library := NewLibrary(android.HostSupported)
|
||||||
library.BuildOnlyStatic()
|
library.BuildOnlyStatic()
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module factory for host shared libraries
|
// Module factory for host shared libraries
|
||||||
func libraryHostSharedFactory() (blueprint.Module, []interface{}) {
|
func libraryHostSharedFactory() android.Module {
|
||||||
module, library := NewLibrary(android.HostSupported)
|
module, library := NewLibrary(android.HostSupported)
|
||||||
library.BuildOnlyShared()
|
library.BuildOnlyShared()
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module factory for header-only libraries
|
// Module factory for header-only libraries
|
||||||
func libraryHeaderFactory() (blueprint.Module, []interface{}) {
|
func libraryHeaderFactory() android.Module {
|
||||||
module, library := NewLibrary(android.HostAndDeviceSupported)
|
module, library := NewLibrary(android.HostAndDeviceSupported)
|
||||||
library.HeaderOnly()
|
library.HeaderOnly()
|
||||||
return module.Init()
|
return module.Init()
|
||||||
|
@@ -18,8 +18,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -136,7 +134,7 @@ func (stub *llndkStubDecorator) link(ctx ModuleContext, flags Flags, deps PathDe
|
|||||||
return stub.libraryDecorator.link(ctx, flags, deps, objs)
|
return stub.libraryDecorator.link(ctx, flags, deps, objs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newLLndkStubLibrary() (*Module, []interface{}) {
|
func newLLndkStubLibrary() *Module {
|
||||||
module, library := NewLibrary(android.DeviceSupported)
|
module, library := NewLibrary(android.DeviceSupported)
|
||||||
library.BuildOnlyShared()
|
library.BuildOnlyShared()
|
||||||
module.stl = nil
|
module.stl = nil
|
||||||
@@ -150,13 +148,18 @@ func newLLndkStubLibrary() (*Module, []interface{}) {
|
|||||||
module.linker = stub
|
module.linker = stub
|
||||||
module.installer = nil
|
module.installer = nil
|
||||||
|
|
||||||
return module, []interface{}{&stub.Properties, &library.MutatedProperties, &library.flagExporter.Properties}
|
module.AddProperties(
|
||||||
|
&stub.Properties,
|
||||||
|
&library.MutatedProperties,
|
||||||
|
&library.flagExporter.Properties)
|
||||||
|
|
||||||
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
func llndkLibraryFactory() (blueprint.Module, []interface{}) {
|
func llndkLibraryFactory() android.Module {
|
||||||
module, properties := newLLndkStubLibrary()
|
module := newLLndkStubLibrary()
|
||||||
return android.InitAndroidArchModule(module, android.DeviceSupported,
|
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibBoth)
|
||||||
android.MultilibBoth, properties...)
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@@ -137,9 +137,11 @@ func (m *headerModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ndkHeadersFactory() (blueprint.Module, []interface{}) {
|
func ndkHeadersFactory() android.Module {
|
||||||
module := &headerModule{}
|
module := &headerModule{}
|
||||||
return android.InitAndroidModule(module, &module.properties)
|
module.AddProperties(&module.properties)
|
||||||
|
android.InitAndroidModule(module)
|
||||||
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
type preprocessedHeaderProperies struct {
|
type preprocessedHeaderProperies struct {
|
||||||
@@ -251,12 +253,16 @@ func processHeadersWithVersioner(ctx android.ModuleContext, srcDir, outDir andro
|
|||||||
return timestampFile
|
return timestampFile
|
||||||
}
|
}
|
||||||
|
|
||||||
func preprocessedNdkHeadersFactory() (blueprint.Module, []interface{}) {
|
func preprocessedNdkHeadersFactory() android.Module {
|
||||||
module := &preprocessedHeaderModule{}
|
module := &preprocessedHeaderModule{}
|
||||||
|
|
||||||
|
module.AddProperties(&module.properties)
|
||||||
|
|
||||||
// Host module rather than device module because device module install steps
|
// Host module rather than device module because device module install steps
|
||||||
// do not get run when embedded in make. We're not any of the existing
|
// do not get run when embedded in make. We're not any of the existing
|
||||||
// module types that can be exposed via the Android.mk exporter, so just use
|
// module types that can be exposed via the Android.mk exporter, so just use
|
||||||
// a host module.
|
// a host module.
|
||||||
return android.InitAndroidArchModule(module, android.HostSupportedNoCross,
|
android.InitAndroidArchModule(module, android.HostSupportedNoCross, android.MultilibFirst)
|
||||||
android.MultilibFirst, &module.properties)
|
|
||||||
|
return module
|
||||||
}
|
}
|
||||||
|
@@ -335,7 +335,7 @@ func (stub *stubDecorator) install(ctx ModuleContext, path android.Path) {
|
|||||||
stub.installPath = ctx.InstallFile(installDir, path).String()
|
stub.installPath = ctx.InstallFile(installDir, path).String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func newStubLibrary() (*Module, []interface{}) {
|
func newStubLibrary() *Module {
|
||||||
module, library := NewLibrary(android.DeviceSupported)
|
module, library := NewLibrary(android.DeviceSupported)
|
||||||
library.BuildOnlyShared()
|
library.BuildOnlyShared()
|
||||||
module.stl = nil
|
module.stl = nil
|
||||||
@@ -349,11 +349,13 @@ func newStubLibrary() (*Module, []interface{}) {
|
|||||||
module.linker = stub
|
module.linker = stub
|
||||||
module.installer = stub
|
module.installer = stub
|
||||||
|
|
||||||
return module, []interface{}{&stub.properties, &library.MutatedProperties}
|
module.AddProperties(&stub.properties, &library.MutatedProperties)
|
||||||
|
|
||||||
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
func ndkLibraryFactory() (blueprint.Module, []interface{}) {
|
func ndkLibraryFactory() android.Module {
|
||||||
module, properties := newStubLibrary()
|
module := newStubLibrary()
|
||||||
return android.InitAndroidArchModule(module, android.DeviceSupported,
|
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibBoth)
|
||||||
android.MultilibBoth, properties...)
|
return module
|
||||||
}
|
}
|
||||||
|
@@ -18,8 +18,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"android/soong/cc/config"
|
"android/soong/cc/config"
|
||||||
)
|
)
|
||||||
@@ -67,7 +65,7 @@ func (*ndkPrebuiltObjectLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
|||||||
return deps
|
return deps
|
||||||
}
|
}
|
||||||
|
|
||||||
func ndkPrebuiltObjectFactory() (blueprint.Module, []interface{}) {
|
func ndkPrebuiltObjectFactory() android.Module {
|
||||||
module := newBaseModule(android.DeviceSupported, android.MultilibBoth)
|
module := newBaseModule(android.DeviceSupported, android.MultilibBoth)
|
||||||
module.linker = &ndkPrebuiltObjectLinker{
|
module.linker = &ndkPrebuiltObjectLinker{
|
||||||
objectLinker: objectLinker{
|
objectLinker: objectLinker{
|
||||||
@@ -101,7 +99,7 @@ func (*ndkPrebuiltLibraryLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
|||||||
return deps
|
return deps
|
||||||
}
|
}
|
||||||
|
|
||||||
func ndkPrebuiltLibraryFactory() (blueprint.Module, []interface{}) {
|
func ndkPrebuiltLibraryFactory() android.Module {
|
||||||
module, library := NewLibrary(android.DeviceSupported)
|
module, library := NewLibrary(android.DeviceSupported)
|
||||||
library.BuildOnlyShared()
|
library.BuildOnlyShared()
|
||||||
linker := &ndkPrebuiltLibraryLinker{
|
linker := &ndkPrebuiltLibraryLinker{
|
||||||
@@ -132,7 +130,7 @@ type ndkPrebuiltStlLinker struct {
|
|||||||
ndkPrebuiltLibraryLinker
|
ndkPrebuiltLibraryLinker
|
||||||
}
|
}
|
||||||
|
|
||||||
func ndkPrebuiltSharedStlFactory() (blueprint.Module, []interface{}) {
|
func ndkPrebuiltSharedStlFactory() android.Module {
|
||||||
module, library := NewLibrary(android.DeviceSupported)
|
module, library := NewLibrary(android.DeviceSupported)
|
||||||
library.BuildOnlyShared()
|
library.BuildOnlyShared()
|
||||||
linker := &ndkPrebuiltStlLinker{
|
linker := &ndkPrebuiltStlLinker{
|
||||||
@@ -147,7 +145,7 @@ func ndkPrebuiltSharedStlFactory() (blueprint.Module, []interface{}) {
|
|||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
func ndkPrebuiltStaticStlFactory() (blueprint.Module, []interface{}) {
|
func ndkPrebuiltStaticStlFactory() android.Module {
|
||||||
module, library := NewLibrary(android.DeviceSupported)
|
module, library := NewLibrary(android.DeviceSupported)
|
||||||
library.BuildOnlyStatic()
|
library.BuildOnlyStatic()
|
||||||
linker := &ndkPrebuiltStlLinker{
|
linker := &ndkPrebuiltStlLinker{
|
||||||
|
@@ -17,8 +17,6 @@ package cc
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -35,7 +33,7 @@ type objectLinker struct {
|
|||||||
Properties ObjectLinkerProperties
|
Properties ObjectLinkerProperties
|
||||||
}
|
}
|
||||||
|
|
||||||
func objectFactory() (blueprint.Module, []interface{}) {
|
func objectFactory() android.Module {
|
||||||
module := newBaseModule(android.HostAndDeviceSupported, android.MultilibBoth)
|
module := newBaseModule(android.HostAndDeviceSupported, android.MultilibBoth)
|
||||||
module.linker = &objectLinker{
|
module.linker = &objectLinker{
|
||||||
baseLinker: NewBaseLinker(),
|
baseLinker: NewBaseLinker(),
|
||||||
|
@@ -16,8 +16,6 @@ package cc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -65,7 +63,7 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func prebuiltSharedLibraryFactory() (blueprint.Module, []interface{}) {
|
func prebuiltSharedLibraryFactory() android.Module {
|
||||||
module, _ := NewPrebuiltSharedLibrary(android.HostAndDeviceSupported)
|
module, _ := NewPrebuiltSharedLibrary(android.HostAndDeviceSupported)
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
@@ -83,7 +81,7 @@ func NewPrebuiltSharedLibrary(hod android.HostOrDeviceSupported) (*Module, *libr
|
|||||||
return module, library
|
return module, library
|
||||||
}
|
}
|
||||||
|
|
||||||
func prebuiltStaticLibraryFactory() (blueprint.Module, []interface{}) {
|
func prebuiltStaticLibraryFactory() android.Module {
|
||||||
module, _ := NewPrebuiltStaticLibrary(android.HostAndDeviceSupported)
|
module, _ := NewPrebuiltStaticLibrary(android.HostAndDeviceSupported)
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
@@ -124,7 +122,7 @@ func (p *prebuiltBinaryLinker) link(ctx ModuleContext,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func prebuiltBinaryFactory() (blueprint.Module, []interface{}) {
|
func prebuiltBinaryFactory() android.Module {
|
||||||
module, _ := NewPrebuiltBinary(android.HostAndDeviceSupported)
|
module, _ := NewPrebuiltBinary(android.HostAndDeviceSupported)
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
@@ -17,9 +17,9 @@ package cc
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"android/soong/android"
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
|
|
||||||
|
"android/soong/android"
|
||||||
"android/soong/cc/config"
|
"android/soong/cc/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
12
cc/test.go
12
cc/test.go
@@ -20,8 +20,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type TestProperties struct {
|
type TestProperties struct {
|
||||||
@@ -57,31 +55,31 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Module factory for tests
|
// Module factory for tests
|
||||||
func testFactory() (blueprint.Module, []interface{}) {
|
func testFactory() android.Module {
|
||||||
module := NewTest(android.HostAndDeviceSupported)
|
module := NewTest(android.HostAndDeviceSupported)
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module factory for test libraries
|
// Module factory for test libraries
|
||||||
func testLibraryFactory() (blueprint.Module, []interface{}) {
|
func testLibraryFactory() android.Module {
|
||||||
module := NewTestLibrary(android.HostAndDeviceSupported)
|
module := NewTestLibrary(android.HostAndDeviceSupported)
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module factory for benchmarks
|
// Module factory for benchmarks
|
||||||
func benchmarkFactory() (blueprint.Module, []interface{}) {
|
func benchmarkFactory() android.Module {
|
||||||
module := NewBenchmark(android.HostAndDeviceSupported)
|
module := NewBenchmark(android.HostAndDeviceSupported)
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module factory for host tests
|
// Module factory for host tests
|
||||||
func testHostFactory() (blueprint.Module, []interface{}) {
|
func testHostFactory() android.Module {
|
||||||
module := NewTest(android.HostSupported)
|
module := NewTest(android.HostSupported)
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module factory for host benchmarks
|
// Module factory for host benchmarks
|
||||||
func benchmarkHostFactory() (blueprint.Module, []interface{}) {
|
func benchmarkHostFactory() android.Module {
|
||||||
module := NewBenchmark(android.HostSupported)
|
module := NewBenchmark(android.HostSupported)
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
@@ -131,8 +131,10 @@ func TestDataTests(t *testing.T) {
|
|||||||
"dir/baz": nil,
|
"dir/baz": nil,
|
||||||
"dir/bar/baz": nil,
|
"dir/bar/baz": nil,
|
||||||
})
|
})
|
||||||
ctx.RegisterModuleType("filegroup", genrule.FileGroupFactory)
|
ctx.RegisterModuleType("filegroup",
|
||||||
ctx.RegisterModuleType("test", newTest)
|
android.ModuleFactoryAdaptor(genrule.FileGroupFactory))
|
||||||
|
ctx.RegisterModuleType("test",
|
||||||
|
android.ModuleFactoryAdaptor(newTest))
|
||||||
|
|
||||||
_, errs := ctx.ParseBlueprintsFiles("Blueprints")
|
_, errs := ctx.ParseBlueprintsFiles("Blueprints")
|
||||||
fail(t, errs)
|
fail(t, errs)
|
||||||
@@ -175,9 +177,11 @@ type testDataTest struct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func newTest() (blueprint.Module, []interface{}) {
|
func newTest() android.Module {
|
||||||
m := &testDataTest{}
|
m := &testDataTest{}
|
||||||
return android.InitAndroidModule(m, &m.Properties)
|
m.AddProperties(&m.Properties)
|
||||||
|
android.InitAndroidModule(m)
|
||||||
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func (test *testDataTest) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (test *testDataTest) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
package cc
|
package cc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/google/blueprint"
|
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
@@ -38,7 +37,7 @@ func (*toolchainLibraryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
|||||||
return deps
|
return deps
|
||||||
}
|
}
|
||||||
|
|
||||||
func toolchainLibraryFactory() (blueprint.Module, []interface{}) {
|
func toolchainLibraryFactory() android.Module {
|
||||||
module, library := NewLibrary(android.HostAndDeviceSupported)
|
module, library := NewLibrary(android.HostAndDeviceSupported)
|
||||||
library.BuildOnlyStatic()
|
library.BuildOnlyStatic()
|
||||||
toolchainLibrary := &toolchainLibraryDecorator{
|
toolchainLibrary := &toolchainLibraryDecorator{
|
||||||
|
@@ -15,8 +15,6 @@
|
|||||||
package genrule
|
package genrule
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/google/blueprint"
|
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -48,10 +46,11 @@ var _ android.SourceFileProducer = (*fileGroup)(nil)
|
|||||||
// filegroup modules contain a list of files, and can be used to export files across package
|
// filegroup modules contain a list of files, and can be used to export files across package
|
||||||
// boundaries. filegroups (and genrules) can be referenced from srcs properties of other modules
|
// boundaries. filegroups (and genrules) can be referenced from srcs properties of other modules
|
||||||
// using the syntax ":module".
|
// using the syntax ":module".
|
||||||
func FileGroupFactory() (blueprint.Module, []interface{}) {
|
func FileGroupFactory() android.Module {
|
||||||
module := &fileGroup{}
|
module := &fileGroup{}
|
||||||
|
module.AddProperties(&module.properties)
|
||||||
return android.InitAndroidModule(module, &module.properties)
|
android.InitAndroidModule(module)
|
||||||
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fg *fileGroup) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (fg *fileGroup) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
|
@@ -268,17 +268,20 @@ func (g *generator) generateSourceFile(ctx android.ModuleContext, task generateT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func generatorFactory(tasks taskFunc, props ...interface{}) (blueprint.Module, []interface{}) {
|
func generatorFactory(tasks taskFunc, props ...interface{}) android.Module {
|
||||||
module := &generator{
|
module := &generator{
|
||||||
tasks: tasks,
|
tasks: tasks,
|
||||||
}
|
}
|
||||||
|
|
||||||
props = append(props, &module.properties)
|
module.AddProperties(props...)
|
||||||
|
module.AddProperties(&module.properties)
|
||||||
|
|
||||||
return android.InitAndroidModule(module, props...)
|
android.InitAndroidModule(module)
|
||||||
|
|
||||||
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenSrcsFactory() (blueprint.Module, []interface{}) {
|
func GenSrcsFactory() android.Module {
|
||||||
properties := &genSrcsProperties{}
|
properties := &genSrcsProperties{}
|
||||||
|
|
||||||
tasks := func(ctx android.ModuleContext, srcFiles android.Paths) []generateTask {
|
tasks := func(ctx android.ModuleContext, srcFiles android.Paths) []generateTask {
|
||||||
@@ -300,7 +303,7 @@ type genSrcsProperties struct {
|
|||||||
Output_extension string
|
Output_extension string
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenRuleFactory() (blueprint.Module, []interface{}) {
|
func GenRuleFactory() android.Module {
|
||||||
properties := &genRuleProperties{}
|
properties := &genRuleProperties{}
|
||||||
|
|
||||||
tasks := func(ctx android.ModuleContext, srcFiles android.Paths) []generateTask {
|
tasks := func(ctx android.ModuleContext, srcFiles android.Paths) []generateTask {
|
||||||
|
@@ -274,13 +274,16 @@ func (a *AndroidApp) aaptFlags(ctx android.ModuleContext) ([]string, android.Pat
|
|||||||
return aaptFlags, aaptDeps, hasResources
|
return aaptFlags, aaptDeps, hasResources
|
||||||
}
|
}
|
||||||
|
|
||||||
func AndroidAppFactory() (blueprint.Module, []interface{}) {
|
func AndroidAppFactory() android.Module {
|
||||||
module := &AndroidApp{}
|
module := &AndroidApp{}
|
||||||
|
|
||||||
module.deviceProperties.Dex = true
|
module.deviceProperties.Dex = true
|
||||||
|
|
||||||
return android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon,
|
module.AddProperties(
|
||||||
&module.Module.properties,
|
&module.Module.properties,
|
||||||
&module.Module.deviceProperties,
|
&module.Module.deviceProperties,
|
||||||
&module.appProperties)
|
&module.appProperties)
|
||||||
|
|
||||||
|
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||||
|
return module
|
||||||
}
|
}
|
||||||
|
47
java/java.go
47
java/java.go
@@ -418,21 +418,26 @@ func (j *JavaLibrary) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
j.deps(ctx)
|
j.deps(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func JavaLibraryFactory() (blueprint.Module, []interface{}) {
|
func JavaLibraryFactory() android.Module {
|
||||||
module := &JavaLibrary{}
|
module := &JavaLibrary{}
|
||||||
|
|
||||||
module.deviceProperties.Dex = true
|
module.deviceProperties.Dex = true
|
||||||
|
|
||||||
return android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon,
|
module.AddProperties(
|
||||||
&module.Module.properties,
|
&module.Module.properties,
|
||||||
&module.Module.deviceProperties)
|
&module.Module.deviceProperties)
|
||||||
|
|
||||||
|
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon)
|
||||||
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
func JavaLibraryHostFactory() (blueprint.Module, []interface{}) {
|
func JavaLibraryHostFactory() android.Module {
|
||||||
module := &JavaLibrary{}
|
module := &JavaLibrary{}
|
||||||
|
|
||||||
return android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon,
|
module.AddProperties(&module.Module.properties)
|
||||||
&module.Module.properties)
|
|
||||||
|
android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
|
||||||
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -463,24 +468,30 @@ func (j *JavaBinary) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
j.deps(ctx)
|
j.deps(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func JavaBinaryFactory() (blueprint.Module, []interface{}) {
|
func JavaBinaryFactory() android.Module {
|
||||||
module := &JavaBinary{}
|
module := &JavaBinary{}
|
||||||
|
|
||||||
module.deviceProperties.Dex = true
|
module.deviceProperties.Dex = true
|
||||||
|
|
||||||
return android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon,
|
module.AddProperties(
|
||||||
&module.Module.properties,
|
&module.Module.properties,
|
||||||
&module.Module.deviceProperties,
|
&module.Module.deviceProperties,
|
||||||
&module.binaryProperties)
|
&module.binaryProperties)
|
||||||
|
|
||||||
|
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon)
|
||||||
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
func JavaBinaryHostFactory() (blueprint.Module, []interface{}) {
|
func JavaBinaryHostFactory() android.Module {
|
||||||
module := &JavaBinary{}
|
module := &JavaBinary{}
|
||||||
|
|
||||||
return android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon,
|
module.AddProperties(
|
||||||
&module.Module.properties,
|
&module.Module.properties,
|
||||||
&module.Module.deviceProperties,
|
&module.Module.deviceProperties,
|
||||||
&module.binaryProperties)
|
&module.binaryProperties)
|
||||||
|
|
||||||
|
android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
|
||||||
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -536,11 +547,13 @@ func (j *JavaPrebuilt) AidlIncludeDirs() android.Paths {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func JavaPrebuiltFactory() (blueprint.Module, []interface{}) {
|
func JavaPrebuiltFactory() android.Module {
|
||||||
module := &JavaPrebuilt{}
|
module := &JavaPrebuilt{}
|
||||||
|
|
||||||
return android.InitAndroidArchModule(module, android.HostAndDeviceSupported,
|
module.AddProperties(&module.properties)
|
||||||
android.MultilibCommon, &module.properties)
|
|
||||||
|
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon)
|
||||||
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -576,11 +589,15 @@ func (j *sdkPrebuilt) AidlPreprocessed() android.OptionalPath {
|
|||||||
return j.aidlPreprocessed
|
return j.aidlPreprocessed
|
||||||
}
|
}
|
||||||
|
|
||||||
func SdkPrebuiltFactory() (blueprint.Module, []interface{}) {
|
func SdkPrebuiltFactory() android.Module {
|
||||||
module := &sdkPrebuilt{}
|
module := &sdkPrebuilt{}
|
||||||
|
|
||||||
return android.InitAndroidArchModule(module, android.HostAndDeviceSupported,
|
module.AddProperties(
|
||||||
android.MultilibCommon, &module.properties, &module.sdkProperties)
|
&module.properties,
|
||||||
|
&module.sdkProperties)
|
||||||
|
|
||||||
|
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon)
|
||||||
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
func inList(s string, l []string) bool {
|
func inList(s string, l []string) bool {
|
||||||
|
@@ -19,8 +19,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -33,10 +31,11 @@ type phony struct {
|
|||||||
requiredModuleNames []string
|
requiredModuleNames []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func phonyFactory() (blueprint.Module, []interface{}) {
|
func phonyFactory() android.Module {
|
||||||
module := &phony{}
|
module := &phony{}
|
||||||
|
|
||||||
return android.InitAndroidModule(module)
|
android.InitAndroidModule(module)
|
||||||
|
return module
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *phony) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (p *phony) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
|
@@ -21,8 +21,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -74,15 +72,16 @@ var (
|
|||||||
stubTemplateHost = "build/soong/python/scripts/stub_template_host.txt"
|
stubTemplateHost = "build/soong/python/scripts/stub_template_host.txt"
|
||||||
)
|
)
|
||||||
|
|
||||||
func PythonBinaryHostFactory() (blueprint.Module, []interface{}) {
|
func PythonBinaryHostFactory() android.Module {
|
||||||
decorator := &pythonBinaryHostDecorator{
|
decorator := &pythonBinaryHostDecorator{
|
||||||
pythonDecorator: pythonDecorator{baseInstaller: NewPythonInstaller("bin")}}
|
pythonDecorator: pythonDecorator{baseInstaller: NewPythonInstaller("bin")}}
|
||||||
|
|
||||||
module := &PythonBinaryHost{}
|
module := &PythonBinaryHost{}
|
||||||
module.pythonBaseModule.installer = decorator
|
module.pythonBaseModule.installer = decorator
|
||||||
|
module.AddProperties(&module.binaryProperties)
|
||||||
|
|
||||||
return InitPythonBaseModule(&module.pythonBinaryBase.pythonBaseModule,
|
return InitPythonBaseModule(&module.pythonBinaryBase.pythonBaseModule,
|
||||||
&module.pythonBinaryBase, android.HostSupportedNoCross, &module.binaryProperties)
|
&module.pythonBinaryBase, android.HostSupportedNoCross)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *pythonBinaryBase) GeneratePythonBuildActions(ctx android.ModuleContext) android.OptionalPath {
|
func (p *pythonBinaryBase) GeneratePythonBuildActions(ctx android.ModuleContext) android.OptionalPath {
|
||||||
|
@@ -17,8 +17,6 @@ package python
|
|||||||
// This file contains the module types for building Python library.
|
// This file contains the module types for building Python library.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/google/blueprint"
|
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -32,7 +30,7 @@ type PythonLibrary struct {
|
|||||||
|
|
||||||
var _ PythonSubModule = (*PythonLibrary)(nil)
|
var _ PythonSubModule = (*PythonLibrary)(nil)
|
||||||
|
|
||||||
func PythonLibraryHostFactory() (blueprint.Module, []interface{}) {
|
func PythonLibraryHostFactory() android.Module {
|
||||||
module := &PythonLibrary{}
|
module := &PythonLibrary{}
|
||||||
|
|
||||||
return InitPythonBaseModule(&module.pythonBaseModule, module, android.HostSupportedNoCross)
|
return InitPythonBaseModule(&module.pythonBaseModule, module, android.HostSupportedNoCross)
|
||||||
|
@@ -152,14 +152,15 @@ var _ PythonDependency = (*pythonBaseModule)(nil)
|
|||||||
var _ android.AndroidMkDataProvider = (*pythonBaseModule)(nil)
|
var _ android.AndroidMkDataProvider = (*pythonBaseModule)(nil)
|
||||||
|
|
||||||
func InitPythonBaseModule(baseModule *pythonBaseModule, subModule PythonSubModule,
|
func InitPythonBaseModule(baseModule *pythonBaseModule, subModule PythonSubModule,
|
||||||
hod android.HostOrDeviceSupported,
|
hod android.HostOrDeviceSupported) android.Module {
|
||||||
props ...interface{}) (blueprint.Module, []interface{}) {
|
|
||||||
|
|
||||||
baseModule.subModule = subModule
|
baseModule.subModule = subModule
|
||||||
|
|
||||||
props = append(props, &baseModule.properties)
|
baseModule.AddProperties(&baseModule.properties)
|
||||||
|
|
||||||
return android.InitAndroidArchModule(baseModule, hod, android.MultilibCommon, props...)
|
android.InitAndroidArchModule(baseModule, hod, android.MultilibCommon)
|
||||||
|
|
||||||
|
return baseModule
|
||||||
}
|
}
|
||||||
|
|
||||||
// the tag used to mark dependencies within "py_libs" attribute.
|
// the tag used to mark dependencies within "py_libs" attribute.
|
||||||
|
@@ -313,8 +313,10 @@ func TestPythonModule(t *testing.T) {
|
|||||||
t.Run(d.desc, func(t *testing.T) {
|
t.Run(d.desc, func(t *testing.T) {
|
||||||
ctx := blueprint.NewContext()
|
ctx := blueprint.NewContext()
|
||||||
android.RegisterTestMutators(ctx)
|
android.RegisterTestMutators(ctx)
|
||||||
ctx.RegisterModuleType("python_library_host", PythonLibraryHostFactory)
|
ctx.RegisterModuleType("python_library_host",
|
||||||
ctx.RegisterModuleType("python_binary_host", PythonBinaryHostFactory)
|
android.ModuleFactoryAdaptor(PythonLibraryHostFactory))
|
||||||
|
ctx.RegisterModuleType("python_binary_host",
|
||||||
|
android.ModuleFactoryAdaptor(PythonBinaryHostFactory))
|
||||||
ctx.MockFileSystem(d.mockFiles)
|
ctx.MockFileSystem(d.mockFiles)
|
||||||
_, testErrs := ctx.ParseBlueprintsFiles(bpFile)
|
_, testErrs := ctx.ParseBlueprintsFiles(bpFile)
|
||||||
fail(t, testErrs)
|
fail(t, testErrs)
|
||||||
|
@@ -17,8 +17,6 @@ package python
|
|||||||
import (
|
import (
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// This file contains the module types for building Python test.
|
// This file contains the module types for building Python test.
|
||||||
@@ -42,13 +40,15 @@ func (p *pythonTestHostDecorator) install(ctx android.ModuleContext, file androi
|
|||||||
p.pythonDecorator.baseInstaller.install(ctx, file)
|
p.pythonDecorator.baseInstaller.install(ctx, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
func PythonTestHostFactory() (blueprint.Module, []interface{}) {
|
func PythonTestHostFactory() android.Module {
|
||||||
decorator := &pythonTestHostDecorator{
|
decorator := &pythonTestHostDecorator{
|
||||||
pythonDecorator: pythonDecorator{baseInstaller: NewPythonInstaller("nativetest")}}
|
pythonDecorator: pythonDecorator{baseInstaller: NewPythonInstaller("nativetest")}}
|
||||||
|
|
||||||
module := &PythonBinaryHost{}
|
module := &PythonBinaryHost{}
|
||||||
module.pythonBaseModule.installer = decorator
|
module.pythonBaseModule.installer = decorator
|
||||||
|
|
||||||
|
module.AddProperties(&module.binaryProperties)
|
||||||
|
|
||||||
return InitPythonBaseModule(&module.pythonBinaryBase.pythonBaseModule,
|
return InitPythonBaseModule(&module.pythonBinaryBase.pythonBaseModule,
|
||||||
&module.pythonBinaryBase, android.HostSupportedNoCross, &module.binaryProperties)
|
&module.pythonBinaryBase, android.HostSupportedNoCross)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user