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():
|
elif self.build_opts.is_darwin():
|
||||||
make = "make"
|
make = "make"
|
||||||
args = ["darwin64-x86_64-cc"]
|
args = ["darwin64-x86_64-cc"]
|
||||||
|
elif self.build_opts.is_linux():
|
||||||
|
make = "make"
|
||||||
|
args = ["linux-x86_64"]
|
||||||
else:
|
else:
|
||||||
raise Exception("don't know how to build openssl for %r" % self.ctx)
|
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)
|
self.add_openssl_to_env(env, install_dirs)
|
||||||
# Enable using nightly features with stable compiler
|
# Enable using nightly features with stable compiler
|
||||||
env["RUSTC_BOOTSTRAP"] = "1"
|
env["RUSTC_BOOTSTRAP"] = "1"
|
||||||
|
env["LIBZ_SYS_STATIC"] = "1"
|
||||||
cmd = [
|
cmd = [
|
||||||
"cargo",
|
"cargo",
|
||||||
operation,
|
operation,
|
||||||
@@ -1052,23 +1056,27 @@ git-fetch-with-cli = true
|
|||||||
workspace_dir = self.workspace_dir()
|
workspace_dir = self.workspace_dir()
|
||||||
config = self._resolve_config()
|
config = self._resolve_config()
|
||||||
if 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:
|
||||||
# A fake manifest has to be crated to change the virtual
|
manifest_content = f.read()
|
||||||
# manifest into a non-virtual. The virtual manifests are limited
|
if "[package]" not in manifest_content:
|
||||||
# in many ways and the inability to define patches on them is
|
# A fake manifest has to be crated to change the virtual
|
||||||
# one. Check https://github.com/rust-lang/cargo/issues/4934 to
|
# manifest into a non-virtual. The virtual manifests are limited
|
||||||
# see if it is resolved.
|
# in many ways and the inability to define patches on them is
|
||||||
f.write(
|
# one. Check https://github.com/rust-lang/cargo/issues/4934 to
|
||||||
"""
|
# see if it is resolved.
|
||||||
[package]
|
f.write(
|
||||||
name = "fake_manifest_of_{}"
|
"""
|
||||||
version = "0.0.0"
|
[package]
|
||||||
[lib]
|
name = "fake_manifest_of_{}"
|
||||||
path = "/dev/null"
|
version = "0.0.0"
|
||||||
""".format(
|
[lib]
|
||||||
self.manifest.name
|
path = "/dev/null"
|
||||||
|
""".format(
|
||||||
|
self.manifest.name
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
else:
|
||||||
|
f.write("\n")
|
||||||
f.write(config)
|
f.write(config)
|
||||||
|
|
||||||
def _resolve_config(self):
|
def _resolve_config(self):
|
||||||
|
@@ -30,6 +30,7 @@ tools/rust/ossconfigs = .
|
|||||||
[shipit.strip]
|
[shipit.strip]
|
||||||
# strip all code unrelated to mononoke to prevent triggering unnecessary checks
|
# strip all code unrelated to mononoke to prevent triggering unnecessary checks
|
||||||
^fbcode/eden/(?!mononoke|scm/lib/xdiff.*)/.*$
|
^fbcode/eden/(?!mononoke|scm/lib/xdiff.*)/.*$
|
||||||
|
^fbcode/eden/mononoke/Cargo\.toml$
|
||||||
^fbcode/eden/mononoke/(?!public_autocargo).+/Cargo\.toml$
|
^fbcode/eden/mononoke/(?!public_autocargo).+/Cargo\.toml$
|
||||||
^fbcode/configerator/structs/scm/mononoke/(?!public_autocargo).+/Cargo\.toml$
|
^fbcode/configerator/structs/scm/mononoke/(?!public_autocargo).+/Cargo\.toml$
|
||||||
|
|
||||||
|
@@ -24,13 +24,9 @@ tools/rust/ossconfigs = .
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
fbthrift
|
fbthrift
|
||||||
|
|
||||||
# macOS doesn't expose the openssl api so we need to build our own.
|
# macOS doesn't expose the openssl api so we need to build our own.
|
||||||
[dependencies.os=darwin]
|
# Windows doesn't have openssl and Linux might contain an old version,
|
||||||
openssl
|
# so we get to provide it
|
||||||
|
|
||||||
# Windows doesn't have openssl, so we get to provide it
|
|
||||||
[dependencies.os=windows]
|
|
||||||
openssl
|
openssl
|
||||||
|
|
||||||
[dependencies.fb=on]
|
[dependencies.fb=on]
|
||||||
|
Reference in New Issue
Block a user