Build build_flags.json in soong

Define release_flags_json module type to install build_flags.json in
'etc'. release_flags_json reads the json files generated from the
soong release-config command.

Bug: 324996303
Test: build and see if the files are installed
Change-Id: I8cdcb7c61dd75cc54e4912d2ed7d1687f424151c
This commit is contained in:
Justin Yun
2024-05-22 20:35:20 +09:00
parent c15b0234e9
commit 5f53869dfe
5 changed files with 78 additions and 3 deletions

View File

@@ -120,7 +120,7 @@ func main() {
panic(err)
}
}
if err = config.WritePartitionBuildFlags(outputDir, product, targetRelease); err != nil {
if err = config.WritePartitionBuildFlags(outputDir); err != nil {
panic(err)
}

View File

@@ -284,13 +284,15 @@ func (config *ReleaseConfig) GenerateReleaseConfig(configs *ReleaseConfigs) erro
return nil
}
func (config *ReleaseConfig) WritePartitionBuildFlags(outDir, product, targetRelease string) error {
func (config *ReleaseConfig) WritePartitionBuildFlags(outDir string) error {
var err error
for partition, flags := range config.PartitionBuildFlags {
slices.SortFunc(flags.FlagArtifacts, func(a, b *rc_proto.FlagArtifact) int {
return cmp.Compare(*a.FlagDeclaration.Name, *b.FlagDeclaration.Name)
})
if err = WriteMessage(filepath.Join(outDir, fmt.Sprintf("build_flags_%s-%s-%s.json", partition, config.Name, product)), flags); err != nil {
// The json file name must not be modified as this is read from
// build_flags_json module
if err = WriteMessage(filepath.Join(outDir, fmt.Sprintf("build_flags_%s.json", partition)), flags); err != nil {
return err
}
}