From 068828be6177170bb389427b81ebf4e326011973 Mon Sep 17 00:00:00 2001 From: Adam Gashlin Date: Tue, 10 Mar 2020 17:51:47 +0000 Subject: [PATCH] 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 --- python/mozbuild/mozbuild/frontend/data.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/python/mozbuild/mozbuild/frontend/data.py b/python/mozbuild/mozbuild/frontend/data.py index 2b4ebf299b86..26ca50609fa6 100644 --- a/python/mozbuild/mozbuild/frontend/data.py +++ b/python/mozbuild/mozbuild/frontend/data.py @@ -584,6 +584,13 @@ class BaseRustProgram(ContextDerived): ContextDerived.__init__(self, context) self.name = name 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) exe_file = '%s%s' % (name, context.config.substs.get(self.SUFFIX_VAR, '')) self.location = mozpath.join(cargo_dir, exe_file)