Fix prebuilt header files to produce proper AndroidMk entries.
Necessary for modules that depend on headers through LOCAL_HEADER_LIBRARIES in legacy Android.mk files. Test: m nothing Test: m nothing SOONG_CONFIG_art_module_source_build=false on internal master Test: m droid checkbuild SOONG_CONFIG_art_module_source_build=false Test: m SOONG_CONFIG_art_module_source_build=false \ out/soong/.intermediates/prebuilts/module_sdk/art/current/sdk/prebuilt_jni_headers/linux_glibc_x86_64/prebuilt_jni_headers.a ar t out/soong/.intermediates/prebuilts/module_sdk/art/current/sdk/prebuilt_jni_headers/linux_glibc_x86_64/prebuilt_jni_headers.a \ && echo ok Bug: 202192894 Change-Id: Ied267053d1fc3563870a3faaf41d79983a22815a
This commit is contained in:
parent
611e140043
commit
d51cb5c130
2 changed files with 18 additions and 1 deletions
|
@ -43,6 +43,17 @@ func TestLibraryHeaders(t *testing.T) {
|
|||
// test if header search paths are correctly added
|
||||
cc := ctx.ModuleForTests("lib", "android_arm64_armv8-a_static").Rule("cc")
|
||||
android.AssertStringDoesContain(t, "cFlags for lib module", cc.Args["cFlags"], " -Imy_include ")
|
||||
|
||||
// Test that there's a valid AndroidMk entry.
|
||||
headers := ctx.ModuleForTests("headers", "android_arm64_armv8-a").Module()
|
||||
e := android.AndroidMkEntriesForTest(t, ctx, headers)[0]
|
||||
|
||||
// This duplicates the tests done in AndroidMkEntries.write. It would be
|
||||
// better to test its output, but there are no test functions that capture that.
|
||||
android.AssertBoolEquals(t, "AndroidMkEntries.Disabled", false, e.Disabled)
|
||||
android.AssertBoolEquals(t, "AndroidMkEntries.OutputFile.Valid()", true, e.OutputFile.Valid())
|
||||
|
||||
android.AssertStringListContains(t, "LOCAL_EXPORT_CFLAGS for headers module", e.EntryMap["LOCAL_EXPORT_CFLAGS"], "-Imy_include")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -197,7 +197,13 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext,
|
|||
if p.header() {
|
||||
ctx.SetProvider(HeaderLibraryInfoProvider, HeaderLibraryInfo{})
|
||||
|
||||
return nil
|
||||
// Need to return an output path so that the AndroidMk logic doesn't skip
|
||||
// the prebuilt header. For compatibility, in case Android.mk files use a
|
||||
// header lib in LOCAL_STATIC_LIBRARIES, create an empty ar file as
|
||||
// placeholder, just like non-prebuilt header modules do in linkStatic().
|
||||
ph := android.PathForModuleOut(ctx, ctx.ModuleName()+staticLibraryExtension)
|
||||
transformObjToStaticLib(ctx, nil, nil, builderFlags{}, ph, nil, nil)
|
||||
return ph
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue