Skip to content

Commit

Permalink
Remove all subcommand executables
Browse files Browse the repository at this point in the history
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 rust-lang#393
  • Loading branch information
alexcrichton committed Aug 27, 2014
1 parent 2aeb7a4 commit 34451af
Show file tree
Hide file tree
Showing 39 changed files with 524 additions and 716 deletions.
6 changes: 3 additions & 3 deletions .travis.install.deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ set -x

if [ "${TRAVIS_OS_NAME}" = "osx" ] || [ "${PLATFORM}" = "mac" ]; then
target=apple-darwin
elif [ "${TRAVIS_OS_NAME}" = "linux" ] || [ "${PLATFORM}" = "linux" ] ||
[ "${TRAVIS_OS_NAME}" = "" ]; then
target=unknown-linux-gnu
elif [ "${OS}" = "Windows_NT" ] || [ "${PLATFORM}" = "win" ]; then
target=pc-mingw32
windows=1
elif [ "${TRAVIS_OS_NAME}" = "linux" ] || [ "${PLATFORM}" = "linux" ] ||
[ "${TRAVIS_OS_NAME}" = "" ]; then
target=unknown-linux-gnu
fi

if [ "${TRAVIS}" = "true" ] && [ "${target}" = "unknown-linux-gnu" ]; then
Expand Down
71 changes: 0 additions & 71 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
[project]

name = "cargo"
version = "0.0.1-pre"
authors = ["Yehuda Katz <wycats@gmail.com>",
"Carl Lerche <me@carllerche.com>"]

[lib]

name = "cargo"
path = "src/cargo/lib.rs"

Expand All @@ -33,74 +31,5 @@ name = "cargo"
test = false
doc = false

[[bin]]
name = "cargo-build"
test = false
doc = false

[[bin]]
name = "cargo-clean"
test = false
doc = false

[[bin]]
name = "cargo-git-checkout"
test = false
doc = false

[[bin]]
name = "cargo-read-manifest"
test = false
doc = false

[[bin]]
name = "cargo-run"
test = false
doc = false

[[bin]]
name = "cargo-rustc"
test = false
doc = false

[[bin]]
name = "cargo-test"
test = false
doc = false

[[bin]]
name = "cargo-bench"
test = false

[[bin]]
name = "cargo-verify-project"
test = false
doc = false

[[bin]]
name = "cargo-version"
test = false
doc = false

[[bin]]
name = "cargo-new"
test = false
doc = false

[[bin]]
name = "cargo-doc"
test = false
doc = false

[[bin]]
name = "cargo-generate-lockfile"
test = false
doc = false

[[bin]]
name = "cargo-update"
test = false
doc = false

[[test]]
name = "tests"
4 changes: 2 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ X = .exe
endif

TARGET_ROOT = target
BIN_TARGETS := $(wildcard src/bin/*.rs)
BIN_TARGETS := cargo
BIN_TARGETS := $(BIN_TARGETS:src/bin/%.rs=%)
BIN_TARGETS := $(filter-out cargo,$(BIN_TARGETS))

Expand Down Expand Up @@ -119,7 +119,7 @@ $$(PKGDIR_$(1))/lib/cargo/manifest.in: all
rm -rf $$(PKGDIR_$(1))
mkdir -p $$(PKGDIR_$(1))/bin $$(PKGDIR_$(1))/lib/cargo
cp $$(TARGET_$(1))/cargo$$(X) $$(PKGDIR_$(1))/bin
cp $$(BIN_TARGETS_$(1)) $$(PKGDIR_$(1))/lib/cargo
#cp $$(BIN_TARGETS_$(1)) $$(PKGDIR_$(1))/lib/cargo
(cd $$(PKGDIR_$(1)) && find . -type f | sed 's/^\.\///') \
> $$(DISTDIR_$(1))/manifest-$$(PKG_NAME).in
cp src/etc/install.sh $$(PKGDIR_$(1))
Expand Down
17 changes: 3 additions & 14 deletions src/bin/cargo-bench.rs → src/bin/bench.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
#![feature(phase)]

extern crate serialize;
extern crate cargo;
extern crate docopt;
#[phase(plugin)] extern crate docopt_macros;

use std::io::process::ExitStatus;

use cargo::ops;
use cargo::execute_main_without_stdin;
use cargo::core::MultiShell;
use cargo::util::{CliResult, CliError, CargoError};
use cargo::util::important_paths::{find_root_manifest_for_cwd};
use docopt;

docopt!(Options, "
Execute all benchmarks of a local package
Usage:
cargo-bench [options] [--] [<args>...]
cargo bench [options] [--] [<args>...]
Options:
-h, --help Print this message
Expand All @@ -33,11 +26,7 @@ run.
", flag_jobs: Option<uint>, flag_target: Option<String>,
flag_manifest_path: Option<String>)

fn main() {
execute_main_without_stdin(execute, true);
}

fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
shell.set_verbose(options.flag_verbose);

Expand Down
26 changes: 7 additions & 19 deletions src/bin/cargo-build.rs → src/bin/build.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
#![feature(phase)]

extern crate serialize;
#[phase(plugin, link)] extern crate log;

extern crate cargo;
extern crate docopt;
#[phase(plugin)] extern crate docopt_macros;

use std::os;
use cargo::{execute_main_without_stdin};
use cargo::ops;
use cargo::ops::CompileOptions;

use cargo::core::MultiShell;
use cargo::util::{CliResult, CliError};
use cargo::ops::CompileOptions;
use cargo::ops;
use cargo::util::important_paths::{find_root_manifest_for_cwd};
use cargo::util::{CliResult, CliError};
use docopt;

docopt!(Options, "
Compile a local package and all of its dependencies
Usage:
cargo-build [options]
cargo build [options]
Options:
-h, --help Print this message
Expand All @@ -32,11 +24,7 @@ Options:
", flag_jobs: Option<uint>, flag_target: Option<String>,
flag_manifest_path: Option<String>)

fn main() {
execute_main_without_stdin(execute, false);
}

fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
debug!("executing; cmd=cargo-build; args={}", os::args());
shell.set_verbose(options.flag_verbose);

Expand Down
6 changes: 0 additions & 6 deletions src/bin/cargo-rustc.rs

This file was deleted.

56 changes: 0 additions & 56 deletions src/bin/cargo-verify-project.rs

This file was deleted.

33 changes: 0 additions & 33 deletions src/bin/cargo-version.rs

This file was deleted.

Loading

3 comments on commit 34451af

@alexcrichton
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=brson

@alexcrichton
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors: retry

@alexcrichton
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors: retry

Please sign in to comment.