Hello! I was having some trouble with the `rust` ...
# general
g
Hello! I was having some trouble with the
rust
backend -- when I run
pants tailor ::
, it repeatedly re-adds the targets to the
BUILD
files. I couldn't find any reference to this kind of issue on github/google, but I did put together a minimal example to repro (threaded). Am I missing some sort of configuration, or is a caveat with the experimental backend?
This bash script sets up a project folder, creates a
myproject
crate, and then runs
pants tailor ::
3 times. Each time it re-detects the
myproject
and I end up with targets
myproject
,
myproject0
, and
myproject1
Copy code
mkdir pants-demo
cd pants-demo
cargo new --lib myproject
cat > pants.toml <<EOF

[GLOBAL]
pants_version = "2.26.1"
# pants_version = "2.28.0dev4"

backend_packages = [
    "pants.backend.experimental.rust",
]

EOF

pants tailor ::
pants tailor ::
pants tailor ::

cat myproject/BUILD
Output of the above script (the
BUILD
file contents start with
rust_package()
):
Copy code
Creating library `myproject` package
note: see more `Cargo.toml` keys and their definitions at <https://doc.rust-lang.org/cargo/reference/manifest.html>
12:34:16.03 [INFO] Initializing scheduler...
12:34:16.12 [INFO] Scheduler initialized.
Created myproject/BUILD:
  - Add rust_package target myproject
Updated myproject/BUILD:
  - Add rust_package target myproject0
Updated myproject/BUILD:
  - Add rust_package target myproject1
rust_package()

# NOTE: Sources restricted from the default for rust_package due to conflict with
#   - myproject:myproject
rust_package(
    name="myproject0",
    sources=[
        "Cargo.toml",
    ],
)

# NOTE: Sources restricted from the default for rust_package due to conflict with
#   - myproject:myproject
rust_package(
    name="myproject1",
    sources=[
        "Cargo.toml",
    ],
)
h
Hmm, I’m not sure the rust backend is fit for any purpose at the moment. @wide-midnight-78598, thoughts?
But that does sound like a straight up bug in the tailor impl
for rust
So I don’t think you’re doing anything wrong. We are.
w
I wasn't involved in the Rust backend, I thought it was just tailoring, @gorgeous-winter-99296 would know better
g
Thanks for the quick response, makes sense!
g
I haven't done much with the pants backend for rust, only my own. But the use-case disappeared so it's a bit unmaintained...
g
It looks like pants itself doesn't use the rust backend, it has 1
BUILD
for the whole workspace and uses
cargo build
directly? I can probably emulate that for now
h
Yeah, that is very much a work in progress, sorry…