Bug 1336153 - Skip RustLibrary init on artifact builds. r=froydnj,nalexander

Artifact builds were relying on disabling Rust source file inclusion.
The RustLibrary mozbuild class wants to know cargo's output directory
when initializing itself, but when no compile environment is available
rust.configure isn't included and the corresponding config keys
aren't available.

Skip inializing the dependent fields in that case. Since the artifact
build never tries to compile any of the rust libraries, leaving
these properties undefined works ok.

MozReview-Commit-ID: 8IzTsweSygn

--HG--
extra : rebase_source : a59fc01483fbc85766ff4445c5db7ddb1e49b87c
This commit is contained in:
Ralph Giles 2017-05-09 14:11:12 -07:00
Родитель f56cb16c14
Коммит bd9dc581ea
1 изменённых файлов: 9 добавлений и 2 удалений

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

@ -543,12 +543,19 @@ class RustLibrary(StaticLibrary):
basename.replace('-', '_'),
context.config.rust_lib_suffix)
self.dependencies = dependencies
self.features = features
self.target_dir = target_dir
# 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
build_dir = mozpath.join(target_dir,
cargo_output_directory(context, self.TARGET_SUBST_VAR))
self.import_name = mozpath.join(build_dir, self.lib_name)
self.deps_path = mozpath.join(build_dir, 'deps')
self.features = features
self.target_dir = target_dir
class SharedLibrary(Library):