Fix date on mac builds
date on mac takes a -r argument that expects seconds, date on linux
takes a -d argument that expects a date string. Prefixing the date
string with @ makes date on linux treat the time as seconds, but is
incorrect for date on mac.
Test: m docs
Change-Id: Ic2a585eaac4c25b7b471caa581d7f25827c3a6b3
diff --git a/java/droiddoc.go b/java/droiddoc.go
index 26b8ac6..63ea4c3 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -727,7 +727,7 @@
if runtime.GOOS == "darwin" {
date = `date -r`
} else {
- date = `date -d`
+ date = `date -d @`
}
// Droiddoc always gets "-source 1.8" because it doesn't support 1.9 sources. For modules with 1.9
@@ -740,7 +740,7 @@
FlagWithArg("-doclet ", "com.google.doclava.Doclava").
FlagWithInputList("-docletpath ", docletPath.Paths(), ":").
FlagWithArg("-hdf page.build ", ctx.Config().BuildId()+"-"+ctx.Config().BuildNumberFromFile()).
- FlagWithArg("-hdf page.now ", `"$(`+date+` @$(cat `+ctx.Config().Getenv("BUILD_DATETIME_FILE")+`) "+%d %b %Y %k:%M")" `)
+ FlagWithArg("-hdf page.now ", `"$(`+date+`$(cat `+ctx.Config().Getenv("BUILD_DATETIME_FILE")+`) "+%d %b %Y %k:%M")" `)
if String(d.properties.Custom_template) == "" {
// TODO: This is almost always droiddoc-templates-sdk