Merge changes If06de5f8,If1f4a1bf into main
* changes:
Convert getFdoProfilePathFromDep and addStubDependencyProviders to use ModuleProxy.
Convert findImplementationLibrary and compilerFlags to use ModuleProxy.
diff --git a/cc/afdo.go b/cc/afdo.go
index 03dc271..828e494 100644
--- a/cc/afdo.go
+++ b/cc/afdo.go
@@ -65,8 +65,8 @@
}
func getFdoProfilePathFromDep(ctx ModuleContext) string {
- fdoProfileDeps := ctx.GetDirectDepsWithTag(FdoProfileTag)
- if len(fdoProfileDeps) > 0 && fdoProfileDeps[0] != nil {
+ fdoProfileDeps := ctx.GetDirectDepsProxyWithTag(FdoProfileTag)
+ if len(fdoProfileDeps) > 0 {
if info, ok := android.OtherModuleProvider(ctx, fdoProfileDeps[0], FdoProfileProvider); ok {
return info.Path.String()
}
diff --git a/cc/cc.go b/cc/cc.go
index a877f47..dff8348 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -46,9 +46,9 @@
var CcMakeVarsInfoProvider = blueprint.NewProvider[*CcMakeVarsInfo]()
type CcObjectInfo struct {
- objFiles android.Paths
- tidyFiles android.Paths
- kytheFiles android.Paths
+ ObjFiles android.Paths
+ TidyFiles android.Paths
+ KytheFiles android.Paths
}
var CcObjectInfoProvider = blueprint.NewProvider[CcObjectInfo]()
@@ -73,13 +73,14 @@
}
type LinkerInfo struct {
- Whole_static_libs proptools.Configurable[[]string]
+ WholeStaticLibs proptools.Configurable[[]string]
// list of modules that should be statically linked into this module.
- Static_libs proptools.Configurable[[]string]
+ StaticLibs proptools.Configurable[[]string]
// list of modules that should be dynamically linked into this module.
- Shared_libs proptools.Configurable[[]string]
+ SharedLibs proptools.Configurable[[]string]
// list of modules that should only provide headers for this module.
- Header_libs proptools.Configurable[[]string]
+ HeaderLibs proptools.Configurable[[]string]
+ UnstrippedOutputFile android.Path
BinaryDecoratorInfo *BinaryDecoratorInfo
LibraryDecoratorInfo *LibraryDecoratorInfo
@@ -90,8 +91,13 @@
type BinaryDecoratorInfo struct{}
type LibraryDecoratorInfo struct {
- Export_include_dirs proptools.Configurable[[]string]
+ ExportIncludeDirs proptools.Configurable[[]string]
}
+
+type LibraryInfo struct {
+ StubsVersion string
+}
+
type TestBinaryInfo struct {
Gtest bool
}
@@ -105,6 +111,7 @@
CmakeSnapshotSupported bool
CompilerInfo *CompilerInfo
LinkerInfo *LinkerInfo
+ LibraryInfo *LibraryInfo
}
var CcInfoProvider = blueprint.NewProvider[CcInfo]()
@@ -2166,13 +2173,13 @@
}
ccObjectInfo := CcObjectInfo{
- kytheFiles: objs.kytheFiles,
+ KytheFiles: objs.kytheFiles,
}
if !ctx.Config().KatiEnabled() || !android.ShouldSkipAndroidMkProcessing(ctx, c) {
- ccObjectInfo.objFiles = objs.objFiles
- ccObjectInfo.tidyFiles = objs.tidyFiles
+ ccObjectInfo.ObjFiles = objs.objFiles
+ ccObjectInfo.TidyFiles = objs.tidyFiles
}
- if len(ccObjectInfo.kytheFiles)+len(ccObjectInfo.objFiles)+len(ccObjectInfo.tidyFiles) > 0 {
+ if len(ccObjectInfo.KytheFiles)+len(ccObjectInfo.ObjFiles)+len(ccObjectInfo.TidyFiles) > 0 {
android.SetProvider(ctx, CcObjectInfoProvider, ccObjectInfo)
}
@@ -2199,16 +2206,17 @@
switch decorator := c.compiler.(type) {
case *libraryDecorator:
ccInfo.CompilerInfo.LibraryDecoratorInfo = &LibraryDecoratorInfo{
- Export_include_dirs: decorator.flagExporter.Properties.Export_include_dirs,
+ ExportIncludeDirs: decorator.flagExporter.Properties.Export_include_dirs,
}
}
}
if c.linker != nil {
ccInfo.LinkerInfo = &LinkerInfo{
- Whole_static_libs: c.linker.baseLinkerProps().Whole_static_libs,
- Static_libs: c.linker.baseLinkerProps().Static_libs,
- Shared_libs: c.linker.baseLinkerProps().Shared_libs,
- Header_libs: c.linker.baseLinkerProps().Header_libs,
+ WholeStaticLibs: c.linker.baseLinkerProps().Whole_static_libs,
+ StaticLibs: c.linker.baseLinkerProps().Static_libs,
+ SharedLibs: c.linker.baseLinkerProps().Shared_libs,
+ HeaderLibs: c.linker.baseLinkerProps().Header_libs,
+ UnstrippedOutputFile: c.UnstrippedOutputFile(),
}
switch decorator := c.linker.(type) {
case *binaryDecorator:
@@ -2225,6 +2233,11 @@
ccInfo.LinkerInfo.ObjectLinkerInfo = &ObjectLinkerInfo{}
}
}
+ if c.library != nil {
+ ccInfo.LibraryInfo = &LibraryInfo{
+ StubsVersion: c.library.stubsVersion(),
+ }
+ }
android.SetProvider(ctx, CcInfoProvider, ccInfo)
c.setOutputFiles(ctx)
@@ -4080,7 +4093,7 @@
func (ks *kytheExtractAllSingleton) GenerateBuildActions(ctx android.SingletonContext) {
var xrefTargets android.Paths
ctx.VisitAllModuleProxies(func(module android.ModuleProxy) {
- files := android.OtherModuleProviderOrDefault(ctx, module, CcObjectInfoProvider).kytheFiles
+ files := android.OtherModuleProviderOrDefault(ctx, module, CcObjectInfoProvider).KytheFiles
if len(files) > 0 {
xrefTargets = append(xrefTargets, files...)
}
diff --git a/cc/cmake_snapshot.go b/cc/cmake_snapshot.go
index 408aea6..a40b863 100644
--- a/cc/cmake_snapshot.go
+++ b/cc/cmake_snapshot.go
@@ -208,19 +208,19 @@
return prop.GetOrDefault(ctx, nil)
},
"getWholeStaticLibsProperty": func(ctx android.ModuleContext, info *CcInfo) []string {
- prop := info.LinkerInfo.Whole_static_libs
+ prop := info.LinkerInfo.WholeStaticLibs
return prop.GetOrDefault(ctx, nil)
},
"getStaticLibsProperty": func(ctx android.ModuleContext, info *CcInfo) []string {
- prop := info.LinkerInfo.Static_libs
+ prop := info.LinkerInfo.StaticLibs
return prop.GetOrDefault(ctx, nil)
},
"getSharedLibsProperty": func(ctx android.ModuleContext, info *CcInfo) []string {
- prop := info.LinkerInfo.Shared_libs
+ prop := info.LinkerInfo.SharedLibs
return prop.GetOrDefault(ctx, nil)
},
"getHeaderLibsProperty": func(ctx android.ModuleContext, info *CcInfo) []string {
- prop := info.LinkerInfo.Header_libs
+ prop := info.LinkerInfo.HeaderLibs
return prop.GetOrDefault(ctx, nil)
},
"getExtraLibs": getExtraLibs,
@@ -552,7 +552,7 @@
func getIncludeDirs(ctx android.ModuleContext, m android.ModuleProxy, info *CcInfo) []string {
moduleDir := ctx.OtherModuleDir(m) + string(filepath.Separator)
if info.CompilerInfo.LibraryDecoratorInfo != nil {
- return sliceWithPrefix(moduleDir, info.CompilerInfo.LibraryDecoratorInfo.Export_include_dirs.GetOrDefault(ctx, nil))
+ return sliceWithPrefix(moduleDir, info.CompilerInfo.LibraryDecoratorInfo.ExportIncludeDirs.GetOrDefault(ctx, nil))
}
return nil
}
diff --git a/cc/compiler.go b/cc/compiler.go
index 91f107c..f2bced1 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -367,7 +367,7 @@
modulePath := ctx.ModuleDir()
reuseObjs := false
- if len(ctx.GetDirectDepsWithTag(reuseObjTag)) > 0 {
+ if len(ctx.GetDirectDepsProxyWithTag(reuseObjTag)) > 0 {
reuseObjs = true
}
diff --git a/cc/library.go b/cc/library.go
index be27b01..c9114fd 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -1216,7 +1216,7 @@
// Visits the stub variants of the library and returns a struct containing the stub .so paths
func addStubDependencyProviders(ctx ModuleContext) []SharedStubLibrary {
stubsInfo := []SharedStubLibrary{}
- stubs := ctx.GetDirectDepsWithTag(stubImplDepTag)
+ stubs := ctx.GetDirectDepsProxyWithTag(stubImplDepTag)
if len(stubs) > 0 {
for _, stub := range stubs {
stubInfo, ok := android.OtherModuleProvider(ctx, stub, SharedLibraryInfoProvider)
@@ -1225,8 +1225,12 @@
continue
}
flagInfo, _ := android.OtherModuleProvider(ctx, stub, FlagExporterInfoProvider)
+ ccInfo, ok := android.OtherModuleProvider(ctx, stub, CcInfoProvider)
+ if !ok || ccInfo.LibraryInfo == nil {
+ panic(fmt.Errorf("couldn't find library info for %s", stub))
+ }
stubsInfo = append(stubsInfo, SharedStubLibrary{
- Version: moduleLibraryInterface(stub).stubsVersion(),
+ Version: ccInfo.LibraryInfo.StubsVersion,
SharedLibraryInfo: stubInfo,
FlagExporterInfo: flagInfo,
})
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index 2411614..197a4b2 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -296,20 +296,20 @@
}
func (this *stubDecorator) findImplementationLibrary(ctx ModuleContext) android.Path {
- dep := ctx.GetDirectDepWithTag(strings.TrimSuffix(ctx.ModuleName(), ndkLibrarySuffix),
+ dep := ctx.GetDirectDepProxyWithTag(strings.TrimSuffix(ctx.ModuleName(), ndkLibrarySuffix),
stubImplementation)
if dep == nil {
- ctx.ModuleErrorf("Could not find implementation for stub")
+ ctx.ModuleErrorf("Could not find implementation for stub: ")
return nil
}
- impl, ok := dep.(*Module)
+ info, ok := android.OtherModuleProvider(ctx, *dep, CcInfoProvider)
if !ok {
ctx.ModuleErrorf("Implementation for stub is not correct module type")
return nil
}
- output := impl.UnstrippedOutputFile()
+ output := info.LinkerInfo.UnstrippedOutputFile
if output == nil {
- ctx.ModuleErrorf("implementation module (%s) has no output", impl)
+ ctx.ModuleErrorf("implementation module (%s) has no output", *dep)
return nil
}
diff --git a/cc/tidy.go b/cc/tidy.go
index 6481b95..18e6f35 100644
--- a/cc/tidy.go
+++ b/cc/tidy.go
@@ -222,8 +222,8 @@
ctx.VisitAllModuleVariantProxies(module, func(variant android.ModuleProxy) {
osName := android.OtherModuleProviderOrDefault(ctx, variant, android.CommonModuleInfoKey).CompileTarget.Os.Name
info := android.OtherModuleProviderOrDefault(ctx, variant, CcObjectInfoProvider)
- addToOSGroup(osName, info.objFiles, allObjFileGroups, subsetObjFileGroups)
- addToOSGroup(osName, info.tidyFiles, allTidyFileGroups, subsetTidyFileGroups)
+ addToOSGroup(osName, info.ObjFiles, allObjFileGroups, subsetObjFileGroups)
+ addToOSGroup(osName, info.TidyFiles, allTidyFileGroups, subsetTidyFileGroups)
})
// (2) Add an all-OS group, with "" or "subset" name, to include all os-specific phony targets.