diff --git a/src/main.rs b/src/main.rs index 4d39674..d7d767a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -416,7 +416,6 @@ async fn main() -> Result<(), anyhow::Error> { )) }; - println!("jar path: {:?}", &jar_path); if file_name.ends_with("-sources.jar") { possible_sources_jars.push(jar_path) } else if file_name.ends_with(".jar") { @@ -476,8 +475,14 @@ async fn main() -> Result<(), anyhow::Error> { &*loader_file_string )?; - println!("Mod Version: {}", parsed_loader_file["version"]); - println!("Mod ID: {}", parsed_loader_file["id"]); + // println!("Mod Version: {}", parsed_loader_file["version"]); + // println!("Mod ID: {}", parsed_loader_file["id"]); + + for dependency in config_file.modrinth.dependencies { + println!("Project ID: {:?}", &dependency.project_id); + println!("Version ID: {:?}", &dependency.version_id); + println!("Dependency Type: {:?}", &dependency.dependency_type) + } clean_up(&tmp_info.dir_path)? diff --git a/src/models/meta.rs b/src/models/meta.rs deleted file mode 100644 index 8b13789..0000000 --- a/src/models/meta.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/models/mod.rs b/src/models/mod.rs index bc9a90e..c7334ed 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -1,7 +1,6 @@ use serde::{Deserialize, Serialize}; pub mod github; -pub mod meta; pub mod modrinth; pub mod project_type; pub mod util; @@ -13,6 +12,9 @@ pub struct GithubConfig { pub repo_name: String } +// Eventually should be moved to models::project_type::modpack::config +// unnecessary for now, but should be moved before project types other than modpacks +// and mods are implemented. #[derive(Debug, Serialize, Deserialize, Clone)] pub struct ModrinthConfig { pub project_id: String, diff --git a/src/models/modrinth/mod.rs b/src/models/modrinth/mod.rs index b1263e3..39e0a38 100644 --- a/src/models/modrinth/mod.rs +++ b/src/models/modrinth/mod.rs @@ -81,13 +81,10 @@ pub struct GalleryObject { } #[derive(Debug, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] pub enum DependencyType { - #[serde(rename = "required")] REQUIRED, - #[serde(rename = "optional")] OPTIONAL, - #[serde(rename = "incompatible")] INCOMPATIBLE, - #[serde(rename = "embedded")] EMBEDDED } diff --git a/src/models/project_type/mc_mod/config.rs b/src/models/project_type/mc_mod/config/mod.rs similarity index 66% rename from src/models/project_type/mc_mod/config.rs rename to src/models/project_type/mc_mod/config/mod.rs index 386a119..d5df858 100644 --- a/src/models/project_type/mc_mod/config.rs +++ b/src/models/project_type/mc_mod/config/mod.rs @@ -1,7 +1,12 @@ use serde::{Serialize, Deserialize}; -use crate::models::{DiscordConfig, GithubConfig, ModrinthConfig}; -use crate::models::modrinth::Loader; +use crate::models::{ + DiscordConfig, + GithubConfig, + modrinth::Loader, + project_type::mc_mod::config::modrinth::ModrinthConfig +}; +mod modrinth; #[derive(Debug, Serialize, Deserialize)] pub struct ModConfig { diff --git a/src/models/project_type/mc_mod/config/modrinth.rs b/src/models/project_type/mc_mod/config/modrinth.rs new file mode 100644 index 0000000..f326e73 --- /dev/null +++ b/src/models/project_type/mc_mod/config/modrinth.rs @@ -0,0 +1,19 @@ +use serde::{Serialize, Deserialize}; +use crate::models::modrinth::DependencyType; + + +#[derive(Debug, Serialize, Deserialize)] +pub struct ModrinthConfig { + pub project_id: String, + pub staging: Option, + #[serde(rename = "dependency")] + pub dependencies: Vec +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct ModrinthDependency { + pub version_id: Option, + pub project_id: Option, + pub dependency_type: DependencyType +} + diff --git a/test_projects/mod/peony_mod.toml b/test_projects/mod/peony_mod.toml index 464d60c..b819154 100644 --- a/test_projects/mod/peony_mod.toml +++ b/test_projects/mod/peony_mod.toml @@ -2,14 +2,27 @@ config_format_version = 1 version_name_format = "[%mc_version%] %project_name% v%project_version% - %loader%" loaders = ["fabric", "quilt"] + [modrinth] project_id = "2jZzXrpV" staging = true +[[modrinth.dependency]] +version_id = "aegpoin" +project_id = "2jZzXrpV" +dependency_type = "optional" + +[[modrinth.dependency]] +version_id = "aegpoin" +project_id = "2jZzXrpV" +dependency_type = "required" + + [github] repo_owner = "LilydevMC" repo_name = "mrpack-dist-test" + [discord] github_emoji_id = "<:github_light:1000525612911444118>" modrinth_emoji_id = "<:modrinth:1000522854766497813>"