cargo-modules icon indicating copy to clipboard operation
cargo-modules copied to clipboard

Split binary and library code

Open jmg-duarte opened this issue 1 year ago • 1 comments

Opening as a draft since I'm facing issues and would like some help/feedback — the current PR is not final by any means.

I've split the code with workspaces, however, this breaks most tests as they now thing they're inside a workspace.

Like so:

---- fields::enum_fields stdout ----
thread 'fields::enum_fields' panicked at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:250:5:
Unexpected failure.
code=1
stderr=``````
Error: Failed to load the project at /Users/jmgd/Documents/Work/cargo-modules/tests/projects/enum_fields/Cargo.toml

Caused by:
    0: Failed to read Cargo metadata from Cargo.toml file /Users/jmgd/Documents/Work/cargo-modules/tests/projects/enum_fields/Cargo.toml, Some(Version { major: 1, minor: 80, patch: 1 })
    1: Failed to run `cd \"/Users/jmgd/Documents/Work/cargo-modules/tests/projects/enum_fields\" && RUSTUP_TOOLCHAIN=\"/Users/jmgd/.rustup/toolchains/1.80-aarch64-apple-darwin\" \"/Users/jmgd/.cargo/bin/cargo\" \"metadata\" \"--format-version\" \"1\" \"--manifest-path\" \"/Users/jmgd/Documents/Work/cargo-modules/tests/projects/enum_fields/Cargo.toml\" \"--filter-platform\" \"aarch64-apple-darwin\"`
    2: `cargo metadata` exited with an error: error: current package believes it\'s in a workspace when it\'s not:
       current:   /Users/jmgd/Documents/Work/cargo-modules/tests/projects/enum_fields/Cargo.toml
       workspace: /Users/jmgd/Documents/Work/cargo-modules/Cargo.toml
       
       this may be fixable by adding `tests/projects/enum_fields` to the `workspace.members` array of the manifest located at: /Users/jmgd/Documents/Work/cargo-modules/Cargo.toml
       Alternatively, to keep it out of the workspace, add the package to the `workspace.exclude` array, or add an empty `[workspace]` table to the package\'s manifest.
       
```

Since I'm not familiar with the test harness, I'm looking for a bit of help maybe there's something we can do that would make

Fixes #315

jmg-duarte avatar Aug 25 '24 15:08 jmg-duarte

I would try adding "an empty [workspace] table to the package's manifest" of the test projects within tests/projects/, as per the above:

this may be fixable by adding tests/projects/enum_fields to the workspace.members array of the manifest located at: /Users/jmgd/Documents/Work/cargo-modules/Cargo.toml Alternatively, to keep it out of the workspace, add the package to the workspace.exclude array, or add an empty [workspace] table to the package's manifest.

I'm heading off to a few weeks of vacation though and will be mostly offline then.

regexident avatar Aug 30 '24 17:08 regexident

I'm closing this since I no longer have time to follow this up.

jmg-duarte avatar Jan 15 '25 17:01 jmg-duarte