Merge "Fix droiddoc date error on Darwin"

This commit is contained in:
Treehugger Robot 2018-06-05 00:00:12 +00:00 committed by Gerrit Code Review
commit d9e8b8c40c
1 changed files with 10 additions and 1 deletions

View File

@ -19,6 +19,7 @@ import (
"android/soong/java/config" "android/soong/java/config"
"fmt" "fmt"
"path/filepath" "path/filepath"
"runtime"
"strings" "strings"
"github.com/google/blueprint" "github.com/google/blueprint"
@ -733,12 +734,20 @@ func (d *Droiddoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
implicits = append(implicits, jsilver) implicits = append(implicits, jsilver)
implicits = append(implicits, doclava) implicits = append(implicits, doclava)
var date string
if runtime.GOOS == "darwin" {
date = `date -r`
} else {
date = `date -d`
}
opts := "-source 1.8 -J-Xmx1600m -J-XX:-OmitStackTraceInFastThrow -XDignore.symbol.file " + opts := "-source 1.8 -J-Xmx1600m -J-XX:-OmitStackTraceInFastThrow -XDignore.symbol.file " +
"-doclet com.google.doclava.Doclava -docletpath " + jsilver.String() + ":" + doclava.String() + " " + "-doclet com.google.doclava.Doclava -docletpath " + jsilver.String() + ":" + doclava.String() + " " +
"-templatedir " + templateDir + " " + htmlDirArgs + " " + htmlDir2Args + " " + "-templatedir " + templateDir + " " + htmlDirArgs + " " + htmlDir2Args + " " +
"-hdf page.build " + ctx.Config().BuildId() + "-" + ctx.Config().BuildNumberFromFile() + " " + "-hdf page.build " + ctx.Config().BuildId() + "-" + ctx.Config().BuildNumberFromFile() + " " +
"-hdf page.now " + `"$$(date -d @$$(cat ` + ctx.Config().Getenv("BUILD_DATETIME_FILE") + `) "+%d %b %Y %k:%M")"` + `-hdf page.now "$$(` + date + ` @$$(cat ` + ctx.Config().Getenv("BUILD_DATETIME_FILE") + `) "+%d %b %Y %k:%M")" ` +
" " + args " " + args
if BoolDefault(d.properties.Create_stubs, true) { if BoolDefault(d.properties.Create_stubs, true) {
opts += " -stubs " + android.PathForModuleOut(ctx, "docs", "stubsDir").String() opts += " -stubs " + android.PathForModuleOut(ctx, "docs", "stubsDir").String()
} }