mirror of
https://github.com/facebook/proxygen.git
synced 2025-08-05 19:55:47 +03:00
cargo_from_buck: add the patch section to Cargo workspace and allow workspace appending to existing manifest
Summary: Two changes here: 1. The `[patch.crates-io]` section of `third-party/rust/Cargo.toml` is being now copied over to workspaces generated by autocargo for OSS and in the runtime generated Cargo.toml file for cargo-fbcode builds. Without that some projects could be buildable in Buck internally, but not externally on GitHub due to missing patches. 2. If a `[workspace]` Cargo.toml file is being generated and there is already a generated Cargo.toml file in the same directory then instead of overriding that file the `[workspace]` (and `[patch]`) sections are appended to that Cargo.toml file. Reviewed By: farnz Differential Revision: D22023144 fbshipit-source-id: dec54491c36c2ee0ab29eefb722b3eceaef6ffe1
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a2e57a880c
commit
24ed129271
@@ -724,6 +724,9 @@ class OpenSSLBuilder(BuilderBase):
|
||||
elif self.build_opts.is_darwin():
|
||||
make = "make"
|
||||
args = ["darwin64-x86_64-cc"]
|
||||
elif self.build_opts.is_linux():
|
||||
make = "make"
|
||||
args = ["linux-x86_64"]
|
||||
else:
|
||||
raise Exception("don't know how to build openssl for %r" % self.ctx)
|
||||
|
||||
@@ -955,6 +958,7 @@ class CargoBuilder(BuilderBase):
|
||||
self.add_openssl_to_env(env, install_dirs)
|
||||
# Enable using nightly features with stable compiler
|
||||
env["RUSTC_BOOTSTRAP"] = "1"
|
||||
env["LIBZ_SYS_STATIC"] = "1"
|
||||
cmd = [
|
||||
"cargo",
|
||||
operation,
|
||||
@@ -1052,7 +1056,9 @@ git-fetch-with-cli = true
|
||||
workspace_dir = self.workspace_dir()
|
||||
config = self._resolve_config()
|
||||
if config:
|
||||
with open(os.path.join(workspace_dir, "Cargo.toml"), "a") as f:
|
||||
with open(os.path.join(workspace_dir, "Cargo.toml"), "r+") as f:
|
||||
manifest_content = f.read()
|
||||
if "[package]" not in manifest_content:
|
||||
# A fake manifest has to be crated to change the virtual
|
||||
# manifest into a non-virtual. The virtual manifests are limited
|
||||
# in many ways and the inability to define patches on them is
|
||||
@@ -1069,6 +1075,8 @@ path = "/dev/null"
|
||||
self.manifest.name
|
||||
)
|
||||
)
|
||||
else:
|
||||
f.write("\n")
|
||||
f.write(config)
|
||||
|
||||
def _resolve_config(self):
|
||||
|
@@ -30,6 +30,7 @@ tools/rust/ossconfigs = .
|
||||
[shipit.strip]
|
||||
# strip all code unrelated to mononoke to prevent triggering unnecessary checks
|
||||
^fbcode/eden/(?!mononoke|scm/lib/xdiff.*)/.*$
|
||||
^fbcode/eden/mononoke/Cargo\.toml$
|
||||
^fbcode/eden/mononoke/(?!public_autocargo).+/Cargo\.toml$
|
||||
^fbcode/configerator/structs/scm/mononoke/(?!public_autocargo).+/Cargo\.toml$
|
||||
|
||||
|
@@ -24,13 +24,9 @@ tools/rust/ossconfigs = .
|
||||
|
||||
[dependencies]
|
||||
fbthrift
|
||||
|
||||
# macOS doesn't expose the openssl api so we need to build our own.
|
||||
[dependencies.os=darwin]
|
||||
openssl
|
||||
|
||||
# Windows doesn't have openssl, so we get to provide it
|
||||
[dependencies.os=windows]
|
||||
# Windows doesn't have openssl and Linux might contain an old version,
|
||||
# so we get to provide it
|
||||
openssl
|
||||
|
||||
[dependencies.fb=on]
|
||||
|
Reference in New Issue
Block a user