Merge "Allow cc.LinkabeInterfaces to request "" variants." am: 3bc70db398
am: 239c81f2e0
Change-Id: I2fd86327accdb1844c5d049caf463514cea2b079
This commit is contained in:
4
cc/cc.go
4
cc/cc.go
@@ -562,6 +562,10 @@ func (c *Module) CcLibraryInterface() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Module) NonCcVariants() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Module) SetBuildStubs() {
|
func (c *Module) SetBuildStubs() {
|
||||||
if c.linker != nil {
|
if c.linker != nil {
|
||||||
if library, ok := c.linker.(*libraryDecorator); ok {
|
if library, ok := c.linker.(*libraryDecorator); ok {
|
||||||
|
@@ -1262,14 +1262,16 @@ func LinkageMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
shared.linker.(prebuiltLibraryInterface).disablePrebuilt()
|
shared.linker.(prebuiltLibraryInterface).disablePrebuilt()
|
||||||
}
|
}
|
||||||
} else if library, ok := mctx.Module().(LinkableInterface); ok && library.CcLibraryInterface() {
|
} else if library, ok := mctx.Module().(LinkableInterface); ok && library.CcLibraryInterface() {
|
||||||
if library.BuildStaticVariant() && library.BuildSharedVariant() {
|
|
||||||
variations := []string{"static", "shared"}
|
|
||||||
|
|
||||||
// Non-cc.Modules need an empty variant for their mutators.
|
// Non-cc.Modules may need an empty variant for their mutators.
|
||||||
if _, ok := mctx.Module().(*Module); !ok {
|
variations := []string{}
|
||||||
|
if library.NonCcVariants() {
|
||||||
variations = append(variations, "")
|
variations = append(variations, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if library.BuildStaticVariant() && library.BuildSharedVariant() {
|
||||||
|
variations := append([]string{"static", "shared"}, variations...)
|
||||||
|
|
||||||
modules := mctx.CreateLocalVariations(variations...)
|
modules := mctx.CreateLocalVariations(variations...)
|
||||||
static := modules[0].(LinkableInterface)
|
static := modules[0].(LinkableInterface)
|
||||||
shared := modules[1].(LinkableInterface)
|
shared := modules[1].(LinkableInterface)
|
||||||
@@ -1281,16 +1283,18 @@ func LinkageMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
reuseStaticLibrary(mctx, static.(*Module), shared.(*Module))
|
reuseStaticLibrary(mctx, static.(*Module), shared.(*Module))
|
||||||
}
|
}
|
||||||
} else if library.BuildStaticVariant() {
|
} else if library.BuildStaticVariant() {
|
||||||
modules := mctx.CreateLocalVariations("static")
|
variations := append([]string{"static"}, variations...)
|
||||||
|
|
||||||
|
modules := mctx.CreateLocalVariations(variations...)
|
||||||
modules[0].(LinkableInterface).SetStatic()
|
modules[0].(LinkableInterface).SetStatic()
|
||||||
} else if library.BuildSharedVariant() {
|
} else if library.BuildSharedVariant() {
|
||||||
modules := mctx.CreateLocalVariations("shared")
|
variations := append([]string{"shared"}, variations...)
|
||||||
modules[0].(LinkableInterface).SetShared()
|
|
||||||
} else if _, ok := mctx.Module().(*Module); !ok {
|
|
||||||
// Non-cc.Modules need an empty variant for their mutators.
|
|
||||||
mctx.CreateLocalVariations("")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
modules := mctx.CreateLocalVariations(variations...)
|
||||||
|
modules[0].(LinkableInterface).SetShared()
|
||||||
|
} else if len(variations) > 0 {
|
||||||
|
mctx.CreateLocalVariations(variations...)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,6 +20,8 @@ type LinkableInterface interface {
|
|||||||
HasStaticVariant() bool
|
HasStaticVariant() bool
|
||||||
GetStaticVariant() LinkableInterface
|
GetStaticVariant() LinkableInterface
|
||||||
|
|
||||||
|
NonCcVariants() bool
|
||||||
|
|
||||||
StubsVersions() []string
|
StubsVersions() []string
|
||||||
BuildStubs() bool
|
BuildStubs() bool
|
||||||
SetBuildStubs()
|
SetBuildStubs()
|
||||||
|
13
rust/rust.go
13
rust/rust.go
@@ -89,6 +89,19 @@ func (mod *Module) SelectedStl() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (mod *Module) NonCcVariants() bool {
|
||||||
|
if mod.compiler != nil {
|
||||||
|
if library, ok := mod.compiler.(libraryInterface); ok {
|
||||||
|
if library.buildRlib() || library.buildDylib() {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
panic(fmt.Errorf("NonCcVariants called on non-library module: %q", mod.BaseModuleName()))
|
||||||
|
}
|
||||||
|
|
||||||
func (mod *Module) ApiLevel() string {
|
func (mod *Module) ApiLevel() string {
|
||||||
panic(fmt.Errorf("Called ApiLevel on Rust module %q; stubs libraries are not yet supported.", mod.BaseModuleName()))
|
panic(fmt.Errorf("Called ApiLevel on Rust module %q; stubs libraries are not yet supported.", mod.BaseModuleName()))
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user