Upgrade to rbx_dom_weak 2.0 (#377)

* Mostly mechanical port bits

* Almost there

* It builds again!

* Turn on all the code again

* Tests compiling but not passing

* Stub work for value resolution

* Implement resolution minus enums and derived properties

* Implement property descriptor resolution

* Update referent snapshots

* Update unions test project

Using a place file instead of a model yields better
error messages in Roblox Studio.

* Add easy shortcut to testing with local rbx-dom

* Update rbx-dom

* Add enum resolution

* Update init.meta.json to use UnresolvedValue

* Expand value resolution support, add test

* Filter SharedString values from web API

* Add 'property' builder method to InstanceSnapshot

* Change InstanceSnapshot/InstanceBuilder boundary

* Fix remove_file crash

* rustfmt

* Update to latest rbx_dom_lua

* Update dependencies, including rbx_dom_weak

* Update to latest rbx-dom

* Update dependencies

* Update rbx-dom, fixing more bugs

* Remove experimental warning on binary place builds

* Remove unused imports
This commit is contained in:
Lucien Greathouse
2021-02-18 20:56:09 -05:00
committed by GitHub
parent b84aab0960
commit 59ef5f05ea
63 changed files with 45602 additions and 21004 deletions

View File

@@ -1,11 +1,10 @@
use insta::assert_yaml_snapshot;
use maplit::hashmap;
use rbx_dom_weak::{RbxInstanceProperties, RbxValue};
use rojo_insta_ext::RedactionMap;
use crate::{
snapshot::{apply_patch_set, InstancePropertiesWithMeta, PatchSet, PatchUpdate, RojoTree},
snapshot::{apply_patch_set, InstanceSnapshot, PatchSet, PatchUpdate, RojoTree},
tree_view::{intern_tree, view_tree},
};
@@ -49,9 +48,7 @@ fn add_property() {
changed_name: None,
changed_class_name: None,
changed_properties: hashmap! {
"Foo".to_owned() => Some(RbxValue::String {
value: "Value of Foo".to_owned(),
}),
"Foo".to_owned() => Some("Value of Foo".into()),
},
changed_metadata: None,
}],
@@ -78,12 +75,9 @@ fn remove_property() {
let root_id = tree.get_root_id();
let mut root_instance = tree.get_instance_mut(root_id).unwrap();
root_instance.properties_mut().insert(
"Foo".to_owned(),
RbxValue::String {
value: "Should be removed".to_owned(),
},
);
root_instance
.properties_mut()
.insert("Foo".to_owned(), "Should be removed".into());
}
let tree_view = view_tree(&tree, &mut redactions);
@@ -112,12 +106,5 @@ fn remove_property() {
}
fn empty_tree() -> RojoTree {
RojoTree::new(InstancePropertiesWithMeta {
properties: RbxInstanceProperties {
name: "ROOT".to_owned(),
class_name: "ROOT".to_owned(),
properties: Default::default(),
},
metadata: Default::default(),
})
RojoTree::new(InstanceSnapshot::new().name("ROOT").class_name("ROOT"))
}

View File

@@ -2,11 +2,10 @@ use std::borrow::Cow;
use insta::assert_yaml_snapshot;
use maplit::hashmap;
use rbx_dom_weak::{RbxInstanceProperties, RbxValue};
use rojo_insta_ext::RedactionMap;
use crate::snapshot::{compute_patch_set, InstancePropertiesWithMeta, InstanceSnapshot, RojoTree};
use crate::snapshot::{compute_patch_set, InstanceSnapshot, RojoTree};
#[test]
fn set_name_and_class_name() {
@@ -43,9 +42,7 @@ fn set_property() {
name: Cow::Borrowed("ROOT"),
class_name: Cow::Borrowed("ROOT"),
properties: hashmap! {
"PropertyName".to_owned() => RbxValue::String {
value: "Hello, world!".to_owned(),
},
"PropertyName".to_owned() => "Hello, world!".into(),
},
children: Vec::new(),
};
@@ -68,9 +65,7 @@ fn remove_property() {
let mut root_instance = tree.get_instance_mut(root_id).unwrap();
root_instance.properties_mut().insert(
"Foo".to_owned(),
RbxValue::String {
value: "This should be removed by the patch.".to_owned(),
},
"This should be removed by the patch.".into(),
);
}
@@ -128,15 +123,8 @@ fn remove_child() {
{
let root_id = tree.get_root_id();
let new_id = tree.insert_instance(
InstancePropertiesWithMeta {
properties: RbxInstanceProperties {
name: "Should not appear in snapshot".to_owned(),
class_name: "Folder".to_owned(),
properties: Default::default(),
},
metadata: Default::default(),
},
root_id,
InstanceSnapshot::new().name("Should not appear in snapshot"),
);
redactions.intern(new_id);
@@ -158,12 +146,5 @@ fn remove_child() {
}
fn empty_tree() -> RojoTree {
RojoTree::new(InstancePropertiesWithMeta {
properties: RbxInstanceProperties {
name: "ROOT".to_owned(),
class_name: "ROOT".to_owned(),
properties: Default::default(),
},
metadata: Default::default(),
})
RojoTree::new(InstanceSnapshot::new().name("ROOT").class_name("ROOT"))
}