cli icon indicating copy to clipboard operation
cli copied to clipboard

Cargo workspace inheritance support

Open cmac4603 opened this issue 1 year ago • 3 comments

Version

❯ fastly version
Fastly CLI version v10.8.10 (7f391164)
Built with go version go1.22.2 linux/amd64 (2024-04-15)
Viceroy version: viceroy 0.9.6

What happened Running fastly compute serve on a rust compute@edge service, which is a workspace member in a larger project, it seems workspace inheritance is not supported.

  • Cargo.toml
[workspace]
members = ["api", "worker"]
resolver = "2"

[workspace.package]
authors = ["Colin MacRae <[email protected]>"]
edition = "2018"
version = "1.1.0"
  • worker/Cargo.toml
[package]
name = "my-app"
version.workspace = true
edition.workspace = true
authors.workspace = true

Results in this output:

ERROR: error reading Cargo.toml manifest: (3, 1): Can't convert workspace = true
(*toml.Tree) to a tree.

Replacing with standard variable and not using the inheritance works, but now there's duplication and multiple places to change the version number for example.

cmac4603 avatar Apr 15 '24 10:04 cmac4603

Thanks for raising this issue @cmac4603

I was the person who initially implemented support for Cargo workspaces (here, see the NOTES section for an example of the set up I was using to test with), and unfortunately, not being a Rust developer, I was not aware of all the features of Cargo workspaces (so my apologies for any issues you've run into).

I'll raise a ticket internally for this to be looked at. I can't give any estimate as to when, but again, thank you for making us aware of this issue 👍🏻

Thanks again.

Integralist avatar Apr 15 '24 10:04 Integralist

Thanks @Integralist, I only just discovered this pattern myself late last year (workspace inheritance came out in rust 1.64 Oct 2022), but it's a great pattern as we almost exclusively use workspaces where I work :) Look forward to seeing this get implemented

cmac4603 avatar Apr 16 '24 07:04 cmac4603

👍 to this – I'm unable to run the examples for the fastly/esi crate.

[package]
name = "esi_example_minimal"
version.workspace = true
authors.workspace = true
license.workspace = true
edition.workspace = true
publish = false
➜  esi_example_minimal git:(release-0.5.0) ✗ fastly compute serve
✓ Verifying fastly.toml
✓ Identifying package name
✓ Identifying toolchain

ERROR: error reading Cargo.toml manifest: (3, 1): Can't convert workspace = true
(*toml.Tree) to a tree.

If you believe this error is the result of a bug, please file an issue: https://github.com/fastly/cli/issues/new?labels=bug&template=bug_report.md

kailan avatar Jul 24 '24 10:07 kailan