feat: commit code
This commit is contained in:
1 parent
5edcb9238c
commit
0a2bac8715
2 files changed
+19
-12
No files matched your search
+13
-8
@@ -2,11 +2,11 @@ use crate::{
|
|||||||
config::{CrateConfig, ExecutableType},
|
config::{CrateConfig, ExecutableType},
|
||||||
error::{Error, Result},
|
error::{Error, Result},
|
||||||
tools::Tool,
|
tools::Tool,
|
||||||
DioxusConfig,
|
CargoFormatInfo, DioxusConfig,
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
fs::{copy, create_dir_all, remove_dir_all, File},
|
fs::{copy, create_dir_all, remove_dir_all, File},
|
||||||
io::{Read, BufRead},
|
io::{BufRead, Read},
|
||||||
panic,
|
panic,
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
process::Command,
|
process::Command,
|
||||||
@@ -80,16 +80,21 @@ pub fn build(config: &CrateConfig, quiet: bool) -> Result<()> {
|
|||||||
let mut child = cmd.spawn()?;
|
let mut child = cmd.spawn()?;
|
||||||
let out = child.stdout.take().unwrap();
|
let out = child.stdout.take().unwrap();
|
||||||
let mut out = std::io::BufReader::new(out);
|
let mut out = std::io::BufReader::new(out);
|
||||||
let mut s = String::new();
|
let mut content = String::new();
|
||||||
let mut n = 0;
|
while let Ok(_) = out.read_line(&mut content) {
|
||||||
while let Ok(_) = out.read_line(&mut s) {
|
|
||||||
// 进程退出后结束循环
|
// 进程退出后结束循环
|
||||||
if let Ok(Some(_)) = child.try_wait() {
|
if let Ok(Some(_)) = child.try_wait() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
println!("\n{}\n", s);
|
let content = content.split('\n').collect::<Vec<&str>>();
|
||||||
loading.text(format!("Building {}", n));
|
for json in content {
|
||||||
n += 1;
|
let d = serde_json::from_str::<CargoFormatInfo>(&json);
|
||||||
|
if let Ok(d) = d {
|
||||||
|
println!("\n{:#?}\n", d);
|
||||||
|
} else {
|
||||||
|
println!("\n\n{:?}\n\n", json);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
loading.success("OK");
|
loading.success("OK");
|
||||||
loading.end();
|
loading.end();
|
||||||
|
|||||||
+6
-4
@@ -1,5 +1,5 @@
|
|||||||
//! Utilities for working with cargo and rust files
|
//! Utilities for working with cargo and rust files
|
||||||
use serde::Serialize;
|
use serde::{Serialize, Deserialize};
|
||||||
|
|
||||||
use crate::error::{Error, Result};
|
use crate::error::{Error, Result};
|
||||||
use std::{
|
use std::{
|
||||||
@@ -93,7 +93,7 @@ impl Metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
pub struct CargoFormatInfo {
|
pub struct CargoFormatInfo {
|
||||||
pub reason: CargoFormatReason,
|
pub reason: CargoFormatReason,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
@@ -101,10 +101,12 @@ pub struct CargoFormatInfo {
|
|||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
manifest_path: String,
|
manifest_path: String,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
message: Option<serde_json::Value>
|
target: Option<serde_json::Value>,
|
||||||
|
#[serde(default)]
|
||||||
|
message: Option<serde_json::Value>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
pub enum CargoFormatReason {
|
pub enum CargoFormatReason {
|
||||||
#[serde(rename = "compiler-message")]
|
#[serde(rename = "compiler-message")]
|
||||||
CompilerMessage,
|
CompilerMessage,
|
||||||
|
|||||||
Reference in new issue
Block a user