Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split binary and library code #322

Closed
wants to merge 1 commit into from
Closed

Conversation

jmg-duarte
Copy link

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

@regexident
Copy link
Owner

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.

@jmg-duarte
Copy link
Author

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

@jmg-duarte jmg-duarte closed this Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ship core logic as a library
2 participants