mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 23:38:50 +03:00
don't try to use vendored crates in non-fbsource builds
Summary: Watchman's vagrant images rely on mapping a watchman source directory fetched from fbsource into the VM. Thus, they sometimes look like fbsource, and that's largely okay. However, the vendored cargo support breaks. Instead, explicitly skip vendored cargo when there is no fbsource dir. Reviewed By: xavierd Differential Revision: D36386674 fbshipit-source-id: 61f2af19507fecd2342cfc94bbb7120ab91c33b4
This commit is contained in:
parent
eecb563b15
commit
d467c11b7b
@ -12,17 +12,20 @@ import shutil
|
||||
import stat
|
||||
import subprocess
|
||||
import sys
|
||||
import typing
|
||||
|
||||
from .dyndeps import create_dyn_dep_munger
|
||||
from .envfuncs import add_path_entry, Env, path_search
|
||||
from .fetcher import copy_if_different
|
||||
from .runcmd import run_cmd
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from .buildopts import BuildOptions
|
||||
|
||||
class BuilderBase(object):
|
||||
def __init__(
|
||||
self,
|
||||
build_opts,
|
||||
build_opts: "BuildOptions",
|
||||
ctx,
|
||||
manifest,
|
||||
src_dir,
|
||||
|
@ -83,7 +83,7 @@ class BuildOptions(object):
|
||||
# If we are running from an fbsource repository, set self.fbsource_dir
|
||||
# to allow the ShipIt-based fetchers to use it.
|
||||
if self.repo_project == "fbsource":
|
||||
self.fbsource_dir = self.repo_root
|
||||
self.fbsource_dir: Optional[str] = self.repo_root
|
||||
else:
|
||||
self.fbsource_dir = None
|
||||
|
||||
|
@ -7,14 +7,18 @@
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import typing
|
||||
|
||||
from .builder import BuilderBase
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from .buildopts import BuildOptions
|
||||
|
||||
|
||||
class CargoBuilder(BuilderBase):
|
||||
def __init__(
|
||||
self,
|
||||
build_opts,
|
||||
build_opts: "BuildOptions",
|
||||
ctx,
|
||||
manifest,
|
||||
src_dir,
|
||||
@ -110,15 +114,16 @@ directory = "{vendored_dir}"
|
||||
"""
|
||||
)
|
||||
|
||||
# Point to vendored crates.io if possible
|
||||
try:
|
||||
from .facebook.rust import vendored_crates
|
||||
if self.build_opts.fbsource_dir:
|
||||
# Point to vendored crates.io if possible
|
||||
try:
|
||||
from .facebook.rust import vendored_crates
|
||||
|
||||
vendored_crates(self.build_opts, cargo_config_file)
|
||||
except ImportError:
|
||||
# This FB internal module isn't shippped to github,
|
||||
# so just rely on cargo downloading crates on it's own
|
||||
pass
|
||||
vendored_crates(self.build_opts.fbsource_dir, cargo_config_file)
|
||||
except ImportError:
|
||||
# This FB internal module isn't shippped to github,
|
||||
# so just rely on cargo downloading crates on it's own
|
||||
pass
|
||||
|
||||
return dep_to_git
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user