Alive and working, all tests pass

This commit is contained in:
Lucien Greathouse 2019-02-26 14:34:46 -08:00
parent 55b17eaec5
commit e056934e21
6 changed files with 33 additions and 20 deletions

18
Cargo.lock generated
View file

@ -1029,12 +1029,12 @@ dependencies = [
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lz4 1.23.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rbx_dom_weak 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rbx_dom_weak 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rbx_dom_weak"
version = "0.3.0"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1044,12 +1044,12 @@ dependencies = [
[[package]]
name = "rbx_reflection"
version = "0.2.373"
version = "1.0.373"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rbx_dom_weak 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rbx_dom_weak 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1062,7 +1062,7 @@ dependencies = [
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rbx_dom_weak 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rbx_dom_weak 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1195,8 +1195,8 @@ dependencies = [
"pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rbx_binary 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rbx_dom_weak 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rbx_reflection 0.2.373 (registry+https://github.com/rust-lang/crates.io-index)",
"rbx_dom_weak 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rbx_reflection 1.0.373 (registry+https://github.com/rust-lang/crates.io-index)",
"rbx_xml 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"reqwest 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1859,8 +1859,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05"
"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
"checksum rbx_binary 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c4d3bffbec1f20f66684448e46ef45dad2fbf1185c3d8f3e29018f027484ffc"
"checksum rbx_dom_weak 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a67bbec623f2f12992dbf2e647deb3fe38613d4f874a8feeae566a931bebe63a"
"checksum rbx_reflection 0.2.373 (registry+https://github.com/rust-lang/crates.io-index)" = "ca97579a12bbf53c76faf09bc5847ae0f14e372d7c7f4c0b68f1c8a2949af28c"
"checksum rbx_dom_weak 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "673606053dba942f6c4607661c423424711a60cb40481f1e20c55acc21f53a38"
"checksum rbx_reflection 1.0.373 (registry+https://github.com/rust-lang/crates.io-index)" = "b37499dc2e097063be0eff716f54fb060ef3beb732e5f699b56feb6d9aa2442b"
"checksum rbx_xml 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2b394e64979c52190e6462dd81d5b2258cdfb7e3891cefaff5d3c4af7cdc07b5"
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
"checksum redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)" = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85"

View file

@ -31,9 +31,9 @@ maplit = "1.0.1"
notify = "4.0"
rand = "0.4"
rbx_binary = "0.3.0"
rbx_dom_weak = "0.3.0"
rbx_dom_weak = "0.3.1"
rbx_xml = "0.3.0"
rbx_reflection = "0.2.373"
rbx_reflection = "1.0.373"
regex = "1.0"
reqwest = "0.9.5"
rlua = "0.16"

View file

@ -64,7 +64,7 @@ struct SourceProjectNode {
class_name: Option<String>,
#[serde(rename = "$properties", default = "HashMap::new", skip_serializing_if = "HashMap::is_empty")]
properties: HashMap<String, RbxValue>,
properties: HashMap<String, UnresolvedRbxValue>,
#[serde(rename = "$ignoreUnknownInstances", skip_serializing_if = "Option::is_none")]
ignore_unknown_instances: Option<bool>,
@ -188,7 +188,7 @@ pub enum ProjectSaveError {
pub struct ProjectNode {
pub class_name: Option<String>,
pub children: HashMap<String, ProjectNode>,
pub properties: HashMap<String, RbxValue>,
pub properties: HashMap<String, UnresolvedRbxValue>,
pub ignore_unknown_instances: Option<bool>,
#[serde(serialize_with = "crate::path_serializer::serialize_option")]
@ -284,7 +284,7 @@ impl Project {
properties: hashmap! {
String::from("HttpEnabled") => RbxValue::Bool {
value: true,
},
}.into(),
},
..Default::default()
},

View file

@ -15,6 +15,7 @@ use log::info;
use maplit::hashmap;
use rbx_dom_weak::{RbxTree, RbxValue, RbxInstanceProperties};
use serde_derive::{Serialize, Deserialize};
use rbx_reflection::{try_resolve_value, ValueResolveError};
use crate::{
imfs::{
@ -119,6 +120,19 @@ pub enum SnapshotError {
ProjectNodeInvalidTransmute {
partition_path: PathBuf,
},
PropertyResolveError {
#[fail(cause)]
inner: ValueResolveError,
},
}
impl From<ValueResolveError> for SnapshotError {
fn from(inner: ValueResolveError) -> SnapshotError {
SnapshotError::PropertyResolveError {
inner,
}
}
}
impl fmt::Display for SnapshotError {
@ -147,6 +161,7 @@ impl fmt::Display for SnapshotError {
writeln!(output, "")?;
writeln!(output, "Partition target ($path): {}", partition_path.display())
},
SnapshotError::PropertyResolveError { inner } => write!(output, "{}", inner),
}
}
}
@ -226,7 +241,8 @@ pub fn snapshot_project_node<'source>(
}
for (key, value) in &node.properties {
snapshot.properties.insert(key.clone(), value.clone());
let resolved_value = try_resolve_value(&snapshot.class_name, key, value)?;
snapshot.properties.insert(key.clone(), resolved_value);
}
if let Some(ignore_unknown_instances) = node.ignore_unknown_instances {

View file

@ -65,7 +65,7 @@ fn single_partition_game() {
let mut http_service_properties = HashMap::new();
http_service_properties.insert("HttpEnabled".to_string(), RbxValue::Bool {
value: true,
});
}.into());
let http_service = ProjectNode {
class_name: Some(String::from("HttpService")),

View file

@ -11,10 +11,7 @@
"HttpService": {
"$className": "HttpService",
"$properties": {
"HttpEnabled": {
"Type": "Bool",
"Value": true
}
"HttpEnabled": true
}
}
}