rust: Support new rust_stdlib_prebuilt_host type
Refactor Rust prebuilts to support the new rust_stdlib_prebuilt_host module type, and change the format for depending on the prebuilt host stdlibs. Bug: 140642453 Test: m Change-Id: Ifbc4741818777934e917631c788b20911856c44a
This commit is contained in:
@@ -32,6 +32,8 @@ type PrebuiltProperties struct {
|
||||
}
|
||||
|
||||
type prebuiltLibraryDecorator struct {
|
||||
android.Prebuilt
|
||||
|
||||
*libraryDecorator
|
||||
Properties PrebuiltProperties
|
||||
}
|
||||
@@ -54,6 +56,13 @@ func PrebuiltRlibFactory() android.Module {
|
||||
return module.Init()
|
||||
}
|
||||
|
||||
func addSrcSupplier(module android.PrebuiltInterface, prebuilt *prebuiltLibraryDecorator) {
|
||||
srcsSupplier := func(_ android.BaseModuleContext, _ android.Module) []string {
|
||||
return prebuilt.prebuiltSrcs()
|
||||
}
|
||||
android.InitPrebuiltModuleWithSrcSupplier(module, srcsSupplier, "srcs")
|
||||
}
|
||||
|
||||
func NewPrebuiltLibrary(hod android.HostOrDeviceSupported) (*Module, *prebuiltLibraryDecorator) {
|
||||
module, library := NewRustLibrary(hod)
|
||||
library.BuildOnlyRust()
|
||||
@@ -62,6 +71,9 @@ func NewPrebuiltLibrary(hod android.HostOrDeviceSupported) (*Module, *prebuiltLi
|
||||
libraryDecorator: library,
|
||||
}
|
||||
module.compiler = prebuilt
|
||||
|
||||
addSrcSupplier(module, prebuilt)
|
||||
|
||||
return module, prebuilt
|
||||
}
|
||||
|
||||
@@ -73,6 +85,9 @@ func NewPrebuiltDylib(hod android.HostOrDeviceSupported) (*Module, *prebuiltLibr
|
||||
libraryDecorator: library,
|
||||
}
|
||||
module.compiler = prebuilt
|
||||
|
||||
addSrcSupplier(module, prebuilt)
|
||||
|
||||
return module, prebuilt
|
||||
}
|
||||
|
||||
@@ -84,6 +99,9 @@ func NewPrebuiltRlib(hod android.HostOrDeviceSupported) (*Module, *prebuiltLibra
|
||||
libraryDecorator: library,
|
||||
}
|
||||
module.compiler = prebuilt
|
||||
|
||||
addSrcSupplier(module, prebuilt)
|
||||
|
||||
return module, prebuilt
|
||||
}
|
||||
|
||||
@@ -130,3 +148,7 @@ func (prebuilt *prebuiltLibraryDecorator) prebuiltSrcs() []string {
|
||||
|
||||
return srcs
|
||||
}
|
||||
|
||||
func (prebuilt *prebuiltLibraryDecorator) prebuilt() *android.Prebuilt {
|
||||
return &prebuilt.Prebuilt
|
||||
}
|
||||
|
Reference in New Issue
Block a user