From 0345ad80739d7479a753bd6533015fd0c14e6503 Mon Sep 17 00:00:00 2001 From: dimitry Date: Wed, 5 Dec 2018 16:28:14 +0100 Subject: [PATCH] Make filegroups work for library.Shared/Static.Srcs Add dependencies for source modules when they are referenced in library.Shared/Static.Srcs. Use ExpandSources to expand filegroups for these properties. Bug: http://b/120534727 Test: make Change-Id: I58d02d8f7d60026abbcde75298c7a61b27bdbf12 --- cc/library.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cc/library.go b/cc/library.go index 822274a14..2257e2ddc 100644 --- a/cc/library.go +++ b/cc/library.go @@ -415,11 +415,11 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa buildFlags := flagsToBuilderFlags(flags) if library.static() { - srcs := android.PathsForModuleSrc(ctx, library.Properties.Static.Srcs) + srcs := ctx.ExpandSources(library.Properties.Static.Srcs, nil) objs = objs.Append(compileObjs(ctx, buildFlags, android.DeviceStaticLibrary, srcs, library.baseCompiler.pathDeps, library.baseCompiler.cFlagsDeps)) } else if library.shared() { - srcs := android.PathsForModuleSrc(ctx, library.Properties.Shared.Srcs) + srcs := ctx.ExpandSources(library.Properties.Shared.Srcs, nil) objs = objs.Append(compileObjs(ctx, buildFlags, android.DeviceSharedLibrary, srcs, library.baseCompiler.pathDeps, library.baseCompiler.cFlagsDeps)) } @@ -491,6 +491,18 @@ func (library *libraryDecorator) linkerInit(ctx BaseModuleContext) { } } +func (library *libraryDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps { + deps = library.baseCompiler.compilerDeps(ctx, deps) + + if library.static() { + android.ExtractSourcesDeps(ctx, library.Properties.Static.Srcs) + } else if library.shared() { + android.ExtractSourcesDeps(ctx, library.Properties.Shared.Srcs) + } + + return deps +} + func (library *libraryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps { if library.static() { if library.Properties.Static.System_shared_libs != nil {