mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-20 20:55:50 +00:00
Upgrade to rbx_tree and friends 0.1.0
This commit is contained in:
22
Cargo.lock
generated
22
Cargo.lock
generated
@@ -1114,18 +1114,18 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rbx_binary"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/LPGhatguy/rbx-tree.git?rev=8442d57a7a21072a380134962724281d044c65ad#8442d57a7a21072a380134962724281d044c65ad"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"byteorder 1.2.7 (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_tree 0.1.0 (git+https://github.com/LPGhatguy/rbx-tree.git?rev=8442d57a7a21072a380134962724281d044c65ad)",
|
||||
"rbx_tree 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rbx_tree"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/LPGhatguy/rbx-tree.git?rev=8442d57a7a21072a380134962724281d044c65ad#8442d57a7a21072a380134962724281d044c65ad"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1135,10 +1135,10 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rbx_xml"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/LPGhatguy/rbx-tree.git?rev=8442d57a7a21072a380134962724281d044c65ad#8442d57a7a21072a380134962724281d044c65ad"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rbx_tree 0.1.0 (git+https://github.com/LPGhatguy/rbx-tree.git?rev=8442d57a7a21072a380134962724281d044c65ad)",
|
||||
"rbx_tree 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -1233,9 +1233,9 @@ dependencies = [
|
||||
"maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"notify 4.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rbx_binary 0.1.0 (git+https://github.com/LPGhatguy/rbx-tree.git?rev=8442d57a7a21072a380134962724281d044c65ad)",
|
||||
"rbx_tree 0.1.0 (git+https://github.com/LPGhatguy/rbx-tree.git?rev=8442d57a7a21072a380134962724281d044c65ad)",
|
||||
"rbx_xml 0.1.0 (git+https://github.com/LPGhatguy/rbx-tree.git?rev=8442d57a7a21072a380134962724281d044c65ad)",
|
||||
"rbx_binary 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rbx_tree 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rbx_xml 0.1.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.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rouille 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1983,9 +1983,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum rand_os 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f46fbd5550acf75b0c2730f5dd1873751daf9beb8f11b44027778fae50d7feca"
|
||||
"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.1.0 (git+https://github.com/LPGhatguy/rbx-tree.git?rev=8442d57a7a21072a380134962724281d044c65ad)" = "<none>"
|
||||
"checksum rbx_tree 0.1.0 (git+https://github.com/LPGhatguy/rbx-tree.git?rev=8442d57a7a21072a380134962724281d044c65ad)" = "<none>"
|
||||
"checksum rbx_xml 0.1.0 (git+https://github.com/LPGhatguy/rbx-tree.git?rev=8442d57a7a21072a380134962724281d044c65ad)" = "<none>"
|
||||
"checksum rbx_binary 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "646399297679f409cdc669b1b7b38a4f31cf97f1f5b6b2d56b5f03eaed8fa468"
|
||||
"checksum rbx_tree 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea5723859bf48caa1ae9fdb94dbd24dd436d17543147081fca2862446bcaaec7"
|
||||
"checksum rbx_xml 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cdc27210e7e234f5af5af22f55c280a07fcc12566c37446d5b4fd0ae39ddea78"
|
||||
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
|
||||
"checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2"
|
||||
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
||||
|
||||
@@ -35,9 +35,9 @@ serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_json = "1.0"
|
||||
uuid = { version = "0.7", features = ["v4", "serde"] }
|
||||
rbx_tree = { rev = "8442d57a7a21072a380134962724281d044c65ad", git = "https://github.com/LPGhatguy/rbx-tree.git" }
|
||||
rbx_xml = { rev = "8442d57a7a21072a380134962724281d044c65ad", git = "https://github.com/LPGhatguy/rbx-tree.git" }
|
||||
rbx_binary = { rev = "8442d57a7a21072a380134962724281d044c65ad", git = "https://github.com/LPGhatguy/rbx-tree.git" }
|
||||
rbx_tree = "0.1.0"
|
||||
rbx_xml = "0.1.0"
|
||||
rbx_binary = "0.1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3.0"
|
||||
|
||||
@@ -52,6 +52,9 @@ pub enum BuildError {
|
||||
|
||||
#[fail(display = "XML model file error")]
|
||||
XmlModelEncodeError(rbx_xml::EncodeError),
|
||||
|
||||
#[fail(display = "Binary model file error")]
|
||||
BinaryModelEncodeError(rbx_binary::EncodeError)
|
||||
}
|
||||
|
||||
impl From<ProjectLoadFuzzyError> for BuildError {
|
||||
@@ -72,6 +75,12 @@ impl From<rbx_xml::EncodeError> for BuildError {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<rbx_binary::EncodeError> for BuildError {
|
||||
fn from(error: rbx_binary::EncodeError) -> BuildError {
|
||||
BuildError::BinaryModelEncodeError(error)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn build(options: &BuildOptions) -> Result<(), BuildError> {
|
||||
let output_kind = options.output_kind
|
||||
.or_else(|| detect_output_kind(options))
|
||||
|
||||
@@ -9,7 +9,7 @@ use std::{
|
||||
|
||||
use failure::Fail;
|
||||
|
||||
use rbx_tree::{RbxTree, RbxInstance, RbxValue, RbxId};
|
||||
use rbx_tree::{RbxTree, RbxInstanceProperties, RbxValue, RbxId};
|
||||
|
||||
use crate::{
|
||||
project::{Project, ProjectNode, InstanceProjectNodeMetadata},
|
||||
@@ -346,7 +346,7 @@ fn snapshot_xml_model<'a>(
|
||||
instance_name: Cow<'a, str>,
|
||||
file: &ImfsFile,
|
||||
) -> Result<Option<RbxSnapshotInstance<'a>>, SnapshotError> {
|
||||
let mut temp_tree = RbxTree::new(RbxInstance {
|
||||
let mut temp_tree = RbxTree::new(RbxInstanceProperties {
|
||||
name: "Temp".to_owned(),
|
||||
class_name: "Folder".to_owned(),
|
||||
properties: HashMap::new(),
|
||||
@@ -377,7 +377,7 @@ fn snapshot_binary_model<'a>(
|
||||
instance_name: Cow<'a, str>,
|
||||
file: &ImfsFile,
|
||||
) -> Result<Option<RbxSnapshotInstance<'a>>, SnapshotError> {
|
||||
let mut temp_tree = RbxTree::new(RbxInstance {
|
||||
let mut temp_tree = RbxTree::new(RbxInstanceProperties {
|
||||
name: "Temp".to_owned(),
|
||||
class_name: "Folder".to_owned(),
|
||||
properties: HashMap::new(),
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::{
|
||||
path::PathBuf,
|
||||
};
|
||||
|
||||
use rbx_tree::{RbxTree, RbxId, RbxInstance, RbxValue};
|
||||
use rbx_tree::{RbxTree, RbxId, RbxInstanceProperties, RbxValue};
|
||||
|
||||
use crate::{
|
||||
path_map::PathMap,
|
||||
@@ -159,14 +159,14 @@ pub fn reconcile_subtree(
|
||||
reconcile_instance_children(tree, id, snapshot, path_map, instance_metadata_map, changes);
|
||||
}
|
||||
|
||||
fn reify_core(snapshot: &RbxSnapshotInstance) -> RbxInstance {
|
||||
fn reify_core(snapshot: &RbxSnapshotInstance) -> RbxInstanceProperties {
|
||||
let mut properties = HashMap::new();
|
||||
|
||||
for (key, value) in &snapshot.properties {
|
||||
properties.insert(key.clone(), value.clone());
|
||||
}
|
||||
|
||||
let instance = RbxInstance {
|
||||
let instance = RbxInstanceProperties {
|
||||
name: snapshot.name.to_string(),
|
||||
class_name: snapshot.class_name.to_string(),
|
||||
properties,
|
||||
@@ -175,7 +175,7 @@ fn reify_core(snapshot: &RbxSnapshotInstance) -> RbxInstance {
|
||||
instance
|
||||
}
|
||||
|
||||
fn reconcile_instance_properties(instance: &mut RbxInstance, snapshot: &RbxSnapshotInstance) -> bool {
|
||||
fn reconcile_instance_properties(instance: &mut RbxInstanceProperties, snapshot: &RbxSnapshotInstance) -> bool {
|
||||
let mut has_diffs = false;
|
||||
|
||||
if instance.name != snapshot.name {
|
||||
|
||||
@@ -10,7 +10,7 @@ use rouille::{
|
||||
Request,
|
||||
Response,
|
||||
};
|
||||
use rbx_tree::{RbxId, RootedRbxInstance};
|
||||
use rbx_tree::{RbxId, RbxInstance};
|
||||
|
||||
use crate::{
|
||||
session::Session,
|
||||
@@ -28,7 +28,7 @@ use crate::{
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct InstanceWithMetadata<'a> {
|
||||
#[serde(flatten)]
|
||||
pub instance: Cow<'a, RootedRbxInstance>,
|
||||
pub instance: Cow<'a, RbxInstance>,
|
||||
|
||||
#[serde(rename = "Metadata")]
|
||||
pub metadata: Option<Cow<'a, InstanceProjectNodeMetadata>>,
|
||||
|
||||
Reference in New Issue
Block a user