Add $properties to project nodes, unsure the full ramifications yet

This commit is contained in:
Lucien Greathouse
2018-11-27 23:08:37 -08:00
parent 49a2bc8ace
commit bcd5fab33c

View File

@@ -7,6 +7,7 @@ use std::{
}; };
use serde_json; use serde_json;
use rbx_tree::RbxValue;
pub static PROJECT_FILENAME: &'static str = "roblox-project.json"; pub static PROJECT_FILENAME: &'static str = "roblox-project.json";
@@ -17,6 +18,9 @@ enum SourceProjectNode {
#[serde(rename = "$className")] #[serde(rename = "$className")]
class_name: String, class_name: String,
#[serde(rename = "$properties", default="HashMap::new")]
properties: HashMap<String, RbxValue>,
// #[serde(rename = "$ignoreUnknown", default = "false")] // #[serde(rename = "$ignoreUnknown", default = "false")]
// ignore_unknown: bool, // ignore_unknown: bool,
@@ -32,7 +36,7 @@ enum SourceProjectNode {
impl SourceProjectNode { impl SourceProjectNode {
pub fn into_project_node(self, project_file_location: &Path) -> ProjectNode { pub fn into_project_node(self, project_file_location: &Path) -> ProjectNode {
match self { match self {
SourceProjectNode::Instance { class_name, mut children } => { SourceProjectNode::Instance { class_name, mut children, properties } => {
let mut new_children = HashMap::new(); let mut new_children = HashMap::new();
for (node_name, node) in children.drain() { for (node_name, node) in children.drain() {
@@ -42,6 +46,7 @@ impl SourceProjectNode {
ProjectNode::Instance(InstanceProjectNode { ProjectNode::Instance(InstanceProjectNode {
class_name, class_name,
children: new_children, children: new_children,
properties,
}) })
}, },
SourceProjectNode::SyncPoint { path: source_path } => { SourceProjectNode::SyncPoint { path: source_path } => {
@@ -150,7 +155,7 @@ pub enum ProjectNode {
pub struct InstanceProjectNode { pub struct InstanceProjectNode {
pub class_name: String, pub class_name: String,
pub children: HashMap<String, ProjectNode>, pub children: HashMap<String, ProjectNode>,
// properties: HashMap<String, RbxValue>, pub properties: HashMap<String, RbxValue>,
// ignore_unknown: bool, // ignore_unknown: bool,
} }