Do not make wget and git as separate layers. (#173)

* Do not make wget and git as separate layers.
diff --git a/container/common/wget.yaml b/container/common/bazel/extra_tools.yaml
similarity index 61%
rename from container/common/wget.yaml
rename to container/common/bazel/extra_tools.yaml
index 1306865..f48e0a5 100644
--- a/container/common/wget.yaml
+++ b/container/common/bazel/extra_tools.yaml
@@ -1,6 +1,10 @@
 schemaVersion: "2.0.0"
 
 commandTests:
+- name: 'check-git'
+  command: 'git'
+  args: ['--version']
+  expectedOutput: ['git version .*']
 - name: 'check-wget'
   command: 'wget'
   args: ['--version']
diff --git a/container/common/git.yaml b/container/common/git.yaml
deleted file mode 100644
index b53979e..0000000
--- a/container/common/git.yaml
+++ /dev/null
@@ -1,7 +0,0 @@
-schemaVersion: "2.0.0"
-
-commandTests:
-- name: 'check-git'
-  command: 'git'
-  args: ['--version']
-  expectedOutput: ['git version .*']
diff --git a/container/debian8/builders/bazel/BUILD b/container/debian8/builders/bazel/BUILD
index 462723a..fd3a955 100644
--- a/container/debian8/builders/bazel/BUILD
+++ b/container/debian8/builders/bazel/BUILD
@@ -16,10 +16,24 @@
 
 package(default_visibility = ["//visibility:public"])
 
-load("//container/rules:docker_toolchains.bzl", "toolchain_container")
+load(
+    "//container/rules:docker_toolchains.bzl",
+    "language_tool_layer",
+    "toolchain_container",
+)
 load("@io_bazel_rules_docker//contrib:test.bzl", "container_test")
 load("//container/common/bazel:version.bzl", "BAZEL_VERSION_SHA256S")
 
+# Tools that are needed in most builds, but not strictly required by bazel.
+language_tool_layer(
+    name = "extra-tools-ltl",
+    base = "@debian8//image",
+    packages = [
+        "git",
+        "wget",
+    ],
+)
+
 # Generate the Bazel container for all supported versions using the
 # corresponding Bazel language_tool_layer targets.
 [toolchain_container(
@@ -35,14 +49,13 @@
     # reproduction.
     installation_cleanup_commands = "update-ca-certificates -f",
     language_layers = [
+        ":extra-tools-ltl",
         "//container/debian8/layers/clang:clang-ltl",
         "//container/debian8/layers/java:java-ltl",
         "//container/debian8/layers/java:java10-ltl",
         "//container/debian8/layers/python:python-ltl",
         "//container/debian8/layers/bazel:bazel-tools",
         "//container/debian8/layers/bazel:bazel_%s-ltl" % bazel_version,
-        "//container/debian8/layers/git:git-ltl",
-        "//container/debian8/layers/wget:wget-ltl",
     ],
 ) for bazel_version, _ in BAZEL_VERSION_SHA256S.items()]
 
@@ -52,11 +65,10 @@
     configs = [
         ":container.yaml",
         "//container/common:clang.yaml",
-        "//container/common:git.yaml",
         "//container/common:java.yaml",
         "//container/common:python2.yaml",
-        "//container/common:wget.yaml",
         "//container/common/bazel:bazel_tools.yaml",
+        "//container/common/bazel:extra_tools.yaml",
         "//container/debian8:debian8.yaml",
         "//container/debian8/layers/bazel:bazel_%s.yaml" % bazel_version,
     ],
diff --git a/container/debian8/layers/git/BUILD b/container/debian8/layers/git/BUILD
deleted file mode 100644
index 3cc805b..0000000
--- a/container/debian8/layers/git/BUILD
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2017 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-licenses(["notice"])  # Apache 2.0
-
-package(default_visibility = ["//visibility:public"])
-
-load("//container/rules:docker_toolchains.bzl", "language_tool_layer")
-
-language_tool_layer(
-    name = "git-ltl",
-    base = "@debian8//image",
-    packages = [
-        "git",
-    ],
-)
diff --git a/container/debian8/layers/wget/BUILD b/container/debian8/layers/wget/BUILD
deleted file mode 100644
index 7d99e8c..0000000
--- a/container/debian8/layers/wget/BUILD
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2017 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-licenses(["notice"])  # Apache 2.0
-
-package(default_visibility = ["//visibility:public"])
-
-load("//container/rules:docker_toolchains.bzl", "language_tool_layer")
-
-language_tool_layer(
-    name = "wget-ltl",
-    base = "@debian8//image",
-    packages = [
-        "ca-certificates",
-        "wget",
-    ],
-)
diff --git a/container/ubuntu14_04/builders/bazel/BUILD b/container/ubuntu14_04/builders/bazel/BUILD
index 6c8968f..a1fe6e5 100644
--- a/container/ubuntu14_04/builders/bazel/BUILD
+++ b/container/ubuntu14_04/builders/bazel/BUILD
@@ -16,10 +16,24 @@
 
 package(default_visibility = ["//visibility:public"])
 
-load("//container/rules:docker_toolchains.bzl", "toolchain_container")
+load(
+    "//container/rules:docker_toolchains.bzl",
+    "language_tool_layer",
+    "toolchain_container",
+)
 load("@io_bazel_rules_docker//contrib:test.bzl", "container_test")
 load("//container/common/bazel:version.bzl", "BAZEL_VERSION_SHA256S")
 
+# Tools that are needed in most builds, but not strictly required by bazel.
+language_tool_layer(
+    name = "extra-tools-ltl",
+    base = "@trusty//image",
+    packages = [
+        "git",
+        "wget",
+    ],
+)
+
 # Generate the Bazel container for all supported versions using the
 # corresponding Bazel language_tool_layer targets.
 [toolchain_container(
@@ -35,14 +49,13 @@
     # reproduction.
     installation_cleanup_commands = "update-ca-certificates -f",
     language_layers = [
+        ":extra-tools-ltl",
         "//container/ubuntu14_04/layers/gcc:gcc-ltl",
         "//container/ubuntu14_04/layers/java:java-ltl",
         "//container/ubuntu14_04/layers/java:java10-ltl",
         "//container/ubuntu14_04/layers/python:python-ltl",
         "//container/ubuntu14_04/layers/bazel:bazel-tools",
         "//container/ubuntu14_04/layers/bazel:bazel_%s-ltl" % bazel_version,
-        "//container/ubuntu14_04/layers/git:git-ltl",
-        "//container/ubuntu14_04/layers/wget:wget-ltl",
     ],
 ) for bazel_version, _ in BAZEL_VERSION_SHA256S.items()]
 
@@ -51,11 +64,10 @@
     name = "bazel_%s-test" % bazel_version,
     configs = [
         ":container.yaml",
-        "//container/common:git.yaml",
         "//container/common:java.yaml",
         "//container/common:python2.yaml",
-        "//container/common:wget.yaml",
         "//container/common/bazel:bazel_tools.yaml",
+        "//container/common/bazel:extra_tools.yaml",
         "//container/ubuntu14_04:ubuntu14_04.yaml",
         "//container/ubuntu14_04/layers/bazel:bazel_%s.yaml" % bazel_version,
         "//container/ubuntu14_04/layers/gcc:gcc.yaml",
diff --git a/container/ubuntu14_04/layers/git/BUILD b/container/ubuntu14_04/layers/git/BUILD
deleted file mode 100644
index 61e19f8..0000000
--- a/container/ubuntu14_04/layers/git/BUILD
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2017 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-licenses(["notice"])  # Apache 2.0
-
-package(default_visibility = ["//visibility:public"])
-
-load("//container/rules:docker_toolchains.bzl", "language_tool_layer")
-
-language_tool_layer(
-    name = "git-ltl",
-    base = "@trusty//image",
-    packages = [
-        "git",
-    ],
-)
diff --git a/container/ubuntu14_04/layers/wget/BUILD b/container/ubuntu14_04/layers/wget/BUILD
deleted file mode 100644
index 00fde62..0000000
--- a/container/ubuntu14_04/layers/wget/BUILD
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2017 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-licenses(["notice"])  # Apache 2.0
-
-package(default_visibility = ["//visibility:public"])
-
-load("//container/rules:docker_toolchains.bzl", "language_tool_layer")
-
-language_tool_layer(
-    name = "wget-ltl",
-    base = "@trusty//image",
-    packages = [
-        "ca-certificates",
-        "wget",
-    ],
-)
diff --git a/container/ubuntu16_04/builders/bazel/BUILD b/container/ubuntu16_04/builders/bazel/BUILD
index ced48b6..90bd556 100644
--- a/container/ubuntu16_04/builders/bazel/BUILD
+++ b/container/ubuntu16_04/builders/bazel/BUILD
@@ -16,10 +16,24 @@
 
 package(default_visibility = ["//visibility:public"])
 
-load("//container/rules:docker_toolchains.bzl", "toolchain_container")
+load(
+    "//container/rules:docker_toolchains.bzl",
+    "language_tool_layer",
+    "toolchain_container",
+)
 load("@io_bazel_rules_docker//contrib:test.bzl", "container_test")
 load("//container/common/bazel:version.bzl", "BAZEL_VERSION_SHA256S")
 
+# Tools that are needed in most builds, but not strictly required by bazel.
+language_tool_layer(
+    name = "extra-tools-ltl",
+    base = "@ubuntu16_04//image",
+    packages = [
+        "git",
+        "wget",
+    ],
+)
+
 # Generate the Bazel container for all supported versions using the
 # corresponding Bazel language_tool_layer targets.
 [toolchain_container(
@@ -35,14 +49,13 @@
     # reproduction.
     installation_cleanup_commands = "update-ca-certificates -f",
     language_layers = [
+        ":extra-tools-ltl",
         "//container/ubuntu16_04/layers/clang:clang-ltl",
         "//container/ubuntu16_04/layers/java:java-ltl",
         "//container/ubuntu16_04/layers/java:java10-ltl",
         "//container/ubuntu16_04/layers/python:python-ltl",
         "//container/ubuntu16_04/layers/bazel:bazel-tools",
         "//container/ubuntu16_04/layers/bazel:bazel_%s-ltl" % bazel_version,
-        "//container/ubuntu16_04/layers/git:git-ltl",
-        "//container/ubuntu16_04/layers/wget:wget-ltl",
     ],
 ) for bazel_version, _ in BAZEL_VERSION_SHA256S.items()]
 
@@ -52,11 +65,10 @@
     configs = [
         ":container.yaml",
         "//container/common:clang.yaml",
-        "//container/common:git.yaml",
         "//container/common:java.yaml",
         "//container/common:python2.yaml",
-        "//container/common:wget.yaml",
         "//container/common/bazel:bazel_tools.yaml",
+        "//container/common/bazel:extra_tools.yaml",
         "//container/ubuntu16_04:ubuntu16_04.yaml",
         "//container/ubuntu16_04/layers/bazel:bazel_%s.yaml" % bazel_version,
     ],
diff --git a/container/ubuntu16_04/builders/bazel_docker_gcloud/BUILD b/container/ubuntu16_04/builders/bazel_docker_gcloud/BUILD
index 414ea07..7ba275f 100644
--- a/container/ubuntu16_04/builders/bazel_docker_gcloud/BUILD
+++ b/container/ubuntu16_04/builders/bazel_docker_gcloud/BUILD
@@ -16,10 +16,24 @@
 
 package(default_visibility = ["//visibility:public"])
 
-load("//container/rules:docker_toolchains.bzl", "toolchain_container")
+load(
+    "//container/rules:docker_toolchains.bzl",
+    "language_tool_layer",
+    "toolchain_container",
+)
 load("@io_bazel_rules_docker//contrib:test.bzl", "container_test")
 load("//container/common/bazel:version.bzl", "BAZEL_VERSION_SHA256S")
 
+# Tools that are needed in most builds, but not strictly required by bazel.
+language_tool_layer(
+    name = "extra-tools-ltl",
+    base = "@ubuntu16_04//image",
+    packages = [
+        "git",
+        "wget",
+    ],
+)
+
 # Generate the container with Bazel and Docker for all supported versions of
 # Bazel.
 [toolchain_container(
@@ -35,14 +49,13 @@
     # reproduction.
     installation_cleanup_commands = "update-ca-certificates -f",
     language_layers = [
+        ":extra-tools-ltl",
         "//container/ubuntu16_04/layers/clang:clang-ltl",
         "//container/ubuntu16_04/layers/java:java-ltl",
         "//container/ubuntu16_04/layers/java:java10-ltl",
         "//container/ubuntu16_04/layers/python:python-ltl",
         "//container/ubuntu16_04/layers/bazel:bazel-tools",
         "//container/ubuntu16_04/layers/bazel:bazel_%s-ltl" % bazel_version,
-        "//container/ubuntu16_04/layers/git:git-ltl",
-        "//container/ubuntu16_04/layers/wget:wget-ltl",
         "//container/ubuntu16_04/layers/docker-17.12.0:docker-ltl",
         "//container/ubuntu16_04/layers/gcloud:gcloud-ltl",
     ],
@@ -54,11 +67,10 @@
     configs = [
         ":container.yaml",
         "//container/common:clang.yaml",
-        "//container/common:git.yaml",
         "//container/common:java.yaml",
         "//container/common:python2.yaml",
-        "//container/common:wget.yaml",
         "//container/common/bazel:bazel_tools.yaml",
+        "//container/common/bazel:extra_tools.yaml",
         "//container/ubuntu16_04:ubuntu16_04.yaml",
         "//container/ubuntu16_04/layers/bazel:bazel_%s.yaml" % bazel_version,
         "//container/ubuntu16_04/layers/docker-17.12.0:docker-17.12.0.yaml",
diff --git a/container/ubuntu16_04/layers/git/BUILD b/container/ubuntu16_04/layers/git/BUILD
deleted file mode 100644
index cc1e88f..0000000
--- a/container/ubuntu16_04/layers/git/BUILD
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2017 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-licenses(["notice"])  # Apache 2.0
-
-package(default_visibility = ["//visibility:public"])
-
-load("//container/rules:docker_toolchains.bzl", "language_tool_layer")
-
-language_tool_layer(
-    name = "git-ltl",
-    base = "@ubuntu16_04//image",
-    packages = [
-        "git",
-    ],
-)
diff --git a/container/ubuntu16_04/layers/wget/BUILD b/container/ubuntu16_04/layers/wget/BUILD
deleted file mode 100644
index a551225..0000000
--- a/container/ubuntu16_04/layers/wget/BUILD
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2017 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-licenses(["notice"])  # Apache 2.0
-
-package(default_visibility = ["//visibility:public"])
-
-load("//container/rules:docker_toolchains.bzl", "language_tool_layer")
-
-language_tool_layer(
-    name = "wget-ltl",
-    base = "@ubuntu16_04//image",
-    packages = [
-        "ca-certificates",
-        "wget",
-    ],
-)