Export apex_available_baseline to soong_injection
So that it can be used in the bazel implementation.
Bug: 268006095
Test: m nothing, check that it's in out/soong/soong_injection
Change-Id: I1520dd874076dee7fa083648d0790b060d658e5a
diff --git a/bp2build/bp2build.go b/bp2build/bp2build.go
index 86b9b27..062eba8 100644
--- a/bp2build/bp2build.go
+++ b/bp2build/bp2build.go
@@ -45,8 +45,12 @@
bp2buildFiles := CreateBazelFiles(ctx.Config(), nil, res.buildFileToTargets, ctx.mode)
writeFiles(ctx, bp2buildDir, bp2buildFiles)
- soongInjectionDir := android.PathForOutput(ctx, bazel.SoongInjectionDirName)
- writeFiles(ctx, soongInjectionDir, CreateSoongInjectionDirFiles(ctx, res.metrics))
+ injectionFiles, err := CreateSoongInjectionDirFiles(ctx, res.metrics)
+ if err != nil {
+ fmt.Printf("%s\n", err.Error())
+ os.Exit(1)
+ }
+ writeFiles(ctx, android.PathForOutput(ctx, bazel.SoongInjectionDirName), injectionFiles)
return &res.metrics
}
@@ -55,17 +59,20 @@
// This includes
// 1. config value(s) that are hardcoded in Soong
// 2. product_config variables
-func CreateSoongInjectionDirFiles(ctx *CodegenContext, metrics CodegenMetrics) []BazelFile {
+func CreateSoongInjectionDirFiles(ctx *CodegenContext, metrics CodegenMetrics) ([]BazelFile, error) {
var ret []BazelFile
productConfigFiles, err := CreateProductConfigFiles(ctx)
if err != nil {
- fmt.Printf("ERROR: %s", err.Error())
- os.Exit(1)
+ return nil, err
}
ret = append(ret, productConfigFiles...)
- ret = append(ret, soongInjectionFiles(ctx.Config(), metrics)...)
- return ret
+ injectionFiles, err := soongInjectionFiles(ctx.Config(), metrics)
+ if err != nil {
+ return nil, err
+ }
+ ret = append(ret, injectionFiles...)
+ return ret, nil
}
// Get the output directory and create it if it doesn't exist.