Loading cmd/soong_build/main.go +6 −1 Original line number Diff line number Diff line Loading @@ -238,7 +238,12 @@ func runApiBp2build(configuration android.Config, ctx *android.Context, extraNin soongInjectionFiles := bp2build.CreateSoongInjectionFiles(configuration, bp2build.CreateCodegenMetrics()) absoluteSoongInjectionDir := shared.JoinPath(topDir, configuration.SoongOutDir(), bazel.SoongInjectionDirName) for _, file := range soongInjectionFiles { writeReadOnlyFile(absoluteSoongInjectionDir, file) // The API targets in api_bp2build workspace do not have any dependency on api_bp2build. // But we need to create these files to prevent errors during Bazel analysis. // These need to be created in Read-Write mode. // This is because the subsequent step (bp2build in api domain analysis) creates them in Read-Write mode // to allow users to edit/experiment in the synthetic workspace. writeReadWriteFile(absoluteSoongInjectionDir, file) } workspace := shared.JoinPath(configuration.SoongOutDir(), "api_bp2build") Loading cmd/soong_build/queryview.go +13 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,19 @@ func writeReadOnlyFile(dir string, f bp2build.BazelFile) error { return err } func writeReadWriteFile(dir string, f bp2build.BazelFile) error { dir = filepath.Join(dir, f.Dir) if err := createDirectoryIfNonexistent(dir); err != nil { return err } pathToFile := filepath.Join(dir, f.Basename) // 0644 is read-write err := ioutil.WriteFile(pathToFile, []byte(f.Contents), 0644) return err } func createDirectoryIfNonexistent(dir string) error { if _, err := os.Stat(dir); os.IsNotExist(err) { return os.MkdirAll(dir, os.ModePerm) Loading Loading
cmd/soong_build/main.go +6 −1 Original line number Diff line number Diff line Loading @@ -238,7 +238,12 @@ func runApiBp2build(configuration android.Config, ctx *android.Context, extraNin soongInjectionFiles := bp2build.CreateSoongInjectionFiles(configuration, bp2build.CreateCodegenMetrics()) absoluteSoongInjectionDir := shared.JoinPath(topDir, configuration.SoongOutDir(), bazel.SoongInjectionDirName) for _, file := range soongInjectionFiles { writeReadOnlyFile(absoluteSoongInjectionDir, file) // The API targets in api_bp2build workspace do not have any dependency on api_bp2build. // But we need to create these files to prevent errors during Bazel analysis. // These need to be created in Read-Write mode. // This is because the subsequent step (bp2build in api domain analysis) creates them in Read-Write mode // to allow users to edit/experiment in the synthetic workspace. writeReadWriteFile(absoluteSoongInjectionDir, file) } workspace := shared.JoinPath(configuration.SoongOutDir(), "api_bp2build") Loading
cmd/soong_build/queryview.go +13 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,19 @@ func writeReadOnlyFile(dir string, f bp2build.BazelFile) error { return err } func writeReadWriteFile(dir string, f bp2build.BazelFile) error { dir = filepath.Join(dir, f.Dir) if err := createDirectoryIfNonexistent(dir); err != nil { return err } pathToFile := filepath.Join(dir, f.Basename) // 0644 is read-write err := ioutil.WriteFile(pathToFile, []byte(f.Contents), 0644) return err } func createDirectoryIfNonexistent(dir string) error { if _, err := os.Stat(dir); os.IsNotExist(err) { return os.MkdirAll(dir, os.ModePerm) Loading