Skip to content

Commit 7d9a7c6

Browse files
committed
auto merge of #420 : alexcrichton/cargo/issue-393-2, r=brson
This commit removes all distributed executables except for `cargo`. All builtin subcommands are implemented through library calls, and the fallback methods are retained to maintain extensability through new subcommands. Closes #393
2 parents 2aeb7a4 + 34451af commit 7d9a7c6

39 files changed

+524
-716
lines changed

.travis.install.deps.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ set -x
22

33
if [ "${TRAVIS_OS_NAME}" = "osx" ] || [ "${PLATFORM}" = "mac" ]; then
44
target=apple-darwin
5-
elif [ "${TRAVIS_OS_NAME}" = "linux" ] || [ "${PLATFORM}" = "linux" ] ||
6-
[ "${TRAVIS_OS_NAME}" = "" ]; then
7-
target=unknown-linux-gnu
85
elif [ "${OS}" = "Windows_NT" ] || [ "${PLATFORM}" = "win" ]; then
96
target=pc-mingw32
107
windows=1
8+
elif [ "${TRAVIS_OS_NAME}" = "linux" ] || [ "${PLATFORM}" = "linux" ] ||
9+
[ "${TRAVIS_OS_NAME}" = "" ]; then
10+
target=unknown-linux-gnu
1111
fi
1212

1313
if [ "${TRAVIS}" = "true" ] && [ "${target}" = "unknown-linux-gnu" ]; then

Cargo.toml

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
[project]
2-
32
name = "cargo"
43
version = "0.0.1-pre"
54
authors = ["Yehuda Katz <[email protected]>",
65
"Carl Lerche <[email protected]>"]
76

87
[lib]
9-
108
name = "cargo"
119
path = "src/cargo/lib.rs"
1210

@@ -33,74 +31,5 @@ name = "cargo"
3331
test = false
3432
doc = false
3533

36-
[[bin]]
37-
name = "cargo-build"
38-
test = false
39-
doc = false
40-
41-
[[bin]]
42-
name = "cargo-clean"
43-
test = false
44-
doc = false
45-
46-
[[bin]]
47-
name = "cargo-git-checkout"
48-
test = false
49-
doc = false
50-
51-
[[bin]]
52-
name = "cargo-read-manifest"
53-
test = false
54-
doc = false
55-
56-
[[bin]]
57-
name = "cargo-run"
58-
test = false
59-
doc = false
60-
61-
[[bin]]
62-
name = "cargo-rustc"
63-
test = false
64-
doc = false
65-
66-
[[bin]]
67-
name = "cargo-test"
68-
test = false
69-
doc = false
70-
71-
[[bin]]
72-
name = "cargo-bench"
73-
test = false
74-
75-
[[bin]]
76-
name = "cargo-verify-project"
77-
test = false
78-
doc = false
79-
80-
[[bin]]
81-
name = "cargo-version"
82-
test = false
83-
doc = false
84-
85-
[[bin]]
86-
name = "cargo-new"
87-
test = false
88-
doc = false
89-
90-
[[bin]]
91-
name = "cargo-doc"
92-
test = false
93-
doc = false
94-
95-
[[bin]]
96-
name = "cargo-generate-lockfile"
97-
test = false
98-
doc = false
99-
100-
[[bin]]
101-
name = "cargo-update"
102-
test = false
103-
doc = false
104-
10534
[[test]]
10635
name = "tests"

Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ X = .exe
4242
endif
4343

4444
TARGET_ROOT = target
45-
BIN_TARGETS := $(wildcard src/bin/*.rs)
45+
BIN_TARGETS := cargo
4646
BIN_TARGETS := $(BIN_TARGETS:src/bin/%.rs=%)
4747
BIN_TARGETS := $(filter-out cargo,$(BIN_TARGETS))
4848

@@ -119,7 +119,7 @@ $$(PKGDIR_$(1))/lib/cargo/manifest.in: all
119119
rm -rf $$(PKGDIR_$(1))
120120
mkdir -p $$(PKGDIR_$(1))/bin $$(PKGDIR_$(1))/lib/cargo
121121
cp $$(TARGET_$(1))/cargo$$(X) $$(PKGDIR_$(1))/bin
122-
cp $$(BIN_TARGETS_$(1)) $$(PKGDIR_$(1))/lib/cargo
122+
#cp $$(BIN_TARGETS_$(1)) $$(PKGDIR_$(1))/lib/cargo
123123
(cd $$(PKGDIR_$(1)) && find . -type f | sed 's/^\.\///') \
124124
> $$(DISTDIR_$(1))/manifest-$$(PKG_NAME).in
125125
cp src/etc/install.sh $$(PKGDIR_$(1))

src/bin/cargo-bench.rs renamed to src/bin/bench.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
1-
#![feature(phase)]
2-
3-
extern crate serialize;
4-
extern crate cargo;
5-
extern crate docopt;
6-
#[phase(plugin)] extern crate docopt_macros;
7-
81
use std::io::process::ExitStatus;
92

103
use cargo::ops;
11-
use cargo::execute_main_without_stdin;
124
use cargo::core::MultiShell;
135
use cargo::util::{CliResult, CliError, CargoError};
146
use cargo::util::important_paths::{find_root_manifest_for_cwd};
7+
use docopt;
158

169
docopt!(Options, "
1710
Execute all benchmarks of a local package
1811
1912
Usage:
20-
cargo-bench [options] [--] [<args>...]
13+
cargo bench [options] [--] [<args>...]
2114
2215
Options:
2316
-h, --help Print this message
@@ -33,11 +26,7 @@ run.
3326
", flag_jobs: Option<uint>, flag_target: Option<String>,
3427
flag_manifest_path: Option<String>)
3528

36-
fn main() {
37-
execute_main_without_stdin(execute, true);
38-
}
39-
40-
fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
29+
pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
4130
let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
4231
shell.set_verbose(options.flag_verbose);
4332

src/bin/cargo-build.rs renamed to src/bin/build.rs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,17 @@
1-
#![feature(phase)]
2-
3-
extern crate serialize;
4-
#[phase(plugin, link)] extern crate log;
5-
6-
extern crate cargo;
7-
extern crate docopt;
8-
#[phase(plugin)] extern crate docopt_macros;
9-
101
use std::os;
11-
use cargo::{execute_main_without_stdin};
12-
use cargo::ops;
13-
use cargo::ops::CompileOptions;
2+
143
use cargo::core::MultiShell;
15-
use cargo::util::{CliResult, CliError};
4+
use cargo::ops::CompileOptions;
5+
use cargo::ops;
166
use cargo::util::important_paths::{find_root_manifest_for_cwd};
7+
use cargo::util::{CliResult, CliError};
8+
use docopt;
179

1810
docopt!(Options, "
1911
Compile a local package and all of its dependencies
2012
2113
Usage:
22-
cargo-build [options]
14+
cargo build [options]
2315
2416
Options:
2517
-h, --help Print this message
@@ -32,11 +24,7 @@ Options:
3224
", flag_jobs: Option<uint>, flag_target: Option<String>,
3325
flag_manifest_path: Option<String>)
3426

35-
fn main() {
36-
execute_main_without_stdin(execute, false);
37-
}
38-
39-
fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
27+
pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
4028
debug!("executing; cmd=cargo-build; args={}", os::args());
4129
shell.set_verbose(options.flag_verbose);
4230

src/bin/cargo-rustc.rs

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/bin/cargo-verify-project.rs

Lines changed: 0 additions & 56 deletions
This file was deleted.

src/bin/cargo-version.rs

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)