Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workspace Cargo.toml support + overhaul examples #54

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

cormacrelf
Copy link
Contributor

@cormacrelf cormacrelf commented Jan 10, 2025

Fixes #51 by

  • Running cargo commands in current dir & prefixing vendor with third-party/...
  • Adding --manifest-path flag
  • Adding manifest_path = "..." + third_party_dir = "..." to reindeer.toml, allowing it to live at your workspace root and just point to where the output should go.
    • (This always bugged me about reindeer, the only real way to use it was with a wrapper script. No longer.)
  • Remaining compatible with the old CLI ways, hopefully.
  • Now that you can run on a workspace toml, filter out workspace members from the BUCK file by default; include_workspace_members = false (default false) because you often want to write your own BUCK files for those instead of having them mixed into a huge generated BUCK file.
  • Overhauls the example, now it's 3 examples with much more documentation. Browse the tree at https://github.com/cormacrelf/reindeer/tree/workspace_cargo_toml/examples to see how it looks.

Altogether you get reindeer --manifest-path ./Cargo.toml --third-party-dir subdirectory buckify, and because this is not something I expect people will want to type, the new config parameters get that down to just reindeer buckify. The layout is as as below.

; cat reindeer.toml

manifest_path = "Cargo.toml"
third_party_dir = "third-party/rust"
...

; reindeer buckify
.
├── Cargo.lock
├── Cargo.toml
├── reindeer.toml
└── third-party
    └── rust
        ├── .cargo/...
        ├── BUCK
        └── vendor

Includes a cargo fmt, let me know if this is wrong, maybe there is configuration drift between this repo & others at meta.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 10, 2025
@cormacrelf
Copy link
Contributor Author

Also fixes CI, hopefully.

@cormacrelf cormacrelf force-pushed the workspace_cargo_toml branch 2 times, most recently from d6173a4 to ea56b0e Compare January 13, 2025 12:27
This is impossible in BUCK files. They are the owners of their
filesystem tree and nothing else.
Pass through and buckify their dependencies, but skip the member crates
themselves. This is important for buckifying a workspace Cargo.toml.
This allows us do configuration keys like `manifest_path = "..."` /
`third_party_dir = "..."` in reindeer.toml.
@cormacrelf cormacrelf force-pushed the workspace_cargo_toml branch 3 times, most recently from dbd1636 to e73d588 Compare January 13, 2025 13:03
…m config

Creates third party dir if it doesn't exist.
@cormacrelf cormacrelf force-pushed the workspace_cargo_toml branch 4 times, most recently from e113201 to 43fb4bb Compare January 14, 2025 13:46
@cormacrelf cormacrelf force-pushed the workspace_cargo_toml branch 4 times, most recently from b93d715 to 36e657f Compare January 16, 2025 10:24
@cormacrelf cormacrelf changed the title Workspace cargo toml support Workspace Cargo.toml support + overhaul examples Jan 16, 2025
@cormacrelf cormacrelf force-pushed the workspace_cargo_toml branch 3 times, most recently from 35bd38b to 1296df5 Compare January 16, 2025 11:03
@cormacrelf
Copy link
Contributor Author

Ok, everything works except windows, and I don't have a windows machine to dig any further into that at the moment. I'm using the exact same blake3/fixups.toml as the buck2 repository, but note that this PR upgrades blake3 to the latest version 1.5.5 (it was 0.1.5 here before). And we get

error[E0433]: failed to resolve: could not find `sse2` in the crate root
   --> .\third-party\blake3-1.5.5.crate\src\platform.rs:123:24
    |
123 |                 crate::sse2::compress_in_place(cv, block, block_len, counter, flags)
    |                        ^^^^ could not find `sse2` in the crate root
    |
note: found an item that was configured out
   --> .\third-party\blake3-1.5.5.crate\src\lib.rs:119:5
    |
119 | mod sse2;
    |     ^^^^
note: the item is gated here
   --> .\third-party\blake3-1.5.5.crate\src\lib.rs:117:1
    |
117 | #[cfg(blake3_sse2_rust)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^
note: found an item that was configured out
   --> .\third-party\blake3-1.5.5.crate\src\lib.rs:122:5
    |
122 | mod sse2;
    |     ^^^^
note: the item is gated here
   --> .\third-party\blake3-1.5.5.crate\src\lib.rs:120:1
    |
120 | #[cfg(blake3_sse2_ffi)]
    | ^^^^^^^^^^^^^^^^^^^^^^^

Even though

@cormacrelf cormacrelf force-pushed the workspace_cargo_toml branch from 1296df5 to 84194e5 Compare January 16, 2025 11:13
@cormacrelf cormacrelf force-pushed the workspace_cargo_toml branch from 84194e5 to 198f4f5 Compare January 16, 2025 11:17
@cormacrelf
Copy link
Contributor Author

Edit, figured out what that was and documented it in the reindeer.toml. Mismatch between prelude's platform names and the ones in this file.

@cormacrelf cormacrelf marked this pull request as ready for review January 16, 2025 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enh: support Cargo.toml workspace at /
2 participants