mirror of https://github.com/encounter/objdiff.git
Compare commits
No commits in common. "a119d9a6dd98a9ed51edaa7c5ba3e14e5f296afa" and "424434edd6564a6c2afaea051d8f2c43ae755d2a" have entirely different histories.
a119d9a6dd
...
424434edd6
|
@ -165,8 +165,6 @@ pub struct ScratchConfig {
|
||||||
pub ctx_path: Option<PathBuf>,
|
pub ctx_path: Option<PathBuf>,
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub build_ctx: Option<bool>,
|
pub build_ctx: Option<bool>,
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
||||||
pub preset_id: Option<u32>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const CONFIG_FILENAMES: [&str; 3] = ["objdiff.json", "objdiff.yml", "objdiff.yaml"];
|
pub const CONFIG_FILENAMES: [&str; 3] = ["objdiff.json", "objdiff.yml", "objdiff.yaml"];
|
||||||
|
|
|
@ -71,7 +71,6 @@ impl ScratchConfigV1 {
|
||||||
c_flags: self.c_flags,
|
c_flags: self.c_flags,
|
||||||
ctx_path: self.ctx_path,
|
ctx_path: self.ctx_path,
|
||||||
build_ctx: self.build_ctx.then_some(true),
|
build_ctx: self.build_ctx.then_some(true),
|
||||||
preset_id: None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,21 +12,6 @@ pub enum ProjectObjectNode {
|
||||||
Dir(String, Vec<ProjectObjectNode>),
|
Dir(String, Vec<ProjectObjectNode>),
|
||||||
}
|
}
|
||||||
|
|
||||||
fn join_single_dir_entries(nodes: &mut Vec<ProjectObjectNode>) {
|
|
||||||
for node in nodes {
|
|
||||||
if let ProjectObjectNode::Dir(my_name, my_nodes) = node {
|
|
||||||
join_single_dir_entries(my_nodes);
|
|
||||||
// If this directory consists of a single sub-directory...
|
|
||||||
if let [ProjectObjectNode::Dir(sub_name, sub_nodes)] = &mut my_nodes[..] {
|
|
||||||
// ... join the two names with a path separator and eliminate the layer
|
|
||||||
*my_name += "/";
|
|
||||||
*my_name += sub_name;
|
|
||||||
*my_nodes = std::mem::take(sub_nodes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn find_dir<'a>(
|
fn find_dir<'a>(
|
||||||
name: &str,
|
name: &str,
|
||||||
nodes: &'a mut Vec<ProjectObjectNode>,
|
nodes: &'a mut Vec<ProjectObjectNode>,
|
||||||
|
@ -75,14 +60,6 @@ fn build_nodes(
|
||||||
let filename = path.file_name().unwrap().to_str().unwrap().to_string();
|
let filename = path.file_name().unwrap().to_str().unwrap().to_string();
|
||||||
out_nodes.push(ProjectObjectNode::Unit(filename, idx));
|
out_nodes.push(ProjectObjectNode::Unit(filename, idx));
|
||||||
}
|
}
|
||||||
// Within the top-level module directories, join paths. Leave the
|
|
||||||
// top-level name intact though since it's the module name.
|
|
||||||
for node in &mut nodes {
|
|
||||||
if let ProjectObjectNode::Dir(_, sub_nodes) = node {
|
|
||||||
join_single_dir_entries(sub_nodes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nodes
|
nodes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ pub struct CreateScratchConfig {
|
||||||
pub compiler_flags: String,
|
pub compiler_flags: String,
|
||||||
pub function_name: String,
|
pub function_name: String,
|
||||||
pub target_obj: PathBuf,
|
pub target_obj: PathBuf,
|
||||||
pub preset_id: Option<u32>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CreateScratchConfig {
|
impl CreateScratchConfig {
|
||||||
|
@ -46,7 +45,6 @@ impl CreateScratchConfig {
|
||||||
compiler_flags: scratch_config.c_flags.clone().unwrap_or_default(),
|
compiler_flags: scratch_config.c_flags.clone().unwrap_or_default(),
|
||||||
function_name,
|
function_name,
|
||||||
target_obj: target_path.to_path_buf(),
|
target_obj: target_path.to_path_buf(),
|
||||||
preset_id: scratch_config.preset_id,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,18 +101,15 @@ fn run_create_scratch(
|
||||||
let obj_path = project_dir.join(&config.target_obj);
|
let obj_path = project_dir.join(&config.target_obj);
|
||||||
let file = reqwest::blocking::multipart::Part::file(&obj_path)
|
let file = reqwest::blocking::multipart::Part::file(&obj_path)
|
||||||
.with_context(|| format!("Failed to open {}", obj_path.display()))?;
|
.with_context(|| format!("Failed to open {}", obj_path.display()))?;
|
||||||
let mut form = reqwest::blocking::multipart::Form::new()
|
let form = reqwest::blocking::multipart::Form::new()
|
||||||
.text("compiler", config.compiler.clone())
|
.text("compiler", config.compiler.clone())
|
||||||
.text("platform", config.platform.clone())
|
.text("platform", config.platform.clone())
|
||||||
.text("compiler_flags", config.compiler_flags.clone())
|
.text("compiler_flags", config.compiler_flags.clone())
|
||||||
.text("diff_label", config.function_name.clone())
|
.text("diff_label", config.function_name.clone())
|
||||||
.text("diff_flags", diff_flags)
|
.text("diff_flags", diff_flags)
|
||||||
.text("context", context.unwrap_or_default())
|
.text("context", context.unwrap_or_default())
|
||||||
.text("source_code", "// Move related code from Context tab to here");
|
.text("source_code", "// Move related code from Context tab to here")
|
||||||
if let Some(preset) = config.preset_id {
|
.part("target_obj", file);
|
||||||
form = form.text("preset", preset.to_string());
|
|
||||||
}
|
|
||||||
form = form.part("target_obj", file);
|
|
||||||
let client = reqwest::blocking::Client::new();
|
let client = reqwest::blocking::Client::new();
|
||||||
let response = client
|
let response = client
|
||||||
.post(formatcp!("{API_HOST}/api/scratch"))
|
.post(formatcp!("{API_HOST}/api/scratch"))
|
||||||
|
|
Loading…
Reference in New Issue