Replace joda-time with Java 8 API

joda-time is used to format dates to timestamp strings, but since change
Iccfdb1e20 in core Gerrit it is no longer exported in the plugin API.

So far we used an explicit dependency on joda-time, but a better long term
solution is to migrate to the Java 8 date/time API.

Factor the timestamp formatting out to a new utility class, replacing the
usage of joda-time with Java 8's DateTimeFormatter.

Timestamps previously generated by joda-time did not use a specific time
zone or locale, and were generated using the server's defaults. In the
new formatter, explicitly set the locale and zone to the server's defaults,
so that any previously generated timestamps will be parsed successfully.

In a future change, we may consider using UTC zone and US locale, and
migrating any existing timestamps.

Keep the dependency on joda-time, but only for a test which confirms
that the new implementation produces the same values for various time
zones (the formatting is different for UTC).

Change-Id: I49bffffbd171065c6b3c0803a5a2bb377bd27ef1
6 files changed
tree: 559ec9e150705f284fb5ce85303ea5b1292dbfa1
  1. src/
  2. tools/
  3. .gitignore
  4. bazlets.bzl
  5. BUILD
  6. external_plugin_deps.bzl
  7. WORKSPACE