Use our own TMPDIR
Some people have run into issues where /tmp is on a smaller partition
than their main source tree, and if it fills up (or only has a few GB
free), their builds can start failing.
There may also be a subset of people whose /tmp may be slower than their
out directory -- if they put their src and out trees on a SSD, but keep
/tmp on a spinning HDD.
Bug: 71755844
Test: check out/soong.log for TMPDIR
Test: do a build, watch out/soong/.temp
Change-Id: Ib749ec736ad0f6c8ce7453861a91b3e99ddbd92d
diff --git a/ui/build/config.go b/ui/build/config.go
index 27ed8e9..a1b5bd4 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -115,6 +115,8 @@
// Tell python not to spam the source tree with .pyc files.
ret.environ.Set("PYTHONDONTWRITEBYTECODE", "1")
+ ret.environ.Set("TMPDIR", absPath(ctx, ret.TempDir()))
+
// Precondition: the current directory is the top of the source tree
if _, err := os.Stat(srcDirFileCheck); err != nil {
if os.IsNotExist(err) {