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

Fix for Rust examples 8 - 9 #548

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

Conversation

marvin-hansen
Copy link
Contributor

@marvin-hansen marvin-hansen commented Feb 2, 2025

Last batch of fixed up Rust examples.
Example 8 got a major makeover b/c the latest rules_rust separated into multiple sub-modules,
which required quite some refactoring.
Resolves #540

Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
# Conflicts:
#	rust-examples/02-hello-cross/MODULE.bazel
 Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
 Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
 Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
 Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
 Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
 Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
 Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
 Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
 Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
@meteorcloudy
Copy link
Member

The number of files for "07-deps-vendor" went up by a lot, is this absolutely necessary in the example?

@marvin-hansen
Copy link
Contributor Author

marvin-hansen commented Feb 3, 2025 via email

@marvin-hansen
Copy link
Contributor Author

marvin-hansen commented Feb 3, 2025 via email

@meteorcloudy
Copy link
Member

Bzlmod also offers a native vendor mode: https://bazel.build/external/vendor, not sure if it should be preferred.

@marvin-hansen
Copy link
Contributor Author

marvin-hansen commented Feb 3, 2025 via email

@meteorcloudy
Copy link
Member

I actually tried native bzlmod vendoring once and after having downloaded about 25GB of every Bazel rule for every platform under the sun

😅, I guess that's before we implemented vendoring targets? With https://bazel.build/external/vendor#vendor-target-dependencies, the Bzlmod vendor mode will only vendor dependencies required to build your targets for the current configuration, which should be much less dependencies than vendoring the whole world.

@marvin-hansen
Copy link
Contributor Author

marvin-hansen commented Feb 3, 2025 via email

 Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
 Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
…to vendor them before build/

 Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
 Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
@marvin-hansen
Copy link
Contributor Author

@meteorcloudy

Can I pick up your brain?

I had the idea to just remove the vendored folder from example 7, add the vendor target to CI, and update the Readme
with instructions how to vendor the depds before running the build. However, Bazel CI somehow doesn't support setting a run target in the config, but without it the CI task fails b/c just run bazel build //vendor:target doesn't create the folder with the vendored deps. For now, I have rolled things back so that CI is green again.

There are a few options:

  1. One might get around this with some shell and gen rule hacking. Don't know, would have to investigate.
  2. One can also just leave it as it and having ~1500 files in the example folder.

The actual crux is, when I looked into Rust vendoring again, I realized I may have to split the example into
4 different ones so I prefer to get this PR resolved, merged, and push the update of the vendor example into a seperate
PR b/c it's quite a bit of work on my end.

That means, whatever resolution for example 7 will be reached, it only lasts as long until I find the time to
split the vendoring example so that it showcases all four vendor modes. Why the rules_rust team came up with the idea that anyone needs/wants 4 different ways to vendor on top of the existing Bazel vendor mechansim is a totally different discussion, but for now I advocate to get this PR over the finishing line and make the renovation of Rust vendoring a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bazel CI] Error in glob: glob pattern 'lib/clang/*/lib/**/*.dylib' didn't match anything
2 participants