diff --git a/Cargo.lock b/Cargo.lock index 1bf031359..d69ffec2e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -155,14 +155,20 @@ dependencies = [ ] [[package]] -name = "cargo" -version = "0.30.0" +name = "bytesize" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cargo" +version = "0.32.0" +source = "git+https://github.com/rust-lang/cargo.git#571a542639e59bb9dc7f6624367afb008d0d86c8" dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crates-io 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crates-io 0.20.0 (git+https://github.com/rust-lang/cargo.git)", "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "crypto-hash 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)", @@ -171,6 +177,7 @@ dependencies = [ "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fs2 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fwdansi 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "git2-curl 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -185,6 +192,7 @@ dependencies = [ "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "opener 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-workspace-hack 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustfix 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -323,8 +331,8 @@ dependencies = [ [[package]] name = "crates-io" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "0.20.0" +source = "git+https://github.com/rust-lang/cargo.git#571a542639e59bb9dc7f6624367afb008d0d86c8" dependencies = [ "curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.2 (git+https://github.com/rust-lang-nursery/failure.git)", @@ -339,7 +347,7 @@ name = "cratesfyi" version = "0.5.0" dependencies = [ "badge 0.2.0", - "cargo 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo 0.32.0 (git+https://github.com/rust-lang/cargo.git)", "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "comrak 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "crates-index-diff 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -472,6 +480,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libnghttp2-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.37 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -560,6 +569,17 @@ dependencies = [ "synstructure 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "failure_derive" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "fake-simd" version = "0.1.2" @@ -663,6 +683,15 @@ dependencies = [ "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "fwdansi" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "generic-array" version = "0.9.0" @@ -1014,6 +1043,14 @@ dependencies = [ "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "libnghttp2-sys" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "libssh2-sys" version = "0.2.11" @@ -1386,6 +1423,16 @@ dependencies = [ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "opener" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.2 (git+https://github.com/rust-lang-nursery/failure.git)", + "failure_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "openssl" version = "0.10.13" @@ -2162,6 +2209,16 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "syn" +version = "0.14.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "syn" version = "0.15.11" @@ -2180,6 +2237,17 @@ dependencies = [ "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "synstructure" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "synstructure" version = "0.10.0" @@ -2718,7 +2786,8 @@ dependencies = [ "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" "checksum byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "90492c5858dd7d2e78691cfb89f90d273a2800fc11d98f60786e5d87e2f83781" "checksum bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0ce55bd354b095246fc34caf4e9e242f5297a7fd938b090cadfea6eee614aa62" -"checksum cargo 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7fb33d5595dd6719062a5f128d13361d5e72727b11131ee7d1aedd75635772ce" +"checksum bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "716960a18f978640f25101b5cbf1c6f6b0d3192fab36a2d98ca96f0ecbe41010" +"checksum cargo 0.32.0 (git+https://github.com/rust-lang/cargo.git)" = "" "checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" "checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3" "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" @@ -2733,7 +2802,7 @@ dependencies = [ "checksum core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "716c271e8613ace48344f723b60b900a93150271e5be206212d052bbc0883efa" "checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" "checksum crates-index-diff 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0bd2579b790a03abb6ffcffbc0d1ac9cb00acd545ef8e5887b464a580131660a" -"checksum crates-io 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a64d1a15ebb6198116e0b3568a3c689f3dec00ce409426ec5dbb6a3bd11ad40" +"checksum crates-io 0.20.0 (git+https://github.com/rust-lang/cargo.git)" = "" "checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" "checksum crossbeam-channel 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7b85741761b7f160bc5e7e0c14986ef685b7f8bf9b7ad081c60c604bb4649827" "checksum crossbeam-deque 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3486aefc4c0487b9cb52372c97df0a48b8c249514af1ee99703bf70d2f2ceda1" @@ -2754,6 +2823,7 @@ dependencies = [ "checksum error 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "a6e606f14042bb87cc02ef6a14db6c90ab92ed6f62d87e69377bc759fd7987cc" "checksum failure 0.1.2 (git+https://github.com/rust-lang-nursery/failure.git)" = "" "checksum failure_derive 0.1.2 (git+https://github.com/rust-lang-nursery/failure.git)" = "" +"checksum failure_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "946d0e98a50d9831f5d589038d2ca7f8f455b1c21028c0db0e84116a12696426" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum fallible-iterator 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea79295a7a3e0d77f19e763cf1fe7189cd95fc2b36735ea0ea6b711a7380f509" "checksum filetime 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "714653f3e34871534de23771ac7b26e999651a0a228f47beb324dfdf1dd4b10f" @@ -2768,6 +2838,7 @@ dependencies = [ "checksum futf 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7c9c1ce3fa9336301af935ab852c437817d14cd33690446569392e65170aac3b" "checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" "checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" +"checksum fwdansi 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "34dd4c507af68d37ffef962063dfa1944ce0dd4d5b82043dbab1dabe088610c3" "checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" "checksum git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "591f8be1674b421644b6c030969520bc3fa12114d2eb467471982ed3e9584e71" "checksum git2-curl 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0173e317f8ba21f3fff0f71549fead5e42e67961dbd402bf69f42775f3cc78b4" @@ -2803,6 +2874,7 @@ dependencies = [ "checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" "checksum libflate 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "21138fc6669f438ed7ae3559d5789a5f0ba32f28c1f0608d1e452b0bb06ee936" "checksum libgit2-sys 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4916b5addc78ec36cc309acfcdf0b9f9d97ab7b84083118b248709c5b7029356" +"checksum libnghttp2-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ffbfb81475cc9f625e44f3a8f8b9cf7173815ae1c7cc2fa91853ec009e38198" "checksum libssh2-sys 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "126a1f4078368b163bfdee65fbab072af08a1b374a5551b21e87ade27b1fbf9d" "checksum libz-sys 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "4401fe74560a0d46fce3464625ac8aa7a79d291dd28cee021d18852d5191c280" "checksum lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "775751a3e69bde4df9b38dd00a1b5d6ac13791e4223d4a0506577f0dd27cfb7a" @@ -2843,6 +2915,7 @@ dependencies = [ "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" +"checksum opener 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "176cd8eadff5ef9fa5c6d19452535662c02c6bf29b3d594a3fc01f749bb24c94" "checksum openssl 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)" = "5af9e83eb3c51ee806387d26a43056f3246d865844caa6dd704d2ba7e831c264" "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" "checksum openssl-sys 0.9.37 (registry+https://github.com/rust-lang/crates.io-index)" = "d4edbc8dfa63f557aee3a498179af2cc6a989e12ba1751840046c79afc9e615a" @@ -2934,9 +3007,11 @@ dependencies = [ "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" "checksum syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)" = "14f9bf6292f3a61d2c716723fdb789a41bbe104168e6f496dc6497e531ea1b9b" +"checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741" "checksum syn 0.15.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b036b7b35e846707c0e55c2c9441fa47867c0f87fca416921db3261b1d8c741a" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec37f4fab4bafaf6b5621c1d54e6aa5d4d059a8f84929e87abfdd7f9f04c6db2" +"checksum synstructure 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "85bb9b7550d063ea184027c9b8c20ac167cd36d3e06b3a40bceb9d746dc1a7b7" "checksum tar 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)" = "83b0d14b53dbfd62681933fadd651e815f99e6084b649e049ab99296e05ab3de" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" "checksum tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "55c1195ef8513f3273d55ff59fe5da6940287a0d7a98331254397f464833675b" diff --git a/Cargo.toml b/Cargo.toml index 8c694eaf1..b14b5b514 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ failure = "0.1" comrak = { version = "0.2.10", default-features = false } toml = "0.4" html5ever = "0.22" -cargo = "0.30" +cargo = { git = "https://github.com/rust-lang/cargo.git" } # iron dependencies iron = "0.5" diff --git a/src/db/add_package.rs b/src/db/add_package.rs index 0e7dcc02d..b404dc142 100644 --- a/src/db/add_package.rs +++ b/src/db/add_package.rs @@ -237,11 +237,11 @@ fn get_readme(pkg: &Package) -> Result> { fn get_rustdoc(pkg: &Package) -> Result> { - if pkg.manifest().targets()[0].src_path().is_absolute() { - read_rust_doc(pkg.manifest().targets()[0].src_path()) + if pkg.manifest().targets()[0].src_path().path().is_absolute() { + read_rust_doc(pkg.manifest().targets()[0].src_path().path()) } else { let mut path = PathBuf::from(try!(source_path(&pkg).ok_or_else(|| err_msg("File not found")))); - path.push(pkg.manifest().targets()[0].src_path()); + path.push(pkg.manifest().targets()[0].src_path().path()); read_rust_doc(path.as_path()) } } diff --git a/src/utils/build_doc.rs b/src/utils/build_doc.rs index 8a5f67ebd..cf29304c3 100644 --- a/src/utils/build_doc.rs +++ b/src/utils/build_doc.rs @@ -9,6 +9,8 @@ use std::sync::Arc; use cargo::core::{SourceId, Dependency, Source, Package, Workspace}; use cargo::core::compiler::{DefaultExecutor, CompileMode, MessageFormat, BuildConfig, Executor}; +use cargo::core::package::PackageSet; +use cargo::core::source::SourceMap; use cargo::util::{CargoResult, Config, internal, Filesystem}; use cargo::sources::SourceConfigMap; use cargo::ops::{self, Packages}; @@ -31,19 +33,25 @@ pub fn build_doc(name: &str, vers: Option<&str>, target: Option<&str>) -> Result let config = try!(Config::default()); let source_id = try!(SourceId::crates_io(&config)); - let source_map = try!(SourceConfigMap::new(&config)); - let mut source = try!(source_map.load(&source_id)); + let source_cfg_map = try!(SourceConfigMap::new(&config)); + let mut source = try!(source_cfg_map.load(&source_id)); // update crates.io-index registry try!(source.update()); let dep = try!(Dependency::parse_no_deprecated(name, vers, &source_id)); let deps = try!(source.query_vec(&dep)); - let pkg = try!(deps.iter().map(|p| p.package_id()).max() - // FIXME: This is probably not a rusty way to handle options and results - // or maybe it is who knows... - .map(|pkgid| source.download(pkgid)) - .unwrap_or(Err(internal("PKG download error")))); + let pkgid = try!(deps.iter().map(|p| p.package_id()).max() + // FIXME: This is probably not a rusty way to handle options and results + // or maybe it is who knows... + .ok_or(internal("no package id available"))); + + let mut source_map = SourceMap::new(); + source_map.insert(source); + + let pkg_set = try!(PackageSet::new(&[pkgid.clone()], source_map, &config)); + + let pkg = try!(pkg_set.get_one(&pkgid)).clone(); let current_dir = try!(env::current_dir()); let target_dir = PathBuf::from(current_dir).join("cratesfyi"); @@ -93,11 +101,13 @@ pub fn build_doc(name: &str, vers: Option<&str>, target: Option<&str>) -> Result false), target_rustc_args: None, target_rustdoc_args: Some(rustdoc_args), + local_rustdoc_args: None, export_dir: None, }; let ws = try!(Workspace::ephemeral(pkg, &config, Some(Filesystem::new(target_dir)), false)); let exec: Arc = Arc::new(DefaultExecutor); + let source = try!(source_cfg_map.load(&source_id)); try!(ops::compile_ws(&ws, Some(source), &opts, &exec)); Ok(try!(ws.current()).clone()) @@ -118,11 +128,17 @@ pub fn get_package(name: &str, vers: Option<&str>) -> CargoResult { let dep = try!(Dependency::parse_no_deprecated(name, vers, &source_id)); let deps = try!(source.query_vec(&dep)); - let pkg = try!(deps.iter().map(|p| p.package_id()).max() - // FIXME: This is probably not a rusty way to handle options and results - // or maybe it is who knows... - .map(|pkgid| source.download(pkgid)) - .unwrap_or(Err(internal("PKG download error")))); + let pkgid = try!(deps.iter().map(|p| p.package_id()).max() + // FIXME: This is probably not a rusty way to handle options and results + // or maybe it is who knows... + .ok_or(internal("no package id available"))); + + let mut source_map = SourceMap::new(); + source_map.insert(source); + + let pkg_set = try!(PackageSet::new(&[pkgid.clone()], source_map, &config)); + + let pkg = try!(pkg_set.get_one(&pkgid)).clone(); Ok(pkg) }