summaryrefslogtreecommitdiff
path: root/ui/build/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'ui/build/config.go')
-rw-r--r--ui/build/config.go37
1 files changed, 35 insertions, 2 deletions
diff --git a/ui/build/config.go b/ui/build/config.go
index a6bba159e..61f6b1c9a 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -63,6 +63,7 @@ type configImpl struct {
environ *Environment
distDir string
buildDateTime string
+ logsPrefix string
// From the arguments
parallel int
@@ -84,6 +85,7 @@ type configImpl struct {
skipSoongTests bool
searchApiDir bool // Scan the Android.bp files generated in out/api_surfaces
skipMetricsUpload bool
+ buildStartedTime int64 // For metrics-upload-only - manually specify a build-started time
// From the product config
katiArgs []string
@@ -255,6 +257,14 @@ func defaultBazelProdMode(cfg *configImpl) bool {
return true
}
+func UploadOnlyConfig(ctx Context, _ ...string) Config {
+ ret := &configImpl{
+ environ: OsEnvironment(),
+ sandboxConfig: &SandboxConfig{},
+ }
+ return Config{ret}
+}
+
func NewConfig(ctx Context, args ...string) Config {
ret := &configImpl{
environ: OsEnvironment(),
@@ -266,9 +276,7 @@ func NewConfig(ctx Context, args ...string) Config {
ret.keepGoing = 1
ret.totalRAM = detectTotalRAM(ctx)
-
ret.parseArgs(ctx, args)
-
// Make sure OUT_DIR is set appropriately
if outDir, ok := ret.environ.Get("OUT_DIR"); ok {
ret.environ.Set("OUT_DIR", filepath.Clean(outDir))
@@ -756,6 +764,14 @@ func (c *configImpl) parseArgs(ctx Context, args []string) {
ctx.Metrics.SetBuildCommand([]string{buildCmd})
} else if strings.HasPrefix(arg, "--bazel-force-enabled-modules=") {
c.bazelForceEnabledModules = strings.TrimPrefix(arg, "--bazel-force-enabled-modules=")
+ } else if strings.HasPrefix(arg, "--build-started-time-unix-millis=") {
+ buildTimeStr := strings.TrimPrefix(arg, "--build-started-time-unix-millis=")
+ val, err := strconv.ParseInt(buildTimeStr, 10, 64)
+ if err == nil {
+ c.buildStartedTime = val
+ } else {
+ ctx.Fatalf("Error parsing build-time-started-unix-millis", err)
+ }
} else if len(arg) > 0 && arg[0] == '-' {
parseArgNum := func(def int) int {
if len(arg) > 2 {
@@ -1092,6 +1108,14 @@ func (c *configImpl) SetIncludeTags(i []string) {
c.includeTags = i
}
+func (c *configImpl) GetLogsPrefix() string {
+ return c.logsPrefix
+}
+
+func (c *configImpl) SetLogsPrefix(prefix string) {
+ c.logsPrefix = prefix
+}
+
func (c *configImpl) HighmemParallel() int {
if i, ok := c.environ.GetInt("NINJA_HIGHMEM_NUM_JOBS"); ok {
return i
@@ -1519,6 +1543,15 @@ func (c *configImpl) SkipMetricsUpload() bool {
return c.skipMetricsUpload
}
+// Returns a Time object if one was passed via a command-line flag.
+// Otherwise returns the passed default.
+func (c *configImpl) BuildStartedTimeOrDefault(defaultTime time.Time) time.Time {
+ if c.buildStartedTime == 0 {
+ return defaultTime
+ }
+ return time.UnixMilli(c.buildStartedTime)
+}
+
func GetMetricsUploader(topDir string, env *Environment) string {
if p, ok := env.Get("METRICS_UPLOADER"); ok {
metricsUploader := filepath.Join(topDir, p)