first time deps
This commit is contained in:
@@ -21,3 +21,4 @@ clap = { version = "4.5.54", features = ["derive"] }
|
||||
serde = { version = "1.0.228", features = ["derive"] }
|
||||
serde_json = "1.0.149"
|
||||
anyhow = "1.0.100"
|
||||
camino = "1.2.2"
|
||||
|
||||
@@ -4,6 +4,8 @@ use anyhow::{Context, Result};
|
||||
use clap::{Parser, Subcommand};
|
||||
use prometeu_deps::{load_sources, resolve_workspace, DepsConfig};
|
||||
use std::path::{Path, PathBuf};
|
||||
use camino::Utf8Path;
|
||||
use crate::emit_artifacts::{emit_artifacts, EmitOptions};
|
||||
|
||||
/// Command line interface for the Prometeu Compiler.
|
||||
#[derive(Parser)]
|
||||
@@ -121,20 +123,18 @@ pub fn run() -> Result<()> {
|
||||
}
|
||||
|
||||
|
||||
fn run_pipeline(cfg: PipelineConfig, project_dir: &Path, explain_deps: bool) -> anyhow::Result<PipelineOutput> {
|
||||
fn run_pipeline(cfg: PipelineConfig, project_dir: &Path, explain_deps: bool) -> Result<PipelineOutput> {
|
||||
let deps_cfg = DepsConfig {
|
||||
explain: explain_deps,
|
||||
cache_dir: Default::default(),
|
||||
registry_dirs: vec![],
|
||||
};
|
||||
|
||||
let resolved = resolve_workspace(&deps_cfg, project_dir)
|
||||
let project_dir_path_buf = Utf8Path::from_path(project_dir)
|
||||
.with_context(|| format!("deps: failed to convert project_dir to Utf8Path: {:?}", project_dir))?;
|
||||
let resolved = resolve_workspace(&deps_cfg, project_dir_path_buf)
|
||||
.with_context(|| format!("deps: failed to resolve project at {:?}", project_dir))?;
|
||||
|
||||
// resolved deve te dar pelo menos:
|
||||
// - graph
|
||||
// - stack (deps-first topo order)
|
||||
|
||||
let sources = load_sources(&deps_cfg, &resolved)
|
||||
.context("deps: failed to load sources")?;
|
||||
|
||||
@@ -156,21 +156,3 @@ fn parse_mode(s: &str) -> Result<BuildMode> {
|
||||
other => anyhow::bail!("invalid --mode '{}': expected debug|release|test", other),
|
||||
}
|
||||
}
|
||||
|
||||
/// Emission options
|
||||
struct EmitOptions {
|
||||
out: Option<PathBuf>,
|
||||
emit_symbols: bool,
|
||||
emit_disasm: bool,
|
||||
}
|
||||
|
||||
/// Placeholder emit function.
|
||||
/// In hard reset, this can be a no-op until backend exists.
|
||||
fn emit_artifacts(_opts: &EmitOptions, _outp: &PipelineOutput) -> Result<()> {
|
||||
// Later:
|
||||
// - decide output dir (opts.out or default)
|
||||
// - write .pbc / program image
|
||||
// - write symbols.json (if exists)
|
||||
// - write disasm (if exists)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
use std::path::PathBuf;
|
||||
use crate::PipelineOutput;
|
||||
|
||||
pub struct EmitOptions {
|
||||
pub(crate) out: Option<PathBuf>,
|
||||
pub(crate) emit_symbols: bool,
|
||||
pub(crate) emit_disasm: bool,
|
||||
}
|
||||
|
||||
pub fn emit_artifacts(_opts: &EmitOptions, _outp: &PipelineOutput) -> anyhow::Result<()> {
|
||||
// Later:
|
||||
// - decide output dir (opts.out or default)
|
||||
// - write .pbc / program image
|
||||
// - write symbols.json (if exists)
|
||||
// - write disasm (if exists)
|
||||
Ok(())
|
||||
}
|
||||
@@ -3,6 +3,7 @@ pub mod config;
|
||||
pub mod ctx;
|
||||
pub mod pipeline;
|
||||
pub mod phases;
|
||||
mod emit_artifacts;
|
||||
|
||||
pub use config::*;
|
||||
pub use ctx::*;
|
||||
|
||||
Reference in New Issue
Block a user