Merge "Enable reclient cache directory." am: 93c52efc15 am: 7e0ea34591

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2517415

Change-Id: I33db4afa3e507833874cc1f1ab0bc839ea13ed06
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Ramy Medhat
2023-04-17 15:26:05 +00:00
committed by Automerger Merge Worker
3 changed files with 18 additions and 2 deletions

View File

@@ -259,10 +259,16 @@ func Build(ctx Context, config Config) {
startGoma(ctx, config)
}
rbeCh := make(chan bool)
if config.StartRBE() {
cleanupRBELogsDir(ctx, config)
go func() {
startRBE(ctx, config)
close(rbeCh)
}()
defer DumpRBEMetrics(ctx, config, filepath.Join(config.LogsDir(), "rbe_metrics.pb"))
} else {
close(rbeCh)
}
if what&RunProductConfig != 0 {
@@ -315,11 +321,11 @@ func Build(ctx Context, config Config) {
testForDanglingRules(ctx, config)
}
<-rbeCh
if what&RunNinja != 0 {
if what&RunKati != 0 {
installCleanIfNecessary(ctx, config)
}
runNinjaForBuild(ctx, config)
}

View File

@@ -1374,6 +1374,15 @@ func (c *configImpl) rbeProxyLogsDir() string {
return filepath.Join(buildTmpDir, "rbe")
}
func (c *configImpl) rbeCacheDir() string {
for _, f := range []string{"RBE_cache_dir", "FLAG_cache_dir"} {
if v, ok := c.environ.Get(f); ok {
return v
}
}
return shared.JoinPath(c.SoongOutDir(), "rbe")
}
func (c *configImpl) shouldCleanupRBELogsDir() bool {
// Perform a log directory cleanup only when the log directory
// is auto created by the build rather than user-specified.

View File

@@ -60,6 +60,7 @@ func getRBEVars(ctx Context, config Config) map[string]string {
"RBE_exec_root": config.rbeExecRoot(),
"RBE_output_dir": config.rbeProxyLogsDir(),
"RBE_proxy_log_dir": config.rbeProxyLogsDir(),
"RBE_cache_dir": config.rbeCacheDir(),
"RBE_platform": "container-image=" + remoteexec.DefaultImage,
}
if config.StartRBE() {