gorgeous-winter-99296
10/02/2023, 1:03 PMgorgeous-winter-99296
10/02/2023, 1:07 PMlate-advantage-75311
10/02/2023, 3:06 PMgorgeous-winter-99296
10/02/2023, 3:11 PMcargo_package which maps to zero-or-one libraries and zero-or-more binaries. Otherwise, I'd expect something like cargo_package followed by maybe one library_crate followed by any number of binary_crate.gorgeous-winter-99296
10/02/2023, 3:13 PMbinary_crate can be create either by specific files or by content in Cargo.toml. Same for libraries. So one can't independently look at files or Cargo.toml, both have to be investigated.gorgeous-winter-99296
10/02/2023, 3:19 PMrustc or rustfmt things, but rather get 90% of work with minimal wraps.gorgeous-winter-99296
10/02/2023, 3:23 PMCargoProcess, so a lot of the work is done once I figure out how to wrapping should happen. But since we can't do 111 it becomes a bit messy... and potentially leads to a lot of redundant work; e.g. linting a crate a dozen times because it has a dozen binaries. So linting has to hit a package; but run has to hit a crate inside the package. Hmm. I wonder if a TargetGenerator can be a target as well? I guess I could do cargo_package() as a generator which generates cargo_package_impl() as a utility.broad-processor-92400
10/02/2023, 7:38 PMgorgeous-winter-99296
10/02/2023, 7:51 PMhappy-kitchen-89482
10/02/2023, 7:53 PMhappy-kitchen-89482
10/02/2023, 7:53 PMhappy-kitchen-89482
10/02/2023, 7:54 PMgorgeous-winter-99296
10/02/2023, 7:59 PMgorgeous-winter-99296
10/02/2023, 8:04 PMhappy-kitchen-89482
10/02/2023, 8:08 PMhappy-kitchen-89482
10/02/2023, 8:09 PMhappy-kitchen-89482
10/02/2023, 8:09 PMgorgeous-winter-99296
10/02/2023, 8:27 PMgorgeous-winter-99296
10/02/2023, 8:28 PMgorgeous-winter-99296
10/02/2023, 8:29 PMpython_sources()\npython_tests() is... a bit pointless. 😛late-advantage-75311
10/02/2023, 9:28 PMrun or package. If they have something defined in a lambda, they would define it in BUILD in their subdir, rather than have to register it in some global file or even a file in a parent dir.
This is neither here or there, excuse the rambling ...gorgeous-winter-99296
10/02/2023, 10:11 PMtargets as a concept would still exist with or without BUILD files, so finding a good structure is still important. FWIW I ended up trying the TargetGenerator approach and it looks a bit dumb for single-bin-crates, but works:
✦ ❯ cat examples/hello-world/src/main.rs
fn main() {
println!("Hello, world!");
}
✦ ❯ cat examples/hello-world/BUILD
cargo_package(name="hello-world")
✦ ❯ pants package examples/hello-world#hello-world
00:02:03.45 [INFO] Wrote dist/examples.hello-world/hello-world
✦ ❯ dist/examples.hello-world/hello-world
Hello, world!
This is with pants-hosted rustup/toolchain building in a sandbox.