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

Commit 3e0836e8 authored by Cole Faust's avatar Cole Faust Committed by Gerrit Code Review
Browse files

Merge "Load starlark files from soong"

parents eb52c2e7 c9508aac
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ bootstrap_go_package {
        "soong-remoteexec",
        "soong-response",
        "soong-shared",
        "soong-starlark",
        "soong-starlark-format",
        "soong-ui-metrics_proto",
        "soong-android-allowlists",
+11 −1
Original line number Diff line number Diff line
@@ -14,7 +14,10 @@

package android

import "sort"
import (
	"android/soong/starlark_import"
	"sort"
)

func (c *config) addNinjaFileDeps(deps ...string) {
	for _, dep := range deps {
@@ -40,4 +43,11 @@ type ninjaDepsSingleton struct{}

func (ninjaDepsSingleton) GenerateBuildActions(ctx SingletonContext) {
	ctx.AddNinjaFileDeps(ctx.Config().ninjaFileDeps()...)

	deps, err := starlark_import.GetNinjaDeps()
	if err != nil {
		ctx.Errorf("Error running starlark code: %s", err)
	} else {
		ctx.AddNinjaFileDeps(deps...)
	}
}
+7 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
package bp2build

import (
	"android/soong/starlark_import"
	"fmt"
	"os"
	"path/filepath"
@@ -93,6 +94,12 @@ func Codegen(ctx *CodegenContext) *CodegenMetrics {
		os.Exit(1)
	}
	writeFiles(ctx, android.PathForOutput(ctx, bazel.SoongInjectionDirName), injectionFiles)
	starlarkDeps, err := starlark_import.GetNinjaDeps()
	if err != nil {
		fmt.Fprintf(os.Stderr, "%s\n", err)
		os.Exit(1)
	}
	ctx.AddNinjaFileDeps(starlarkDeps...)
	return &res.metrics
}

+9 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
package main

import (
	"android/soong/starlark_import"
	"io/fs"
	"io/ioutil"
	"os"
@@ -47,6 +48,14 @@ func createBazelWorkspace(ctx *bp2build.CodegenContext, outDir string, generateF
		}
	}

	// Add starlark deps here, so that they apply to both queryview and apibp2build which
	// both run this function.
	starlarkDeps, err2 := starlark_import.GetNinjaDeps()
	if err2 != nil {
		return err2
	}
	ctx.AddNinjaFileDeps(starlarkDeps...)

	return nil
}

+1 −0
Original line number Diff line number Diff line
@@ -6,4 +6,5 @@ require (
	github.com/google/blueprint v0.0.0
	google.golang.org/protobuf v0.0.0
	prebuilts/bazel/common/proto/analysis_v2 v0.0.0
	go.starlark.net v0.0.0
)
Loading