Revert^2 "rust: Only allow bindgen to produce rlibs."

b983c8971b

Change-Id: Ic82433885f7932be8cfe65433330527214807684
This commit is contained in:
Matthew Maurer 2022-08-02 16:57:30 +00:00
parent b983c8971b
commit 9cc801ab7a
3 changed files with 14 additions and 3 deletions

View file

@ -299,7 +299,15 @@ func NewRustBindgen(hod android.HostOrDeviceSupported) (*Module, *bindgenDecorat
ClangProperties: cc.RustBindgenClangProperties{},
}
module := NewSourceProviderModule(hod, bindgen, false)
module := NewSourceProviderModule(hod, bindgen, false, true)
android.AddLoadHook(module, func(ctx android.LoadHookContext) {
type stub_props struct {
Visibility []string
}
props := &stub_props{[]string{":__subpackages__"}}
ctx.PrependProperties(props)
})
return module, bindgen
}

View file

@ -238,7 +238,7 @@ func NewRustProtobuf(hod android.HostOrDeviceSupported) (*Module, *protobufDecor
Properties: ProtobufProperties{},
}
module := NewSourceProviderModule(hod, protobuf, false)
module := NewSourceProviderModule(hod, protobuf, false, false)
return module, protobuf
}

View file

@ -65,9 +65,12 @@ func NewSourceProvider() *BaseSourceProvider {
}
}
func NewSourceProviderModule(hod android.HostOrDeviceSupported, sourceProvider SourceProvider, enableLints bool) *Module {
func NewSourceProviderModule(hod android.HostOrDeviceSupported, sourceProvider SourceProvider, enableLints bool, rlibOnly bool) *Module {
_, library := NewRustLibrary(hod)
library.BuildOnlyRust()
if rlibOnly {
library.BuildOnlyRlib()
}
library.sourceProvider = sourceProvider
module := newModule(hod, android.MultilibBoth)