mirror of
https://github.com/facebook/proxygen.git
synced 2025-08-07 07:02:53 +03:00
eden/edenapi and mononoke integration tests: add edenapi/tools to getdeps and use them in tests (#51)
Summary: Pull Request resolved: https://github.com/facebookexperimental/eden/pull/51 This diff extends capabilities of CargoBuilder in getdeps so that individual manifests can be build even without workspaces. Thanks to that a build for edenapi/tools can be made and its artifacts can be used in mononoke integration tests. Reviewed By: StanislavGlebik Differential Revision: D23574887 fbshipit-source-id: 8a974a6b5235d36a44fe082aad55cd380d84dd09
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9cea7a730e
commit
8ecccf04e3
@@ -999,6 +999,7 @@ class CargoBuilder(BuilderBase):
|
||||
inst_dir,
|
||||
build_doc,
|
||||
workspace_dir,
|
||||
manifests_to_build,
|
||||
loader,
|
||||
):
|
||||
super(CargoBuilder, self).__init__(
|
||||
@@ -1006,6 +1007,7 @@ class CargoBuilder(BuilderBase):
|
||||
)
|
||||
self.build_doc = build_doc
|
||||
self.ws_dir = workspace_dir
|
||||
self.manifests_to_build = manifests_to_build and manifests_to_build.split(",")
|
||||
self.loader = loader
|
||||
|
||||
def run_cargo(self, install_dirs, operation, args=None):
|
||||
@@ -1026,7 +1028,10 @@ class CargoBuilder(BuilderBase):
|
||||
return os.path.join(self.build_dir, "source")
|
||||
|
||||
def workspace_dir(self):
|
||||
return os.path.join(self.build_source_dir(), self.ws_dir)
|
||||
return os.path.join(self.build_source_dir(), self.ws_dir or "")
|
||||
|
||||
def manifest_dir(self, manifest):
|
||||
return os.path.join(self.build_source_dir(), manifest)
|
||||
|
||||
def recreate_dir(self, src, dst):
|
||||
if os.path.isdir(dst):
|
||||
@@ -1058,7 +1063,8 @@ incremental = false
|
||||
)
|
||||
)
|
||||
|
||||
self._patchup_workspace()
|
||||
if self.ws_dir is not None:
|
||||
self._patchup_workspace()
|
||||
|
||||
try:
|
||||
from getdeps.facebook.rust import vendored_crates
|
||||
@@ -1069,11 +1075,26 @@ incremental = false
|
||||
# so just rely on cargo downloading crates on it's own
|
||||
pass
|
||||
|
||||
self.run_cargo(
|
||||
install_dirs,
|
||||
"build",
|
||||
["--out-dir", os.path.join(self.inst_dir, "bin"), "-Zunstable-options"],
|
||||
)
|
||||
if self.manifests_to_build is None:
|
||||
self.run_cargo(
|
||||
install_dirs,
|
||||
"build",
|
||||
["--out-dir", os.path.join(self.inst_dir, "bin"), "-Zunstable-options"],
|
||||
)
|
||||
else:
|
||||
for manifest in self.manifests_to_build:
|
||||
self.run_cargo(
|
||||
install_dirs,
|
||||
"build",
|
||||
[
|
||||
"--out-dir",
|
||||
os.path.join(self.inst_dir, "bin"),
|
||||
"-Zunstable-options",
|
||||
"--manifest-path",
|
||||
self.manifest_dir(manifest),
|
||||
],
|
||||
)
|
||||
|
||||
self.recreate_dir(build_source_dir, os.path.join(self.inst_dir, "source"))
|
||||
|
||||
def run_tests(
|
||||
@@ -1082,11 +1103,18 @@ incremental = false
|
||||
if test_filter:
|
||||
args = ["--", test_filter]
|
||||
else:
|
||||
args = None
|
||||
args = []
|
||||
|
||||
self.run_cargo(install_dirs, "test", args)
|
||||
if self.build_doc:
|
||||
self.run_cargo(install_dirs, "doc", ["--no-deps"])
|
||||
if self.manifests_to_build is None:
|
||||
self.run_cargo(install_dirs, "test", args)
|
||||
if self.build_doc:
|
||||
self.run_cargo(install_dirs, "doc", ["--no-deps"])
|
||||
else:
|
||||
for manifest in self.manifests_to_build:
|
||||
margs = ["--manifest-path", self.manifest_dir(manifest)]
|
||||
self.run_cargo(install_dirs, "test", args + margs)
|
||||
if self.build_doc:
|
||||
self.run_cargo(install_dirs, "doc", ["--no-deps"] + margs)
|
||||
|
||||
def _patchup_workspace(self):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user