1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-05 19:55:47 +03:00

improve crate vendoring (#110)

Summary:
Pull Request resolved: https://github.com/facebookexperimental/eden/pull/110

Pull Request resolved: https://github.com/facebookexperimental/rust-shed/pull/27

Make it so that changes to rust-shed or other common rust source are used locally vendored, so they don't need to be pushed to github before they are visible in a build.

There was already some support for cargo vendoring in getdeps, but it was limited to dependencies between manifests built with cargo builder.  This wasn't enough to build something like eden (cmake is main entry point, with later calls cargo) or eden_scm (make is main entry point, with later calls to cargo), so this diff adds a cargo prepare step for getdeps other primary build systems.

The cargo vendoring is done by using a cargo config file to point to the source files used by getdeps.  It has two modes:

1. per crate, existing mode which is already automatic for cargo to cargo manifest dependencies.  To use it for a non cargo build manifest, add crate.pathmap
2. per git url, existing mode which was only use for crates.io third-party crates, now can be enabled by setting cargo.cargo_config_file

Reviewed By: yancouto

Differential Revision: D33895469

fbshipit-source-id: 7b13c0b679532492a336ce217de875c25fe1be90
This commit is contained in:
Alex Hornby
2022-02-16 01:07:57 -08:00
committed by Facebook GitHub Bot
parent 234713f961
commit fa26d2a99b
10 changed files with 292 additions and 88 deletions

View File

@@ -86,14 +86,22 @@ class BuilderBase(object):
allow_fail=allow_fail,
)
def build(self, install_dirs, reconfigure: bool) -> None:
print("Building %s..." % self.manifest.name)
def _reconfigure(self, reconfigure):
if self.build_dir is not None:
if not os.path.isdir(self.build_dir):
os.makedirs(self.build_dir)
reconfigure = True
return reconfigure
def prepare(self, install_dirs, reconfigure):
print("Preparing %s..." % self.manifest.name)
reconfigure = self._reconfigure(reconfigure)
self._prepare(install_dirs=install_dirs, reconfigure=reconfigure)
def build(self, install_dirs, reconfigure) -> None:
print("Building %s..." % self.manifest.name)
reconfigure = self._reconfigure(reconfigure)
self._prepare(install_dirs=install_dirs, reconfigure=reconfigure)
self._build(install_dirs=install_dirs, reconfigure=reconfigure)
# On Windows, emit a wrapper script that can be used to run build artifacts
@@ -135,6 +143,12 @@ class BuilderBase(object):
raise an exception."""
pass
def _prepare(self, install_dirs, reconfigure):
"""Prepare the build. Useful when need to generate config,
but builder is not the primary build system.
e.g. cargo when called from cmake"""
pass
def _build(self, install_dirs, reconfigure) -> None:
"""Perform the build.
install_dirs contains the list of installation directories for