mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
ecs: prepare for publishing
This commit is contained in:
parent
34752a27bd
commit
423c5e3e0f
24 changed files with 85 additions and 49 deletions
|
@ -9,7 +9,8 @@ use bevy_ecs::{ParallelExecutor, Resources, Schedule, World};
|
|||
/// ## Example
|
||||
/// Here is a simple "Hello World" Bevy app:
|
||||
/// ```
|
||||
///use bevy::prelude::*;
|
||||
///use bevy_app::prelude::*;
|
||||
///use bevy_ecs::prelude::*;
|
||||
///
|
||||
///fn main() {
|
||||
/// App::build()
|
||||
|
|
|
@ -14,7 +14,7 @@ categories = ["game-engines", "data-structures"]
|
|||
profiler = []
|
||||
|
||||
[dependencies]
|
||||
hecs = { path = "hecs", features = ["macros", "serialize"] }
|
||||
bevy_hecs = { path = "hecs", features = ["macros", "serialize"], version = "0.1" }
|
||||
rand = "0.7.2"
|
||||
rayon = "1.3"
|
||||
crossbeam-channel = "0.4.2"
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
[package]
|
||||
name = "hecs"
|
||||
version = "0.2.12"
|
||||
description = "A fast, minimal, and ergonomic entity-component-system"
|
||||
authors = ["Benjamin Saunders <ben.e.saunders@gmail.com>"]
|
||||
name = "bevy_hecs"
|
||||
version = "0.1.0"
|
||||
description = "Bevy fork of hecs: a fast, minimal, and ergonomic entity-component-system"
|
||||
authors = [
|
||||
"Benjamin Saunders <ben.e.saunders@gmail.com>",
|
||||
"Bevy Contributors <bevyengine@gmail.com>",
|
||||
"Carter Anderson <mcanders1@gmail.com>"]
|
||||
edition = "2018"
|
||||
license = "Apache-2.0"
|
||||
repository = "https://github.com/Ralith/hecs"
|
||||
|
@ -20,11 +23,11 @@ maintenance = { status = "actively-developed" }
|
|||
default = ["std"]
|
||||
std = []
|
||||
# Enables derive(Bundle)
|
||||
macros = ["hecs-macros", "lazy_static"]
|
||||
macros = ["bevy_hecs_macros", "lazy_static"]
|
||||
serialize = ["serde"]
|
||||
|
||||
[dependencies]
|
||||
hecs-macros = { path = "macros", version = "0.3.0", optional = true }
|
||||
bevy_hecs_macros = { path = "macros", version = "0.1.0", optional = true }
|
||||
hashbrown = { version = "0.8.0", default-features = false, features = ["ahash", "inline-more"] }
|
||||
lazy_static = { version = "1.4.0", optional = true, features = ["spin_no_std"] }
|
||||
serde = { version = "1", features = ["derive"], optional = true}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// modified by Bevy contributors
|
||||
|
||||
use bencher::{benchmark_group, benchmark_main, Bencher};
|
||||
use hecs::*;
|
||||
use bevy_hecs::*;
|
||||
|
||||
struct Position(f32);
|
||||
struct Velocity(f32);
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
//! One way to the contents of an entity, as you might do for debugging. A similar pattern could
|
||||
//! also be useful for serialization, or other row-oriented generic operations.
|
||||
|
||||
fn format_entity(entity: hecs::EntityRef<'_>) -> String {
|
||||
fn fmt<T: hecs::Component + std::fmt::Display>(entity: hecs::EntityRef<'_>) -> Option<String> {
|
||||
fn format_entity(entity: bevy_hecs::EntityRef<'_>) -> String {
|
||||
fn fmt<T: bevy_hecs::Component + std::fmt::Display>(entity: bevy_hecs::EntityRef<'_>) -> Option<String> {
|
||||
Some(entity.get::<T>()?.to_string())
|
||||
}
|
||||
|
||||
const FUNCTIONS: &[&dyn Fn(hecs::EntityRef<'_>) -> Option<String>] =
|
||||
const FUNCTIONS: &[&dyn Fn(bevy_hecs::EntityRef<'_>) -> Option<String>] =
|
||||
&[&fmt::<i32>, &fmt::<bool>, &fmt::<f64>];
|
||||
|
||||
let mut out = String::new();
|
||||
|
@ -31,7 +31,7 @@ fn format_entity(entity: hecs::EntityRef<'_>) -> String {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let mut world = hecs::World::new();
|
||||
let mut world = bevy_hecs::World::new();
|
||||
let e = world.spawn((42, true));
|
||||
println!("{}", format_entity(world.entity(e).unwrap()));
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "hecs-macros"
|
||||
version = "0.3.0"
|
||||
description = "Procedural macro definitions for hecs"
|
||||
name = "bevy_hecs_macros"
|
||||
version = "0.1.0"
|
||||
description = "Bevy fork of hecs-macros: procedural macro definitions for hecs"
|
||||
authors = ["Benjamin Saunders <ben.e.saunders@gmail.com>"]
|
||||
edition = "2018"
|
||||
license = "Apache-2.0"
|
||||
|
@ -10,7 +10,7 @@ license = "Apache-2.0"
|
|||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
syn = { version = "1.0", default-features = false, features = ["proc-macro", "parsing", "printing", "derive"] }
|
||||
syn = "1.0"
|
||||
quote = "1.0.3"
|
||||
proc-macro2 = "1.0.1"
|
||||
proc-macro-crate = "0.1.4"
|
|
@ -50,7 +50,7 @@ pub fn derive_bundle(input: TokenStream) -> TokenStream {
|
|||
} else if crate_name("bevy_ecs").is_ok() {
|
||||
"bevy_ecs"
|
||||
} else {
|
||||
"hecs"
|
||||
"bevy_hecs"
|
||||
};
|
||||
|
||||
let path: Path = syn::parse(path_str.parse::<TokenStream>().unwrap()).unwrap();
|
||||
|
|
|
@ -35,7 +35,7 @@ use crate::{archetype::TypeInfo, Component, DynamicBundle};
|
|||
/// Prefer reusing the same builder over creating new ones repeatedly.
|
||||
///
|
||||
/// ```
|
||||
/// # use hecs::*;
|
||||
/// # use bevy_hecs::*;
|
||||
/// let mut world = World::new();
|
||||
/// let mut builder = EntityBuilder::new();
|
||||
/// builder.add(123).add("abc");
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
//! - exclusion of externally-implementable functionality
|
||||
//!
|
||||
//! ```
|
||||
//! # use hecs::*;
|
||||
//! # use bevy_hecs::*;
|
||||
//! let mut world = World::new();
|
||||
//! // Nearly any type can be used as a component with zero boilerplate
|
||||
//! let a = world.spawn((123, true, "abc"));
|
||||
|
@ -96,4 +96,4 @@ pub use lazy_static;
|
|||
pub use query::Fetch;
|
||||
|
||||
#[cfg(feature = "macros")]
|
||||
pub use hecs_macros::Bundle;
|
||||
pub use bevy_hecs_macros::Bundle;
|
||||
|
|
|
@ -463,7 +463,7 @@ impl<'a, T: Fetch<'a>> Fetch<'a> for TryFetch<T> {
|
|||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// # use hecs::*;
|
||||
/// # use bevy_hecs::*;
|
||||
/// let mut world = World::new();
|
||||
/// let a = world.spawn((123, true, "abc"));
|
||||
/// let b = world.spawn((456, false));
|
||||
|
@ -524,7 +524,7 @@ impl<'a, T: Component, F: Fetch<'a>> Fetch<'a> for FetchWithout<T, F> {
|
|||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// # use hecs::*;
|
||||
/// # use bevy_hecs::*;
|
||||
/// let mut world = World::new();
|
||||
/// let a = world.spawn((123, true, "abc"));
|
||||
/// let b = world.spawn((456, false));
|
||||
|
@ -648,7 +648,7 @@ impl<'w, Q: Query> QueryBorrow<'w, Q> {
|
|||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// # use hecs::*;
|
||||
/// # use bevy_hecs::*;
|
||||
/// let mut world = World::new();
|
||||
/// let a = world.spawn((123, true, "abc"));
|
||||
/// let b = world.spawn((456, false));
|
||||
|
@ -671,7 +671,7 @@ impl<'w, Q: Query> QueryBorrow<'w, Q> {
|
|||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// # use hecs::*;
|
||||
/// # use bevy_hecs::*;
|
||||
/// let mut world = World::new();
|
||||
/// let a = world.spawn((123, true, "abc"));
|
||||
/// let b = world.spawn((456, false));
|
||||
|
|
|
@ -75,7 +75,7 @@ impl World {
|
|||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// # use hecs::*;
|
||||
/// # use bevy_hecs::*;
|
||||
/// let mut world = World::new();
|
||||
/// let a = world.spawn((123, "abc"));
|
||||
/// let b = world.spawn((456, true));
|
||||
|
@ -128,7 +128,7 @@ impl World {
|
|||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// # use hecs::*;
|
||||
/// # use bevy_hecs::*;
|
||||
/// let mut world = World::new();
|
||||
/// let entities = world.spawn_batch((0..1_000).map(|i| (i, "abc"))).collect::<Vec<_>>();
|
||||
/// for i in 0..1_000 {
|
||||
|
@ -241,7 +241,7 @@ impl World {
|
|||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// # use hecs::*;
|
||||
/// # use bevy_hecs::*;
|
||||
/// let mut world = World::new();
|
||||
/// let a = world.spawn((123, true, "abc"));
|
||||
/// let b = world.spawn((456, false));
|
||||
|
@ -268,7 +268,7 @@ impl World {
|
|||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// # use hecs::*;
|
||||
/// # use bevy_hecs::*;
|
||||
/// let mut world = World::new();
|
||||
/// let a = world.spawn((123, true, "abc"));
|
||||
/// // The returned query must outlive the borrow made by `get`
|
||||
|
@ -322,7 +322,7 @@ impl World {
|
|||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// # use hecs::*;
|
||||
/// # use bevy_hecs::*;
|
||||
/// let mut world = World::new();
|
||||
/// let a = world.spawn(());
|
||||
/// let b = world.spawn(());
|
||||
|
@ -351,7 +351,7 @@ impl World {
|
|||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// # use hecs::*;
|
||||
/// # use bevy_hecs::*;
|
||||
/// let mut world = World::new();
|
||||
/// let e = world.spawn((123, "abc"));
|
||||
/// world.insert(e, (456, true));
|
||||
|
@ -452,7 +452,7 @@ impl World {
|
|||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// # use hecs::*;
|
||||
/// # use bevy_hecs::*;
|
||||
/// let mut world = World::new();
|
||||
/// let e = world.spawn((123, "abc", true));
|
||||
/// assert_eq!(world.remove::<(i32, &str)>(e), Ok((123, "abc")));
|
||||
|
@ -586,7 +586,7 @@ impl World {
|
|||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// # use hecs::*;
|
||||
/// # use bevy_hecs::*;
|
||||
/// let mut world = World::new();
|
||||
/// let initial_gen = world.archetypes_generation();
|
||||
/// world.spawn((123, "abc"));
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
// modified by Bevy contributors
|
||||
|
||||
use hecs::*;
|
||||
use bevy_hecs::*;
|
||||
|
||||
#[test]
|
||||
fn random_access() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pub use hecs::{Query as HecsQuery, *};
|
||||
pub use bevy_hecs::{Query as HecsQuery, *};
|
||||
mod resource;
|
||||
mod schedule;
|
||||
mod system;
|
||||
|
|
|
@ -8,7 +8,7 @@ use core::{
|
|||
ops::{Deref, DerefMut},
|
||||
ptr::NonNull,
|
||||
};
|
||||
use hecs::smaller_tuples_too;
|
||||
use bevy_hecs::smaller_tuples_too;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
/// Shared borrow of a Resource
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use super::{FetchResource, ResourceQuery};
|
||||
use crate::system::SystemId;
|
||||
use core::any::TypeId;
|
||||
use hecs::{Archetype, Ref, RefMut, TypeInfo};
|
||||
use bevy_hecs::{Archetype, Ref, RefMut, TypeInfo};
|
||||
use std::{collections::HashMap, ptr::NonNull};
|
||||
|
||||
/// A Resource type
|
||||
|
|
|
@ -5,7 +5,7 @@ use crate::{
|
|||
};
|
||||
use crossbeam_channel::{Receiver, Sender};
|
||||
use fixedbitset::FixedBitSet;
|
||||
use hecs::{ArchetypesGeneration, World};
|
||||
use bevy_hecs::{ArchetypesGeneration, World};
|
||||
use rayon::ScopeFifo;
|
||||
use std::{
|
||||
ops::Range,
|
||||
|
@ -396,7 +396,7 @@ mod tests {
|
|||
Commands,
|
||||
};
|
||||
use fixedbitset::FixedBitSet;
|
||||
use hecs::{Entity, World};
|
||||
use bevy_hecs::{Entity, World};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::{
|
|||
resource::Resources,
|
||||
system::{System, SystemId, ThreadLocalExecution},
|
||||
};
|
||||
use hecs::World;
|
||||
use bevy_hecs::World;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
collections::{HashMap, HashSet},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use super::SystemId;
|
||||
use crate::resource::{Resource, Resources};
|
||||
use hecs::{Bundle, Component, DynamicBundle, Entity, World};
|
||||
use bevy_hecs::{Bundle, Component, DynamicBundle, Entity, World};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
/// A queued command to mutate the current [World] or [Resources]
|
||||
|
@ -327,7 +327,7 @@ impl Commands {
|
|||
mod tests {
|
||||
use super::Commands;
|
||||
use crate::resource::Resources;
|
||||
use hecs::World;
|
||||
use bevy_hecs::World;
|
||||
|
||||
#[test]
|
||||
fn command_buffer() {
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::{
|
|||
resource::{FetchResource, ResourceQuery, Resources, UnsafeClone},
|
||||
system::{ArchetypeAccess, Commands, System, SystemId, ThreadLocalExecution},
|
||||
};
|
||||
use hecs::{Fetch, Query as HecsQuery, World};
|
||||
use bevy_hecs::{Fetch, Query as HecsQuery, World};
|
||||
use std::borrow::Cow;
|
||||
|
||||
pub(crate) struct SystemFn<State, F, ThreadLocalF, Init, SetArchetypeAccess>
|
||||
|
@ -347,7 +347,7 @@ mod tests {
|
|||
resource::{ResMut, Resources},
|
||||
schedule::Schedule,
|
||||
};
|
||||
use hecs::{Entity, With, World};
|
||||
use bevy_hecs::{Entity, With, World};
|
||||
|
||||
struct A;
|
||||
struct B;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::ArchetypeAccess;
|
||||
use hecs::{
|
||||
use bevy_hecs::{
|
||||
Archetype, Component, ComponentError, Entity, Fetch, Query as HecsQuery, QueryOne, Ref, RefMut,
|
||||
World,
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::resource::Resources;
|
||||
use fixedbitset::FixedBitSet;
|
||||
use hecs::{Access, Query, World};
|
||||
use bevy_hecs::{Access, Query, World};
|
||||
use std::{any::TypeId, borrow::Cow, collections::HashSet};
|
||||
|
||||
/// Determines the strategy used to run the `run_thread_local` function in a [System]
|
||||
|
@ -105,7 +105,7 @@ impl TypeAccess {
|
|||
mod tests {
|
||||
use super::{ArchetypeAccess, TypeAccess};
|
||||
use crate::resource::{FetchResource, Res, ResMut, ResourceQuery};
|
||||
use hecs::World;
|
||||
use bevy_hecs::World;
|
||||
use std::any::TypeId;
|
||||
|
||||
struct A;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use hecs::{Bundle, Component, DynamicBundle, Entity, World};
|
||||
use bevy_hecs::{Bundle, Component, DynamicBundle, Entity, World};
|
||||
|
||||
/// Converts a reference to `Self` to a [WorldBuilder]
|
||||
pub trait WorldBuilderSource {
|
||||
|
|
|
@ -299,7 +299,6 @@ pub fn derive_property(input: TokenStream) -> TokenStream {
|
|||
})
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct PropertyDef {
|
||||
type_name: Ident,
|
||||
generics: Generics,
|
||||
|
|
33
tools/publish.sh
Normal file
33
tools/publish.sh
Normal file
|
@ -0,0 +1,33 @@
|
|||
crates=(
|
||||
bevy_app
|
||||
bevy_asset
|
||||
bevy_audio
|
||||
bevy_core
|
||||
bevy_derive
|
||||
bevy_diagnostic
|
||||
bevy_ecs
|
||||
bevy_ecs/hecs
|
||||
bevy_ecs/hecs/macros
|
||||
bevy_gltf
|
||||
bevy_input
|
||||
bevy_math
|
||||
bevy_pbr
|
||||
bevy_property
|
||||
bevy_render
|
||||
bevy_scene
|
||||
bevy_sprite
|
||||
bevy_text
|
||||
bevy_transform
|
||||
bevy_type_registry
|
||||
bevy_ui
|
||||
bevy_wgpu
|
||||
bevy_window
|
||||
bevy_winit
|
||||
)
|
||||
|
||||
cd crates
|
||||
for crate in "${crates[@]}"
|
||||
do
|
||||
echo "Publishing ${crate}"
|
||||
(cd $crate; cargo build)
|
||||
done
|
Loading…
Reference in a new issue