bevy/crates/bevy_tasks/Cargo.toml

78 lines
2.1 KiB
TOML
Raw Normal View History

[package]
name = "bevy_tasks"
version = "0.15.0-dev"
edition = "2021"
2020-11-03 21:34:00 +00:00
description = "A task executor for Bevy Engine"
homepage = "https://bevyengine.org"
repository = "https://github.com/bevyengine/bevy"
Relicense Bevy under the dual MIT or Apache-2.0 license (#2509) This relicenses Bevy under the dual MIT or Apache-2.0 license. For rationale, see #2373. * Changes the LICENSE file to describe the dual license. Moved the MIT license to docs/LICENSE-MIT. Added the Apache-2.0 license to docs/LICENSE-APACHE. I opted for this approach over dumping both license files at the root (the more common approach) for a number of reasons: * Github links to the "first" license file (LICENSE-APACHE) in its license links (you can see this in the wgpu and rust-analyzer repos). People clicking these links might erroneously think that the apache license is the only option. Rust and Amethyst both use COPYRIGHT or COPYING files to solve this problem, but this creates more file noise (if you do everything at the root) and the naming feels way less intuitive. * People have a reflex to look for a LICENSE file. By providing a single license file at the root, we make it easy for them to understand our licensing approach. * I like keeping the root clean and noise free * There is precedent for putting the apache and mit license text in sub folders (amethyst) * Removed the `Copyright (c) 2020 Carter Anderson` copyright notice from the MIT license. I don't care about this attribution, it might make license compliance more difficult in some cases, and it didn't properly attribute other contributors. We shoudn't replace it with something like "Copyright (c) 2021 Bevy Contributors" because "Bevy Contributors" is not a legal entity. Instead, we just won't include the copyright line (which has precedent ... Rust also uses this approach). * Updates crates to use the new "MIT OR Apache-2.0" license value * Removes the old legion-transform license file from bevy_transform. bevy_transform has been its own, fully custom implementation for a long time and that license no longer applies. * Added a License section to the main readme * Updated our Bevy Plugin licensing guidelines. As a follow-up we should update the website to properly describe the new license. Closes #2373
2021-07-23 21:11:51 +00:00
license = "MIT OR Apache-2.0"
2020-11-03 21:34:00 +00:00
keywords = ["bevy"]
[features]
Add `no_std` support to `bevy_tasks` (#15464) # Objective - Contributes to #15460 ## Solution - Added the following features: - `std` (default) - `async_executor` (default) - `edge_executor` - `critical-section` - `portable-atomic` - Added [`edge-executor`](https://crates.io/crates/edge-executor) as a `no_std` alternative to `async-executor`. - Updated the `single_threaded_task_pool` to work in `no_std` environments by gating its reliance on `thread_local`. ## Testing - Added to `compile-check-no-std` CI command ## Notes - In previous iterations of this PR, a custom `async-executor` alternative was vendored in. This raised concerns around maintenance and testing. In this iteration, an existing version of that same vendoring is now used, but _only_ in `no_std` contexts. For existing `std` contexts, the original `async-executor` is used. - Due to the way statics work, certain `TaskPool` operations have added restrictions around `Send`/`Sync` in `no_std`. This is because there isn't a straightforward way to create a thread-local in `no_std`. If these added constraints pose an issue we can revisit this at a later date. - If a user enables both the `async_executor` and `edge_executor` features, we will default to using `async-executor`. Since enabling `async_executor` requires `std`, we can safely assume we are in an `std` context and use the original library. --------- Co-authored-by: Mike <2180432+hymm@users.noreply.github.com> Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2024-12-06 02:14:54 +00:00
default = ["std", "async_executor"]
std = [
"futures-lite/std",
"async-task/std",
"spin/std",
"edge-executor?/std",
"portable-atomic-util?/std",
]
multi_threaded = ["std", "dep:async-channel", "dep:concurrent-queue"]
async_executor = ["std", "dep:async-executor"]
edge_executor = ["dep:edge-executor"]
critical-section = [
"dep:critical-section",
"edge-executor?/critical-section",
"portable-atomic?/critical-section",
]
portable-atomic = [
"dep:portable-atomic",
"dep:portable-atomic-util",
"edge-executor?/portable-atomic",
"async-task/portable-atomic",
"spin/portable_atomic",
]
[dependencies]
Add `no_std` support to `bevy_tasks` (#15464) # Objective - Contributes to #15460 ## Solution - Added the following features: - `std` (default) - `async_executor` (default) - `edge_executor` - `critical-section` - `portable-atomic` - Added [`edge-executor`](https://crates.io/crates/edge-executor) as a `no_std` alternative to `async-executor`. - Updated the `single_threaded_task_pool` to work in `no_std` environments by gating its reliance on `thread_local`. ## Testing - Added to `compile-check-no-std` CI command ## Notes - In previous iterations of this PR, a custom `async-executor` alternative was vendored in. This raised concerns around maintenance and testing. In this iteration, an existing version of that same vendoring is now used, but _only_ in `no_std` contexts. For existing `std` contexts, the original `async-executor` is used. - Due to the way statics work, certain `TaskPool` operations have added restrictions around `Send`/`Sync` in `no_std`. This is because there isn't a straightforward way to create a thread-local in `no_std`. If these added constraints pose an issue we can revisit this at a later date. - If a user enables both the `async_executor` and `edge_executor` features, we will default to using `async-executor`. Since enabling `async_executor` requires `std`, we can safely assume we are in an `std` context and use the original library. --------- Co-authored-by: Mike <2180432+hymm@users.noreply.github.com> Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2024-12-06 02:14:54 +00:00
futures-lite = { version = "2.0.1", default-features = false, features = [
"alloc",
] }
async-task = { version = "4.4.0", default-features = false }
spin = { version = "0.9.8", default-features = false, features = [
"spin_mutex",
"rwlock",
"once",
] }
derive_more = { version = "1", default-features = false, features = [
"deref",
"deref_mut",
] }
async-executor = { version = "1.11", optional = true }
edge-executor = { version = "0.4.1", default-features = false, optional = true }
async-channel = { version = "2.3.0", optional = true }
Update async-io requirement from 1.13.0 to 2.0.0 (#10238) Updates the requirements on [async-io](https://github.com/smol-rs/async-io) to permit the latest version. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/smol-rs/async-io/releases">async-io's releases</a>.</em></p> <blockquote> <h2>v2.0.0</h2> <ul> <li><strong>Breaking:</strong> <code>Async::new()</code> now takes types that implement <code>AsFd</code>/<code>AsSocket</code> instead of <code>AsRawFd</code>/<code>AsRawSocket</code>, in order to implement I/O safety. (<a href="https://redirect.github.com/smol-rs/async-io/issues/142">#142</a>)</li> <li><strong>Breaking:</strong> <code>Async::get_mut()</code>, <code>Async::read_with_mut()</code> and <code>Async::write_with_mut()</code> are now <code>unsafe</code>. The underlying source is technically &quot;borrowed&quot; by the polling instance, so moving it out would be unsound. (<a href="https://redirect.github.com/smol-rs/async-io/issues/142">#142</a>)</li> <li>Expose miscellaneous <code>kqueue</code> filters in the <code>os::kqueue</code> module. (<a href="https://redirect.github.com/smol-rs/async-io/issues/112">#112</a>)</li> <li>Expose a way to get the underlying <code>Poller</code>'s file descriptor on Unix. (<a href="https://redirect.github.com/smol-rs/async-io/issues/125">#125</a>)</li> <li>Add a new <code>Async::new_nonblocking</code> method to allow users to avoid duplicating an already nonblocking socket. (<a href="https://redirect.github.com/smol-rs/async-io/issues/159">#159</a>)</li> <li>Remove the unused <code>fastrand</code> and <code>memchr</code> dependencies. (<a href="https://redirect.github.com/smol-rs/async-io/issues/131">#131</a>)</li> <li>Use <code>tracing</code> instead of <code>log</code>. (<a href="https://redirect.github.com/smol-rs/async-io/issues/140">#140</a>)</li> <li>Support ESP-IDF. (<a href="https://redirect.github.com/smol-rs/async-io/issues/144">#144</a>)</li> <li>Optimize the <code>block_on</code> function to reduce allocation, leading to a slight performance improvement. (<a href="https://redirect.github.com/smol-rs/async-io/issues/149">#149</a>)</li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/smol-rs/async-io/blob/master/CHANGELOG.md">async-io's changelog</a>.</em></p> <blockquote> <h1>Version 2.0.0</h1> <ul> <li><strong>Breaking:</strong> <code>Async::new()</code> now takes types that implement <code>AsFd</code>/<code>AsSocket</code> instead of <code>AsRawFd</code>/<code>AsRawSocket</code>, in order to implement I/O safety. (<a href="https://redirect.github.com/smol-rs/async-io/issues/142">#142</a>)</li> <li><strong>Breaking:</strong> <code>Async::get_mut()</code>, <code>Async::read_with_mut()</code> and <code>Async::write_with_mut()</code> are now <code>unsafe</code>. The underlying source is technically &quot;borrowed&quot; by the polling instance, so moving it out would be unsound. (<a href="https://redirect.github.com/smol-rs/async-io/issues/142">#142</a>)</li> <li>Expose miscellaneous <code>kqueue</code> filters in the <code>os::kqueue</code> module. (<a href="https://redirect.github.com/smol-rs/async-io/issues/112">#112</a>)</li> <li>Expose a way to get the underlying <code>Poller</code>'s file descriptor on Unix. (<a href="https://redirect.github.com/smol-rs/async-io/issues/125">#125</a>)</li> <li>Add a new <code>Async::new_nonblocking</code> method to allow users to avoid duplicating an already nonblocking socket. (<a href="https://redirect.github.com/smol-rs/async-io/issues/159">#159</a>)</li> <li>Remove the unused <code>fastrand</code> and <code>memchr</code> dependencies. (<a href="https://redirect.github.com/smol-rs/async-io/issues/131">#131</a>)</li> <li>Use <code>tracing</code> instead of <code>log</code>. (<a href="https://redirect.github.com/smol-rs/async-io/issues/140">#140</a>)</li> <li>Support ESP-IDF. (<a href="https://redirect.github.com/smol-rs/async-io/issues/144">#144</a>)</li> <li>Optimize the <code>block_on</code> function to reduce allocation, leading to a slight performance improvement. (<a href="https://redirect.github.com/smol-rs/async-io/issues/149">#149</a>)</li> </ul> <h1>Version 1.13.0</h1> <ul> <li>Use <a href="https://crates.io/crates/rustix/"><code>rustix</code></a> instead of <a href="https://crates.io/crates/libc/"><code>libc</code></a>/<a href="https://crates.io/crates/windows-sys/"><code>windows-sys</code></a> for system calls (<a href="https://redirect.github.com/smol-rs/async-io/issues/76">#76</a>)</li> <li>Add a <code>will_fire</code> method to <code>Timer</code> to test if it will ever fire (<a href="https://redirect.github.com/smol-rs/async-io/issues/106">#106</a>)</li> <li>Reduce syscalls in <code>Async::new</code> (<a href="https://redirect.github.com/smol-rs/async-io/issues/107">#107</a>)</li> <li>Improve the drop ergonomics of <code>Readable</code> and <code>Writable</code> (<a href="https://redirect.github.com/smol-rs/async-io/issues/109">#109</a>)</li> <li>Change the &quot;<code>wepoll</code>&quot; in documentation to &quot;<code>IOCP</code>&quot; (<a href="https://redirect.github.com/smol-rs/async-io/issues/116">#116</a>)</li> </ul> <h1>Version 1.12.0</h1> <ul> <li>Switch from <code>winapi</code> to <code>windows-sys</code> (<a href="https://redirect.github.com/smol-rs/async-io/issues/102">#102</a>)</li> </ul> <h1>Version 1.11.0</h1> <ul> <li>Update <code>concurrent-queue</code> to v2. (<a href="https://redirect.github.com/smol-rs/async-io/issues/99">#99</a>)</li> </ul> <h1>Version 1.10.0</h1> <ul> <li>Remove the dependency on the <code>once_cell</code> crate to restore the MSRV. (<a href="https://redirect.github.com/smol-rs/async-io/issues/95">#95</a>)</li> </ul> <h1>Version 1.9.0</h1> <ul> <li>Fix panic on very large durations. (<a href="https://redirect.github.com/smol-rs/async-io/issues/87">#87</a>)</li> <li>Add <code>Timer::never</code> (<a href="https://redirect.github.com/smol-rs/async-io/issues/87">#87</a>)</li> </ul> <h1>Version 1.8.0</h1> <ul> <li>Implement I/O safety traits on Rust 1.63+ (<a href="https://redirect.github.com/smol-rs/async-io/issues/84">#84</a>)</li> </ul> <h1>Version 1.7.0</h1> <ul> <li>Process timers set for exactly <code>now</code>. (<a href="https://redirect.github.com/smol-rs/async-io/issues/73">#73</a>)</li> </ul> <h1>Version 1.6.0</h1> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/smol-rs/async-io/commit/7e89eec4d15d70215f5a96f7f66a3c0224aa90a5"><code>7e89eec</code></a> v2.0.0</li> <li><a href="https://github.com/smol-rs/async-io/commit/356431754cb3756d1c9f59f29c11c04a7f353ffa"><code>3564317</code></a> tests: Add test for <a href="https://redirect.github.com/smol-rs/async-io/issues/154">#154</a></li> <li><a href="https://github.com/smol-rs/async-io/commit/a5da16f07268c5be34818f18920496ff2fc60da3"><code>a5da16f</code></a> Expose Async::new_nonblocking</li> <li><a href="https://github.com/smol-rs/async-io/commit/0f2af634d8272006e6135d7fd23f3b636908d713"><code>0f2af63</code></a> Avoid needless set_nonblocking calls</li> <li><a href="https://github.com/smol-rs/async-io/commit/62e3454f3807ec6ece80ef3abc8cfdc3a41b58bf"><code>62e3454</code></a> Migrate to Rust 2021 (<a href="https://redirect.github.com/smol-rs/async-io/issues/160">#160</a>)</li> <li><a href="https://github.com/smol-rs/async-io/commit/59ee2ea27c5add95d09947f592149811024d7527"><code>59ee2ea</code></a> Use set_nonblocking in Async::new on Windows (<a href="https://redirect.github.com/smol-rs/async-io/issues/157">#157</a>)</li> <li><a href="https://github.com/smol-rs/async-io/commit/d5bc619021b056f0e334950a22a756e1733e3812"><code>d5bc619</code></a> Remove needless as_fd/as_socket calls (<a href="https://redirect.github.com/smol-rs/async-io/issues/158">#158</a>)</li> <li><a href="https://github.com/smol-rs/async-io/commit/0b5016e567d50f72e8fc404dee91e307235756f9"><code>0b5016e</code></a> m: Replace socket2 calls with rustix</li> <li><a href="https://github.com/smol-rs/async-io/commit/8c3c3bd80bd3aac02534a2166298f84127065c09"><code>8c3c3bd</code></a> m: Optimize block_on by caching Parker and Waker</li> <li><a href="https://github.com/smol-rs/async-io/commit/1b1466a6c17327fcd8b7e9a3ec43ebcff2bcc471"><code>1b1466a</code></a> Update this crate to use the new polling breaking changes (<a href="https://redirect.github.com/smol-rs/async-io/issues/142">#142</a>)</li> <li>Additional commits viewable in <a href="https://github.com/smol-rs/async-io/compare/v1.13.0...v2.0.0">compare view</a></li> </ul> </details> <br /> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-23 23:49:57 +00:00
async-io = { version = "2.0.0", optional = true }
concurrent-queue = { version = "2.0.0", optional = true }
Add `no_std` support to `bevy_tasks` (#15464) # Objective - Contributes to #15460 ## Solution - Added the following features: - `std` (default) - `async_executor` (default) - `edge_executor` - `critical-section` - `portable-atomic` - Added [`edge-executor`](https://crates.io/crates/edge-executor) as a `no_std` alternative to `async-executor`. - Updated the `single_threaded_task_pool` to work in `no_std` environments by gating its reliance on `thread_local`. ## Testing - Added to `compile-check-no-std` CI command ## Notes - In previous iterations of this PR, a custom `async-executor` alternative was vendored in. This raised concerns around maintenance and testing. In this iteration, an existing version of that same vendoring is now used, but _only_ in `no_std` contexts. For existing `std` contexts, the original `async-executor` is used. - Due to the way statics work, certain `TaskPool` operations have added restrictions around `Send`/`Sync` in `no_std`. This is because there isn't a straightforward way to create a thread-local in `no_std`. If these added constraints pose an issue we can revisit this at a later date. - If a user enables both the `async_executor` and `edge_executor` features, we will default to using `async-executor`. Since enabling `async_executor` requires `std`, we can safely assume we are in an `std` context and use the original library. --------- Co-authored-by: Mike <2180432+hymm@users.noreply.github.com> Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2024-12-06 02:14:54 +00:00
critical-section = { version = "1.2.0", optional = true }
portable-atomic = { version = "1", default-features = false, features = [
"fallback",
], optional = true }
portable-atomic-util = { version = "0.2.4", features = [
"alloc",
], optional = true }
2020-09-25 22:26:23 +00:00
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen-futures = "0.4"
pin-project = "1"
futures-channel = "0.3"
[dev-dependencies]
fix: upgrade to winit v0.30 (#13366) # Objective - Upgrade winit to v0.30 - Fixes https://github.com/bevyengine/bevy/issues/13331 ## Solution This is a rewrite/adaptation of the new trait system described and implemented in `winit` v0.30. ## Migration Guide The custom UserEvent is now renamed as WakeUp, used to wake up the loop if anything happens outside the app (a new [custom_user_event](https://github.com/bevyengine/bevy/pull/13366/files#diff-2de8c0a8d3028d0059a3d80ae31b2bbc1cde2595ce2d317ea378fe3e0cf6ef2d) shows this behavior. The internal `UpdateState` has been removed and replaced internally by the AppLifecycle. When changed, the AppLifecycle is sent as an event. The `UpdateMode` now accepts only two values: `Continuous` and `Reactive`, but the latter exposes 3 new properties to enable reactive to device, user or window events. The previous `UpdateMode::Reactive` is now equivalent to `UpdateMode::reactive()`, while `UpdateMode::ReactiveLowPower` to `UpdateMode::reactive_low_power()`. The `ApplicationLifecycle` has been renamed as `AppLifecycle`, and now contains the possible values of the application state inside the event loop: * `Idle`: the loop has not started yet * `Running` (previously called `Started`): the loop is running * `WillSuspend`: the loop is going to be suspended * `Suspended`: the loop is suspended * `WillResume`: the loop is going to be resumed Note: the `Resumed` state has been removed since the resumed app is just running. Finally, now that `winit` enables this, it extends the `WinitPlugin` to support custom events. ## Test platforms - [x] Windows - [x] MacOs - [x] Linux (x11) - [x] Linux (Wayland) - [x] Android - [x] iOS - [x] WASM/WebGPU - [x] WASM/WebGL2 ## Outstanding issues / regressions - [ ] iOS: build failed in CI - blocking, but may just be flakiness - [x] Cross-platform: when the window is maximised, changes in the scale factor don't apply, to make them apply one has to make the window smaller again. (Re-maximising keeps the updated scale factor) - non-blocking, but good to fix - [ ] Android: it's pretty easy to quickly open and close the app and then the music keeps playing when suspended. - non-blocking but worrying - [ ] Web: the application will hang when switching tabs - Not new, duplicate of https://github.com/bevyengine/bevy/issues/13486 - [ ] Cross-platform?: Screenshot failure, `ERROR present_frames: wgpu_core::present: No work has been submitted for this frame before` taking the first screenshot, but after pressing space - non-blocking, but good to fix --------- Co-authored-by: François <francois.mockers@vleue.com>
2024-06-03 13:06:48 +00:00
web-time = { version = "1.1" }
[lints]
workspace = true
[package.metadata.docs.rs]
rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"]
all-features = true