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

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2172545

Change-Id: Ic0396b3e890b9df46335f7802758b8688f5c091d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2022-08-02 22:23:03 +00:00 committed by Automerger Merge Worker
commit 957fbfa934
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)