Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 902fd17a authored by Usta Shrestha's avatar Usta Shrestha
Browse files

ensure out/bazel_metrics exists before writing to cquery-buildroot_bazel_profile.gz

Bug: 222133546
Test: `rm -rf out` then `USE_BAZEL_ANALYSIS m libnativehelper` and ensure 'out/bazel_metrics' exists
Change-Id: I6803aba830e1c40f3618bfc41109728d721fd2af
parent 6bd0d4e8
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -664,7 +664,12 @@ func (context *bazelContext) InvokeBazel() error {
	if err != nil {
		return err
	}

	if metricsDir := context.paths.BazelMetricsDir(); metricsDir != "" {
		err = os.MkdirAll(metricsDir, 0777)
		if err != nil {
			return err
		}
	}
	err = ioutil.WriteFile(filepath.Join(soongInjectionPath, "WORKSPACE.bazel"), []byte{}, 0666)
	if err != nil {
		return err
@@ -716,9 +721,9 @@ func (context *bazelContext) InvokeBazel() error {
		}
	}

	for val, _ := range context.requests {
	for val := range context.requests {
		if cqueryResult, ok := cqueryResults[getCqueryId(val)]; ok {
			context.results[val] = string(cqueryResult)
			context.results[val] = cqueryResult
		} else {
			return fmt.Errorf("missing result for bazel target %s. query output: [%s], cquery err: [%s]",
				getCqueryId(val), cqueryOutput, cqueryErr)