Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: bazelbuild/rules_rust
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.56.0
Choose a base ref
...
head repository: bazelbuild/rules_rust
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.57.0
Choose a head ref

Commits on Dec 17, 2024

  1. Added documentation for all rules_rust settings (#3114)

    There is no way to document symbols in a BUILD file or anything that is
    not a rule, macro, aspect, or provider. So to be able to generate
    documentation for settings, I've added `settings.bzl` files which
    contain macros with docstrings to do the trick.
    UebelAndre authored Dec 17, 2024
    Copy the full SHA
    eb1fe7d View commit details
  2. Add test for editing patch Cargo.toml files (#3063)

    This tests that the repository rules are properly invalidated when
    patched Cargo.toml files are edited.
    illicitonion authored Dec 17, 2024
    Copy the full SHA
    f9a060d View commit details
  3. Copy the full SHA
    717d160 View commit details
  4. Remove the unused implicit attribute _cc_toolchains. (#3116)

    CC toolchains are gathered from the line:
    ```
    toolchains = use_cc_toolchains(),
    ```
    
    Keep toolchain usage of _cc_toolchain with a TODO to remove it.
    
    See #3115 for details.
    katre authored Dec 17, 2024
    Copy the full SHA
    1bfd1da View commit details
  5. Copy the full SHA
    d832c6c View commit details
  6. Remove crosstool files (#3118)

    Remove `toolchain.crosstool_files and _cc_toolchains`.
    Fixes #3115.
    katre authored Dec 17, 2024
    Copy the full SHA
    0e2fbbf View commit details

Commits on Dec 20, 2024

  1. Copy the full SHA
    89aec55 View commit details

Commits on Dec 29, 2024

  1. Look up CARGO_BAZEL_GENERATOR_PATH correctly (#2088)

    The intent is to allow this variable to be passed in an --action_env,
    but ctx.var is not where these show up:
    ctx.configuration.default_shell_env is.
    HackAttack authored Dec 29, 2024
    Copy the full SHA
    22d40b8 View commit details
  2. Added render_config and splicing_config to create_universe bzlmod (#3136

    )
    
    There was previously no way to set `render_config` values with `bzlmod`
    and `splicing_config` was a bit awkward in it's current implementation
    by needing to inline a json encoded string. This change adds a
    `tag_class` to manage the interaction for each config.
    UebelAndre authored Dec 29, 2024
    Copy the full SHA
    0e6ea40 View commit details
  3. Migrate sys example to bzlmod (#3130)

    Relates to #1839
    UebelAndre authored Dec 29, 2024
    Copy the full SHA
    088209e View commit details
  4. Copy the full SHA
    ee7d299 View commit details
  5. Copy the full SHA
    3dedbef View commit details
  6. Copy the full SHA
    ce8d20b View commit details
  7. fix: add 'manual' option for //rust/settings/lto (#3120)

    Related to #3119
    
    Adds an option named "manual" to `//rust/settings/lto` which was
    introduced in #3104. When
    set to "manual" we will not automatically set any flags so users with
    customized setups can configure the relevant flags on their own.
    
    FWIW this was an oversight and IMO should have been included in the
    original PR. Apologies to anyone who stumbled over this or encountered
    build issues!
    ParkMyCar authored Dec 29, 2024
    Copy the full SHA
    55ef2b8 View commit details
  8. Migrate ffi examples to bzlmod (#3129)

    Relates to #1839
    UebelAndre authored Dec 29, 2024
    Copy the full SHA
    51ff049 View commit details
  9. Copy the full SHA
    a29089b View commit details
  10. workspace: Pay attention to members (#3102)

    Previously we were ignoring this field and always doing auto-discovery.
    
    Cargo only does auto-discovery if this field is not set.
    
    Fixes #3090
    illicitonion authored Dec 29, 2024
    Copy the full SHA
    4960125 View commit details
  11. Ignore symlinks in workspace discovery (#3142)

    There are edge-cases around bazel output symlinks which are fiddly to
    cover, and I wouldn't expect people to have symlinks between crates
    within their local workspace. If they do, they can use the explicit
    `members` property of the Cargo.toml workspace to explicitly include it.
    illicitonion authored Dec 29, 2024
    Copy the full SHA
    c06feef View commit details

Commits on Dec 30, 2024

  1. Warn less (#3145)

    We were accidentally warning on all of the paths to track, where we
    should only be warning on the _external_ paths to track.
    illicitonion authored Dec 30, 2024
    Copy the full SHA
    cdfb735 View commit details

Commits on Dec 31, 2024

  1. Updated crates_vendor rule to accurately use runfiles (#3146)

    This is most impactful for windows environments that do not support
    runfiles (symlinks) at all.
    UebelAndre authored Dec 31, 2024
    Copy the full SHA
    37acfa1 View commit details
  2. Consolidate example packages (#3144)

    closes #1839
    UebelAndre authored Dec 31, 2024
    Copy the full SHA
    d3b890d View commit details

Commits on Jan 2, 2025

  1. Remove rules_foreign_cc example (#3151)

    This has been moved to `rules_foreign_cc`
    bazel-contrib/rules_foreign_cc#1354
    UebelAndre authored Jan 2, 2025
    Copy the full SHA
    4f339e7 View commit details
  2. Copy the full SHA
    c0fe933 View commit details
  3. Make lto toolchain options public and don't link proc-macros with LTO (

    …#3147)
    
    I would like to make lto setting public in toolchain so that when we are
    providing custom toolchains it would be easier to make configurations
    for LTO with `select` statements.
    
    The logic which determines the flags based on cargo outputs.
    
    Proc-macro crates can not be linked with lto and we should not emit
    bitcode either. This fixes #3143
    
    ---------
    
    Co-authored-by: Daniel Wagner-Hall <dwagnerhall@apple.com>
    havasd and illicitonion authored Jan 2, 2025
    Copy the full SHA
    568bb7b View commit details

Commits on Jan 3, 2025

  1. Update hello_comp_opt example with new LTO settings (#3155)

    Fixes comment mentioned in
    [3143#issuecomment-2568947858](#3143 (comment))
    
    ---------
    
    Co-authored-by: UebelAndre <github@uebelandre.com>
    havasd and UebelAndre authored Jan 3, 2025
    Copy the full SHA
    b9f51f5 View commit details
  2. Replace symlinks in the output of cargo build scripts (#3067)

    #2948 breaks building of rdkafka with `cmake` because of dangling
    symlinks.
    
    When building with latest version we get the following error:
    ```
    ERROR: /home/wincent/.cache/bazel/_bazel_wincent/394c4c1d21c5490d4a70260a2cfccaf5/external/rules_rust~~crate~crates__rdkafka-sys-4.8.0-2.3.0/BUILD.bazel:68:19: error while validating output tree artifact external/rules_rust~~crate~crates__rdkafka-sys-4.8.0-2.3.0/_bs.out_dir: child lib/cmake/RdKafka/FindLZ4.cmake is a dangling symbolic link
    ERROR: /home/wincent/.cache/bazel/_bazel_wincent/394c4c1d21c5490d4a70260a2cfccaf5/external/rules_rust~~crate~crates__rdkafka-sys-4.8.0-2.3.0/BUILD.bazel:68:19: Running Cargo build script rdkafka-sys failed: not all outputs were created or valid
    Target @@rules_rust~~crate~crates__rdkafka-0.37.0//:rdkafka failed to build
    Use --verbose_failures to see the command lines of failed build steps.
    ERROR: /home/wincent/.cache/bazel/_bazel_wincent/394c4c1d21c5490d4a70260a2cfccaf5/external/rules_rust~~crate~crates__rdkafka-sys-4.8.0-2.3.0/BUILD.bazel:18:13 Compiling Rust rlib rdkafka_sys v4.8.0+2.3.0 (7 files) failed: not all outputs were created or valid
    ```
    havasd authored Jan 3, 2025
    Copy the full SHA
    1d0fe8a View commit details

Commits on Jan 8, 2025

  1. Updated crate_universe bzlmod to support skipping splicing (#3148)

    Additional Changes:
    - Updated crate_universe macros to refer to aliases instead of direct
    external target for bzlmod support.
    - Added `rust_host_tools_nightly` module for exposing a nightly
    toolchain
    - Converted `examples/crate_universe` to use bzlmod
    UebelAndre authored Jan 8, 2025
    Copy the full SHA
    5e90483 View commit details
  2. Fixed crate_universe examples not vendoring consistent crate versions (

    …#3169)
    
    This would lead to regular failures as new versions could be picked up
    that would no longer match what's hard-coded in the MODULE.bazel.
    
    Relates to #2368
    UebelAndre authored Jan 8, 2025
    Copy the full SHA
    b9d8426 View commit details
  3. feat: Add rust_lint_group and cargo_lints rule to define lint gro…

    …ups (#2993)
    
    Chatted about this previously in
    [Slack](https://bazelbuild.slack.com/archives/CSV56UT0F/p1718030356910019).
    The goal with this PR is to make it easier to define and share lint
    configurations for your build.
    
    ### Description
    
    The PR adds two new rules, `rust_lint_group` and `cargo_lints`. It also
    adds a "lints" attr to `rust_library` and `rust_binary` rules that
    expects a new `LintsInfo` provider.
    
    * `rust_lint_group` allows you to define Rust, Clippy, and Rustdoc lints
    in a `BUILD` file.
    * `cargo_lints` automatically generates a set of lints by reading a
    crate's `Cargo.toml`, and optionally the workspace's Cargo.toml for
    workspace inheritance.
    
    Then the rustc, clippy, and rustdoc actions are all updated to check for
    the `LintsInfo` provider and appends the correct arguments so the lints
    take effect.
    
    
    ### Design
    
    Honestly this is my first large change to a set of Bazel rules, so I
    definitely could have done something wrong here!
    
    The change is split into two commits, the first introduces
    `rust_lint_group` which IMO is relatively straight forward. Some
    attributes are defined on a rule which are then formatted into command
    line flags and passed around with a provider.
    
    The second commit adds `cargo_lints` and is much larger, a few things
    worth considering:
    
    * I was back and forth a bit on using a `repository_rule` or a regular
    `rule`. While the `repository_rule` maps well to a Cargo Workspace and
    you'd only need to define it once, not everyone uses workspaces and so I
    figured a regular `rule` was more general.
    * Parsing a `Cargo.toml` is done via a new Rust binary called
    `cargo_toml_info`. I tried to keep the external dependencies on this
    binary to a minimum, it only has one at the moment which is
    [`cargo_toml`](https://docs.rs/cargo_toml/latest/cargo_toml/) and I
    based this change largely off of
    #2772. I tried to make the
    tool general though so other Cargo metadata rules could use it in the
    future.
    
    ### Tests
    
    There aren't any! I wasn't sure where the best place to start was, any
    guidance here is appreciated!
    ParkMyCar authored Jan 8, 2025
    Copy the full SHA
    3d63631 View commit details
  4. Generate docs from source. (#3152)

    No more needing to manually run a script to render source into the repo.
    This process was ultimately made super slow by needing to compile
    protobuf to build stardoc.
    UebelAndre authored Jan 8, 2025
    Copy the full SHA
    2435cae View commit details
  5. Copy the full SHA
    b53f9a8 View commit details
  6. Added cargo_manifest_dir submodule to cargo_build_script_runner. (#…

    …3161)
    
    This change aims to isolate some of the newer, more complicated parts of
    `cargo_build_script_runner`.
    UebelAndre authored Jan 8, 2025
    Copy the full SHA
    b6c9468 View commit details
  7. Copy the full SHA
    f329c0c View commit details

Commits on Jan 9, 2025

  1. Copy the full SHA
    dfcf422 View commit details
  2. Copy the full SHA
    5367387 View commit details
  3. Run bazel mod tidy after vendoring crate_universe outputs (#3177)

    `bazel mod tidy` will now run at the end of any `crates_vendor`
    executions if the current workspace contains a `MODULE.bazel` file and
    the current Bazel version is greater than `7.0.0`.
    
    closes #2368
    UebelAndre authored Jan 9, 2025
    Copy the full SHA
    f86e01b View commit details

Commits on Jan 10, 2025

  1. Add support for UEFI targets and OS (#2142)

    Requires bazelbuild/platforms#76
    
    ---------
    
    Co-authored-by: Tim Windelschmidt <tim@monogon.tech>
    lorenz and fionera authored Jan 10, 2025
    Copy the full SHA
    c241ed0 View commit details
  2. Add documentation about using binary dependencies in crate_universe (#…

    …3183)
    
    I spent a bit of time with it on how to use it properly as the
    documentation was not too explicit to me. So I thought I write it down.
    havasd authored Jan 10, 2025
    Copy the full SHA
    5e426fa View commit details

Commits on Jan 13, 2025

  1. Improve handling of compile_data with mixed sources (#3176)

    I'm not very well versed in starlark nor the rules_rust codebase, so
    feel free to ignore this and address the issue in a more fitting way,
    but this fixes #3171 and a related issue for me.
    martingms authored Jan 13, 2025
    Copy the full SHA
    bb74a65 View commit details

Commits on Jan 20, 2025

  1. Copy the full SHA
    ab3572e View commit details
  2. Copy the full SHA
    dc29194 View commit details
  3. Delete rules_nodejs rules from wasm_bindgen (#3153)

    `bazel_build_rules_nodejs` has long since been deprecated. Users who
    still need to use these rules can pin `rules_rust_wasm_bindgen` to
    `0.56.0`.
    UebelAndre authored Jan 20, 2025
    Copy the full SHA
    8dcd68d View commit details
  4. Copy the full SHA
    af70b2a View commit details
  5. Fix toolchain repo aliases and add a test. (#3181)

    Co-authored-by: UebelAndre <github@uebelandre.com>
    sputt and UebelAndre authored Jan 20, 2025
    Copy the full SHA
    aae84e9 View commit details
  6. Copy the full SHA
    281d270 View commit details
  7. Don't register rust_host_tools twice (#3188)

    The bazel-lsp uses `rust_host_tools` to perform some actions by using:
    
    ```starlark
    rust_host_tools = use_extension("@rules_rust//rust:extensions.bzl", "rust_host_tools") 
    use_repo(rust_host_tools, "rust_host_tools")
    ```
    
    See:
    https://github.com/cameron-martin/bazel-lsp/blob/19b799e528c884be6efeb108ed1840a4edff1330/MODULE.bazel#L14
    
    It started failing when using rules_rust from HEAD after
    #3148 because rules_rust's
    MODULE.bazel registers toolchain with the same name:
    
    ```starlark
    rust_host_tools.host_tools(
        name = "rust_host_tools",
    )
    ```
    
    See:
    https://github.com/bazelbuild/rules_rust/blob/aae84e97c73eae2e6654e1a7e1b751d0c1f2ac9e/MODULE.bazel#L70
    hauserx authored Jan 20, 2025
    Copy the full SHA
    ff2dddb View commit details
  8. Release 0.57.0 (#3165)

    UebelAndre authored Jan 20, 2025
    Copy the full SHA
    f0ef6ed View commit details
  9. Copy the full SHA
    c075460 View commit details
Showing 1,965 changed files with 27,803 additions and 20,556 deletions.
Loading