1
0

Add forge data to main version info

This commit is contained in:
Jai A
2021-11-08 20:17:20 -07:00
parent e91f8f693b
commit 0990ac4fc1
3 changed files with 21 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "daedalus"
version = "0.1.4"
version = "0.1.5"
authors = ["Jai A <jaiagr+gpg@pm.me>"]
edition = "2018"
license = "MIT"

View File

@@ -1,3 +1,4 @@
use crate::modded::{Processor, SidedDataEntry};
use crate::{download_file, Error};
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
@@ -51,9 +52,11 @@ pub struct Version {
pub sha1: String,
/// Whether the version supports the latest player safety features
pub compliance_level: u32,
#[serde(skip_serializing_if = "Option::is_none")]
/// (Modrinth Provided) The link to the assets index for this version
/// This is only available when using the Modrinth mirror
pub assets_index_url: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
/// (Modrinth Provided) The SHA1 hash of the assets index for this version
/// This is only available when using the Modrinth mirror
pub assets_index_sha1: Option<String>,
@@ -147,8 +150,10 @@ pub struct LibraryDownload {
#[derive(Serialize, Deserialize, Debug)]
/// A list of files that should be downloaded for libraries
pub struct LibraryDownloads {
#[serde(skip_serializing_if = "Option::is_none")]
/// The primary library artifact
pub artifact: Option<LibraryDownload>,
#[serde(skip_serializing_if = "Option::is_none")]
/// Conditional files that may be needed to be downloaded alongside the library
/// The HashMap key specifies a classifier as additional information for downloading files
pub classifiers: Option<HashMap<String, LibraryDownload>>,
@@ -315,6 +320,12 @@ pub struct VersionInfo {
#[serde(rename = "type")]
/// The type of version
pub type_: VersionType,
#[serde(skip_serializing_if = "Option::is_none")]
/// (Forge-only)
pub data: Option<HashMap<String, SidedDataEntry>>,
#[serde(skip_serializing_if = "Option::is_none")]
/// (Forge-only) The list of processors to run after downloading the files
pub processors: Option<Vec<Processor>>,
}
/// Fetches detailed information about a version from the manifest

View File

@@ -31,10 +31,13 @@ pub struct PartialVersionInfo {
pub release_time: DateTime<Utc>,
/// The latest time a file in this version was updated
pub time: DateTime<Utc>,
#[serde(skip_serializing_if = "Option::is_none")]
/// The classpath to the main class to launch the game
pub main_class: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
/// (Legacy) Arguments passed to the game
pub minecraft_arguments: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
/// Arguments passed to the game or JVM
pub arguments: Option<HashMap<ArgumentType, Vec<Argument>>>,
/// Libraries that the version depends on
@@ -42,8 +45,10 @@ pub struct PartialVersionInfo {
#[serde(rename = "type")]
/// The type of version
pub type_: VersionType,
#[serde(skip_serializing_if = "Option::is_none")]
/// (Forge-only)
pub data: Option<HashMap<String, SidedDataEntry>>,
#[serde(skip_serializing_if = "Option::is_none")]
/// (Forge-only) The list of processors to run after downloading the files
pub processors: Option<Vec<Processor>>,
}
@@ -57,8 +62,10 @@ pub struct Processor {
pub classpath: Vec<String>,
/// Arguments for this processor.
pub args: Vec<String>,
#[serde(skip_serializing_if = "Option::is_none")]
/// Represents a map of outputs. Keys and values can be data values
pub outputs: Option<HashMap<String, String>>,
#[serde(skip_serializing_if = "Option::is_none")]
/// Which sides this processor shall be ran on.
/// Valid values: client, server, extract
pub sides: Option<Vec<String>>,
@@ -120,6 +127,8 @@ pub fn merge_partial_version(partial: PartialVersionInfo, merge: VersionInfo) ->
release_time: partial.release_time,
time: partial.time,
type_: partial.type_,
data: partial.data,
processors: partial.processors,
}
}