Merge "Write ide_qeury results to stdout" into main

This commit is contained in:
Michael Merg 2024-03-20 14:56:53 +00:00 committed by Gerrit Code Review
commit fdaf4cf995
2 changed files with 5 additions and 5 deletions

View file

@ -117,7 +117,7 @@ llvm::Expected<std::unique_ptr<clang::tooling::CompilationDatabase>> LoadCompDB(
result.mutable_status()->set_code(::ide_query::Status::FAILURE);
result.mutable_status()->set_message("Command working dir " +
working_dir.str() +
"outside repository " + repo_dir);
" outside repository " + repo_dir);
continue;
}
working_dir = working_dir.ltrim('/');

View file

@ -121,7 +121,7 @@ func main() {
log.Fatalf("Failed to query cc targets: %v", *status.Message)
}
toMake = append(toMake, ccTargets...)
fmt.Printf("Running make for modules: %v\n", strings.Join(toMake, ", "))
fmt.Fprintf(os.Stderr, "Running make for modules: %v\n", strings.Join(toMake, ", "))
if err := runMake(ctx, env, toMake...); err != nil {
log.Printf("Building deps failed: %v", err)
}
@ -136,13 +136,13 @@ func main() {
log.Fatalf("Failed to marshal result proto: %v", err)
}
err = os.WriteFile(path.Join(env.RepoDir, env.OutDir, "ide_query.pb"), data, 0644)
_, err = os.Stdout.Write(data)
if err != nil {
log.Fatalf("Failed to write result proto: %v", err)
}
for _, s := range res.Sources {
fmt.Printf("%s: %v (Deps: %d, Generated: %d)\n", s.GetPath(), s.GetStatus(), len(s.GetDeps()), len(s.GetGenerated()))
fmt.Fprintf(os.Stderr, "%s: %v (Deps: %d, Generated: %d)\n", s.GetPath(), s.GetStatus(), len(s.GetDeps()), len(s.GetGenerated()))
}
}
@ -312,7 +312,7 @@ func runMake(ctx context.Context, env Env, modules ...string) error {
args = append(args, modules...)
cmd := exec.CommandContext(ctx, "build/soong/soong_ui.bash", args...)
cmd.Dir = env.RepoDir
cmd.Stdout = os.Stdout
cmd.Stdout = os.Stderr
cmd.Stderr = os.Stderr
return cmd.Run()
}