forked from rojo-rbx/rojo
Use rbx_xml 0.9.0's config to read unknown properties
This commit is contained in:
@@ -74,6 +74,11 @@ impl_from!(BuildError {
|
|||||||
SnapshotError => SnapshotError,
|
SnapshotError => SnapshotError,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fn xml_encode_config() -> rbx_xml::EncodeOptions {
|
||||||
|
rbx_xml::EncodeOptions::new()
|
||||||
|
.property_behavior(rbx_xml::EncodePropertyBehavior::WriteUnknown)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn build(options: &BuildOptions) -> Result<(), BuildError> {
|
pub fn build(options: &BuildOptions) -> Result<(), BuildError> {
|
||||||
let output_kind = options.output_kind
|
let output_kind = options.output_kind
|
||||||
.or_else(|| detect_output_kind(options))
|
.or_else(|| detect_output_kind(options))
|
||||||
@@ -100,7 +105,7 @@ pub fn build(options: &BuildOptions) -> Result<(), BuildError> {
|
|||||||
// descendants.
|
// descendants.
|
||||||
|
|
||||||
let root_id = tree.get_root_id();
|
let root_id = tree.get_root_id();
|
||||||
rbx_xml::to_writer_default(&mut file, &tree, &[root_id])?;
|
rbx_xml::to_writer(&mut file, &tree, &[root_id], xml_encode_config())?;
|
||||||
},
|
},
|
||||||
OutputKind::Rbxlx => {
|
OutputKind::Rbxlx => {
|
||||||
// Place files don't contain an entry for the DataModel, but our
|
// Place files don't contain an entry for the DataModel, but our
|
||||||
@@ -108,7 +113,7 @@ pub fn build(options: &BuildOptions) -> Result<(), BuildError> {
|
|||||||
|
|
||||||
let root_id = tree.get_root_id();
|
let root_id = tree.get_root_id();
|
||||||
let top_level_ids = tree.get_instance(root_id).unwrap().get_children_ids();
|
let top_level_ids = tree.get_instance(root_id).unwrap().get_children_ids();
|
||||||
rbx_xml::to_writer_default(&mut file, &tree, top_level_ids)?;
|
rbx_xml::to_writer(&mut file, &tree, top_level_ids, xml_encode_config())?;
|
||||||
},
|
},
|
||||||
OutputKind::Rbxm => {
|
OutputKind::Rbxm => {
|
||||||
let root_id = tree.get_root_id();
|
let root_id = tree.get_root_id();
|
||||||
|
|||||||
@@ -653,7 +653,10 @@ fn snapshot_xml_model_file<'source>(
|
|||||||
.file_stem().expect("Could not extract file stem")
|
.file_stem().expect("Could not extract file stem")
|
||||||
.to_str().expect("Could not convert path to UTF-8");
|
.to_str().expect("Could not convert path to UTF-8");
|
||||||
|
|
||||||
let temp_tree = rbx_xml::from_reader_default(file.contents.as_slice())
|
let options = rbx_xml::DecodeOptions::new()
|
||||||
|
.property_behavior(rbx_xml::DecodePropertyBehavior::ReadUnknown);
|
||||||
|
|
||||||
|
let temp_tree = rbx_xml::from_reader(file.contents.as_slice(), options)
|
||||||
.map_err(|inner| SnapshotError::XmlModelDecodeError {
|
.map_err(|inner| SnapshotError::XmlModelDecodeError {
|
||||||
inner,
|
inner,
|
||||||
path: file.path.clone(),
|
path: file.path.clone(),
|
||||||
|
|||||||
Reference in New Issue
Block a user