rust: add ccToolchain to Module
The cc toolchain information is required when using cc.Stripper. Move to a Module method to avoid importing the cc package everywhere. Test: m nothing Bug: 153430439 Change-Id: I497dcdff4e767ecb8b8688c73cf88850c302683d
This commit is contained in:
@@ -21,7 +21,6 @@ import (
|
|||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
ccConfig "android/soong/cc/config"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -92,8 +91,8 @@ type bindgenDecorator struct {
|
|||||||
Properties BindgenProperties
|
Properties BindgenProperties
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *bindgenDecorator) GenerateSource(ctx android.ModuleContext, deps PathDeps) android.Path {
|
func (b *bindgenDecorator) GenerateSource(ctx ModuleContext, deps PathDeps) android.Path {
|
||||||
ccToolchain := ccConfig.FindToolchain(ctx.Os(), ctx.Arch())
|
ccToolchain := ctx.RustModule().ccToolchain(ctx)
|
||||||
|
|
||||||
var cflags []string
|
var cflags []string
|
||||||
var implicits android.Paths
|
var implicits android.Paths
|
||||||
|
@@ -23,6 +23,7 @@ import (
|
|||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"android/soong/cc"
|
"android/soong/cc"
|
||||||
|
cc_config "android/soong/cc/config"
|
||||||
"android/soong/rust/config"
|
"android/soong/rust/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -656,6 +657,10 @@ func (mod *Module) toolchain(ctx android.BaseModuleContext) config.Toolchain {
|
|||||||
return mod.cachedToolchain
|
return mod.cachedToolchain
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (mod *Module) ccToolchain(ctx android.BaseModuleContext) cc_config.Toolchain {
|
||||||
|
return cc_config.FindToolchain(ctx.Os(), ctx.Arch())
|
||||||
|
}
|
||||||
|
|
||||||
func (d *Defaults) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (d *Defaults) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,7 +38,7 @@ type BaseSourceProvider struct {
|
|||||||
var _ SourceProvider = (*BaseSourceProvider)(nil)
|
var _ SourceProvider = (*BaseSourceProvider)(nil)
|
||||||
|
|
||||||
type SourceProvider interface {
|
type SourceProvider interface {
|
||||||
GenerateSource(ctx android.ModuleContext, deps PathDeps) android.Path
|
GenerateSource(ctx ModuleContext, deps PathDeps) android.Path
|
||||||
Srcs() android.Paths
|
Srcs() android.Paths
|
||||||
SourceProviderProps() []interface{}
|
SourceProviderProps() []interface{}
|
||||||
SourceProviderDeps(ctx DepsContext, deps Deps) Deps
|
SourceProviderDeps(ctx DepsContext, deps Deps) Deps
|
||||||
@@ -49,7 +49,7 @@ func (sp *BaseSourceProvider) Srcs() android.Paths {
|
|||||||
return android.Paths{sp.OutputFile}
|
return android.Paths{sp.OutputFile}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sp *BaseSourceProvider) GenerateSource(ctx android.ModuleContext, deps PathDeps) android.Path {
|
func (sp *BaseSourceProvider) GenerateSource(ctx ModuleContext, deps PathDeps) android.Path {
|
||||||
panic("BaseSourceProviderModule does not implement GenerateSource()")
|
panic("BaseSourceProviderModule does not implement GenerateSource()")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user