Add precompiled cf_segments tool as x20 dependency

Since the golem builders do not have x20 access it will not be able to
compile CF segments. We therefore make a precompiled version and put
it as a depencency for the runners to use.

Change-Id: I55fbe9e02551fd51ef4e0145b4a4b0d3fb1c17a8
diff --git a/tools/golem_build.py b/tools/golem_build.py
index 5448589..30d46bc 100755
--- a/tools/golem_build.py
+++ b/tools/golem_build.py
@@ -10,7 +10,7 @@
 
 GRADLE_ARGS = ['--no-daemon']
 BUILD_TARGETS = ['R8', 'D8', 'R8LibApiOnly', 'buildExampleJars', 'CompatDx',
-                 'downloadAndroidCts', 'downloadDx', 'buildCfSegments']
+                 'downloadAndroidCts', 'downloadDx']
 
 def Main():
   gradle.RunGradle(GRADLE_ARGS + BUILD_TARGETS)
diff --git a/tools/test_r8cfsegments.py b/tools/test_r8cfsegments.py
index d160b03..20a0448 100755
--- a/tools/test_r8cfsegments.py
+++ b/tools/test_r8cfsegments.py
@@ -15,7 +15,10 @@
 #    <NAME>-AnnotationSets(CodeSize): <size>
 #    ...
 #
-# Uses the R8CfSegments Java tool (Gradle target).
+# Uses the R8CfSegments Java tool which is downloaded as an x20 dependency.
+# To make changes to the R8CfSegments tool one can use the gradle target -
+# remember to update the x20 dependency afterwards if you want the numbers
+# tracked.
 
 from __future__ import print_function
 import argparse
diff --git a/tools/utils.py b/tools/utils.py
index 0f7aa96..0244197 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -59,7 +59,7 @@
     'proguard6.0.1',
     'lib',
     'retrace.jar')
-CF_SEGMENTS_JAR = os.path.join(LIBS, 'cf_segments.jar')
+CF_SEGMENTS_TOOL = os.path.join(THIRD_PARTY, 'cf_segments')
 PINNED_R8_JAR = os.path.join(REPO_ROOT, 'third_party/r8/r8.jar')
 PINNED_PGR8_JAR = os.path.join(REPO_ROOT, 'third_party/r8/r8-pg6.0.1.jar')
 
@@ -385,7 +385,7 @@
 def getCfSegmentSizes(cfFile):
   cmd = ['java',
          '-cp',
-         CF_SEGMENTS_JAR,
+         CF_SEGMENTS_TOOL,
          'com.android.tools.r8.cf_segments.MeasureLib',
          cfFile]
   PrintCmd(cmd)