Bug 1697929 - Switch autospider.py to use mach for configure, builds, recurse_syms using an autogenerated mozconfig r=firefox-build-system-reviewers,glandium
authorSteve Fink <sfink@mozilla.com>
Mon, 19 Apr 2021 14:21:43 +0000
changeset 576560 1526c8b3fb4ef8977c0d2fcfb0bba3d258c0e75d
parent 576559 da7d7390ef5d0e00f81a6522a2a345c952de8abc
child 576561 ea7ee8ec0172c60f3513ad6addb40af89f45a556
push id141419
push usersfink@mozilla.com
push dateMon, 19 Apr 2021 14:24:24 +0000
treeherderautoland@043a215fa9f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfirefox-build-system-reviewers, glandium
bugs1697929
milestone89.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1697929 - Switch autospider.py to use mach for configure, builds, recurse_syms using an autogenerated mozconfig r=firefox-build-system-reviewers,glandium Differential Revision: https://phabricator.services.mozilla.com/D108128
js/src/devtools/automation/autospider.py
js/src/devtools/automation/macbuildenv.sh
js/src/devtools/automation/variants/arm-sim
js/src/devtools/automation/variants/nonunified
js/src/devtools/automation/variants/plaindebug
js/src/devtools/automation/variants/smooshdebug
js/src/devtools/automation/winbuildenv.sh
taskcluster/scripts/builder/build-sm.sh
taskcluster/scripts/builder/sm-tooltool-config.sh
--- a/js/src/devtools/automation/autospider.py
+++ b/js/src/devtools/automation/autospider.py
@@ -7,50 +7,62 @@
 import argparse
 import json
 import logging
 import multiprocessing
 import re
 import os
 import platform
 import posixpath
+import shlex
 import shutil
 import subprocess
 import sys
 
 from collections import Counter, namedtuple
 from logging import info
 from os import environ as env
+from pathlib import Path
 from subprocess import Popen
 from threading import Timer
 
 Dirs = namedtuple("Dirs", ["scripts", "js_src", "source", "tooltool", "fetches"])
 
 
 def directories(pathmodule, cwd, fixup=lambda s: s):
     scripts = pathmodule.join(fixup(cwd), fixup(pathmodule.dirname(__file__)))
     js_src = pathmodule.abspath(pathmodule.join(scripts, "..", ".."))
     source = pathmodule.abspath(pathmodule.join(js_src, "..", ".."))
     tooltool = pathmodule.abspath(
         env.get("TOOLTOOL_CHECKOUT", pathmodule.join(source, "..", ".."))
     )
-    fetches = pathmodule.abspath(
-        env.get("MOZ_FETCHES_DIR", pathmodule.join(source, "..", ".."))
+    mozbuild = pathmodule.abspath(
+        # os.path.expanduser does not work on Windows.
+        env.get("MOZBUILD_STATE_PATH")
+        or pathmodule.join(Path.home(), ".mozbuild")
     )
+    fetches = pathmodule.abspath(env.get("MOZ_FETCHES_DIR", mozbuild))
     return Dirs(scripts, js_src, source, tooltool, fetches)
 
 
+def quote(s):
+    # shlex quotes for the purpose of passing to the native shell, which is cmd
+    # on Windows, and therefore will not replace backslashed paths with forward
+    # slashes. When such a path is passed to sh, the backslashes will be
+    # interpreted as escape sequences.
+    return shlex.quote(s).replace("\\", "/")
+
+
 # Some scripts will be called with sh, which cannot use backslashed
 # paths. So for direct subprocess.* invocation, use normal paths from
 # DIR, but when running under the shell, use POSIX style paths.
 DIR = directories(os.path, os.getcwd())
 PDIR = directories(
     posixpath, os.environ["PWD"], fixup=lambda s: re.sub(r"^(\w):", r"/\1", s)
 )
-env["CPP_UNIT_TESTS_DIR_JS_SRC"] = DIR.js_src
 
 AUTOMATION = env.get("AUTOMATION", False)
 
 parser = argparse.ArgumentParser(description="Run a spidermonkey shell build job")
 parser.add_argument(
     "--verbose",
     action="store_true",
     default=AUTOMATION,
@@ -81,17 +93,19 @@ parser.add_argument(
     metavar="TIMEOUT",
     default=12600,
     help="kill job after TIMEOUT seconds",
 )
 parser.add_argument(
     "--objdir",
     type=str,
     metavar="DIR",
-    default=env.get("OBJDIR", os.path.join(DIR.source, "obj-spider")),
+    # The real default must be set later so that OBJDIR and POBJDIR can be
+    # platform-dependent strings.
+    default=env.get("OBJDIR"),
     help="object directory",
 )
 group = parser.add_mutually_exclusive_group()
 group.add_argument(
     "--optimize",
     action="store_true",
     help="generate an optimized build. Overrides variant setting.",
 )
@@ -150,73 +164,44 @@ parser.add_argument(
     "--build-only",
     "--build",
     dest="skip_tests",
     action="store_const",
     const="all",
     help="only do a build, do not run any tests",
 )
 parser.add_argument(
-    "--noconf", action="store_true", help="skip running configure when doing a build"
-)
-parser.add_argument(
     "--nobuild",
     action="store_true",
     help="Do not do a build. Rerun tests on existing build.",
 )
 parser.add_argument(
     "variant", type=str, help="type of job requested, see variants/ subdir"
 )
 args = parser.parse_args()
 
 logging.basicConfig(level=logging.INFO, format="%(message)s")
 
-OBJDIR = args.objdir
+env["CPP_UNIT_TESTS_DIR_JS_SRC"] = DIR.js_src
+if AUTOMATION and platform.system() == "Windows":
+    # build/win{32,64}/mozconfig.vs-latest uses TOOLTOOL_DIR to set VSPATH.
+    env["TOOLTOOL_DIR"] = DIR.fetches
+
+OBJDIR = args.objdir or os.path.join(DIR.source, "obj-spider")
+OBJDIR = os.path.abspath(OBJDIR)
 OUTDIR = os.path.join(OBJDIR, "out")
-POBJDIR = posixpath.join(PDIR.source, args.objdir)
+POBJDIR = args.objdir or posixpath.join(PDIR.source, "obj-spider")
+POBJDIR = posixpath.abspath(POBJDIR)
 MAKE = env.get("MAKE", "make")
-MAKEFLAGS = env.get("MAKEFLAGS", "-j6" + ("" if AUTOMATION else " -s"))
 PYTHON = sys.executable
 
 for d in ("scripts", "js_src", "source", "tooltool", "fetches"):
     info("DIR.{name} = {dir}".format(name=d, dir=getattr(DIR, d)))
 
 
-def set_vars_from_script(script, vars):
-    """Run a shell script, then dump out chosen environment variables. The build
-    system uses shell scripts to do some configuration that we need to
-    borrow. On Windows, the script itself must output the variable settings
-    (in the form "export FOO=<value>"), since otherwise there will be
-    problems with mismatched Windows/POSIX formats.
-    """
-    script_text = "source %s" % script
-    if platform.system() == "Windows":
-        parse_state = "parsing exports"
-    else:
-        script_text += "; echo VAR SETTINGS:; "
-        script_text += "; ".join("echo $" + var for var in vars)
-        parse_state = "scanning"
-    stdout = subprocess.check_output(["sh", "-x", "-c", script_text]).decode()
-    tograb = vars[:]
-    for line in stdout.splitlines():
-        if parse_state == "scanning":
-            if line == "VAR SETTINGS:":
-                parse_state = "grabbing"
-        elif parse_state == "grabbing":
-            var = tograb.pop(0)
-            env[var] = line
-        elif parse_state == "parsing exports":
-            m = re.match(r"export (\w+)=(.*)", line)
-            if m:
-                var, value = m.groups()
-                if var in tograb:
-                    env[var] = value
-                    info("Setting %s = %s" % (var, value))
-
-
 def ensure_dir_exists(
     name, clobber=True, creation_marker_filename="CREATED-BY-AUTOSPIDER"
 ):
     if creation_marker_filename is None:
         marker = None
     else:
         marker = os.path.join(name, creation_marker_filename)
     if clobber:
@@ -254,16 +239,24 @@ if args.variant == "nonunified":
             subprocess.check_call(
                 ["sed"]
                 + in_place
                 + ["s/UNIFIED_SOURCES/SOURCES/", os.path.join(dirpath, "moz.build")]
             )
 
 CONFIGURE_ARGS = variant["configure-args"]
 
+compiler = variant.get("compiler")
+if compiler != "gcc" and "clang-plugin" not in CONFIGURE_ARGS:
+    CONFIGURE_ARGS += " --enable-clang-plugin"
+
+if compiler == "gcc":
+    env["CC"] = "gcc"
+    env["CXX"] = "g++"
+
 opt = args.optimize
 if opt is None:
     opt = variant.get("optimize")
 if opt is not None:
     CONFIGURE_ARGS += " --enable-optimize" if opt else " --disable-optimize"
 
 opt = args.debug
 if opt is None:
@@ -286,23 +279,16 @@ if word_bits is None and args.platform:
         word_bits = 32
     elif platform_arch in ("win64", "linux64"):
         word_bits = 64
 
 # Fall back to the word size of the host.
 if word_bits is None:
     word_bits = 64 if platform.architecture()[0] == "64bit" else 32
 
-if "compiler" in variant:
-    compiler = variant["compiler"]
-elif platform.system() == "Windows":
-    compiler = "clang-cl"
-else:
-    compiler = "clang"
-
 # Need a platform name to use as a key in variant files.
 if args.platform:
     variant_platform = args.platform.split("-")[0]
 elif platform.system() == "Windows":
     variant_platform = "win64" if word_bits == 64 else "win32"
 elif platform.system() == "Linux":
     variant_platform = "linux64" if word_bits == 64 else "linux"
 elif platform.system() == "Darwin":
@@ -329,42 +315,33 @@ if os.path.exists(os.path.join(compiler_
         platlib = "lib64" if word_bits == 64 else "lib"
     compiler_libdir = os.path.join(compiler_dir, platlib)
 else:
     env.setdefault("CC", compiler)
     env.setdefault("CXX", cxx)
 
 bindir = os.path.join(OBJDIR, "dist", "bin")
 env["LD_LIBRARY_PATH"] = ":".join(
-    p for p in (bindir, compiler_libdir, env.get("LD_LIBRARY_PATH")) if p
+    filter(
+        None,
+        [
+            # for libnspr etc.
+            bindir,
+            # the precompiled breakpad injector library is incompatible with the
+            # system libstdc++ on our CI machines
+            compiler_libdir if AUTOMATION else None,
+            # existing search path, if any
+            env.get("LD_LIBRARY_PATH"),
+        ],
+    )
 )
 
-for v in ("CC", "CXX", "LD_LIBRARY_PATH"):
-    info("default {name} = {value}".format(name=v, value=env[v]))
-
-rust_dir = os.path.join(DIR.fetches, "rustc")
-if os.path.exists(os.path.join(rust_dir, "bin", "rustc")):
-    env.setdefault("RUSTC", os.path.join(rust_dir, "bin", "rustc"))
-    env.setdefault("CARGO", os.path.join(rust_dir, "bin", "cargo"))
-else:
-    env.setdefault("RUSTC", "rustc")
-    env.setdefault("CARGO", "cargo")
-
-if platform.system() == "Darwin":
-    os.environ["SOURCE"] = DIR.source
-    set_vars_from_script(os.path.join(DIR.scripts, "macbuildenv.sh"), ["CC", "CXX"])
-elif platform.system() == "Windows":
+os.environ["SOURCE"] = DIR.source
+if platform.system() == "Windows":
     MAKE = env.get("MAKE", "mozmake")
-    os.environ["SOURCE"] = DIR.source
-    if word_bits == 64:
-        os.environ["USE_64BIT"] = "1"
-    set_vars_from_script(
-        posixpath.join(PDIR.scripts, "winbuildenv.sh"),
-        ["PATH", "VC_PATH", "DIA_SDK_PATH", "CC", "CXX", "WINDOWSSDKDIR"],
-    )
 
 # Configure flags, based on word length and cross-compilation
 if word_bits == 32:
     if platform.system() == "Windows":
         CONFIGURE_ARGS += " --target=i686-pc-mingw32"
     elif platform.system() == "Linux":
         if not platform.machine().startswith("arm"):
             CONFIGURE_ARGS += " --target=i686-pc-linux"
@@ -379,22 +356,16 @@ if word_bits == 32:
         env["CXXFLAGS"] = "{0} {1}".format(env.get("CXXFLAGS", ""), sse_flags)
 else:
     if platform.system() == "Windows":
         CONFIGURE_ARGS += " --target=x86_64-pc-mingw32"
 
 if platform.system() == "Linux" and AUTOMATION:
     CONFIGURE_ARGS = "--enable-stdcxx-compat --disable-gold " + CONFIGURE_ARGS
 
-# Override environment variant settings conditionally.
-CONFIGURE_ARGS = "{} {}".format(
-    variant.get("conditional-configure-args", {}).get(variant_platform, ""),
-    CONFIGURE_ARGS,
-)
-
 # Timeouts.
 ACTIVE_PROCESSES = set()
 
 
 def killall():
     for proc in ACTIVE_PROCESSES:
         proc.kill()
     ACTIVE_PROCESSES.clear()
@@ -412,16 +383,30 @@ ensure_dir_exists(OUTDIR, clobber=not ar
 env.setdefault("MOZ_UPLOAD_DIR", OBJDIR)
 ensure_dir_exists(env["MOZ_UPLOAD_DIR"], clobber=False, creation_marker_filename=None)
 info("MOZ_UPLOAD_DIR = {}".format(env["MOZ_UPLOAD_DIR"]))
 
 
 def run_command(command, check=False, **kwargs):
     kwargs.setdefault("cwd", OBJDIR)
     info("in directory {}, running {}".format(kwargs["cwd"], command))
+    if platform.system() == "Windows":
+        # Windows will use cmd for the shell, which causes all sorts of
+        # problems. Use sh instead, quoting appropriately. (Use sh in all
+        # cases, not just when shell=True, because we want to be able to use
+        # paths that sh understands and cmd does not.)
+        if not isinstance(command, list):
+            if kwargs.get("shell"):
+                command = shlex.split(command)
+            else:
+                command = [command]
+
+        command = " ".join(quote(c) for c in command)
+        command = ["sh", "-c", command]
+        kwargs["shell"] = False
     proc = Popen(command, **kwargs)
     ACTIVE_PROCESSES.add(proc)
     stdout, stderr = None, None
     try:
         stdout, stderr = proc.communicate()
     finally:
         ACTIVE_PROCESSES.discard(proc)
     status = proc.wait()
@@ -448,16 +433,26 @@ if AUTOMATION:
     # Currently only supported on linux64.
     if platform.system() == "Linux" and word_bits == 64:
         use_minidump = variant.get("use_minidump", True)
     else:
         use_minidump = False
 else:
     use_minidump = False
 
+
+def resolve_path(dirs, *components):
+    if None in components:
+        return None
+    for dir in dirs:
+        path = os.path.join(dir, *components)
+        if os.path.exists(path):
+            return path
+
+
 if use_minidump:
     env.setdefault("MINIDUMP_SAVE_PATH", env["MOZ_UPLOAD_DIR"])
 
     injector_basename = {
         "Linux": "libbreakpadinjector.so",
         "Darwin": "breakpadinjector.dylib",
     }.get(platform.system())
 
@@ -473,67 +468,51 @@ if use_minidump:
         use_minidump = False
 
     info("use_minidump is {}".format(use_minidump))
     info("  MINIDUMP_SAVE_PATH={}".format(env["MINIDUMP_SAVE_PATH"]))
     info("  injector lib is {}".format(injector_lib))
     info("  MINIDUMP_STACKWALK={}".format(env.get("MINIDUMP_STACKWALK")))
 
 
-def need_updating_configure(configure):
-    if not os.path.exists(configure):
-        return True
+mozconfig = os.path.join(DIR.source, "mozconfig.autospider")
+CONFIGURE_ARGS += " --enable-nspr-build"
+CONFIGURE_ARGS += " --prefix={OBJDIR}/dist".format(OBJDIR=quote(OBJDIR))
 
-    dep_files = [
-        os.path.join(DIR.js_src, "configure.in"),
-        os.path.join(DIR.js_src, "old-configure.in"),
-    ]
-    for file in dep_files:
-        if os.path.getmtime(file) > os.path.getmtime(configure):
-            return True
+# Generate a mozconfig.
+with open(mozconfig, "wt") as fh:
+    if AUTOMATION and platform.system() == "Windows":
+        fh.write('. "$topsrcdir/build/%s/mozconfig.vs-latest"\n' % variant_platform)
+    fh.write("ac_add_options --with-project=js\n")
+    fh.write("ac_add_options " + CONFIGURE_ARGS + "\n")
+    fh.write("mk_add_options MOZ_OBJDIR=" + quote(OBJDIR) + "\n")
 
-    return False
+env["MOZCONFIG"] = mozconfig
 
+mach = posixpath.join(PDIR.source, "mach")
 
 if not args.nobuild:
-    CONFIGURE_ARGS += " --enable-nspr-build"
-    CONFIGURE_ARGS += " --prefix={OBJDIR}/dist".format(OBJDIR=POBJDIR)
-
-    # Generate a configure script from configure.in.
-    configure = os.path.join(DIR.js_src, "configure")
-    if need_updating_configure(configure):
-        shutil.copyfile(configure + ".in", configure)
-        os.chmod(configure, 0o755)
-
-    # Run configure
-    if not args.noconf:
-        run_command(
-            [
-                "sh",
-                "-c",
-                posixpath.join(PDIR.js_src, "configure") + " " + CONFIGURE_ARGS,
-            ],
-            check=True,
-        )
-
-    # Run make
-    run_command("%s -w %s" % (MAKE, MAKEFLAGS), shell=True, check=True)
+    # Do the build
+    run_command([mach, "build"], check=True)
 
     if use_minidump:
         # Convert symbols to breakpad format.
+        cmd_env = env.copy()
+        cmd_env["MOZ_SOURCE_REPO"] = "file://" + DIR.source
+        cmd_env["RUSTC_COMMIT"] = "0"
+        cmd_env["MOZ_CRASHREPORTER"] = "1"
+        cmd_env["MOZ_AUTOMATION_BUILD_SYMBOLS"] = "1"
         run_command(
             [
-                "make",
+                mach,
+                "build",
                 "recurse_syms",
-                "MOZ_SOURCE_REPO=file://" + DIR.source,
-                "RUSTC_COMMIT=0",
-                "MOZ_CRASHREPORTER=1",
-                "MOZ_AUTOMATION_BUILD_SYMBOLS=1",
             ],
             check=True,
+            env=cmd_env,
         )
 
 COMMAND_PREFIX = []
 # On Linux, disable ASLR to make shell builds a bit more reproducible.
 if subprocess.call("type setarch >/dev/null 2>&1", shell=True) == 0:
     COMMAND_PREFIX.extend(["setarch", platform.machine(), "-R"])
 
 
deleted file mode 100644
--- a/js/src/devtools/automation/macbuildenv.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-# We will be sourcing mozconfig files, which end up calling mk_add_options and
-# ac_add_options with various settings. We only need the variable settings they
-# create along the way.
-mk_add_options() {
-  : do nothing
-}
-ac_add_options() {
-  : do nothing
-}
-
-topsrcdir="$SOURCE"
-
-# Setup CC and CXX variables
-. $topsrcdir/build/macosx/mozconfig.common
--- a/js/src/devtools/automation/variants/arm-sim
+++ b/js/src/devtools/automation/variants/arm-sim
@@ -1,6 +1,7 @@
 {
-    "configure-args": "--enable-simulator=arm --target=i686-pc-linux --enable-rust-simd",
+    "__comment1": "Bug 1700372: --disable-clang-plugin is needed to avoid a warning (that we treat as an error) for comparing a number to itself to test for NaN",
+    "configure-args": "--enable-simulator=arm --target=i686-pc-linux --enable-rust-simd --disable-clang-plugin",
     "optimize": true,
     "debug": true,
     "bits": 32
 }
--- a/js/src/devtools/automation/variants/nonunified
+++ b/js/src/devtools/automation/variants/nonunified
@@ -1,13 +1,10 @@
 {
     "configure-args": "--enable-warnings-as-errors --enable-rust-simd",
     "debug": true,
     "env": {
         "JS_SMOOSH_DISABLE_OPCODE_CHECK": "1"
     },
-    "conditional-configure-args": {
-        "linux64": "--enable-smoosh"
-    },
     "skip-tests": {
         "all": ["jstests", "jittest", "checks"]
     }
 }
--- a/js/src/devtools/automation/variants/plaindebug
+++ b/js/src/devtools/automation/variants/plaindebug
@@ -1,10 +1,7 @@
 {
     "configure-args": "--enable-rust-simd",
     "debug": true,
     "env": {
         "JSTESTS_EXTRA_ARGS": "--jitflags=debug"
-    },
-    "conditional-configure-args": {
-        "linux64": "--enable-clang-plugin"
     }
 }
--- a/js/src/devtools/automation/variants/smooshdebug
+++ b/js/src/devtools/automation/variants/smooshdebug
@@ -1,12 +1,8 @@
 {
     "configure-args": "--enable-rust-simd --enable-smoosh",
     "debug": true,
-    "compiler": "clang",
     "env": {
         "JSTESTS_EXTRA_ARGS": "--args='--smoosh' --jitflags=debug --exclude-file={DIR}/smoosh-jstests-slow.txt",
         "JITTEST_EXTRA_ARGS": "--args='--smoosh'"
-    },
-    "conditional-configure-args": {
-        "linux64": "--enable-clang-plugin"
     }
 }
deleted file mode 100644
--- a/js/src/devtools/automation/winbuildenv.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-mk_export_correct_style() {
-  echo "export $1=$(cmd.exe //c echo %$1%)"
-}
-
-topsrcdir="$SOURCE"
-
-# Tooltool installs in parent of topsrcdir for spidermonkey builds.
-# Resolve that path since the mozconfigs assume tooltool installs in
-# topsrcdir.
-export VSPATH="$(cd ${topsrcdir}/.. && pwd)/vs2017_15.8.4"
-
-if [ -n "$USE_64BIT" ]; then
-  . $topsrcdir/build/win64/mozconfig.vs-latest
-else
-  . $topsrcdir/build/win32/mozconfig.vs-latest
-fi
-
-mk_export_correct_style CC
-mk_export_correct_style CXX
-mk_export_correct_style LINKER
-mk_export_correct_style WINDOWSSDKDIR
-mk_export_correct_style DIA_SDK_PATH
-mk_export_correct_style VC_PATH
-
-# PATH also needs to point to mozmake.exe, which can come from either
-# newer mozilla-build or tooltool.
-if ! which mozmake 2>/dev/null; then
-    export PATH="$PATH:$SOURCE/.."
-    if ! which mozmake 2>/dev/null; then
-  ( cd $SOURCE/..; $SOURCE/mach artifact toolchain -v --tooltool-manifest $SOURCE/browser/config/tooltool-manifests/${platform:-win32}/releng.manifest --retry 4${TOOLTOOL_CACHE:+ --cache-dir ${TOOLTOOL_CACHE}})
-    fi
-fi
--- a/taskcluster/scripts/builder/build-sm.sh
+++ b/taskcluster/scripts/builder/build-sm.sh
@@ -25,33 +25,33 @@ if [ "$upload" = "1" ]; then
     cp -rL $OBJDIR/dist/bin/{js,jsapi-tests,js-gdb.py} $UPLOAD_DIR
 
     # Fuzzing users want the correct version of llvm-symbolizer available in the
     # same directory as the built output.
     for f in "$MOZ_FETCHES_DIR/clang/bin/llvm-symbolizer"*; do
         gzip -c "$f" > "$UPLOAD_DIR/llvm-symbolizer.gz" || echo "gzip $f failed" >&2
         break
     done
-
-    # Fuzzing also uses a few fields in target.json file for automated downloads to
-    # identify what was built.
-    if [ -n "$MOZ_BUILD_DATE" ] && [ -n "$GECKO_HEAD_REV" ]; then
-        cat >$UPLOAD_DIR/target.json <<EOF
-{
-  "buildid": "$MOZ_BUILD_DATE",
-  "moz_source_stamp": "$GECKO_HEAD_REV"
-}
-EOF
-    fi
 else # !upload
-
 # Provide a note for users on why we don't include artifacts for these builds
 # by default, and how they can get the artifacts if they really need them.
-cat >$UPLOAD_DIR/README-artifacts.txt <<'EOF'
+    cat >"$UPLOAD_DIR"/README-artifacts.txt <<'EOF'
 Artifact upload has been disabled for this build due to infrequent usage of the
 generated artifacts.  If you find yourself in a position where you need the
 shell or similar artifacts from this build, please redo your push with the
 environment variable MOZ_JS_UPLOAD_BINARIES set to 1.  You can provide this as
 the option `--env MOZ_JS_UPLOAD_BINARIES=1` to `mach try fuzzy` or `mach try auto`.
 EOF
 fi
 
+# Fuzzing also uses a few fields in target.json file for automated downloads to
+# identify what was built.
+if [ -n "$MOZ_BUILD_DATE" ] && [ -n "$GECKO_HEAD_REV" ]; then
+    cat >"$UPLOAD_DIR"/target.json <<EOF
+{
+  "buildid": "$MOZ_BUILD_DATE",
+  "moz_source_stamp": "$GECKO_HEAD_REV"
+}
+EOF
+    cp "$GECKO_PATH"/mozconfig.autospider "$UPLOAD_DIR"
+fi
+
 exit $BUILD_STATUS
--- a/taskcluster/scripts/builder/sm-tooltool-config.sh
+++ b/taskcluster/scripts/builder/sm-tooltool-config.sh
@@ -1,17 +1,16 @@
 #!/bin/bash
 
 set -x
 
 SPIDERMONKEY_VARIANT=${SPIDERMONKEY_VARIANT:-plain}
 UPLOAD_DIR=${UPLOAD_DIR:-$HOME/artifacts/}
 WORK=${WORK:-$HOME/workspace}
 
-export TOOLTOOL_CHECKOUT=${TOOLTOOL_CHECKOUT:-$WORK}
 
 ( # Create scope for set -e
 set -e
 mkdir -p $WORK
 cd $WORK
 
 # Need to install things from tooltool. Figure out what platform to use.