adding the master make check that was previously unimplemented

unstable
penguin 3 years ago
parent fe494f650f
commit 5ca581b496

9
Cargo.lock generated

@ -161,7 +161,6 @@ dependencies = [
"igloo_agent",
"igloo_cli",
"igloo_core",
"igloo_make",
"igloo_manifest",
]
@ -193,18 +192,10 @@ dependencies = [
"config",
"igloo_base",
"igloo_cli",
"igloo_make",
"igloo_manifest",
"zmq",
]
[[package]]
name = "igloo_make"
version = "0.1.0"
dependencies = [
"igloo_base",
]
[[package]]
name = "igloo_manifest"
version = "0.1.0"

@ -14,8 +14,7 @@ igloo_core = { path = "./igloo_core" }
igloo_cli = { path = "./igloo_cli" }
igloo_agent = { path = "./igloo_agent" }
igloo_manifest = { path = "./igloo_manifest" }
igloo_make = { path = "./igloo_make" }
[workspace]
members = ["igloo_base", "igloo_core", "igloo_cli", "igloo_agent", "igloo_manifest", "igloo_make"]
members = ["igloo_base", "igloo_core", "igloo_cli", "igloo_agent", "igloo_manifest"]

@ -7,4 +7,4 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
directories = "3.0.1"
directories = "3.0.1"

@ -1,5 +1,3 @@
mod env_info;
use std::path::PathBuf;
use std::env;
use directories::*;

@ -15,9 +15,12 @@ mod tests {
}
}
/// IglooCliConfig stores information about the igloo command being run.
/// It is all handled in active memory because we only care about this
/// information during the execution of that command.
pub struct IglooCliConfig
{
pub cli_conf: clap::ArgMatches,
pub raw: clap::ArgMatches,
pub version_major: i8,
pub version_minor: i8,
pub version_patch: i8,
@ -30,7 +33,7 @@ impl IglooCliConfig
{
Self
{
cli_conf: igloo_app(),
raw: igloo_app(),
version_major: env!("CARGO_PKG_VERSION_MAJOR")
.to_string()
.parse()

@ -9,8 +9,7 @@ edition = "2018"
[dependencies]
clap = "3.0.0-beta.2"
config = "0.10"
igloo_base = { path = "../igloo_base" }
igloo_cli = { path = "../igloo_cli" }
igloo_manifest = { path = "../igloo_manifest" }
igloo_make = { path = "../igloo_make" }
igloo_base = { path = "../igloo_base" }
zmq = "0.9"

@ -1 +0,0 @@
penguin@penguin-arch-home.90817:1632361064

@ -33,6 +33,7 @@ impl IglooPrj
IglooPrj
{
name: String::from(""),
/// target_bank -- a vector of targets added for this project
target_bank: Vec::default(),
project_dir: std::path::PathBuf::default(),
root: PathBuf::default(),
@ -67,7 +68,7 @@ impl IglooPrj
return Err(res_err)
}
match target_is_valid(&inst.master_make_man, &inst.master_target_man, target_in)
match IglooManifest::target_is_valid(&inst.master_make_man, &inst.master_target_man, target_in)
{
Ok(v) =>
{

@ -62,7 +62,7 @@ impl Igloo
{
let mut res: IglooInstType = Null;
// Load manifests first
match get_master_make_manifest(&mut self.master_make_man)
match IglooManifest::get_master_make_manifest(&mut self.master_make_man)
{
ErrNone => (),
v =>
@ -71,7 +71,7 @@ impl Igloo
return Err(v)
}
}
match get_master_target_manifest(&mut self.master_target_man)
match IglooManifest::get_master_target_manifest(&mut self.master_target_man)
{
ErrNone => (),
v =>
@ -82,7 +82,7 @@ impl Igloo
}
// Assign our instance type (new, run, flash, etc..)
match igloo_subcommand(&self.cli_conf.cli_conf)
match igloo_subcommand(&self.cli_conf.raw)
{
Ok(v) => res = v,
Err(e) => return Err(e),
@ -103,12 +103,6 @@ impl Igloo
{
let mut res_err = ErrNone;
let mut prj: IglooPrj;
println!("Version Major: {0}\n\
Version Minor: {1}\n\
Version Patch: {2}",
self.cli_conf.version_major,
self.cli_conf.version_minor,
self.cli_conf.version_patch);
loop { match inst_type
{
Null => res_err = ErrNone,
@ -116,7 +110,7 @@ impl Igloo
{
let prj_name: &str = self
.cli_conf
.cli_conf
.raw
.subcommand()
.unwrap().1
.value_of("project_name")
@ -124,7 +118,7 @@ impl Igloo
let target: &str = self
.cli_conf
.cli_conf
.raw
.subcommand()
.unwrap().1
.value_of("target")
@ -147,7 +141,13 @@ impl Igloo
Info =>
{
// list current version
println!("Igloo Version: {0}.{1}.{2}\n",
self.cli_conf.version_major,
self.cli_conf.version_minor,
self.cli_conf.version_patch);
// list esf version
// list supported mcus
// if we're in a project, list the project info
// list targets/boards
println!("Info in run handler");

@ -1,10 +0,0 @@
[package]
name = "igloo_make"
version = "0.1.0"
authors = ["Penguin <penguin@epenguin.net>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
igloo_base = { path = "../igloo_base" }

@ -1,9 +0,0 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
use igloo_base;

@ -0,0 +1 @@
penguin@penguin-arch-home.8452:1632509282

@ -1,9 +1,9 @@
/// Igloo Manifest is a subproject responsible for working with manifests.
/// Manifests are anything from config files to giant lists or ... manifests.
/// For now, all functionality is going to sit in this lib.rs until I figure out
/// how I want to structure manifests
extern crate config;
use igloo_base::*;
use igloo_base::IglooErrType::*;
use config::Config;
#[cfg(test)]
mod tests {
#[test]
@ -12,111 +12,124 @@ mod tests {
}
}
/// Igloo Manifest -- Responsible for all lookups in manifest files
pub fn get_master_make_manifest(man: &mut Config) -> IglooErrType
pub mod IglooManifest
{
let mut ret: IglooErrType = ErrNone;
match man.merge(
config::File::with_name(
IglooEnvInfo::get_env_info().esfd.join("manifest/make-manifest.toml")
.to_str()
.unwrap()))
{
Ok(_v) => (),
Err(e) =>
{
println!("Error: {:?}", e);
ret = FailedToLoadMasterMakeManifest;
}
}
ret
}
use igloo_base::*;
use igloo_base::IglooErrType::*;
use config::Config;
pub fn get_master_target_manifest(man: &mut Config) -> IglooErrType
{
let mut ret: IglooErrType = ErrNone;
match man.merge(
config::File::with_name(
IglooEnvInfo::get_env_info().esfd.join("manifest/target-manifest.toml")
.to_str()
.unwrap()))
/// master_mm -- Master Make Manifest
/// master_tm -- Master Target Manifest
/// name -- name of target
pub fn target_is_valid(master_mm: &Config, master_tm: &Config, name: &str)
-> Result<bool, IglooErrType>
{
Ok(_v) => (),
Err(e) =>
let mut ret: bool = true;
if name.is_empty()
{
println!("Error: {:?}", e);
ret = FailedToLoadMasterTargetManifest;
return Err(InvalidTarget)
}
}
ret
}
/// master_mm -- Master Make Manifest
/// master_tm -- Master Target Manifest
/// name -- name of target
pub fn target_is_valid(master_mm: &Config, master_tm: &Config, name: &str)
-> Result<bool, IglooErrType>
{
let mut ret: bool = true;
if name.is_empty()
{
return Err(InvalidTarget)
}
match master_tm.get_table("target.make")
{
Ok(v) =>
let mut target_make_name: String = String::default();
match master_tm.get_table("target.make")
{
match v.get(name)
Ok(v) =>
{
Some(v) =>
match v.get(name)
{
println!("target.make entry for \"{}\" exists!", v);
}
None =>
{
println!("target.make entry for \"{}\" does not exist", name);
ret = false;
Some(v) =>
{
println!("target.make entry for \"{}\" exists!", v);
target_make_name = v.to_string();
println!("v.to_string() = {}", target_make_name);
}
None =>
{
println!("target.make entry for \"{}\" does not exist", name);
ret = false;
}
}
}
Err(e) =>
{
println!("{:?}", e);
return Err(FailedToLoadMasterMakeManifest)
}
}
if !ret
{
return Ok(ret)
}
Err(e) =>
let target_table = master_tm.get_table("target.manifest");
match target_table
{
println!("{:?}", e);
return Err(FailedToLoadMasterMakeManifest)
Ok(v) =>
{
match v.get(name)
{
Some(v) =>
{
println!("target.manifest entry for \"{}\" exists!", v);
}
None =>
{
ret = false;
}
}
}
Err(e) =>
{
println!("{:?}", e);
return Err(FailedToLoadMasterTargetManifest)
}
}
}
if !ret
{
return Ok(ret)
Ok(ret)
}
let target_table = master_tm.get_table("target.manifest");
match target_table
/// Igloo Manifest -- Responsible for all lookups in manifest files
pub fn get_master_make_manifest(man: &mut Config) -> IglooErrType
{
Ok(v) =>
let mut ret: IglooErrType = ErrNone;
match man.merge(
config::File::with_name(
IglooEnvInfo::get_env_info().esfd.join("manifest/make-manifest.toml")
.to_str()
.unwrap()))
{
match v.get(name)
Ok(_v) => (),
Err(e) =>
{
Some(v) =>
{
println!("target.manifest entry for \"{}\" exists!", v);
}
None =>
{
ret = false;
}
println!("Error: {:?}", e);
ret = FailedToLoadMasterMakeManifest;
}
}
Err(e) =>
ret
}
pub fn get_master_target_manifest(man: &mut Config) -> IglooErrType
{
let mut ret: IglooErrType = ErrNone;
match man.merge(
config::File::with_name(
IglooEnvInfo::get_env_info().esfd.join("manifest/target-manifest.toml")
.to_str()
.unwrap()))
{
println!("{:?}", e);
return Err(FailedToLoadMasterTargetManifest)
Ok(_v) => (),
Err(e) =>
{
println!("Error: {:?}", e);
ret = FailedToLoadMasterTargetManifest;
}
}
}
Ok(ret)
ret
}
}

Loading…
Cancel
Save