forked from rojo-rbx/rojo
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:
committed by
GitHub
parent
b84aab0960
commit
59ef5f05ea
@@ -1,6 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use rbx_dom_weak::RbxId;
|
||||
use rbx_dom_weak::types::Ref;
|
||||
use serde::Serialize;
|
||||
|
||||
use librojo::web_api::{Instance, InstanceUpdate, ReadResponse, SubscribeResponse};
|
||||
@@ -31,8 +31,8 @@ pub trait Internable<T> {
|
||||
fn intern(&self, redactions: &mut RedactionMap, extra: T);
|
||||
}
|
||||
|
||||
impl Internable<RbxId> for ReadResponse<'_> {
|
||||
fn intern(&self, redactions: &mut RedactionMap, root_id: RbxId) {
|
||||
impl Internable<Ref> for ReadResponse<'_> {
|
||||
fn intern(&self, redactions: &mut RedactionMap, root_id: Ref) {
|
||||
redactions.intern(root_id);
|
||||
|
||||
let root_instance = self.instances.get(&root_id).unwrap();
|
||||
@@ -43,12 +43,8 @@ impl Internable<RbxId> for ReadResponse<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Internable<&'a HashMap<RbxId, Instance<'_>>> for Instance<'a> {
|
||||
fn intern(
|
||||
&self,
|
||||
redactions: &mut RedactionMap,
|
||||
other_instances: &HashMap<RbxId, Instance<'_>>,
|
||||
) {
|
||||
impl<'a> Internable<&'a HashMap<Ref, Instance<'_>>> for Instance<'a> {
|
||||
fn intern(&self, redactions: &mut RedactionMap, other_instances: &HashMap<Ref, Instance<'_>>) {
|
||||
redactions.intern(self.id);
|
||||
|
||||
for child_id in self.children.iter() {
|
||||
@@ -75,7 +71,7 @@ fn intern_instance_updates(redactions: &mut RedactionMap, updates: &[InstanceUpd
|
||||
|
||||
fn intern_instance_additions(
|
||||
redactions: &mut RedactionMap,
|
||||
additions: &HashMap<RbxId, Instance<'_>>,
|
||||
additions: &HashMap<Ref, Instance<'_>>,
|
||||
) {
|
||||
// This method redacts in a deterministic order from a HashMap by collecting
|
||||
// all of the instances that are direct children of instances we've already
|
||||
@@ -83,7 +79,7 @@ fn intern_instance_additions(
|
||||
let mut added_roots = Vec::new();
|
||||
|
||||
for (id, added) in additions {
|
||||
let parent_id = added.parent.unwrap();
|
||||
let parent_id = added.parent;
|
||||
let parent_redacted = redactions.get_redacted_value(parent_id);
|
||||
|
||||
// Here, we assume that instances are only added to other instances that
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::{
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use rbx_dom_weak::RbxId;
|
||||
use rbx_dom_weak::types::Ref;
|
||||
|
||||
use tempfile::{tempdir, TempDir};
|
||||
|
||||
@@ -146,7 +146,7 @@ impl TestServeSession {
|
||||
Ok(serde_json::from_str(&body).expect("Server returned malformed response"))
|
||||
}
|
||||
|
||||
pub fn get_api_read(&self, id: RbxId) -> Result<ReadResponse, reqwest::Error> {
|
||||
pub fn get_api_read(&self, id: Ref) -> Result<ReadResponse, reqwest::Error> {
|
||||
let url = format!("http://localhost:{}/api/read/{}", self.port, id);
|
||||
let body = reqwest::get(&url)?.text()?;
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ gen_build_tests! {
|
||||
server_init,
|
||||
txt,
|
||||
txt_in_folder,
|
||||
unresolved_values,
|
||||
}
|
||||
|
||||
fn run_build_test(test_name: &str) {
|
||||
|
||||
Reference in New Issue
Block a user