Skip to content

Commit f41e224

Browse files
authored
Migrate bevy to latest main (#178)
* Migrate everything except bevy_editor_cam * Update bevy to d6725d3 and migrate PointerAction * Add workaround for ashpd not explicitly depending on futures-util/io
1 parent 4894f0e commit f41e224

File tree

11 files changed

+44
-49
lines changed

11 files changed

+44
-49
lines changed

Cargo.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ unsafe_op_in_unsafe_fn = "warn"
2727
unused_qualifications = "warn"
2828

2929
[workspace.dependencies]
30-
bevy = { git = "https://github.com/bevyengine/bevy.git", rev = "909b02e9de418fcf3b8960e98c3de423505eadd5", features = [
30+
bevy = { git = "https://github.com/bevyengine/bevy.git", rev = "d6725d3b1baa6a730fa6bfab1bb8f2a9e5f4716e", features = [
3131
"wayland",
3232
] }
33-
bevy_derive = { git = "https://github.com/bevyengine/bevy.git", rev = "909b02e9de418fcf3b8960e98c3de423505eadd5" }
34-
bevy_macro_utils = { git = "https://github.com/bevyengine/bevy.git", rev = "909b02e9de418fcf3b8960e98c3de423505eadd5" }
35-
thiserror = "1"
33+
bevy_derive = { git = "https://github.com/bevyengine/bevy.git", rev = "d6725d3b1baa6a730fa6bfab1bb8f2a9e5f4716e" }
34+
bevy_macro_utils = { git = "https://github.com/bevyengine/bevy.git", rev = "d6725d3b1baa6a730fa6bfab1bb8f2a9e5f4716e" }
35+
thiserror = "2.0"
3636
serde = { version = "1", features = ["derive"] }
3737
tracing-test = "0.2.5"
3838
tracing = "0.1.40"
@@ -41,6 +41,10 @@ rfd = "0.15"
4141
ron = "0.8.1"
4242
variadics_please = "1.0"
4343

44+
# This is a temporary workaround for https://github.com/bilelmoussaoui/ashpd/issues/264
45+
# Should be ok to remove once the issue is fixed, published, and `rfd` points to the new version.
46+
futures-util = { version = "0.3", features = ["io"] }
47+
4448
# local crates
4549

4650
# bevy_editor_panes

bevy_editor_panes/bevy_asset_browser/src/ui/top_bar.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub fn refresh_ui(
5252
// Clear location path UI
5353
if let Some(childrens) = top_bar_childrens {
5454
for child in childrens.iter() {
55-
commands.entity(*child).despawn();
55+
commands.entity(child).despawn();
5656
}
5757
commands.entity(top_bar_entity).remove::<Children>();
5858
}
@@ -169,7 +169,7 @@ fn spawn_path_segment_ui<'a>(
169169
.iter()
170170
.step_by(2) // Step by 2 to go through each segment, skipping the separators
171171
.skip(1) // Skip the "Sources" segment
172-
.position(|child| *child == segment)
172+
.position(|child| child == segment)
173173
.expect(
174174
"You shouldn't be able to click on a segment that isn't in the asset location path"
175175
);

bevy_widgets/bevy_i-cant-believe-its-not-bsn/src/hierarchy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ mod tests {
256256
assert_eq!(children.len(), 3);
257257

258258
for (i, child_entity) in children.iter().enumerate() {
259-
assert_eq!(world.get::<B>(*child_entity), Some(&B(i as u8)));
259+
assert_eq!(world.get::<B>(child_entity), Some(&B(i as u8)));
260260
}
261261
}
262262

@@ -275,7 +275,7 @@ mod tests {
275275
assert_eq!(children.len(), 7);
276276

277277
for (i, child_entity) in children.iter().enumerate() {
278-
assert_eq!(world.get::<B>(*child_entity), Some(&B(i as u8)));
278+
assert_eq!(world.get::<B>(child_entity), Some(&B(i as u8)));
279279
}
280280
}
281281

crates/bevy_bsn/src/construct.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use alloc::borrow::Cow;
22
use bevy::{
33
ecs::{
4-
bundle::DynamicBundle,
4+
bundle::{BundleFromComponents, DynamicBundle},
55
component::{ComponentId, Components, RequiredComponents, StorageType},
6-
storage::Storages,
76
system::EntityCommands,
87
world::error::EntityFetchError,
98
},
@@ -186,16 +185,27 @@ all_tuples!(
186185
);
187186

188187
#[allow(unsafe_code)]
189-
/// SAFETY: This just passes through to the inner [`Bundle`] implementations.
188+
/// SAFETY: This just passes through to the inner [`Bundle`] implementation.
190189
unsafe impl<B: Bundle> Bundle for ConstructTuple<B> {
191-
fn component_ids(
190+
fn component_ids(components: &mut Components, ids: &mut impl FnMut(ComponentId)) {
191+
B::component_ids(components, ids);
192+
}
193+
194+
fn register_required_components(
192195
components: &mut Components,
193-
storages: &mut Storages,
194-
ids: &mut impl FnMut(ComponentId),
196+
required_components: &mut RequiredComponents,
195197
) {
196-
B::component_ids(components, storages, ids);
198+
B::register_required_components(components, required_components);
197199
}
198200

201+
fn get_component_ids(components: &Components, ids: &mut impl FnMut(Option<ComponentId>)) {
202+
B::get_component_ids(components, ids);
203+
}
204+
}
205+
206+
#[allow(unsafe_code)]
207+
/// SAFETY: This just passes through to the inner [`BundleFromComponents`] implementation.
208+
unsafe impl<B: BundleFromComponents> BundleFromComponents for ConstructTuple<B> {
199209
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> Self
200210
where
201211
// Ensure that the `OwningPtr` is used correctly
@@ -207,21 +217,11 @@ unsafe impl<B: Bundle> Bundle for ConstructTuple<B> {
207217
unsafe { B::from_components(ctx, func) },
208218
)
209219
}
210-
211-
fn register_required_components(
212-
components: &mut Components,
213-
storages: &mut Storages,
214-
required_components: &mut RequiredComponents,
215-
) {
216-
B::register_required_components(components, storages, required_components);
217-
}
218-
219-
fn get_component_ids(components: &Components, ids: &mut impl FnMut(Option<ComponentId>)) {
220-
B::get_component_ids(components, ids);
221-
}
222220
}
223221

224222
impl<B: Bundle> DynamicBundle for ConstructTuple<B> {
223+
type Effect = ();
224+
225225
fn get_components(self, func: &mut impl FnMut(StorageType, OwningPtr<'_>)) {
226226
self.0.get_components(func);
227227
}

crates/bevy_editor/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ bevy_editor_styles.workspace = true
1414
serde.workspace = true
1515
ron.workspace = true
1616
rfd.workspace = true
17+
futures-util.workspace = true
1718

1819
# Panes
1920
bevy_editor_core.workspace = true

crates/bevy_editor_cam/src/input.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@ impl EditorCamInputEvent {
286286
PointerAction::Move { delta } => Some(delta),
287287
PointerAction::Press { .. }
288288
| PointerAction::Cancel
289-
| PointerAction::Release(_) => None,
289+
| PointerAction::Release(_)
290+
| PointerAction::Scroll { .. } => None,
290291
})
291292
.sum();
292293

crates/bevy_editor_launcher/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ bevy_footer_bar.workspace = true
1414
bevy_editor_styles.workspace = true
1515

1616
rfd.workspace = true
17+
futures-util.workspace = true
1718
serde.workspace = true
1819
ron.workspace = true

crates/bevy_infinite_grid/src/render/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::borrow::Cow;
22

33
use bevy::{
4-
asset::load_internal_asset,
4+
asset::{load_internal_asset, weak_handle},
55
core_pipeline::{core_2d::Transparent2d, core_3d::Transparent3d},
66
ecs::{
77
query::ROQueryItem,
@@ -37,7 +37,7 @@ use bevy::{
3737

3838
use crate::InfiniteGridSettings;
3939

40-
const GRID_SHADER_HANDLE: Handle<Shader> = Handle::weak_from_u128(15204473893972682982);
40+
const GRID_SHADER_HANDLE: Handle<Shader> = weak_handle!("7cd38dd1-d707-481e-b38c-0eccb706e629");
4141

4242
pub fn render_app_builder(app: &mut App) {
4343
load_internal_asset!(app, GRID_SHADER_HANDLE, "grid.wgsl", Shader::from_wgsl);

crates/bevy_pane_layout/src/handlers.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ pub(crate) fn remove_pane(
2626

2727
// Find the index of this pane among its siblings
2828
let siblings = children_query.get(parent).unwrap();
29-
let index = siblings
30-
.iter()
31-
.position(|entity| *entity == target)
32-
.unwrap();
29+
let index = siblings.iter().position(|entity| entity == target).unwrap();
3330

3431
let size = size_query.get(target).unwrap().0;
3532

@@ -84,10 +81,7 @@ pub(crate) fn split_pane(
8481

8582
// Find the index of this pane among its siblings
8683
let siblings = children_query.get(parent).unwrap();
87-
let index = siblings
88-
.iter()
89-
.position(|entity| *entity == target)
90-
.unwrap();
84+
let index = siblings.iter().position(|entity| entity == target).unwrap();
9185

9286
// Parent has a matching divider direction
9387
let matching_direction = divider_query

crates/bevy_pane_layout/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ fn cleanup_divider_single_child(
142142
for (entity, children, parent) in &mut query {
143143
let mut iter = children
144144
.iter()
145-
.filter(|child| !resize_handle_query.contains(**child));
146-
let child = *iter.next().unwrap();
145+
.filter(|child| !resize_handle_query.contains(*child));
146+
let child = iter.next().unwrap();
147147
if iter.next().is_some() {
148148
continue;
149149
}
@@ -153,7 +153,7 @@ fn cleanup_divider_single_child(
153153

154154
// Find the index of this divider among its siblings
155155
let siblings = children_query.get(parent.get()).unwrap();
156-
let index = siblings.iter().position(|s| *s == entity).unwrap();
156+
let index = siblings.iter().position(|s| s == entity).unwrap();
157157

158158
commands
159159
.entity(parent.get())

0 commit comments

Comments
 (0)