Bug 1519501 - Generalize a bit GenerateServoStyleConsts and rename to RunCbindgen. r=heycam

Differential Revision: https://phabricator.services.mozilla.com/D16399
This commit is contained in:
Emilio Cobos Álvarez 2019-01-13 00:42:48 +01:00
Родитель d133439037
Коммит 68022ead2d
2 изменённых файлов: 11 добавлений и 9 удалений

Просмотреть файл

@ -8,19 +8,19 @@ import mozpack.path as mozpath
import os
import subprocess
STYLE = mozpath.join(buildconfig.topsrcdir, "servo", "components", "style")
CARGO_LOCK = mozpath.join(buildconfig.topsrcdir, "Cargo.lock")
def generate(output, cbindgen_toml_path):
def generate(output, cbindgen_crate_path, *in_tree_dependencies):
env = os.environ.copy()
env['CARGO'] = str(buildconfig.substs['CARGO'])
p = subprocess.Popen([
buildconfig.substs['CBINDGEN'],
mozpath.join(buildconfig.topsrcdir, "toolkit", "library", "rust"),
"--lockfile",
CARGO_LOCK,
"--crate",
"style"
mozpath.basename(cbindgen_crate_path),
], env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
@ -31,9 +31,11 @@ def generate(output, cbindgen_toml_path):
deps = set()
deps.add(CARGO_LOCK)
for path, dirs, files in os.walk(STYLE):
for file in files:
if os.path.splitext(file)[1] == ".rs":
deps.add(mozpath.join(path, file))
deps.add(mozpath.join(cbindgen_crate_path, "cbindgen.toml"))
for directory in in_tree_dependencies + (cbindgen_crate_path,):
for path, dirs, files in os.walk(directory):
for file in files:
if os.path.splitext(file)[1] == ".rs":
deps.add(mozpath.join(path, file))
return deps

Просмотреть файл

@ -322,9 +322,9 @@ if CONFIG['COMPILE_ENVIRONMENT']:
]
consts = GENERATED_FILES['ServoStyleConsts.h']
consts.script = 'GenerateServoStyleConsts.py:generate'
consts.script = 'RunCbindgen.py:generate'
consts.inputs = [
'/servo/components/style/cbindgen.toml',
'/servo/components/style',
]
CONFIGURE_SUBST_FILES += [