Bug 1519319 - Move cbindgen check to bindgen.configure. r=froydnj
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 11 Jan 2019 15:42:07 +0000
changeset 453566 027d42f23d2dc4979d6f9fde3b5883fe4c14bd43
parent 453565 82ed24e46ee400390de09dbd4363f852b6675c5b
child 453567 b9d64807cd97fae903cf2fae57c0042b7085f365
push id35360
push usernbeleuzu@mozilla.com
push dateSat, 12 Jan 2019 09:39:47 +0000
treeherdermozilla-central@cb35977ae7a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1519319
milestone66.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 1519319 - Move cbindgen check to bindgen.configure. r=froydnj Depends on D16292 Differential Revision: https://phabricator.services.mozilla.com/D16293
build/moz.configure/bindgen.configure
build/moz.configure/rust.configure
--- a/build/moz.configure/bindgen.configure
+++ b/build/moz.configure/bindgen.configure
@@ -1,14 +1,48 @@
 # -*- 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/.
 
+# cbindgen is needed by the style system build.
+cbindgen = check_prog('CBINDGEN', ['cbindgen'], paths=toolchain_search_path,
+                      when=depends(build_project)
+                      (lambda build_project: build_project != 'js'))
+
+
+@depends_if(cbindgen)
+@checking('cbindgen version')
+@imports(_from='textwrap', _import='dedent')
+def cbindgen_version(cbindgen):
+    cbindgen_min_version = Version('0.6.7')
+
+    # cbindgen x.y.z
+    version = Version(check_cmd_output(cbindgen, '--version').strip().split(" ")[1])
+
+    if version < cbindgen_min_version:
+        die(dedent('''\
+        cbindgen version {} is too old. At least version {} is required.
+
+        Please update using 'cargo install cbindgen --force' or running
+        './mach bootstrap', after removing the existing executable located at
+        {}.
+        '''.format(version, cbindgen_min_version, cbindgen)))
+
+    return version
+
+
+# Bindgen can use rustfmt to format Rust file, but it's not required.
+js_option(env='RUSTFMT', nargs=1, help='Path to the rustfmt program')
+
+rustfmt = check_prog('RUSTFMT', ['rustfmt'], paths=toolchain_search_path,
+                     input='RUSTFMT', allow_missing=True)
+
+
 # We support setting up the appropriate options for bindgen via setting
 # LLVM_CONFIG or by providing explicit configure options.  The Windows
 # installer of LLVM/Clang doesn't provide llvm-config, so we need both
 # methods to support all of our tier-1 platforms.
 @depends(host)
 @imports('which')
 @imports('os')
 @imports('subprocess')
--- a/build/moz.configure/rust.configure
+++ b/build/moz.configure/rust.configure
@@ -271,49 +271,16 @@ option('--enable-rust-tests',
 def rust_tests(enable_rust_tests, rustdoc):
     if enable_rust_tests and not rustdoc:
         die('--enable-rust-tests requires rustdoc')
     return bool(enable_rust_tests)
 
 
 set_config('MOZ_RUST_TESTS', rust_tests)
 
-# cbindgen is needed by the style system build.
-cbindgen = check_prog('CBINDGEN', ['cbindgen'], paths=toolchain_search_path,
-                      when=depends(build_project)
-                      (lambda build_project: build_project != 'js'))
-
-
-@depends_if(cbindgen)
-@checking('cbindgen version')
-@imports(_from='textwrap', _import='dedent')
-def cbindgen_version(cbindgen):
-    cbindgen_min_version = Version('0.6.7')
-
-    # cbindgen x.y.z
-    version = Version(check_cmd_output(cbindgen, '--version').strip().split(" ")[1])
-
-    if version < cbindgen_min_version:
-        die(dedent('''\
-        cbindgen version {} is too old. At least version {} is required.
-
-        Please update using 'cargo install cbindgen --force' or running
-        './mach bootstrap', after removing the existing executable located at
-        {}.
-        '''.format(version, cbindgen_min_version, cbindgen)))
-
-    return version
-
-
-# Bindgen can use rustfmt to format Rust file, but it's not required.
-js_option(env='RUSTFMT', nargs=1, help='Path to the rustfmt program')
-
-rustfmt = check_prog('RUSTFMT', ['rustfmt'], paths=toolchain_search_path,
-                     input='RUSTFMT', allow_missing=True)
-
 js_option(env='WIN64_LINK', nargs=1, help='Path to link.exe that targets win64')
 js_option(env='WIN64_LIB', nargs=1, help='Paths to libraries for the win64 linker')
 
 set_config('WIN64_LINK', depends('WIN64_LINK')(lambda x: x))
 set_config('WIN64_LIB', depends('WIN64_LIB')(lambda x: x))
 
 
 @depends(target, rustc_info, c_compiler, 'WIN64_LINK', 'WIN64_LIB')