From 649d8174b8550b5d5a18258d5e093dcd213a1581 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 10 Dec 2020 12:30:21 -0800 Subject: [PATCH 1/2] Require libraries in header_libs to be cc_library_header Allowing header_libs to refer to a cc_library, cc_library_static or cc_library_shared was unintentional, make it an error. Fixes: 173252016 Test: m checkbuild Change-Id: I9f7986f6ca37deddf1f208b15a87d3c0cff25585 --- cc/cc.go | 9 ++++++++- cc/library.go | 24 +++++++++++++++--------- cc/linkable.go | 7 +++++++ cc/prebuilt.go | 6 ++++++ 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/cc/cc.go b/cc/cc.go index ae75c1d34..f5f2d04cf 100644 --- a/cc/cc.go +++ b/cc/cc.go @@ -2446,7 +2446,14 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps { switch { case libDepTag.header(): - // nothing + if !ctx.OtherModuleHasProvider(dep, HeaderLibraryInfoProvider) { + if !ctx.Config().AllowMissingDependencies() { + ctx.ModuleErrorf("module %q is not a header library", depName) + } else { + ctx.AddMissingDependencies([]string{depName}) + } + return + } case libDepTag.shared(): if !ctx.OtherModuleHasProvider(dep, SharedLibraryInfoProvider) { if !ctx.Config().AllowMissingDependencies() { diff --git a/cc/library.go b/cc/library.go index b796aafe3..3244db7fd 100644 --- a/cc/library.go +++ b/cc/library.go @@ -940,16 +940,22 @@ func (library *libraryDecorator) linkStatic(ctx ModuleContext, ctx.CheckbuildFile(outputFile) - ctx.SetProvider(StaticLibraryInfoProvider, StaticLibraryInfo{ - StaticLibrary: outputFile, - ReuseObjects: library.reuseObjects, - Objects: library.objects, + if library.static() { + ctx.SetProvider(StaticLibraryInfoProvider, StaticLibraryInfo{ + StaticLibrary: outputFile, + ReuseObjects: library.reuseObjects, + Objects: library.objects, - TransitiveStaticLibrariesForOrdering: android.NewDepSetBuilder(android.TOPOLOGICAL). - Direct(outputFile). - Transitive(deps.TranstiveStaticLibrariesForOrdering). - Build(), - }) + TransitiveStaticLibrariesForOrdering: android.NewDepSetBuilder(android.TOPOLOGICAL). + Direct(outputFile). + Transitive(deps.TranstiveStaticLibrariesForOrdering). + Build(), + }) + } + + if library.header() { + ctx.SetProvider(HeaderLibraryInfoProvider, HeaderLibraryInfo{}) + } return outputFile } diff --git a/cc/linkable.go b/cc/linkable.go index ddf395009..94b5a54ac 100644 --- a/cc/linkable.go +++ b/cc/linkable.go @@ -125,6 +125,13 @@ type StaticLibraryInfo struct { var StaticLibraryInfoProvider = blueprint.NewProvider(StaticLibraryInfo{}) +// HeaderLibraryInfo is a marker provider that identifies a module as a header library. +type HeaderLibraryInfo struct { +} + +// HeaderLibraryInfoProvider is a marker provider that identifies a module as a header library. +var HeaderLibraryInfoProvider = blueprint.NewProvider(HeaderLibraryInfo{}) + // FlagExporterInfo is a provider to propagate transitive library information // pertaining to exported include paths and flags. type FlagExporterInfo struct { diff --git a/cc/prebuilt.go b/cc/prebuilt.go index 37df4ba0f..df713409d 100644 --- a/cc/prebuilt.go +++ b/cc/prebuilt.go @@ -190,6 +190,12 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext, } } + if p.header() { + ctx.SetProvider(HeaderLibraryInfoProvider, HeaderLibraryInfo{}) + + return nil + } + return nil } From 3f2fa9b846977eec7276fb768ad6e7be3836b527 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 10 Dec 2020 16:02:38 -0800 Subject: [PATCH 2/2] Add libstagefright_mp3dec_headers to allowed apex deps libstagefright_mp3dec_headers is being split out of libstagefright_mp3dec. Bug: 173252016 Test: m checkbuild Change-Id: I7ab485832628203a907ebe8c3f79325d8b5788f4 --- apex/allowed_deps.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/apex/allowed_deps.txt b/apex/allowed_deps.txt index a2f87978e..a0699d816 100644 --- a/apex/allowed_deps.txt +++ b/apex/allowed_deps.txt @@ -383,6 +383,7 @@ libstagefright_m4vh263dec(minSdkVersion:29) libstagefright_m4vh263enc(minSdkVersion:29) libstagefright_metadatautils(minSdkVersion:29) libstagefright_mp3dec(minSdkVersion:29) +libstagefright_mp3dec_headers(minSdkVersion:29) libstagefright_mpeg2extractor(minSdkVersion:29) libstagefright_mpeg2support_nocrypto(minSdkVersion:29) libstats_jni(minSdkVersion:(no version))