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

Add <spec> arguments to cargo build/clean #628

Merged
merged 5 commits into from
Sep 30, 2014

Conversation

alexcrichton
Copy link
Member

This is rebased on #617 as I wanted to use one of the functions added in the patch. Otherwise the details are in the commits.

@alexcrichton
Copy link
Member Author

Hm, question. I'm thinking of just extending this to solve #483, but that raises questions with the CLI syntax for cargo test. I don't think we want cargo test <spec> because that'll conflict with cargo test testname_filter which is far more convenient. For that reason, I think that cargo {test,bench} want a -p, --package flag with a SPEC argument that specifies what to test/bench.

Given that, the other commands which support <spec> as a command line argument (as opposed to flag) is cargo {update, clean, pkgid, build}. I'm thinking that to be consistent, all commands should take -p, --package except pkgid and update which operate much more closely on dependencies than the other commands.

Does that sound sane?

@alexcrichton
Copy link
Member Author

Updated with said comment and a fix for #483 as well.

@brson
Copy link
Contributor

brson commented Sep 24, 2014

r=me

@alexcrichton
Copy link
Member Author

I discussed this with @wycats on IRC, and he had two major comments:

  1. The wording around ambiguous specifications should be something like:
There are multiple `curl` packages in your project. Please re-run ${command} 
as `cargo ${command} -p` and one of the  following:
  ${spec1}
  ${spec2}
  ${spec3}
  ...
  1. To be consistent, all commands should take a specification via -p. This means that cargo update foo will be deprecated in favor of cargo update -p foo.

@alexcrichton
Copy link
Member Author

Updated. re-r?

@brson
Copy link
Contributor

brson commented Sep 29, 2014

r=me

This adds a new argument to `cargo clean` which will enable selectively cleaning
particular packages. The command only cleans the package specified, no other
(not the dependencies of the package).

cc rust-lang#537
This allows selectively building one dependency within a dependency graph for
debugging its build or such.

Closes rust-lang#537
This functionality allows running tests and benchmarks on any upstream
dependencies in the dependency graph. This is most useful for path sources all
developed in tandem (see Servo for instance).

In terms of built artifacts, this will actually preserve as many artifacts as
possible. That means that if you test a low-level dependency with the high-level
artifacts already built, the high-level artifacts will not get removed. This
means that it's possible to accidentally have a low-level dependency to depend
on a higher level one just because it's lib is picked up via -L, but this is
generally a necessary evil to get testing to not rebuild packages too often.

Closes rust-lang#483
To maintain consistency with `cargo {build,test,bench,clean}` the `update`
subcommand now takes a specific package via the `-p` argument instead of as a
positional argument.
bors added a commit that referenced this pull request Sep 30, 2014
This is rebased on #617 as I wanted to use one of the functions added in the patch. Otherwise the details are in the commits.
@bors bors merged commit 37dbfd2 into rust-lang:master Sep 30, 2014
@alexcrichton alexcrichton deleted the issue-537 branch October 2, 2014 20:36
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.

3 participants