Merge "Allow static/shared modules to be disabled per-arch"
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
|||||||
"android/soong/glob"
|
"android/soong/glob"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
|
"github.com/google/blueprint/proptools"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -89,6 +90,7 @@ type Module interface {
|
|||||||
GenerateAndroidBuildActions(ModuleContext)
|
GenerateAndroidBuildActions(ModuleContext)
|
||||||
|
|
||||||
base() *ModuleBase
|
base() *ModuleBase
|
||||||
|
Disable()
|
||||||
Enabled() bool
|
Enabled() bool
|
||||||
Target() Target
|
Target() Target
|
||||||
InstallInData() bool
|
InstallInData() bool
|
||||||
@@ -292,6 +294,10 @@ func (a *ModuleBase) DeviceSupported() bool {
|
|||||||
a.hostAndDeviceProperties.Device_supported
|
a.hostAndDeviceProperties.Device_supported
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *ModuleBase) Disable() {
|
||||||
|
a.commonProperties.Enabled = proptools.BoolPtr(false)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *ModuleBase) Enabled() bool {
|
func (a *ModuleBase) Enabled() bool {
|
||||||
if a.commonProperties.Enabled == nil {
|
if a.commonProperties.Enabled == nil {
|
||||||
return a.Os().Class != HostCross
|
return a.Os().Class != HostCross
|
||||||
|
17
cc/cc.go
17
cc/cc.go
@@ -360,11 +360,13 @@ type FlagExporterProperties struct {
|
|||||||
|
|
||||||
type LibraryLinkerProperties struct {
|
type LibraryLinkerProperties struct {
|
||||||
Static struct {
|
Static struct {
|
||||||
|
Enabled *bool `android:"arch_variant"`
|
||||||
Whole_static_libs []string `android:"arch_variant"`
|
Whole_static_libs []string `android:"arch_variant"`
|
||||||
Static_libs []string `android:"arch_variant"`
|
Static_libs []string `android:"arch_variant"`
|
||||||
Shared_libs []string `android:"arch_variant"`
|
Shared_libs []string `android:"arch_variant"`
|
||||||
} `android:"arch_variant"`
|
} `android:"arch_variant"`
|
||||||
Shared struct {
|
Shared struct {
|
||||||
|
Enabled *bool `android:"arch_variant"`
|
||||||
Whole_static_libs []string `android:"arch_variant"`
|
Whole_static_libs []string `android:"arch_variant"`
|
||||||
Static_libs []string `android:"arch_variant"`
|
Static_libs []string `android:"arch_variant"`
|
||||||
Shared_libs []string `android:"arch_variant"`
|
Shared_libs []string `android:"arch_variant"`
|
||||||
@@ -1548,6 +1550,21 @@ type libraryLinker struct {
|
|||||||
|
|
||||||
var _ linker = (*libraryLinker)(nil)
|
var _ linker = (*libraryLinker)(nil)
|
||||||
|
|
||||||
|
func (library *libraryLinker) begin(ctx BaseModuleContext) {
|
||||||
|
library.baseLinker.begin(ctx)
|
||||||
|
if library.static() {
|
||||||
|
if library.Properties.Static.Enabled != nil &&
|
||||||
|
!*library.Properties.Static.Enabled {
|
||||||
|
ctx.module().Disable()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if library.Properties.Shared.Enabled != nil &&
|
||||||
|
!*library.Properties.Shared.Enabled {
|
||||||
|
ctx.module().Disable()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (library *libraryLinker) props() []interface{} {
|
func (library *libraryLinker) props() []interface{} {
|
||||||
props := library.baseLinker.props()
|
props := library.baseLinker.props()
|
||||||
return append(props,
|
return append(props,
|
||||||
|
Reference in New Issue
Block a user