Switch from reqwest to ureq

Reduces our dependency tree from 188 crates to 50 and does not regress performance since we only used the blocking aspects of reqwest anyway

Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
This commit is contained in:
Harsh Shandilya 2019-12-09 07:50:51 +05:30
parent d3334a134a
commit 004e11565f
No known key found for this signature in database
GPG Key ID: C2E74282C2133D62
4 changed files with 205 additions and 1190 deletions

1383
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -14,10 +14,10 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
reqwest = "0.9.22"
clap = "2.33.0"
log = "0.4.8"
roxmltree = "0.7.3"
ureq = "0.11.2"
[badges]
maintenance = { status = "actively-developed" }

View File

@ -1,7 +1,7 @@
extern crate clap;
extern crate log;
extern crate reqwest;
extern crate roxmltree;
extern crate ureq;
use clap::{App, Arg};
use log::{LevelFilter, Metadata, Record};

View File

@ -46,9 +46,9 @@ fn get_maven_index() -> Result<String, std::io::Error> {
/// Downloads the Maven master index for Google's Maven Repository
/// and returns the XML as a String
#[cfg(not(test))]
fn get_maven_index() -> Result<String, reqwest::Error> {
fn get_maven_index() -> Result<String, std::io::Error> {
info!("Downloading maven index...");
reqwest::get("https://dl.google.com/dl/android/maven2/master-index.xml")?.text()
ureq::get("https://dl.google.com/dl/android/maven2/master-index.xml").call().into_string()
}
/// Get the group-index.xml URL for a given group
@ -63,9 +63,9 @@ fn get_groups_index_url(group: String) -> String {
/// The group parameter is here only for logging purposes and may be removed
/// at any time.
#[cfg(not(test))]
fn get_group_index(group: &str, url: &str) -> Result<String, reqwest::Error> {
fn get_group_index(group: &str, url: &str) -> Result<String, std::io::Error> {
info!("Getting index for {} from {}", group, url);
reqwest::get(url)?.text()
ureq::get(url).call().into_string()
}
#[cfg(test)]