|
@@ -22,7 +22,7 @@ type BazelFile struct {
|
|
|
}
|
|
|
|
|
|
// PRIVATE: Use CreateSoongInjectionDirFiles instead
|
|
|
-func soongInjectionFiles(cfg android.Config, metrics CodegenMetrics) []BazelFile {
|
|
|
+func soongInjectionFiles(cfg android.Config, metrics CodegenMetrics) ([]BazelFile, error) {
|
|
|
var files []BazelFile
|
|
|
|
|
|
files = append(files, newFile("android", GeneratedBuildFileName, "")) // Creates a //cc_toolchain package.
|
|
@@ -36,7 +36,11 @@ func soongInjectionFiles(cfg android.Config, metrics CodegenMetrics) []BazelFile
|
|
|
files = append(files, newFile("java_toolchain", "constants.bzl", java_config.BazelJavaToolchainVars(cfg)))
|
|
|
|
|
|
files = append(files, newFile("apex_toolchain", GeneratedBuildFileName, "")) // Creates a //apex_toolchain package.
|
|
|
- files = append(files, newFile("apex_toolchain", "constants.bzl", apex.BazelApexToolchainVars()))
|
|
|
+ apexToolchainVars, err := apex.BazelApexToolchainVars()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ files = append(files, newFile("apex_toolchain", "constants.bzl", apexToolchainVars))
|
|
|
|
|
|
files = append(files, newFile("metrics", "converted_modules.txt", strings.Join(metrics.Serialize().ConvertedModules, "\n")))
|
|
|
|
|
@@ -52,7 +56,7 @@ func soongInjectionFiles(cfg android.Config, metrics CodegenMetrics) []BazelFile
|
|
|
|
|
|
apiLevelsContent, err := json.Marshal(android.GetApiLevelsMap(cfg))
|
|
|
if err != nil {
|
|
|
- panic(err)
|
|
|
+ return nil, err
|
|
|
}
|
|
|
files = append(files, newFile("api_levels", GeneratedBuildFileName, `exports_files(["api_levels.json"])`))
|
|
|
files = append(files, newFile("api_levels", "api_levels.json", string(apiLevelsContent)))
|
|
@@ -64,7 +68,7 @@ func soongInjectionFiles(cfg android.Config, metrics CodegenMetrics) []BazelFile
|
|
|
files = append(files, newFile("allowlists", "mixed_build_prod_allowlist.txt", strings.Join(android.GetBazelEnabledModules(android.BazelProdMode), "\n")+"\n"))
|
|
|
files = append(files, newFile("allowlists", "mixed_build_staging_allowlist.txt", strings.Join(android.GetBazelEnabledModules(android.BazelStagingMode), "\n")+"\n"))
|
|
|
|
|
|
- return files
|
|
|
+ return files, nil
|
|
|
}
|
|
|
|
|
|
func CreateBazelFiles(
|