From f47b1c00ee6c55f98f1858db6d6bc1fc1a4bed0e Mon Sep 17 00:00:00 2001 From: andriyDev Date: Fri, 13 Jun 2025 12:54:31 -0700 Subject: [PATCH] Bump ron version to 0.10. (#19631) # Objective - Update ron to the latest version. - This is blocking changes to AnimationGraph (as some valid structs are not capable of being deserialized). ## Solution - Bump ron! ## Testing - The particular issue I was blocked by seems to be resolved! --- Cargo.toml | 2 +- crates/bevy_animation/Cargo.toml | 2 +- crates/bevy_animation/src/graph.rs | 3 ++- crates/bevy_asset/Cargo.toml | 2 +- crates/bevy_dev_tools/Cargo.toml | 2 +- crates/bevy_reflect/Cargo.toml | 2 +- crates/bevy_reflect/src/serde/ser/processor.rs | 8 ++++---- examples/animation/animation_graph.rs | 14 ++++++++------ tools/example-showcase/Cargo.toml | 2 +- 9 files changed, 20 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1dd5410428..ed2b369f5f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -562,7 +562,7 @@ bevy_dylib = { path = "crates/bevy_dylib", version = "0.16.0-dev", default-featu [dev-dependencies] rand = "0.8.0" rand_chacha = "0.3.1" -ron = "0.8.0" +ron = "0.10" flate2 = "1.0" serde = { version = "1", features = ["derive"] } serde_json = "1.0.140" diff --git a/crates/bevy_animation/Cargo.toml b/crates/bevy_animation/Cargo.toml index 9f9cd26587..9db4a97fd0 100644 --- a/crates/bevy_animation/Cargo.toml +++ b/crates/bevy_animation/Cargo.toml @@ -32,7 +32,7 @@ bevy_platform = { path = "../bevy_platform", version = "0.16.0-dev", default-fea # other petgraph = { version = "0.7", features = ["serde-1"] } -ron = "0.8" +ron = "0.10" serde = "1" blake3 = { version = "1.0" } downcast-rs = { version = "2", default-features = false, features = ["std"] } diff --git a/crates/bevy_animation/src/graph.rs b/crates/bevy_animation/src/graph.rs index aa6d252fee..a5f4041ac7 100644 --- a/crates/bevy_animation/src/graph.rs +++ b/crates/bevy_animation/src/graph.rs @@ -1,10 +1,11 @@ //! The animation graph, which allows animations to be blended together. use core::{ + fmt::Write, iter, ops::{Index, IndexMut, Range}, }; -use std::io::{self, Write}; +use std::io; use bevy_asset::{ io::Reader, Asset, AssetEvent, AssetId, AssetLoader, AssetPath, Assets, Handle, LoadContext, diff --git a/crates/bevy_asset/Cargo.toml b/crates/bevy_asset/Cargo.toml index cbb138b0f5..e91987f40a 100644 --- a/crates/bevy_asset/Cargo.toml +++ b/crates/bevy_asset/Cargo.toml @@ -54,7 +54,7 @@ parking_lot = { version = "0.12", default-features = false, features = [ "arc_lock", "send_guard", ] } -ron = { version = "0.8", default-features = false } +ron = { version = "0.10", default-features = false } serde = { version = "1", default-features = false, features = ["derive"] } thiserror = { version = "2", default-features = false } derive_more = { version = "1", default-features = false, features = ["from"] } diff --git a/crates/bevy_dev_tools/Cargo.toml b/crates/bevy_dev_tools/Cargo.toml index 2250a35393..ab5a04f2b2 100644 --- a/crates/bevy_dev_tools/Cargo.toml +++ b/crates/bevy_dev_tools/Cargo.toml @@ -31,7 +31,7 @@ bevy_state = { path = "../bevy_state", version = "0.16.0-dev" } # other serde = { version = "1.0", features = ["derive"], optional = true } -ron = { version = "0.8.0", optional = true } +ron = { version = "0.10", optional = true } tracing = { version = "0.1", default-features = false, features = ["std"] } [lints] diff --git a/crates/bevy_reflect/Cargo.toml b/crates/bevy_reflect/Cargo.toml index 8827fc695b..4d72ab1d6a 100644 --- a/crates/bevy_reflect/Cargo.toml +++ b/crates/bevy_reflect/Cargo.toml @@ -114,7 +114,7 @@ wgpu-types = { version = "24", features = [ ], optional = true, default-features = false } [dev-dependencies] -ron = "0.8.0" +ron = "0.10" rmp-serde = "1.1" bincode = { version = "2.0", features = ["serde"] } serde_json = "1.0.140" diff --git a/crates/bevy_reflect/src/serde/ser/processor.rs b/crates/bevy_reflect/src/serde/ser/processor.rs index cf31ab7566..fc35ff883a 100644 --- a/crates/bevy_reflect/src/serde/ser/processor.rs +++ b/crates/bevy_reflect/src/serde/ser/processor.rs @@ -112,15 +112,15 @@ use crate::{PartialReflect, TypeRegistry}; /// } /// } /// -/// fn save(type_registry: &TypeRegistry, asset: &MyAsset) -> Result, AssetError> { -/// let mut asset_bytes = Vec::new(); +/// fn save(type_registry: &TypeRegistry, asset: &MyAsset) -> Result { +/// let mut asset_string = String::new(); /// /// let processor = HandleProcessor; /// let serializer = ReflectSerializer::with_processor(asset, type_registry, &processor); -/// let mut ron_serializer = ron::Serializer::new(&mut asset_bytes, None)?; +/// let mut ron_serializer = ron::Serializer::new(&mut asset_string, None)?; /// /// serializer.serialize(&mut ron_serializer)?; -/// Ok(asset_bytes) +/// Ok(asset_string) /// } /// ``` /// diff --git a/examples/animation/animation_graph.rs b/examples/animation/animation_graph.rs index 884ec1a2af..f420b05f38 100644 --- a/examples/animation/animation_graph.rs +++ b/examples/animation/animation_graph.rs @@ -180,17 +180,19 @@ fn setup_assets_programmatically( IoTaskPool::get() .spawn(async move { + use std::io::Write; + + let serialized_graph = + ron::ser::to_string_pretty(&animation_graph, PrettyConfig::default()) + .expect("Failed to serialize the animation graph"); let mut animation_graph_writer = File::create(Path::join( &FileAssetReader::get_base_path(), Path::join(Path::new("assets"), Path::new(ANIMATION_GRAPH_PATH)), )) .expect("Failed to open the animation graph asset"); - ron::ser::to_writer_pretty( - &mut animation_graph_writer, - &animation_graph, - PrettyConfig::default(), - ) - .expect("Failed to serialize the animation graph"); + animation_graph_writer + .write_all(serialized_graph.as_bytes()) + .expect("Failed to write the animation graph"); }) .detach(); } diff --git a/tools/example-showcase/Cargo.toml b/tools/example-showcase/Cargo.toml index f97dab44a7..2a54af4a68 100644 --- a/tools/example-showcase/Cargo.toml +++ b/tools/example-showcase/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" [dependencies] xshell = "0.2" clap = { version = "4.0", features = ["derive"] } -ron = "0.8" +ron = "0.10" toml_edit = { version = "0.22.7", default-features = false, features = [ "parse", ] }