Logical steps for a Cargo

I really want to implement a package manager like Cargo for my engine which doesn't use Rust but ActionScript and MXML (the compiler and package manager uses Rust, but the languages should target HTML5).

I'm starting by implementing the check command for verification, but I'm lost as to what steps I should take, yet.

I currently have this:

pub async fn check_process(matches: &clap::ArgMatches) {
    let builtins = matches.get_one::<std::path::PathBuf>("builtins");
    let package = matches.get_one::<String>("package");

    let dir = std::env::current_dir().unwrap();
    let dag = match Dag::retrieve(&dir, &dir, package.cloned()).await {
        Ok(dag) => dag,
        Err(error) => {
            match error {
                DagError::ManifestNotFound => {
                    println!("{} {}", "Error:".red(), "Whack manifest not found.");
                },
                DagError::PackageMustBeSpecified => {
                    println!("{} {}", "Error:".red(), "Package must be specified.");
                },
            }

            return;
        },
    };

    // Check the built-ins first
    fixme();

    // Check each dependency in ascending order for AS3 and MXML errors,
    // running the build script if required.
    fixme();
}

And that:

use std::rc::Rc;
use std::path::PathBuf;
use crate::packagemanager::WhackPackage;

/// Directed acyclic graph of the dependency tree.
pub struct Dag {
    pub vertices: Vec<Rc<WhackPackage>>,
    pub edges: Vec<DagEdge>,
    pub first: Rc<WhackPackage>,
    pub last: Rc<WhackPackage>,
}

impl Dag {
    /// Retrieves the directed acyclic graph of the dependency tree.
    pub async fn retrieve(dir: &PathBuf, entry_dir: &PathBuf, package: Option<String>) -> Result<Dag, DagError> {
        // Read the Whack manifest
        fixme();

        // If current project is a workspace, then require a package name
        // to be specified, at which the check process executes.
        fixme();

        // Check for manifest updates.
        fixme();

        // If the manifest has been updated, update dependencies
        // and clear up the build script's artifacts.
        // Remember that the lock file must be considered for the
        // exact versions of registry dependencies.
        fixme();

        // Build a directed acyclic graph (DAG) of the dependencies.
        fixme();
    }
}

pub struct DagEdge {
    pub from: Rc<WhackPackage>,
    pub to: Rc<WhackPackage>,
}

pub enum DagError {
    ManifestNotFound,
    PackageMustBeSpecified,
}

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.