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
This commit is contained in:
Colin Cross
2019-07-18 11:19:33 -07:00
parent daa4c67980
commit d64b325d53

View File

@@ -727,7 +727,7 @@ func (d *Droiddoc) doclavaDocsFlags(ctx android.ModuleContext, cmd *android.Rule
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 @@ func (d *Droiddoc) doclavaDocsFlags(ctx android.ModuleContext, cmd *android.Rule
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