Loading android/module.go +4 −0 Original line number Diff line number Diff line Loading @@ -819,6 +819,10 @@ func (m *ModuleBase) Host() bool { return m.Os().Class == Host || m.Os().Class == HostCross } func (m *ModuleBase) Device() bool { return m.Os().Class == Device } func (m *ModuleBase) Arch() Arch { return m.Target().Arch } Loading cc/cc_test.go +34 −0 Original line number Diff line number Diff line Loading @@ -430,6 +430,40 @@ func TestVndk(t *testing.T) { checkVndkLibrariesOutput(t, ctx, "vndkcorevariant.libraries.txt", nil) } func TestVndkWithHostSupported(t *testing.T) { ctx := testCc(t, ` cc_library { name: "libvndk_host_supported", vendor_available: true, vndk: { enabled: true, }, host_supported: true, } cc_library { name: "libvndk_host_supported_but_disabled_on_device", vendor_available: true, vndk: { enabled: true, }, host_supported: true, enabled: false, target: { host: { enabled: true, } } } vndk_libraries_txt { name: "vndkcore.libraries.txt", } `) checkVndkLibrariesOutput(t, ctx, "vndkcore.libraries.txt", []string{"libvndk_host_supported.so"}) } func TestVndkLibrariesTxtAndroidMk(t *testing.T) { bp := ` vndk_libraries_txt { Loading cc/vndk.go +16 −11 Original line number Diff line number Diff line Loading @@ -334,16 +334,24 @@ func processVndkLibrary(mctx android.BottomUpMutatorContext, m *Module) { } } func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool { // Sanity check for modules that mustn't be VNDK func shouldSkipVndkMutator(m *Module) bool { if !m.Enabled() { return false return true } if !m.Device() { // Skip non-device modules return true } if m.Target().NativeBridge == android.NativeBridgeEnabled { // Skip native_bridge modules return true } if !mctx.Device() { return false } if m.Target().NativeBridge == android.NativeBridgeEnabled { func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool { if shouldSkipVndkMutator(m) { return false } Loading Loading @@ -377,11 +385,8 @@ func VndkMutator(mctx android.BottomUpMutatorContext) { if !ok { return } if !m.Enabled() { return } if m.Target().NativeBridge == android.NativeBridgeEnabled { // Skip native_bridge modules if shouldSkipVndkMutator(m) { return } Loading Loading
android/module.go +4 −0 Original line number Diff line number Diff line Loading @@ -819,6 +819,10 @@ func (m *ModuleBase) Host() bool { return m.Os().Class == Host || m.Os().Class == HostCross } func (m *ModuleBase) Device() bool { return m.Os().Class == Device } func (m *ModuleBase) Arch() Arch { return m.Target().Arch } Loading
cc/cc_test.go +34 −0 Original line number Diff line number Diff line Loading @@ -430,6 +430,40 @@ func TestVndk(t *testing.T) { checkVndkLibrariesOutput(t, ctx, "vndkcorevariant.libraries.txt", nil) } func TestVndkWithHostSupported(t *testing.T) { ctx := testCc(t, ` cc_library { name: "libvndk_host_supported", vendor_available: true, vndk: { enabled: true, }, host_supported: true, } cc_library { name: "libvndk_host_supported_but_disabled_on_device", vendor_available: true, vndk: { enabled: true, }, host_supported: true, enabled: false, target: { host: { enabled: true, } } } vndk_libraries_txt { name: "vndkcore.libraries.txt", } `) checkVndkLibrariesOutput(t, ctx, "vndkcore.libraries.txt", []string{"libvndk_host_supported.so"}) } func TestVndkLibrariesTxtAndroidMk(t *testing.T) { bp := ` vndk_libraries_txt { Loading
cc/vndk.go +16 −11 Original line number Diff line number Diff line Loading @@ -334,16 +334,24 @@ func processVndkLibrary(mctx android.BottomUpMutatorContext, m *Module) { } } func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool { // Sanity check for modules that mustn't be VNDK func shouldSkipVndkMutator(m *Module) bool { if !m.Enabled() { return false return true } if !m.Device() { // Skip non-device modules return true } if m.Target().NativeBridge == android.NativeBridgeEnabled { // Skip native_bridge modules return true } if !mctx.Device() { return false } if m.Target().NativeBridge == android.NativeBridgeEnabled { func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool { if shouldSkipVndkMutator(m) { return false } Loading Loading @@ -377,11 +385,8 @@ func VndkMutator(mctx android.BottomUpMutatorContext) { if !ok { return } if !m.Enabled() { return } if m.Target().NativeBridge == android.NativeBridgeEnabled { // Skip native_bridge modules if shouldSkipVndkMutator(m) { return } Loading