Bug 1284816 - Remove --disable-rust. r=ted
authorRalph Giles <giles@mozilla.com>
Wed, 01 Feb 2017 15:38:49 -0800
changeset 332223 eb1677e32680094ee2aaea88377470416efa21a6
parent 332222 0afe5ed6c1b47584a5f90bfc10060567dc9eb6a9
child 332224 f982632569403bca42101c5a8ad54e46d72c4b2a
push id31299
push userkwierso@gmail.com
push dateThu, 02 Feb 2017 23:55:49 +0000
treeherdermozilla-central@b4b23e49820c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1284816
milestone54.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 1284816 - Remove --disable-rust. r=ted Remove the option to build without rust code. We are not testing this configuration and expect to land non-optional rust code in the near future, so it doesn't make sense to maintain this option. MozReview-Commit-ID: CwTlMXGvr5n
build/docs/rust.rst
build/moz.configure/rust.configure
python/mozbuild/mozbuild/vendor_rust.py
--- a/build/docs/rust.rst
+++ b/build/docs/rust.rst
@@ -4,25 +4,16 @@
 Including Rust Code in Firefox
 ==============================
 
 The build system has support for building and linking Rust crates.
 Rust code is built using ``cargo`` in the typical way, so it is
 straightforward to take an existing Rust crate and integrate it
 into Firefox.
 
-.. important::
-
-   Rust code is enabled by default in Firefox builds. Until we have
-   a required component written in Rust, you can build without by
-   setting ``ac_add_options --disable-rust`` in your mozconfig.
-   This option will be around for a little longer
-   (`bug 1284816 <https://bugzilla.mozilla.org/show_bug.cgi?id=1284816>`_).
-
-
 Linking Rust Crates into libxul
 ===============================
 
 Rust crates that you want to link into libxul should be listed in the
 ``dependencies`` section of `toolkit/library/rust/shared/Cargo.toml <https://dxr.mozilla.org/mozilla-central/source/toolkit/library/rust/shared/Cargo.toml>`_.
 You'll also need to add an ``extern crate`` reference to `toolkit/library/rust/shared/lib.rs <https://dxr.mozilla.org/mozilla-central/source/toolkit/library/rust/shared/lib.rs>`_.
 This ensures that the Rust code will be linked properly into libxul as well
 as the copy of libxul used for gtests.
--- a/build/moz.configure/rust.configure
+++ b/build/moz.configure/rust.configure
@@ -1,28 +1,18 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
-option('--disable-rust', help='Don\'t include Rust language sources')
-
-@depends('--enable-rust')
-def rust_compiler_names(value):
-    if value:
-        return ['rustc']
-
-@depends('--enable-rust')
-def cargo_binary_names(value):
-    if value:
-        return ['cargo']
-
-rustc = check_prog('RUSTC', rust_compiler_names, allow_missing=True)
-cargo = check_prog('CARGO', cargo_binary_names, allow_missing=True)
+# Rust is required by `rust_compiler` below. We allow_missing here
+# to propagate failures to the better error message there.
+rustc = check_prog('RUSTC', ['rustc'], allow_missing=True)
+cargo = check_prog('CARGO', ['cargo'], allow_missing=True)
 
 @depends_if(rustc)
 @checking('rustc version', lambda info: info.version)
 def rustc_info(rustc):
         out = check_cmd_output(rustc, '--version', '--verbose').splitlines()
         info = dict((s.strip() for s in line.split(':', 1)) for line in out[1:])
         return namespace(
             version=Version(info.get('release', '0')),
@@ -42,46 +32,45 @@ def cargo_supports_frozen(cargo):
         if 'MOZ_AUTOMATION' in os.environ and not supported:
             die('cargo in automation must support --frozen')
         return supported
     except subprocess.CalledProcessError as e:
         die('Failed to call cargo: %s', e.message)
 
 set_config('MOZ_CARGO_SUPPORTS_FROZEN', cargo_supports_frozen)
 
-@depends('--enable-rust', rustc, rustc_info)
+@depends(rustc, rustc_info)
 @imports(_from='textwrap', _import='dedent')
-def rust_compiler(value, rustc, rustc_info):
-    if value:
-        if not rustc:
-            die(dedent('''\
-            Rust compiler not found.
-            To compile rust language sources, you must have 'rustc' in your path.
-            See https//www.rust-lang.org/ for more information.
+def rust_compiler(rustc, rustc_info):
+    if not rustc:
+        die(dedent('''\
+        Rust compiler not found.
+        To compile rust language sources, you must have 'rustc' in your path.
+        See https//www.rust-lang.org/ for more information.
 
-            You can install rust by running './mach bootstrap'
-            or by directly running the installer from https://rustup.rs/
-            '''))
-        version = rustc_info.version
-        min_version = Version('1.13')
-        if version < min_version:
-            die(dedent('''\
-            Rust compiler {} is too old.
+        You can install rust by running './mach bootstrap'
+        or by directly running the installer from https://rustup.rs/
+        '''))
+    version = rustc_info.version
+    min_version = Version('1.13')
+    if version < min_version:
+        die(dedent('''\
+        Rust compiler {} is too old.
 
-            To compile Rust language sources please install at least
-            version {} of the 'rustc' toolchain and make sure it is
-            first in your path.
+        To compile Rust language sources please install at least
+        version {} of the 'rustc' toolchain and make sure it is
+        first in your path.
 
-            You can verify this by typing 'rustc --version'.
+        You can verify this by typing 'rustc --version'.
 
-            If you have the 'rustup' tool installed you can upgrade
-            to the latest release by typing 'rustup update'. The
-            installer is available from https://rustup.rs/
-            '''.format(version, min_version)))
-        return True
+        If you have the 'rustup' tool installed you can upgrade
+        to the latest release by typing 'rustup update'. The
+        installer is available from https://rustup.rs/
+        '''.format(version, min_version)))
+    return True
 
 set_config('MOZ_RUST', rust_compiler)
 
 @template
 def rust_triple_alias(host_or_target):
     """Template defining the alias used for rustc's --target flag.
     `host_or_target` is either `host` or `target` (the @depends functions
     from init.configure).
--- a/python/mozbuild/mozbuild/vendor_rust.py
+++ b/python/mozbuild/mozbuild/vendor_rust.py
@@ -14,17 +14,16 @@ import mozfile
 import mozpack.path as mozpath
 import os
 import subprocess
 import sys
 
 class VendorRust(MozbuildObject):
     def get_cargo_path(self):
         try:
-            # If the build isn't --enable-rust then CARGO won't be set.
             return self.substs['CARGO']
         except (BuildEnvironmentNotFoundException, KeyError):
             # Default if this tree isn't configured.
             import which
             return which.which('cargo')
 
     def check_cargo_version(self, cargo):
         '''