Create src file provider in build/blueprint

Change-Id: I7091effe7791c1f3ea57e775b37cd72f4ee13d03
This commit is contained in:
Aditya Choudhary 2023-12-01 13:17:45 +00:00
parent 02d2b9e4cc
commit a992d06f60
3 changed files with 10 additions and 0 deletions

View file

@ -52,6 +52,7 @@ bootstrap_go_package {
"provider.go", "provider.go",
"scope.go", "scope.go",
"singleton_ctx.go", "singleton_ctx.go",
"source_file_provider.go"
], ],
testSrcs: [ testSrcs: [
"context_test.go", "context_test.go",

View file

@ -337,6 +337,7 @@ func (g *GoPackage) GenerateBuildActions(ctx blueprint.ModuleContext) {
buildGoPackage(ctx, g.pkgRoot, g.properties.PkgPath, g.archiveFile, buildGoPackage(ctx, g.pkgRoot, g.properties.PkgPath, g.archiveFile,
srcs, genSrcs) srcs, genSrcs)
ctx.SetProvider(blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: srcs})
} }
func (g *GoPackage) Srcs() []string { func (g *GoPackage) Srcs() []string {
@ -533,6 +534,7 @@ func (g *GoBinary) GenerateBuildActions(ctx blueprint.ModuleContext) {
Validations: validations, Validations: validations,
Optional: !g.properties.Default, Optional: !g.properties.Default,
}) })
ctx.SetProvider(blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: srcs})
} }
func buildGoPluginLoader(ctx blueprint.ModuleContext, pkgPath, pluginSrc string) bool { func buildGoPluginLoader(ctx blueprint.ModuleContext, pkgPath, pluginSrc string) bool {

7
source_file_provider.go Normal file
View file

@ -0,0 +1,7 @@
package blueprint
type SrcsFileProviderData struct {
SrcPaths []string
}
var SrcsFileProviderKey = NewProvider(SrcsFileProviderData{})