diff options
Diffstat (limited to 'src/librustpkg/api.rs')
| -rw-r--r-- | src/librustpkg/api.rs | 57 |
1 files changed, 21 insertions, 36 deletions
diff --git a/src/librustpkg/api.rs b/src/librustpkg/api.rs index 727bbcb30b4..e1092458ffa 100644 --- a/src/librustpkg/api.rs +++ b/src/librustpkg/api.rs @@ -12,6 +12,7 @@ use context::*; use crate::*; use package_id::*; use package_source::*; +use target::*; use version::Version; use workcache_support::*; @@ -63,56 +64,40 @@ pub fn new_workcache_context(p: &Path) -> workcache::Context { pub fn build_lib(sysroot: Path, root: Path, name: ~str, version: Version, lib: Path) { let cx = default_context(sysroot); - let subroot = root.clone(); - let subversion = version.clone(); - let sublib = lib.clone(); - do cx.workcache_context.with_prep(name) |prep| { - let pkg_src = PkgSrc { - workspace: subroot.clone(), - start_dir: subroot.push("src").push(name), - id: PkgId{ version: subversion.clone(), ..PkgId::new(name)}, - libs: ~[mk_crate(sublib.clone())], + let pkg_src = PkgSrc { + workspace: root.clone(), + start_dir: root.push("src").push(name), + id: PkgId{ version: version, ..PkgId::new(name)}, + // n.b. This assumes the package only has one crate + libs: ~[mk_crate(lib)], mains: ~[], tests: ~[], benchs: ~[] }; - pkg_src.declare_inputs(prep); - let subcx = cx.clone(); - let subsrc = pkg_src.clone(); - do prep.exec |exec| { - subsrc.build(exec, &subcx.clone(), ~[]); - } - }; + pkg_src.build(&cx, ~[]); } pub fn build_exe(sysroot: Path, root: Path, name: ~str, version: Version, main: Path) { let cx = default_context(sysroot); - let subroot = root.clone(); - let submain = main.clone(); - do cx.workcache_context.with_prep(name) |prep| { - let pkg_src = PkgSrc { - workspace: subroot.clone(), - start_dir: subroot.push("src").push(name), - id: PkgId{ version: version.clone(), ..PkgId::new(name)}, - libs: ~[], - mains: ~[mk_crate(submain.clone())], - tests: ~[], - benchs: ~[] - }; - pkg_src.declare_inputs(prep); - let subsrc = pkg_src.clone(); - let subcx = cx.clone(); - do prep.exec |exec| { - subsrc.clone().build(exec, &subcx.clone(), ~[]); - } - } + let pkg_src = PkgSrc { + workspace: root.clone(), + start_dir: root.push("src").push(name), + id: PkgId{ version: version, ..PkgId::new(name)}, + libs: ~[], + // n.b. This assumes the package only has one crate + mains: ~[mk_crate(main)], + tests: ~[], + benchs: ~[] + }; + + pkg_src.build(&cx, ~[]); } pub fn install_pkg(sysroot: Path, workspace: Path, name: ~str, version: Version) { let cx = default_context(sysroot); let pkgid = PkgId{ version: version, ..PkgId::new(name)}; - cx.install(PkgSrc::new(workspace, false, pkgid)); + cx.install(PkgSrc::new(workspace, false, pkgid), &Everything); } fn mk_crate(p: Path) -> Crate { |
