all_flags.pb: Properly handle intermediate files
Bug: 343203557 Test: manual, TH Change-Id: I9a4ef39b0c2a641ccd996187ce5f7629520dffc0
This commit is contained in:
parent
585564cab2
commit
194d492d55
2 changed files with 19 additions and 6 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"os"
|
||||
|
||||
rc_lib "android/soong/cmd/release_config/release_config_lib"
|
||||
rc_proto "android/soong/cmd/release_config/release_config_proto"
|
||||
)
|
||||
|
||||
type Flags struct {
|
||||
|
@ -62,18 +63,17 @@ func main() {
|
|||
}
|
||||
|
||||
flagArtifacts := rc_lib.FlagArtifactsFactory("")
|
||||
intermediates := []*rc_proto.FlagDeclarationArtifacts{}
|
||||
for _, intermediate := range flags.intermediates {
|
||||
fas := rc_lib.FlagArtifactsFactory(intermediate)
|
||||
for _, fa := range *fas {
|
||||
(*flagArtifacts)[*fa.FlagDeclaration.Name] = fa
|
||||
}
|
||||
fda := rc_lib.FlagDeclarationArtifactsFactory(intermediate)
|
||||
intermediates = append(intermediates, fda)
|
||||
}
|
||||
for _, decl := range flags.decls {
|
||||
fa := rc_lib.FlagArtifactFactory(decl)
|
||||
(*flagArtifacts)[*fa.FlagDeclaration.Name] = fa
|
||||
}
|
||||
|
||||
message := flagArtifacts.GenerateFlagDeclarationArtifacts()
|
||||
message := flagArtifacts.GenerateFlagDeclarationArtifacts(intermediates)
|
||||
err = rc_lib.WriteFormattedMessage(flags.output, flags.format, message)
|
||||
if err != nil {
|
||||
errorExit(err)
|
||||
|
|
|
@ -102,11 +102,24 @@ func (fa *FlagArtifact) GenerateFlagDeclarationArtifact() *rc_proto.FlagDeclarat
|
|||
return ret
|
||||
}
|
||||
|
||||
func (fas *FlagArtifacts) GenerateFlagDeclarationArtifacts() *rc_proto.FlagDeclarationArtifacts {
|
||||
func FlagDeclarationArtifactsFactory(path string) *rc_proto.FlagDeclarationArtifacts {
|
||||
ret := &rc_proto.FlagDeclarationArtifacts{}
|
||||
if path != "" {
|
||||
LoadMessage(path, ret)
|
||||
} else {
|
||||
ret.FlagDeclarationArtifacts = []*rc_proto.FlagDeclarationArtifact{}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (fas *FlagArtifacts) GenerateFlagDeclarationArtifacts(intermediates []*rc_proto.FlagDeclarationArtifacts) *rc_proto.FlagDeclarationArtifacts {
|
||||
ret := &rc_proto.FlagDeclarationArtifacts{FlagDeclarationArtifacts: []*rc_proto.FlagDeclarationArtifact{}}
|
||||
for _, fa := range *fas {
|
||||
ret.FlagDeclarationArtifacts = append(ret.FlagDeclarationArtifacts, fa.GenerateFlagDeclarationArtifact())
|
||||
}
|
||||
for _, fda := range intermediates {
|
||||
ret.FlagDeclarationArtifacts = append(ret.FlagDeclarationArtifacts, fda.FlagDeclarationArtifacts...)
|
||||
}
|
||||
slices.SortFunc(ret.FlagDeclarationArtifacts, func(a, b *rc_proto.FlagDeclarationArtifact) int {
|
||||
return cmp.Compare(*a.Name, *b.Name)
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue