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

cargo package in workspaces doesn't put artifacts in root target dir #4304

Closed
behnam opened this issue Jul 20, 2017 · 2 comments · Fixed by #4851
Closed

cargo package in workspaces doesn't put artifacts in root target dir #4304

behnam opened this issue Jul 20, 2017 · 2 comments · Fixed by #4851
Labels
A-workspaces Area: workspaces C-bug Category: bug Command-package

Comments

@behnam
Copy link
Contributor

behnam commented Jul 20, 2017

(Since package is part of the publish command, most of the following concerns also apply to publish.)

The current "Publishing on crates.io" doc doesn't have any content regarding workspaces: http://doc.crates.io/crates-io.html

Here's what the workspace RFC (and The Manifest Format) say about build outputs:

Whenever any crate in the workspace is compiled, output will be placed in the target directory next to the root Cargo.toml.

Now, if you cd to the directory of a member crate and execute cargo package, the package tarball is created in a target directory next to the member Cargo.toml, but not the root. It's not clear if package falls under this rule, or not, as it's not exactly compiling.

So, is this expected behavior for cargo package? If so, should we add a note about it to the docs?

Also worth noting is the fact that, when packaging, all the dependent package versions are expected to be available on crates.io. I think that's expected behavior, but it results in different behavior between build/test and package, where first ones pass easily if a dependency is not registered, but the latter fails with no matching package named [...] found. Do we need to have a note about this, also?

And, of course, there's the larger issue of package not supporting --all, which I assume is a KP, but haven't been able to find a tracker for it. I think if we intentionally want to not support --all for package (and publish), we better document it in the CLI and the docs.

@behnam
Copy link
Contributor Author

behnam commented Jul 20, 2017

Okay, found the tracker for publish --all: #2878 (comment)

Also, should mention this part from the RFC:

Once Cargo understands a workspace of crates, we could easily extend various subcommands with a --all flag to perform tasks such as:

  • Test all crates within a workspace (run all unit tests, doc tests, etc)
  • Build all binaries for a set of crates within a workspace
  • Publish all crates in a workspace if necessary to crates.io

And, one clarification: even a command like this:

cargo package --manifest-path <path-to-member>/Cargo.toml

results in a target dir to be created at <path-to-member>, instead of workspace root.

I'm guessing that this is a separate issue from supporting package --all.

@alexcrichton
Copy link
Member

Ah yeah the placement of target is just a bug here! Also I'd very much love to see support for --all in these commands!

@carols10cents carols10cents changed the title Unexpected behavior of cargo package commands in workspaces cargo package in workspaces doesn't put artifacts in root target dir Aug 28, 2017
@carols10cents carols10cents added A-workspaces Area: workspaces C-bug Category: bug Command-package labels Aug 28, 2017
sfackler added a commit to sfackler/cargo that referenced this issue Dec 21, 2017
We'd previously dump it in the package's directory which is wrong when
working in a workspace.

Closes rust-lang#4304
bors added a commit that referenced this issue Dec 21, 2017
Untar into the right dir when verifying

We'd previously dump it in the package's directory which is wrong when
working in a workspace.

Closes #4304

r? @alexcrichton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-workspaces Area: workspaces C-bug Category: bug Command-package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants