From 152968312e01936aab11f803d82641b390671875 Mon Sep 17 00:00:00 2001 From: Penguin Date: Mon, 17 Jan 2022 14:45:22 -0600 Subject: [PATCH] move --- doc/changelog.md | 9 +++++++++ doc/target_configurations.toml | 36 ++++++++++++++++++++++++++++++++++ igloo_core/src/igloo_action.rs | 36 ++++++++++++++++++++++++++++++++++ igloo_core/src/igloo_target.rs | 8 ++++++++ igloo_core/src/lib.rs | 2 +- igloo_util/src/lib.rs | 1 + src/main.rs | 1 + 7 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 doc/changelog.md create mode 100644 doc/target_configurations.toml diff --git a/doc/changelog.md b/doc/changelog.md new file mode 100644 index 0000000..fd55bf7 --- /dev/null +++ b/doc/changelog.md @@ -0,0 +1,9 @@ +# Igloo Change Log + +I needed to make a changelog, but I didn't really know how to do this in a way that didn't make me look like an idiot. This isn't really a change log for code. It's like a change log for project level decisions or just places for me to put checkpoints and describe what I'm doing. Idk if this is dumb feel free to tell me a better way to do this. + +## [1-10-2021] Adding user level configurations for targets + +I'm adding user level configurations for targets. They will be in the [user] section. I need to fill out some sort of extensive database-style file with all possible configurations in it. For now, I'm making a file named target_configurations.toml to store these things in. + + diff --git a/doc/target_configurations.toml b/doc/target_configurations.toml new file mode 100644 index 0000000..6828d24 --- /dev/null +++ b/doc/target_configurations.toml @@ -0,0 +1,36 @@ +# Target Configurations +# The default [esf] sections have been removed because they aren't important here. +# What is important in your target.toml files is your user section. +# You can define things like extra include directories, more object files, and more. +# One thing to note is that arrays will ADD to the make variable. Regular strings will +# REPLACE the variable if it already exists. +# Example +# inc_dirs = ["inc/dir/one", "inc/dir/two" ] +# This will ADD to the already existing include directories in your makefile +# +# toolchain = "/usr/bin/arm-unknown-eabi" +# This will REPLACE the already existing toolchain variable. +# +# +# In order to revert from these changes to the defaults, you just need to remove the variables. +# Igloo will restore the missing variables with their originals. +[esf] +# ignore this section. Focus on the user section + +[user] +# esf modules have yet to be created, but when they are created, they will be added like this. +modules = ["usart_sync", "usart_async"] + +# At some point, igloo will support some editors. This just means producing a project file or a specific directory +# so that your editor or ide will already see your project as a project and not just a bunch of files. +# The editor var will also be allowed to include some extra support like bear (for generating compile_commands.json) +# This has not yet been implemented. +# editor = ["nvim", "bear"] + +[user.make] +toolchain = "/usr/bin/arm-unknown-eabi" # custom toolchain path here +objs = ["my/object.o"] +# inc_dirs: Specify include directories you want the toolchain to see +# Specify paths from the root of your project, not absolute dirs +inc_dirs = ["inc/dir/one", "inc/dir/two"] + diff --git a/igloo_core/src/igloo_action.rs b/igloo_core/src/igloo_action.rs index 1eabfd3..1915d35 100644 --- a/igloo_core/src/igloo_action.rs +++ b/igloo_core/src/igloo_action.rs @@ -130,6 +130,42 @@ pub fn ia_new(igloo: &Igloo, project_name: String, initial_target: String) -> Ig ret } +pub fn ia_build(igloo: &Igloo) -> IglooStatus +{ + let mut ret: IglooStatus = IS_GOOD; + + loop + { + if !IglooProject::is_igloo_prj(&igloo.env.cwd) + { + ret = IS_NOT_IGLOO_DIRECTORY; + break; + } + + let mut prj = match IglooProject::from_existing(&igloo) + { + Ok(v) => v, + Err(e) => + { + ret = e; + break; + }, + }; + + + + + + + break;} + + if ret != IS_GOOD + { + igloo_debug!(ERROR, ret); + } + ret +} + /// Debugging function to make sure projects are being loaded correctly pub fn ia_debug(igloo: &Igloo) -> IglooStatus { diff --git a/igloo_core/src/igloo_target.rs b/igloo_core/src/igloo_target.rs index 5a44698..836a7a9 100644 --- a/igloo_core/src/igloo_target.rs +++ b/igloo_core/src/igloo_target.rs @@ -129,6 +129,14 @@ impl IglooTarget Ok(ret_target) } + // Verifies target is valid and exists within the project + // This means the target must have a folder in the targets folder + // and a .toml + pub fn target_from_existing(prj: &IglooProject, name: String) -> Result + { + + } + /// Creates the target's configuration file from itself /// the target must be valid at this point or else the file will be junk pub fn generate(&self, project: &IglooProject) -> IglooStatus diff --git a/igloo_core/src/lib.rs b/igloo_core/src/lib.rs index 92333ad..dbd196a 100644 --- a/igloo_core/src/lib.rs +++ b/igloo_core/src/lib.rs @@ -113,7 +113,7 @@ impl Igloo } IT_BUILD => { - + res_err = igloo_action::ia_build(self); } IT_ERASE => { diff --git a/igloo_util/src/lib.rs b/igloo_util/src/lib.rs index 15c207c..0db0897 100644 --- a/igloo_util/src/lib.rs +++ b/igloo_util/src/lib.rs @@ -64,6 +64,7 @@ pub enum IglooStatus IS_FAILED_TO_EXTRACT_MF_VAR, IS_FAILED_TO_WRITE_MF_VAR, IS_FAILED_TO_CREATE_SYMLINK, + IS_NOT_IGLOO_DIRECTORY, IS_NONE, } diff --git a/src/main.rs b/src/main.rs index 2f48fb3..8860a7c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,6 +9,7 @@ use igloo_util::IglooDebugSeverity::{self, *}; use igloo_util::IglooStatus::{self, *}; use igloo_util::IglooType::{self, *}; use igloo_util::TRACE_LEVEL; + fn main() { let mut ig = Igloo::new();