mirror of
https://github.com/esp-rs/espup.git
synced 2025-10-02 15:14:56 +00:00
style: 🎨 Format includes
This commit is contained in:
parent
99c5a154a1
commit
517cce3ac1
@ -5,14 +5,15 @@ use crate::emoji;
|
|||||||
use crate::gcc_toolchain::{get_toolchain_name, get_ulp_toolchain_name};
|
use crate::gcc_toolchain::{get_toolchain_name, get_ulp_toolchain_name};
|
||||||
use crate::utils::get_home_dir;
|
use crate::utils::get_home_dir;
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use embuild::espidf::EspIdfRemote;
|
use embuild::{espidf, espidf::EspIdfRemote, git};
|
||||||
use embuild::{espidf, git};
|
|
||||||
use log::{debug, info};
|
use log::{debug, info};
|
||||||
use std::collections::hash_map::DefaultHasher;
|
use std::{
|
||||||
use std::env;
|
collections::hash_map::DefaultHasher,
|
||||||
use std::fs;
|
env,
|
||||||
use std::hash::{Hash, Hasher};
|
fs::remove_dir_all,
|
||||||
use std::path::PathBuf;
|
hash::{Hash, Hasher},
|
||||||
|
path::PathBuf,
|
||||||
|
};
|
||||||
use strum::{Display, EnumIter, EnumString, IntoStaticStr};
|
use strum::{Display, EnumIter, EnumString, IntoStaticStr};
|
||||||
|
|
||||||
const DEFAULT_GIT_REPOSITORY: &str = "https://github.com/espressif/esp-idf";
|
const DEFAULT_GIT_REPOSITORY: &str = "https://github.com/espressif/esp-idf";
|
||||||
@ -139,10 +140,10 @@ impl EspIdfRepo {
|
|||||||
exports.push(format!("export PATH={:?}", espidf.exported_path));
|
exports.push(format!("export PATH={:?}", espidf.exported_path));
|
||||||
if self.minified {
|
if self.minified {
|
||||||
info!("{} Minifying ESP-IDF", emoji::INFO);
|
info!("{} Minifying ESP-IDF", emoji::INFO);
|
||||||
fs::remove_dir_all(espidf_dir.join("docs"))?;
|
remove_dir_all(espidf_dir.join("docs"))?;
|
||||||
fs::remove_dir_all(espidf_dir.join("examples"))?;
|
remove_dir_all(espidf_dir.join("examples"))?;
|
||||||
fs::remove_dir_all(espidf_dir.join("tools").join("esp_app_trace"))?;
|
remove_dir_all(espidf_dir.join("tools").join("esp_app_trace"))?;
|
||||||
fs::remove_dir_all(espidf_dir.join("tools").join("test_idf_size"))?;
|
remove_dir_all(espidf_dir.join("tools").join("test_idf_size"))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(exports)
|
Ok(exports)
|
||||||
|
@ -8,9 +8,7 @@ use crate::utils::{download_file, get_home_dir};
|
|||||||
use anyhow::{bail, Result};
|
use anyhow::{bail, Result};
|
||||||
use embuild::cmd;
|
use embuild::cmd;
|
||||||
use log::{info, warn};
|
use log::{info, warn};
|
||||||
use std::env;
|
use std::{env, path::PathBuf, process::Stdio};
|
||||||
use std::path::PathBuf;
|
|
||||||
use std::process::Stdio;
|
|
||||||
|
|
||||||
const DEFAULT_XTENSA_RUST_REPOSITORY: &str =
|
const DEFAULT_XTENSA_RUST_REPOSITORY: &str =
|
||||||
"https://github.com/esp-rs/rust-build/releases/download";
|
"https://github.com/esp-rs/rust-build/releases/download";
|
||||||
|
17
src/utils.rs
17
src/utils.rs
@ -5,12 +5,11 @@ use anyhow::{bail, Result};
|
|||||||
use dirs::home_dir;
|
use dirs::home_dir;
|
||||||
use flate2::bufread::GzDecoder;
|
use flate2::bufread::GzDecoder;
|
||||||
use log::{debug, info};
|
use log::{debug, info};
|
||||||
use std::fs::File;
|
use std::{
|
||||||
use std::io::BufReader;
|
fs::{create_dir_all, remove_dir_all, File},
|
||||||
use std::io::Write;
|
io::{copy, BufReader, Write},
|
||||||
use std::path::Path;
|
path::{Path, PathBuf},
|
||||||
use std::path::PathBuf;
|
};
|
||||||
use std::{fs, io};
|
|
||||||
use tar::Archive;
|
use tar::Archive;
|
||||||
use xz2::read::XzDecoder;
|
use xz2::read::XzDecoder;
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ pub mod logging {
|
|||||||
/// Deletes dist folder.
|
/// Deletes dist folder.
|
||||||
pub fn clear_dist_folder() -> Result<()> {
|
pub fn clear_dist_folder() -> Result<()> {
|
||||||
info!("{} Clearing dist folder", emoji::WRENCH);
|
info!("{} Clearing dist folder", emoji::WRENCH);
|
||||||
fs::remove_dir_all(&get_dist_path(""))?;
|
remove_dir_all(&get_dist_path(""))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +82,7 @@ pub fn download_file(
|
|||||||
return Ok(file_path);
|
return Ok(file_path);
|
||||||
} else if !Path::new(&output_directory).exists() {
|
} else if !Path::new(&output_directory).exists() {
|
||||||
info!("{} Creating directory: {}", emoji::WRENCH, output_directory);
|
info!("{} Creating directory: {}", emoji::WRENCH, output_directory);
|
||||||
if let Err(_e) = fs::create_dir_all(output_directory) {
|
if let Err(_e) = create_dir_all(output_directory) {
|
||||||
bail!(
|
bail!(
|
||||||
"{} Creating directory {} failed",
|
"{} Creating directory {} failed",
|
||||||
emoji::ERROR,
|
emoji::ERROR,
|
||||||
@ -137,7 +136,7 @@ pub fn download_file(
|
|||||||
} else {
|
} else {
|
||||||
info!("{} Creating file: {}", emoji::WRENCH, file_path);
|
info!("{} Creating file: {}", emoji::WRENCH, file_path);
|
||||||
let mut out = File::create(file_path)?;
|
let mut out = File::create(file_path)?;
|
||||||
io::copy(&mut resp, &mut out)?;
|
copy(&mut resp, &mut out)?;
|
||||||
}
|
}
|
||||||
Ok(format!("{}/{}", output_directory, file_name))
|
Ok(format!("{}/{}", output_directory, file_name))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user