pr 61.2
This commit is contained in:
parent
3b0d9435e2
commit
ada072805e
@ -134,7 +134,7 @@ mod tests {
|
|||||||
use crate::deps::resolver::{ProjectId, ResolvedEdge, ResolvedGraph, ResolvedNode};
|
use crate::deps::resolver::{ProjectId, ResolvedEdge, ResolvedGraph, ResolvedNode};
|
||||||
use crate::manifest::Manifest;
|
use crate::manifest::Manifest;
|
||||||
use crate::sources::ProjectSources;
|
use crate::sources::ProjectSources;
|
||||||
use std::collections::HashMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
fn mock_node(name: &str, version: &str) -> ResolvedNode {
|
fn mock_node(name: &str, version: &str) -> ResolvedNode {
|
||||||
ResolvedNode {
|
ResolvedNode {
|
||||||
@ -144,7 +144,7 @@ mod tests {
|
|||||||
name: name.to_string(),
|
name: name.to_string(),
|
||||||
version: version.to_string(),
|
version: version.to_string(),
|
||||||
kind: crate::manifest::ManifestKind::Lib,
|
kind: crate::manifest::ManifestKind::Lib,
|
||||||
dependencies: HashMap::new(),
|
dependencies: BTreeMap::new(),
|
||||||
},
|
},
|
||||||
sources: ProjectSources {
|
sources: ProjectSources {
|
||||||
main: None,
|
main: None,
|
||||||
|
|||||||
@ -95,6 +95,10 @@ pub enum Commands {
|
|||||||
Verify {
|
Verify {
|
||||||
/// Path to the project root directory.
|
/// Path to the project root directory.
|
||||||
project_dir: PathBuf,
|
project_dir: PathBuf,
|
||||||
|
|
||||||
|
/// Whether to explain the dependency resolution process.
|
||||||
|
#[arg(long)]
|
||||||
|
explain_deps: bool,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,10 +129,10 @@ pub fn run() -> Result<()> {
|
|||||||
let compilation_unit = compiler::compile_ext(&project_dir, explain_deps)?;
|
let compilation_unit = compiler::compile_ext(&project_dir, explain_deps)?;
|
||||||
compilation_unit.export(&out, emit_disasm, emit_symbols)?;
|
compilation_unit.export(&out, emit_disasm, emit_symbols)?;
|
||||||
}
|
}
|
||||||
Commands::Verify { project_dir } => {
|
Commands::Verify { project_dir, explain_deps } => {
|
||||||
println!("Verifying project at {:?}", project_dir);
|
println!("Verifying project at {:?}", project_dir);
|
||||||
|
|
||||||
compiler::compile(&project_dir)?;
|
compiler::compile_ext(&project_dir, explain_deps)?;
|
||||||
println!("Project is valid!");
|
println!("Project is valid!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::HashMap;
|
use std::collections::BTreeMap;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ pub struct Manifest {
|
|||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub kind: ManifestKind,
|
pub kind: ManifestKind,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub dependencies: HashMap<Alias, DependencySpec>,
|
pub dependencies: BTreeMap<Alias, DependencySpec>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|||||||
@ -37,6 +37,10 @@ enum Commands {
|
|||||||
Build {
|
Build {
|
||||||
/// Project source directory.
|
/// Project source directory.
|
||||||
project_dir: String,
|
project_dir: String,
|
||||||
|
|
||||||
|
/// Whether to explain the dependency resolution process.
|
||||||
|
#[arg(long)]
|
||||||
|
explain_deps: bool,
|
||||||
},
|
},
|
||||||
/// Packages a cartridge directory into a distributable .pmc file.
|
/// Packages a cartridge directory into a distributable .pmc file.
|
||||||
Pack {
|
Pack {
|
||||||
@ -56,6 +60,10 @@ enum VerifyCommands {
|
|||||||
C {
|
C {
|
||||||
/// Project directory
|
/// Project directory
|
||||||
project_dir: String,
|
project_dir: String,
|
||||||
|
|
||||||
|
/// Whether to explain the dependency resolution process.
|
||||||
|
#[arg(long)]
|
||||||
|
explain_deps: bool,
|
||||||
},
|
},
|
||||||
/// Verifies a cartridge or PMC file
|
/// Verifies a cartridge or PMC file
|
||||||
P {
|
P {
|
||||||
@ -86,15 +94,23 @@ fn main() {
|
|||||||
&["--debug", &cart, "--port", &port.to_string()],
|
&["--debug", &cart, "--port", &port.to_string()],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Some(Commands::Build { project_dir }) => {
|
Some(Commands::Build { project_dir, explain_deps }) => {
|
||||||
dispatch(&exe_dir, "prometeuc", &["build", &project_dir]);
|
let mut args = vec!["build", &project_dir];
|
||||||
|
if explain_deps {
|
||||||
|
args.push("--explain-deps");
|
||||||
|
}
|
||||||
|
dispatch(&exe_dir, "prometeuc", &args);
|
||||||
}
|
}
|
||||||
Some(Commands::Pack { .. }) => {
|
Some(Commands::Pack { .. }) => {
|
||||||
not_implemented("pack", "prometeup");
|
not_implemented("pack", "prometeup");
|
||||||
}
|
}
|
||||||
Some(Commands::Verify { target }) => match target {
|
Some(Commands::Verify { target }) => match target {
|
||||||
VerifyCommands::C { project_dir } => {
|
VerifyCommands::C { project_dir, explain_deps } => {
|
||||||
dispatch(&exe_dir, "prometeuc", &["verify", &project_dir]);
|
let mut args = vec!["verify", &project_dir];
|
||||||
|
if explain_deps {
|
||||||
|
args.push("--explain-deps");
|
||||||
|
}
|
||||||
|
dispatch(&exe_dir, "prometeuc", &args);
|
||||||
}
|
}
|
||||||
VerifyCommands::P { .. } => not_implemented("verify p", "prometeup"),
|
VerifyCommands::P { .. } => not_implemented("verify p", "prometeup"),
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user