Skip to content

Release 0.3 with migration to Bevy 0.15 #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: release-0.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
717703e
Migrate to bevy 0.13
mxgrey Aug 27, 2024
dcc4556
Migrate to bevy 0.14
mxgrey Aug 27, 2024
ff06de6
Bump minor version
mxgrey Aug 27, 2024
b264ffa
Prep for release
mxgrey Aug 27, 2024
b3991c1
Add specific version
mxgrey Aug 27, 2024
56de85e
Fix merge
mxgrey Aug 27, 2024
5bd485a
Fix docs
mxgrey Aug 27, 2024
8fa94f4
Merge branch 'release-0.1' into release-0.2
mxgrey Aug 27, 2024
152228c
Merge branch 'main' into xiyu/release-0.1
xiyuoh Apr 23, 2025
ebcfda6
Merge branch 'xiyu/release-0.1' into xiyu/release-0.2
xiyuoh Apr 23, 2025
f1146f9
Rename Add to Queue for methods with deferred semantics
xiyuoh Apr 23, 2025
b15b631
Allow World::entity family of functions to take multiple entities and…
xiyuoh Apr 23, 2025
9096cae
Merge BuildWorldChildren and BuildChildren traits #14052
xiyuoh Apr 23, 2025
7d3b80e
Support systems that take references as input
xiyuoh Apr 23, 2025
2e5e716
Cleanup App::world getters
xiyuoh Apr 23, 2025
4d0f9ee
QueryEntityError now has a lifetime
xiyuoh Apr 23, 2025
3fcf8a3
Merge branch 'xiyu/release-0.2' into xiyu/release-0.3
xiyuoh Apr 23, 2025
603e60e
Cleanup World::get_entity_mut -> Result
xiyuoh Apr 23, 2025
3d5d443
Match bevy 0.15.3 uuid
xiyuoh Apr 29, 2025
03b6e63
Use TaskPool to build wasm-task
xiyuoh May 2, 2025
f3c961a
Style
xiyuoh May 2, 2025
26032b2
Style
xiyuoh May 2, 2025
4e8b224
Style again
xiyuoh May 2, 2025
5be42e5
Style
xiyuoh May 2, 2025
724cc5a
Use correct spawn
xiyuoh May 2, 2025
2598131
Update CI to 1.76
xiyuoh May 2, 2025
85d05e7
Merge branch 'xiyu/release-0.1' into xiyu/release-0.2
xiyuoh May 2, 2025
9dcf6c9
Merge branch 'xiyu/release-0.2' into xiyu/release-0.3
xiyuoh May 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions .github/workflows/ci_linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
build:
strategy:
matrix:
rust-version: [stable, 1.75]
rust-version: [stable, 1.81]

runs-on: ubuntu-latest

Expand All @@ -28,14 +28,6 @@ jobs:
- name: Setup rust
run: rustup default ${{ matrix.rust-version }}

# As new versions of our dependencies come out, they might depend on newer
# versions of the Rust compiler. When that happens, we'll use this step to
# lock down the dependency to a version that is known to be compatible with
# compiler version 1.75.
- name: Patch dependencies
if: ${{ matrix.rust-version == 1.75 }}
run: ./scripts/patch-versions-msrv-1_75.sh

- name: Build default features
run: cargo build --workspace
- name: Test default features
Expand Down
20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_impulse"
version = "0.0.2"
version = "0.3.0"
edition = "2021"
authors = ["Grey <[email protected]>"]
license = "Apache-2.0"
Expand All @@ -17,18 +17,18 @@ categories = [

[dependencies]
bevy_impulse_derive = { path = "macros", version = "0.0.2" }
bevy_ecs = "0.12"
bevy_utils = "0.12"
bevy_hierarchy = "0.12"
bevy_derive = "0.12"
bevy_app = "0.12"
bevy_ecs = "0.15"
bevy_utils = "0.15"
bevy_hierarchy = "0.15"
bevy_derive = "0.15"
bevy_app = "0.15"

async-task = { version = "4.7.1", optional = true }

# TODO(@mxgrey) We could probably remove bevy_tasks when the single_threaded_async
# feature is active, but we'd have to refactor some internal usage of
# bevy_tasks::Task, so we're leaving it as a mandatory dependency for now.
bevy_tasks = { version = "0.12", features = ["multi-threaded"] }
bevy_tasks = { version = "0.15", features = ["multi_threaded"] }

itertools = "0.13"
smallvec = "1.13"
Expand All @@ -43,8 +43,8 @@ thiserror = "1.0"
# the testing module for doctests, and doctests can only
# make use of default features, so we're a bit stuck with
# these for now.
bevy_core = "0.12"
bevy_time = "0.12"
bevy_core = "0.15"
bevy_time = "0.15"

schemars = { version = "0.8.21", optional = true }
serde = { version = "1.0.210", features = ["derive", "rc"], optional = true }
Expand All @@ -55,7 +55,7 @@ strum = { version = "0.26.3", optional = true, features = ["derive"] }
semver = { version = "1.0.24", optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
uuid = { version = "1.13.1", default-features = false, features = ["js"] }
uuid = { version = "1.12", default-features = false, features = ["js"] }

[features]
single_threaded_async = ["dep:async-task"]
Expand Down
10 changes: 5 additions & 5 deletions examples/diagram/calculator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "calculator"
version = "0.1.0"
version = "0.3.0"
edition = "2021"

[dependencies]
bevy_app = "0.12"
bevy_core = "0.12"
bevy_impulse = { version = "0.0.2", path = "../../..", features = ["diagram"] }
bevy_time = "0.12"
bevy_app = "0.15"
bevy_core = "0.15"
bevy_impulse = { version = "0.3.0", path = "../../..", features = ["diagram"] }
bevy_time = "0.15"
clap = { version = "4.5.23", features = ["derive"] }
serde_json = "1.0.128"
tracing-subscriber = "0.3.19"
Expand Down
2 changes: 1 addition & 1 deletion examples/diagram/calculator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn main() -> Result<(), Box<dyn Error>> {

let request = serde_json::Value::from_str(&args.request)?;
let mut promise =
app.world
app.world_mut()
.command(|cmds| -> Result<Promise<serde_json::Value>, DiagramError> {
let workflow = diagram.spawn_io_workflow(cmds, &registry)?;
Ok(cmds.request(request, workflow).take_response())
Expand Down
9 changes: 2 additions & 7 deletions src/async_execution/single_threaded_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use bevy_ecs::prelude::World;

use async_task::Runnable;
pub(crate) use bevy_tasks::Task as TaskHandle;
pub(crate) use bevy_tasks::{Task as TaskHandle, TaskPool};
use tokio::sync::mpsc::{
unbounded_channel, UnboundedReceiver as TokioReceiver, UnboundedSender as TokioSender,
};
Expand Down Expand Up @@ -99,12 +99,7 @@ impl SingleThreadedExecution {
where
T: Send + 'static,
{
let sender = self.runnable_sender.clone();
let (runnable, task) = async_task::spawn_local(future, move |runnable| {
sender.send(runnable).ok();
});
let _ = self.runnable_sender.send(runnable);
TaskHandle::new(task)
TaskPool::new().spawn_local(future)
}

pub(crate) fn cancel_sender(&self) -> SingleThreadedExecutionSender {
Expand Down
18 changes: 12 additions & 6 deletions src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl<T> Buffer<T> {
let target = builder.commands.spawn(UnusedTarget).id();
builder
.commands
.add(OnNewBufferValue::new(self.id(), target));
.queue(OnNewBufferValue::new(self.id(), target));
Chain::new(target, builder)
}

Expand Down Expand Up @@ -359,7 +359,10 @@ where
}

impl<'w, 's, T: 'static + Send + Sync> BufferAccess<'w, 's, T> {
pub fn get<'a>(&'a self, key: &BufferKey<T>) -> Result<BufferView<'a, T>, QueryEntityError> {
pub fn get<'a>(
&'a self,
key: &BufferKey<T>,
) -> Result<BufferView<'a, T>, QueryEntityError<'a>> {
let session = key.session();
self.query
.get(key.buffer())
Expand Down Expand Up @@ -388,7 +391,10 @@ impl<'w, 's, T> BufferAccessMut<'w, 's, T>
where
T: 'static + Send + Sync,
{
pub fn get<'a>(&'a self, key: &BufferKey<T>) -> Result<BufferView<'a, T>, QueryEntityError> {
pub fn get<'a>(
&'a self,
key: &BufferKey<T>,
) -> Result<BufferView<'a, T>, QueryEntityError<'a>> {
let session = key.session();
self.query
.get(key.buffer())
Expand All @@ -402,7 +408,7 @@ where
pub fn get_mut<'a>(
&'a mut self,
key: &BufferKey<T>,
) -> Result<BufferMut<'w, 's, 'a, T>, QueryEntityError> {
) -> Result<BufferMut<'w, 's, 'a, T>, QueryEntityError<'a>> {
let buffer = key.buffer();
let session = key.session();
let accessor = key.tag.accessor;
Expand Down Expand Up @@ -442,7 +448,7 @@ impl BufferWorldAccess for World {
{
let buffer_ref = self
.get_entity(key.tag.buffer)
.ok_or(BufferError::BufferMissing)?;
.map_err(|_| BufferError::BufferMissing)?;
let storage = buffer_ref
.get::<BufferStorage<T>>()
.ok_or(BufferError::BufferMissing)?;
Expand Down Expand Up @@ -734,7 +740,7 @@ where
{
fn drop(&mut self) {
if self.modified {
self.commands.add(NotifyBufferUpdate::new(
self.commands.queue(NotifyBufferUpdate::new(
self.buffer,
self.session,
self.accessor,
Expand Down
4 changes: 2 additions & 2 deletions src/buffer/any_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ impl<'w, 's, 'a> AnyBufferMut<'w, 's, 'a> {
impl<'w, 's, 'a> Drop for AnyBufferMut<'w, 's, 'a> {
fn drop(&mut self) {
if self.modified {
self.commands.add(NotifyBufferUpdate::new(
self.commands.queue(NotifyBufferUpdate::new(
self.buffer,
self.session,
self.accessor,
Expand Down Expand Up @@ -1003,7 +1003,7 @@ impl<T: 'static + Send + Sync + Any> AnyBufferAccessInterface for AnyBufferAcces
) -> Result<AnyBufferView<'a>, BufferError> {
let buffer_ref = world
.get_entity(key.tag.buffer)
.ok_or(BufferError::BufferMissing)?;
.map_err(|_| BufferError::BufferMissing)?;
let storage = buffer_ref
.get::<BufferStorage<T>>()
.ok_or(BufferError::BufferMissing)?;
Expand Down
2 changes: 1 addition & 1 deletion src/buffer/bufferable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ pub trait IterBufferable {
let buffers = self.into_buffer_vec::<N>(builder);
let join = builder.commands.spawn(()).id();
let target = builder.commands.spawn(UnusedTarget).id();
builder.commands.add(AddOperation::new(
builder.commands.queue(AddOperation::new(
Some(builder.scope()),
join,
Join::new(buffers, target),
Expand Down
8 changes: 4 additions & 4 deletions src/buffer/buffering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub trait Joining: Buffering {

let join = builder.commands.spawn(()).id();
let target = builder.commands.spawn(UnusedTarget).id();
builder.commands.add(AddOperation::new(
builder.commands.queue(AddOperation::new(
Some(scope),
join,
Join::new(self, target),
Expand Down Expand Up @@ -101,7 +101,7 @@ pub trait Accessing: Buffering {

let listen = builder.commands.spawn(()).id();
let target = builder.commands.spawn(UnusedTarget).id();
builder.commands.add(AddOperation::new(
builder.commands.queue(AddOperation::new(
Some(scope),
listen,
Listen::new(self, target),
Expand All @@ -113,7 +113,7 @@ pub trait Accessing: Buffering {
fn access<T: 'static + Send + Sync>(self, builder: &mut Builder) -> Node<T, (T, Self::Key)> {
let source = builder.commands.spawn(()).id();
let target = builder.commands.spawn(UnusedTarget).id();
builder.commands.add(AddOperation::new(
builder.commands.queue(AddOperation::new(
Some(builder.scope),
source,
OperateBufferAccess::<T, Self>::new(self, target),
Expand Down Expand Up @@ -189,7 +189,7 @@ pub trait Accessing: Buffering {

let begin_cancel = builder.commands.spawn(()).set_parent(builder.scope).id();
self.verify_scope(builder.scope);
builder.commands.add(AddOperation::new(
builder.commands.queue(AddOperation::new(
None,
begin_cancel,
BeginCleanupWorkflow::<Self>::new(
Expand Down
4 changes: 2 additions & 2 deletions src/buffer/json_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ impl<'w, 's, 'a> JsonBufferMut<'w, 's, 'a> {
impl<'w, 's, 'a> Drop for JsonBufferMut<'w, 's, 'a> {
fn drop(&mut self) {
if self.modified {
self.commands.add(NotifyBufferUpdate::new(
self.commands.queue(NotifyBufferUpdate::new(
self.buffer,
self.session,
self.accessor,
Expand Down Expand Up @@ -922,7 +922,7 @@ impl<T: 'static + Send + Sync + Serialize + DeserializeOwned> JsonBufferAccessIn
) -> Result<JsonBufferView<'a>, BufferError> {
let buffer_ref = world
.get_entity(key.tag.buffer)
.ok_or(BufferError::BufferMissing)?;
.map_err(|_| BufferError::BufferMissing)?;
let storage = buffer_ref
.get::<BufferStorage<T>>()
.ok_or(BufferError::BufferMissing)?;
Expand Down
26 changes: 13 additions & 13 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl<'w, 's, 'a> Builder<'w, 's, 'a> {
/// Connect the output of one into the input slot of another node.
pub fn connect<T: 'static + Send + Sync>(&mut self, output: Output<T>, input: InputSlot<T>) {
assert_eq!(output.scope(), input.scope());
self.commands.add(Connect {
self.commands.queue(Connect {
original_target: output.id(),
new_target: input.id(),
});
Expand All @@ -159,7 +159,7 @@ impl<'w, 's, 'a> Builder<'w, 's, 'a> {
settings: BufferSettings,
) -> Buffer<T> {
let source = self.commands.spawn(()).id();
self.commands.add(AddOperation::new(
self.commands.queue(AddOperation::new(
Some(self.scope),
source,
OperateBuffer::<T>::new(settings),
Expand Down Expand Up @@ -222,7 +222,7 @@ impl<'w, 's, 'a> Builder<'w, 's, 'a> {
T: Clone + 'static + Send + Sync,
{
let source = self.commands.spawn(()).id();
self.commands.add(AddOperation::new(
self.commands.queue(AddOperation::new(
Some(self.scope),
source,
ForkClone::<T>::new(ForkTargetStorage::new()),
Expand Down Expand Up @@ -258,7 +258,7 @@ impl<'w, 's, 'a> Builder<'w, 's, 'a> {
let target_ok = self.commands.spawn(UnusedTarget).id();
let target_err = self.commands.spawn(UnusedTarget).id();

self.commands.add(AddOperation::new(
self.commands.queue(AddOperation::new(
Some(self.scope),
source,
make_result_branching::<T, E>(ForkTargetStorage::from_iter([target_ok, target_err])),
Expand Down Expand Up @@ -287,7 +287,7 @@ impl<'w, 's, 'a> Builder<'w, 's, 'a> {
let target_some = self.commands.spawn(UnusedTarget).id();
let target_none = self.commands.spawn(UnusedTarget).id();

self.commands.add(AddOperation::new(
self.commands.queue(AddOperation::new(
Some(self.scope),
source,
make_option_branching::<T>(ForkTargetStorage::from_iter([target_some, target_none])),
Expand Down Expand Up @@ -390,7 +390,7 @@ impl<'w, 's, 'a> Builder<'w, 's, 'a> {

let source = self.commands.spawn(()).id();
let target = self.commands.spawn(UnusedTarget).id();
self.commands.add(AddOperation::new(
self.commands.queue(AddOperation::new(
Some(self.scope),
source,
Collect::<T, N>::new(target, min, max),
Expand Down Expand Up @@ -427,7 +427,7 @@ impl<'w, 's, 'a> Builder<'w, 's, 'a> {
T: 'static + Send + Sync + Splittable,
{
let source = self.commands.spawn(()).id();
self.commands.add(AddOperation::new(
self.commands.queue(AddOperation::new(
Some(self.scope),
source,
OperateSplit::<T>::default(),
Expand All @@ -450,7 +450,7 @@ impl<'w, 's, 'a> Builder<'w, 's, 'a> {
T: 'static + Send + Sync + ToString,
{
let source = self.commands.spawn(()).id();
self.commands.add(AddOperation::new(
self.commands.queue(AddOperation::new(
Some(self.scope),
source,
OperateCancel::<T>::new(),
Expand All @@ -466,7 +466,7 @@ impl<'w, 's, 'a> Builder<'w, 's, 'a> {
/// input value that triggered it, use [`Self::create_cancel`].
pub fn create_quiet_cancel(&mut self) -> InputSlot<()> {
let source = self.commands.spawn(()).id();
self.commands.add(AddOperation::new(
self.commands.queue(AddOperation::new(
Some(self.scope),
source,
OperateQuietCancel,
Expand Down Expand Up @@ -582,7 +582,7 @@ impl<'w, 's, 'a> Builder<'w, 's, 'a> {

let source = self.commands.spawn(()).id();
let target = self.commands.spawn(UnusedTarget).id();
self.commands.add(AddOperation::new(
self.commands.queue(AddOperation::new(
Some(self.scope),
source,
Trim::<T>::new(branches, target),
Expand Down Expand Up @@ -613,7 +613,7 @@ impl<'w, 's, 'a> Builder<'w, 's, 'a> {

let source = self.commands.spawn(()).id();
let target = self.commands.spawn(UnusedTarget).id();
self.commands.add(AddOperation::new(
self.commands.queue(AddOperation::new(
Some(self.scope),
source,
OperateDynamicGate::<T, _>::new(buffers, target),
Expand Down Expand Up @@ -642,7 +642,7 @@ impl<'w, 's, 'a> Builder<'w, 's, 'a> {

let source = self.commands.spawn(()).id();
let target = self.commands.spawn(UnusedTarget).id();
self.commands.add(AddOperation::new(
self.commands.queue(AddOperation::new(
Some(self.scope),
source,
OperateStaticGate::<T, _>::new(buffers, target, action),
Expand Down Expand Up @@ -752,7 +752,7 @@ impl<'w, 's, 'a> Builder<'w, 's, 'a> {
let mut map = StreamTargetMap::default();
let (bundle, streams) = Streams::spawn_node_streams(source, &mut map, self);
self.commands.entity(source).insert((bundle, map));
self.commands.add(AddOperation::new(
self.commands.queue(AddOperation::new(
Some(self.scope),
source,
Injection::<Request, Response, Streams>::new(target),
Expand Down
2 changes: 1 addition & 1 deletion src/builder/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

use bevy_ecs::{
prelude::{Entity, World},
system::Command,
world::Command,
};
use bevy_hierarchy::prelude::DespawnRecursiveExt;

Expand Down
Loading