THRIFT-4351: use travis build stages to optimize build,
avoiding duplicate rebuilds of the same image, and also
allow personal docker hub repositories for private fork
builds to be optimized. Move ubsan build to artful image
because it catches more stuff and fix what was found.

THRIFT-4345: solidify docker build strategy for maximum
coverage: trusty, xenial, artful as stock as they can be

THRIFT-4344: add top level language summary markdown and
update readme with a new image on the layered architecture

THRIFT-3847: remove VERSION macro from config.h which
was causing a conflict on artful builds.

THRIFT-4359: fix haxe map/set decode when key is binary,
as a missing break statement caused it to use an int
during decode

This closes #1389
diff --git a/build/docker/ubuntu-xenial/Dockerfile b/build/docker/ubuntu-xenial/Dockerfile
index 560cf87..255b6e8 100644
--- a/build/docker/ubuntu-xenial/Dockerfile
+++ b/build/docker/ubuntu-xenial/Dockerfile
@@ -10,32 +10,40 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+#
 # Apache Thrift Docker build environment for Ubuntu Xenial
+# Using all stock Ubuntu Xenial packaging except for:
+# - d: does not come with Ubuntu so we're installing 2.073.2 for coverage
+# - dart: does not come with Ubuntu so we're installing 1.22.1 for coverage
+#
+
 #
 # Known missing or disabled libraries:
 # - d: deimos for libevent and openssl omitted - not compatible / build errors
 
 FROM buildpack-deps:xenial-scm
 MAINTAINER Apache Thrift <dev@thrift.apache.org>
-
 ENV DEBIAN_FRONTEND noninteractive
 
 ### Add apt repos
 
-RUN apt-get update && apt-get install -y --no-install-recommends apt apt-transport-https curl wget apt-utils
+RUN apt-get update && apt-get dist-upgrade -y && apt-get install -y --no-install-recommends apt apt-transport-https curl wget apt-utils
 
 # csharp (mono)
-RUN echo "deb http://download.mono-project.com/repo/debian xenial main" | tee /etc/apt/sources.list.d/mono.list && \
-    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A6A19B38D3D831EF
+# RUN echo "deb http://download.mono-project.com/repo/debian xenial main" | tee /etc/apt/sources.list.d/mono.list && \
+#     apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A6A19B38D3D831EF
 
 # D
 RUN wget http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list && \
-    apt-get update && apt-get -y --allow-unauthenticated install --reinstall d-apt-keyring
+    wget -qO - https://dlang.org/d-keyring.gpg | apt-key add -
+ENV D_VERSION 2.073.2-0
 
 # Dart
 RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
     curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list && \
     sed -i /etc/apt/sources.list.d/dart_stable.list -e 's/https:/http:/g'
+# since ubuntu-artful can't run dart, we'll run 1.240 on xenial for now
+ENV DART_VERSION 1.24.2-1
 
 # dotnet (core) 2.0.0
 RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg && \
@@ -43,11 +51,11 @@
 
 # node.js (this step runs apt-get update internally)
 # note: node 8.5 introduced some issues with directory handling / jsdoc / something... using 7.x for now
-RUN curl -sL https://deb.nodesource.com/setup_7.x | bash
+# RUN curl -sL https://deb.nodesource.com/setup_7.x | bash
 
 
 ### install general dependencies
-RUN apt-get install -y --no-install-recommends \
+RUN apt-get update && apt-get install -y --no-install-recommends \
 `# General dependencies` \
       bash-completion \
       bison \
@@ -84,19 +92,23 @@
 `# csharp (mono) dependencies` \
       mono-devel
 
-RUN apt-get install -y --no-install-recommends \
+RUN apt-get install -y --allow-unauthenticated --no-install-recommends \
 `# D dependencies` \
-      dmd-bin \
+      dmd-bin=$D_VERSION \
+      libphobos2-dev=$D_VERSION \
+      dub \
+      dfmt \
+      dscanner \
       libevent-dev \
       libssl-dev \
       xdg-utils
-# libevent deimos doesn't seem to work so disabling it:
+# libevent deimos doesn't seem to work so not enabling it:
 # RUN mkdir -p /usr/include/dmd/druntime/import/deimos /usr/include/dmd/druntime/import/C && \
 #     curl -sSL https://github.com/D-Programming-Deimos/libevent/archive/master.tar.gz| tar xz && \
 #     mv libevent-master/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
 #     mv libevent-master/C/* /usr/include/dmd/druntime/import/C/ && \
 #     rm -rf libevent-master
-# openssl deimos doesn't work with openssl-1.0.2 so disabling it:
+# openssl deimos doesn't work with openssl-1.0.2 so not enabling it:
 # RUN curl -sSL https://github.com/D-Programming-Deimos/openssl/archive/master.tar.gz| tar xz && \
 #     mv openssl-master/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
 #     mv openssl-master/C/* /usr/include/dmd/druntime/import/C/ && \
@@ -104,7 +116,7 @@
 
 RUN apt-get install -y --no-install-recommends \
 `# Dart dependencies` \
-      dart
+      dart=$DART_VERSION
 ENV PATH /usr/lib/dart/bin:$PATH
 
 RUN apt-get install -y --no-install-recommends \
@@ -159,7 +171,9 @@
 
 RUN apt-get install -y --no-install-recommends \
 `# Node.js dependencies` \
-      nodejs
+      nodejs \
+      npm && \
+    ln -s /usr/bin/nodejs /usr/bin/node
 
 RUN apt-get install -y --no-install-recommends \
 `# OCaml dependencies` \
@@ -222,9 +236,6 @@
       cargo \
       rustc
 
-# Update anything else left hanging
-RUN apt-get dist-upgrade -y
-
 # Clean up
 RUN rm -rf /var/cache/apt/* && \
     rm -rf /var/lib/apt/lists/* && \