Bug 1621070 - Skip BaseRustProgram init when COMPILE_ENVIRONMENT is missing. r=froydnj

Based on the bug 1336153 patch which protected Rust libraries.

Differential Revision: https://phabricator.services.mozilla.com/D66155

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Adam Gashlin 2020-03-10 17:51:47 +00:00
Родитель 4601f6b5bc
Коммит 068828be61
1 изменённых файлов: 7 добавлений и 0 удалений

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

@ -584,6 +584,13 @@ class BaseRustProgram(ContextDerived):
ContextDerived.__init__(self, context) ContextDerived.__init__(self, context)
self.name = name self.name = name
self.cargo_file = cargo_file self.cargo_file = cargo_file
# Skip setting properties below which depend on cargo
# when we don't have a compile environment. The required
# config keys won't be available, but the instance variables
# that we don't set should never be accessed by the actual
# build in that case.
if not context.config.substs.get('COMPILE_ENVIRONMENT'):
return
cargo_dir = cargo_output_directory(context, self.TARGET_SUBST_VAR) cargo_dir = cargo_output_directory(context, self.TARGET_SUBST_VAR)
exe_file = '%s%s' % (name, context.config.substs.get(self.SUFFIX_VAR, '')) exe_file = '%s%s' % (name, context.config.substs.get(self.SUFFIX_VAR, ''))
self.location = mozpath.join(cargo_dir, exe_file) self.location = mozpath.join(cargo_dir, exe_file)