Bug 1474575 - Use the fetch-content script to download grcov for A(test-ccov) builds. r=marco draft
authorTudor-Gabriel Vîjială <tvijiala@mozilla.com>
Thu, 12 Jul 2018 15:18:27 +0100
changeset 817366 57aacc2d1eee39fdbf927602da67fbd0baa62e87
parent 817312 fe17acc6e291e54463db3ea82697c714ae5a4b27
push id116042
push userbmo:tvijiala@mozilla.com
push dateThu, 12 Jul 2018 14:58:30 +0000
reviewersmarco
bugs1474575
milestone63.0a1
Bug 1474575 - Use the fetch-content script to download grcov for A(test-ccov) builds. r=marco MozReview-Commit-ID: 5AJ2R72eDjN
mobile/android/mach_commands.py
taskcluster/ci/build/android-stuff.yml
taskcluster/ci/build/kind.yml
--- a/mobile/android/mach_commands.py
+++ b/mobile/android/mach_commands.py
@@ -4,18 +4,16 @@
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import argparse
 import logging
 import os
 import shutil
 import subprocess
-import tarfile
-import urllib
 import zipfile
 
 import mozpack.path as mozpath
 
 from mozfile import TemporaryDirectory
 
 from mozbuild.base import (
     MachCommandBase,
@@ -219,24 +217,21 @@ class MachCommands(MachCommandBase):
 
         self.gradle(self.substs['GRADLE_ANDROID_TEST_CCOV_REPORT_TASKS'] +
                     ['--continue', enable_ccov] + args, verbose=True)
         self._process_jacoco_reports()
         return 0
 
     def _process_jacoco_reports(self):
         def download_grcov(parent_dir):
-            # TODO: Bug 1472236 - Remove this and use fetch tasks to download grcov.
-            grcov_version = "v0.2.1"
-            tar_name = 'grcov.tar.bz2'
-            tar_path = os.path.join(parent_dir, tar_name)
-            url = 'https://github.com/mozilla/grcov/releases/download/%s/grcov-linux-x86_64.tar.bz2' % grcov_version  # NOQA: E501
-            urllib.urlretrieve(url, tar_path)
-            with tarfile.open(tar_path) as tar:
-                tar.extractall(parent_dir)
+            fetch_script_path = os.path.join(self.topsrcdir, 'taskcluster', 'scripts', 'misc',
+                                             'fetch-content')
+            args = [fetch_script_path, 'task-artifacts', os.environ['MOZ_FETCHES'],
+                    '-d', parent_dir]
+            self.run_process(args, ensure_exit_code=True)
             return os.path.join(parent_dir, 'grcov')
 
         def run_grcov(grcov_path, input_path):
             args = [grcov_path, input_path, '-t', 'lcov']
             return subprocess.check_output(args)
 
         with TemporaryDirectory() as xml_dir, TemporaryDirectory() as grcov_dir:
             grcov = download_grcov(grcov_dir)
--- a/taskcluster/ci/build/android-stuff.yml
+++ b/taskcluster/ci/build/android-stuff.yml
@@ -74,16 +74,18 @@ android-test-ccov/opt:
             - builds/releng_base_android_64_builds.py
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: android-test-ccov
         tooltool-downloads: internal
     toolchains:
         - android-gradle-dependencies
         - android-sdk-linux
+    fetches:
+        - grcov-linux-x86_64
 
 android-lint/opt:
     description: "Android lint"
     index:
         product: mobile
         job-name: android-lint
     treeherder:
         platform: android-4-0-armv7-api16/opt
--- a/taskcluster/ci/build/kind.yml
+++ b/taskcluster/ci/build/kind.yml
@@ -1,22 +1,24 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 loader: taskgraph.loader.transform:loader
 
 kind-dependencies:
     - toolchain
+    - fetch
 
 transforms:
     - taskgraph.transforms.build:transforms
     - taskgraph.transforms.build_attrs:transforms
     - taskgraph.transforms.build_lints:transforms
     - taskgraph.transforms.use_toolchains:transforms
+    - taskgraph.transforms.use_fetches:transforms
     - taskgraph.transforms.job:transforms
     - taskgraph.transforms.task:transforms
 
 jobs-from:
     - android.yml
     - android-stuff.yml
     - linux.yml
     - macosx.yml