提交 61edb0cc 编写于 作者: N Niko Matsakis

Separate the driver into its own crate that uses trans, typeck.

上级 93eb4333
...@@ -53,8 +53,8 @@ TARGET_CRATES := libc std flate arena term \ ...@@ -53,8 +53,8 @@ TARGET_CRATES := libc std flate arena term \
serialize getopts collections test time rand \ serialize getopts collections test time rand \
log regex graphviz core rbml alloc rustrt \ log regex graphviz core rbml alloc rustrt \
unicode unicode
HOST_CRATES := syntax rustc rustc_typeck rustc_trans rustdoc regex_macros fmt_macros \ RUSTC_CRATES := rustc rustc_typeck rustc_driver rustc_trans rustc_back rustc_llvm
rustc_llvm rustc_back HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc regex_macros fmt_macros
CRATES := $(TARGET_CRATES) $(HOST_CRATES) CRATES := $(TARGET_CRATES) $(HOST_CRATES)
TOOLS := compiletest rustdoc rustc TOOLS := compiletest rustdoc rustc
...@@ -67,14 +67,16 @@ DEPS_std := core libc rand alloc collections rustrt unicode \ ...@@ -67,14 +67,16 @@ DEPS_std := core libc rand alloc collections rustrt unicode \
native:rust_builtin native:backtrace native:rust_builtin native:backtrace
DEPS_graphviz := std DEPS_graphviz := std
DEPS_syntax := std term serialize log fmt_macros arena libc DEPS_syntax := std term serialize log fmt_macros arena libc
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back \
rustc_typeck log syntax serialize rustc_llvm rustc_trans
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \ DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
rustc_typeck log syntax serialize rustc_llvm log syntax serialize rustc_llvm
DEPS_rustc_typeck := rustc syntax DEPS_rustc_typeck := rustc syntax
DEPS_rustc := syntax flate arena serialize getopts rbml \ DEPS_rustc := syntax flate arena serialize getopts rbml \
time log graphviz rustc_llvm rustc_back time log graphviz rustc_llvm rustc_back
DEPS_rustc_llvm := native:rustllvm libc std DEPS_rustc_llvm := native:rustllvm libc std
DEPS_rustc_back := std syntax rustc_llvm flate log libc DEPS_rustc_back := std syntax rustc_llvm flate log libc
DEPS_rustdoc := rustc rustc_trans native:hoedown serialize getopts \ DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \
test time test time
DEPS_flate := std native:miniz DEPS_flate := std native:miniz
DEPS_arena := std DEPS_arena := std
...@@ -96,7 +98,7 @@ DEPS_fmt_macros = std ...@@ -96,7 +98,7 @@ DEPS_fmt_macros = std
TOOL_DEPS_compiletest := test getopts TOOL_DEPS_compiletest := test getopts
TOOL_DEPS_rustdoc := rustdoc TOOL_DEPS_rustdoc := rustdoc
TOOL_DEPS_rustc := rustc_trans TOOL_DEPS_rustc := rustc_driver
TOOL_SOURCE_compiletest := $(S)src/compiletest/compiletest.rs TOOL_SOURCE_compiletest := $(S)src/compiletest/compiletest.rs
TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs
TOOL_SOURCE_rustc := $(S)src/driver/driver.rs TOOL_SOURCE_rustc := $(S)src/driver/driver.rs
...@@ -115,8 +117,9 @@ ONLY_RLIB_unicode := 1 ...@@ -115,8 +117,9 @@ ONLY_RLIB_unicode := 1
DOC_CRATES := $(filter-out rustc, \ DOC_CRATES := $(filter-out rustc, \
$(filter-out rustc_trans, \ $(filter-out rustc_trans, \
$(filter-out rustc_typeck, \ $(filter-out rustc_typeck, \
$(filter-out syntax, $(CRATES))))) $(filter-out rustc_driver, \
COMPILER_DOC_CRATES := rustc rustc_trans rustc_typeck syntax $(filter-out syntax, $(CRATES))))))
COMPILER_DOC_CRATES := rustc rustc_trans rustc_typeck rustc_driver syntax
# This macro creates some simple definitions for each crate being built, just # This macro creates some simple definitions for each crate being built, just
# some munging of all of the parameters above. # some munging of all of the parameters above.
......
...@@ -12,6 +12,6 @@ ...@@ -12,6 +12,6 @@
extern crate "rustdoc" as this; extern crate "rustdoc" as this;
#[cfg(rustc)] #[cfg(rustc)]
extern crate "rustc_trans" as this; extern crate "rustc_driver" as this;
fn main() { this::main() } fn main() { this::main() }
...@@ -8,22 +8,22 @@ ...@@ -8,22 +8,22 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use back::link; use rustc::session::Session;
use back::write; use rustc::session::config::{mod, Input, OutputFilenames};
use session::Session; use rustc::lint;
use session::config::{mod, Input, OutputFilenames}; use rustc::metadata::creader;
use lint; use rustc::middle::{stability, ty, reachable};
use metadata::creader; use rustc::middle::dependency_format;
use middle::{stability, ty, reachable}; use rustc::middle;
use middle::dependency_format; use rustc::plugin::load::Plugins;
use middle; use rustc::plugin::registry::Registry;
use plugin::load::Plugins; use rustc::plugin;
use plugin::registry::Registry; use rustc::util::common::time;
use plugin; use rustc_trans::back::link;
use rustc_trans::back::write;
use rustc_trans::save;
use rustc_trans::trans;
use rustc_typeck as typeck; use rustc_typeck as typeck;
use trans;
use util::common::time;
use serialize::{json, Encodable}; use serialize::{json, Encodable};
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
use std::io::fs; use std::io::fs;
use std::os; use std::os;
use arena::TypedArena; use arena::TypedArena;
use save;
use syntax::ast; use syntax::ast;
use syntax::ast_map; use syntax::ast_map;
use syntax::attr; use syntax::attr;
......
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //
...@@ -8,15 +8,46 @@ ...@@ -8,15 +8,46 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
pub use syntax::diagnostic; //! The Rust compiler.
//!
//! # Note
//!
//! This API is completely unstable and subject to change.
#![crate_name = "rustc_driver"]
#![experimental]
#![crate_type = "dylib"]
#![crate_type = "rlib"]
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![feature(default_type_params, globs, if_let, import_shadowing, macro_rules, phase, quote)]
#![feature(slicing_syntax, unsafe_destructor)]
#![feature(rustc_diagnostic_macros)]
extern crate arena;
extern crate flate;
extern crate getopts;
extern crate graphviz;
extern crate libc;
extern crate rustc;
extern crate rustc_typeck;
extern crate rustc_back;
extern crate rustc_trans;
#[phase(plugin, link)] extern crate log;
#[phase(plugin, link)] extern crate syntax;
extern crate serialize;
extern crate "rustc_llvm" as llvm;
use back::link; pub use syntax::diagnostic;
use session::{config, Session, build_session};
use session::config::Input;
use lint::Lint;
use lint;
use metadata;
use rustc_trans::back::link;
use rustc::session::{config, Session, build_session};
use rustc::session::config::Input;
use rustc::lint::Lint;
use rustc::lint;
use rustc::metadata;
use rustc::DIAGNOSTICS; use rustc::DIAGNOSTICS;
use std::any::AnyRefExt; use std::any::AnyRefExt;
...@@ -24,14 +55,15 @@ ...@@ -24,14 +55,15 @@
use std::os; use std::os;
use std::task::TaskBuilder; use std::task::TaskBuilder;
use session::early_error; use rustc::session::early_error;
use syntax::ast; use syntax::ast;
use syntax::parse; use syntax::parse;
use syntax::diagnostic::Emitter; use syntax::diagnostic::Emitter;
use syntax::diagnostics; use syntax::diagnostics;
use getopts; #[cfg(test)]
pub mod test;
pub mod driver; pub mod driver;
pub mod pretty; pub mod pretty;
...@@ -507,3 +539,9 @@ pub fn monitor(f: proc():Send) { ...@@ -507,3 +539,9 @@ pub fn monitor(f: proc():Send) {
} }
} }
pub fn main() {
let args = std::os::args();
let result = run(args);
std::os::set_exit_status(result);
}
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
...@@ -15,19 +15,18 @@ ...@@ -15,19 +15,18 @@
pub use self::PpMode::*; pub use self::PpMode::*;
use self::NodesMatchingUII::*; use self::NodesMatchingUII::*;
use back::link; use rustc_trans::back::link;
use session::Session; use driver;
use session::config::{mod, Input};
use driver::driver::{mod}; use rustc::middle::ty;
use rustc::middle::borrowck::{mod, FnPartsWithCFG};
use middle::ty; use rustc::middle::borrowck::graphviz as borrowck_dot;
use middle::borrowck::{mod, FnPartsWithCFG}; use rustc::middle::cfg;
use middle::borrowck::graphviz as borrowck_dot; use rustc::middle::cfg::graphviz::LabelledCFG;
use middle::cfg; use rustc::session::Session;
use middle::cfg::graphviz::LabelledCFG; use rustc::session::config::{mod, Input};
use rustc::util::ppaux;
use util::ppaux;
use syntax::ast; use syntax::ast;
use syntax::ast_map::{mod, blocks, NodePrinter}; use syntax::ast_map::{mod, blocks, NodePrinter};
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
extern crate graphviz; extern crate graphviz;
extern crate libc; extern crate libc;
extern crate rustc; extern crate rustc;
extern crate rustc_typeck;
extern crate rustc_back; extern crate rustc_back;
#[phase(plugin, link)] extern crate log; #[phase(plugin, link)] extern crate log;
#[phase(plugin, link)] extern crate syntax; #[phase(plugin, link)] extern crate syntax;
...@@ -66,17 +65,7 @@ pub mod back { ...@@ -66,17 +65,7 @@ pub mod back {
pub mod trans; pub mod trans;
pub mod save; pub mod save;
pub mod driver;
pub mod lib { pub mod lib {
pub use llvm; pub use llvm;
} }
pub fn main() {
let args = std::os::args();
let result = driver::run(args);
std::os::set_exit_status(result);
}
#[cfg(test)]
pub mod test;
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
pub use self::MaybeTyped::*; pub use self::MaybeTyped::*;
use rustc_trans::driver::driver; use rustc_driver::driver;
use rustc::session::{mod, config}; use rustc::session::{mod, config};
use rustc::middle::{privacy, ty}; use rustc::middle::{privacy, ty};
use rustc::lint; use rustc::lint;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
extern crate libc; extern crate libc;
extern crate rustc; extern crate rustc;
extern crate rustc_trans; extern crate rustc_trans;
extern crate rustc_driver;
extern crate serialize; extern crate serialize;
extern crate syntax; extern crate syntax;
extern crate "test" as testing; extern crate "test" as testing;
...@@ -163,7 +164,7 @@ pub fn main_args(args: &[String]) -> int { ...@@ -163,7 +164,7 @@ pub fn main_args(args: &[String]) -> int {
usage(args[0].as_slice()); usage(args[0].as_slice());
return 0; return 0;
} else if matches.opt_present("version") { } else if matches.opt_present("version") {
match rustc_trans::driver::version("rustdoc", &matches) { match rustc_driver::version("rustdoc", &matches) {
Some(err) => { Some(err) => {
println!("{}", err); println!("{}", err);
return 1 return 1
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
use std::collections::{HashSet, HashMap}; use std::collections::{HashSet, HashMap};
use testing; use testing;
use rustc::session::{mod, config}; use rustc::session::{mod, config};
use rustc_trans::driver::driver; use rustc_driver::driver;
use syntax::ast; use syntax::ast;
use syntax::codemap::{CodeMap, dummy_spanned}; use syntax::codemap::{CodeMap, dummy_spanned};
use syntax::diagnostic; use syntax::diagnostic;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册