multiproduct_kati: better directory names.

Naming directories according to current date. This makes them easier to
parse when using the tool multiple time.

Also considered:
  millis := time.Now().UnixNano() / 1000000
  name := fmt.Sprintf("multiproduct-%d", millis)

Also considered putting separators in the number, but it makes for too
long of a directory name.

Test: multiproduct_kati
Change-Id: I10ac6754094653abf5bf11b04efc3c44905d3c8d
This commit is contained in:
Steven Moreland
2017-03-29 19:26:09 -07:00
parent e7ee3c7bc2
commit 552432e827

View File

@@ -19,12 +19,12 @@ import (
"context"
"flag"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"runtime"
"strings"
"sync"
"time"
"android/soong/ui/build"
"android/soong/ui/logger"
@@ -84,9 +84,11 @@ func main() {
config := build.NewConfig(buildCtx)
if *outDir == "" {
var err error
*outDir, err = ioutil.TempDir(config.OutDir(), "multiproduct")
if err != nil {
name := "multiproduct-" + time.Now().Format("20060102150405")
*outDir = filepath.Join(config.OutDir(), name)
if err := os.MkdirAll(*outDir, 0777); err != nil {
log.Fatalf("Failed to create tempdir: %v", err)
}