Archive jar excluding dependencies when building on the buildbots.

R=ricow@google.com

Change-Id: I358926c59fe8207f65761839e07a47204de2634c
diff --git a/tools/archive.py b/tools/archive.py
index d929768..8e7436b 100755
--- a/tools/archive.py
+++ b/tools/archive.py
@@ -65,9 +65,13 @@
 def Main():
   if not 'BUILDBOT_BUILDERNAME' in os.environ:
     raise Exception('You are not a bot, don\'t archive builds')
-
+  # Create maven release first which uses a build that exclude dependencies.
   create_maven_release.main(["--out", utils.LIBS])
 
+  # Generate and copy the build that exclude dependencies.
+  gradle.RunGradleExcludeDeps([utils.R8])
+  shutil.copyfile(utils.R8_JAR, utils.R8_EXCLUDE_DEPS_JAR)
+
   # Ensure all archived artifacts has been built before archiving.
   gradle.RunGradle([utils.D8, utils.R8, utils.COMPATDX, utils.COMPATPROGUARD])
   version = GetVersion()
@@ -87,6 +91,7 @@
 
     for file in [utils.D8_JAR,
                  utils.R8_JAR,
+                 utils.R8_EXCLUDE_DEPS_JAR,
                  utils.COMPATDX_JAR,
                  utils.COMPATPROGUARD_JAR,
                  utils.MAVEN_ZIP]:
diff --git a/tools/utils.py b/tools/utils.py
index ec78304..cf01d3b 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -29,6 +29,7 @@
 
 D8_JAR = os.path.join(LIBS, 'd8.jar')
 R8_JAR = os.path.join(LIBS, 'r8.jar')
+R8_EXCLUDE_DEPS_JAR = os.path.join(LIBS, 'r8-exclude-deps.jar')
 COMPATDX_JAR = os.path.join(LIBS, 'compatdx.jar')
 COMPATPROGUARD_JAR = os.path.join(LIBS, 'compatproguard.jar')