Skip to content

Commit

Permalink
ci: reorganize crates and attempt to fix CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
zicklag committed Aug 21, 2023
1 parent fea00da commit b6988d3
Show file tree
Hide file tree
Showing 135 changed files with 156 additions and 67 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ jobs:
command: clippy
args: --target ${{ matrix.config.target }} -- -W clippy::correctness -D warnings

- name: ⚙️ Test
if: matrix.config.target != 'wasm32-unknown-unknown'
uses: actions-rs/cargo@v1
env:
CARGO_TARGET_DIR: ${{ matrix.config.target_dir }}
with:
command: test
args: --workspace

minimal_deps_check:
runs-on: ubuntu-latest
name: 🔧 Check Minimal Dependency Versions
Expand Down
36 changes: 30 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 32 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
[workspace]
members = ["crates/*", "demos/*"]
resolver = "2"
members = [
"framework_crates/*",
"other_crates/*",
"demos/*"
]
default-members = [
"framework_crates/*"
]

[workspace.package]
edition = "2021"
version = "0.3.0"
rust-version = "^1.71.0"
readme = "README.md"
homepage = "https://fishfolk.org/development/bones/introduction/"
repository = "https://github.com/fishfolk/bones"
documentation = "https://fishfolk.github.io/bones/rustdoc/bones_framework/index.html"
license = "MIT or Apache2.0"
authors = ["Bones Contributors"]
categories = [
"game-development",
"game-engines",
"wasm",
"data-structures",
]
keywords = [
"bones",
"bevy",
"scripting",
"ecs",
"framework",
]

[profile.release]
lto = true
4 changes: 2 additions & 2 deletions demos/assets_minimal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ version = "0.1.0"
edition = "2021"

[dependencies]
bones_framework = { path = "../../crates/bones_framework" }
bones_bevy_renderer = { path = "../../crates/bones_bevy_renderer" }
bones_framework = { path = "../../framework_crates/bones_framework" }
bones_bevy_renderer = { path = "../../framework_crates/bones_bevy_renderer" }
4 changes: 2 additions & 2 deletions demos/features/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ edition = "2021"
license = "Unlicense"

[dependencies]
bones_framework = { path = "../../crates/bones_framework" }
bones_bevy_renderer = { path = "../../crates/bones_bevy_renderer" }
bones_framework = { path = "../../framework_crates/bones_framework" }
bones_bevy_renderer = { path = "../../framework_crates/bones_bevy_renderer" }
4 changes: 2 additions & 2 deletions demos/hello_world/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ version = "0.1.0"
edition = "2021"

[dependencies]
bones_framework = { path = "../../crates/bones_framework" }
bones_bevy_renderer = { path = "../../crates/bones_bevy_renderer" }
bones_framework = { path = "../../framework_crates/bones_framework" }
bones_bevy_renderer = { path = "../../framework_crates/bones_bevy_renderer" }
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ pub enum AssetKind {
/// This is meant to be used in a `type_data` attribute when deriving [`HasSchema`].
///
/// ```
/// # use bones_asset::prelude::*;
/// # use glam::*;
/// #[derive(HasSchema, Default, Clone)]
/// #[type_data(metadata_asset("atlas"))]
/// #[repr(C)]
Expand All @@ -300,14 +302,22 @@ pub fn metadata_asset(extension: &str) -> AssetKind {
/// This is meant to be used in a `type_data` attribute when deriving [`HasSchema`].
///
/// ```
/// # use bones_asset::prelude::*;
/// #[derive(HasSchema, Default, Clone)]
/// #[type_data(asset_loader("png", PngLoader))]
/// #[repr(C)]
/// struct Image {
/// data: Vec<u8>,
/// data: SVec<u8>,
/// width: u32,
/// height: u32,
/// }
///
/// struct PngLoader;
/// impl AssetLoader for PngLoader {
/// fn load(&self, ctx: AssetLoadCtx, data: &[u8]) -> anyhow::Result<SchemaBox> {
/// todo!("Load PNG from data");
/// }
/// }
/// ```
pub fn asset_loader<L: AssetLoader, E: Into<AssetExtensions>>(
extensions: E,
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::path::{Path, PathBuf};
use std::path::PathBuf;

use bones_utils::HashMap;

Expand Down Expand Up @@ -39,7 +39,7 @@ pub struct FileAssetIo {
#[cfg(not(target_arch = "wasm32"))]
impl FileAssetIo {
/// Create a new [`FileAssetIo`].
pub fn new(core_dir: &Path, packs_dir: &Path, watch: bool) -> Self {
pub fn new(core_dir: &std::path::Path, packs_dir: &std::path::Path, watch: bool) -> Self {
let cwd = std::env::current_dir().unwrap();
let core_dir = cwd.join(core_dir);
let packs_dir = cwd.join(packs_dir);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ name = "bones_bevy_renderer"
repository = "https://github.com/fishfolk/bones"
version = "0.2.0"

[features]
default = ["webgl2"]
webgl2 = ["bevy/webgl2"]

[dependencies]
bones_framework = { version = "^0.2.0", path = "../bones_framework" }

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,29 @@ impl BonesBevyRenderer {
{
let mut bones_image_ids = BonesImageIds::default();
let mut asset_server = self.game.asset_server();
let mut bevy_images = app.world.resource_mut::<Assets<Image>>();

if !asset_server.asset_types.is_empty() {
// Configure the AssetIO
let io = bones::FileAssetIo::new(&self.asset_dir, &self.packs_dir, true);
asset_server.set_io(io);

// Load the game assets
asset_server
.load_assets()
.expect("Could not load game assets");

// Take all loaded image assets and conver them to external images that reference bevy handles
let mut bevy_images = app.world.resource_mut::<Assets<Image>>();
bones_image_ids.load_bones_images(&mut asset_server, &mut bevy_images);
#[cfg(not(target_arch = "wasm32"))]
{
// Configure the AssetIO
let io = bones::FileAssetIo::new(&self.asset_dir, &self.packs_dir, true);
asset_server.set_io(io);

// Load the game assets
asset_server
.load_assets()
.expect("Could not load game assets");

// Take all loaded image assets and conver them to external images that reference bevy handles
bones_image_ids.load_bones_images(&mut asset_server, &mut bevy_images);
}
#[cfg(target_arch = "wasm32")]
{
bones_image_ids.load_bones_images(&mut asset_server, &mut bevy_images);
// TODO: Implement WASM asset loader.
unimplemented!("WASM asset loading is not implemented yet.");
}
}

app.insert_resource(bones_image_ids);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ impl Entities {
///
/// ```
/// # use bones_ecs::prelude::*;
/// # #[derive(Clone, TypeUlid)]
/// # #[ulid = "01GP1SVTTSR91P40B2W0XPQ1SN"]
/// # #[derive(HasSchema, Clone, Default)]
/// # #[repr(C)]
/// # struct Pos { x: f32, y: f32 };
/// # #[derive(Clone, TypeUlid)]
/// # #[ulid = "01GP1SW3HYWEB2TY4S40ARMB1R"]
/// # #[derive(HasSchema, Clone, Default)]
/// # #[repr(C)]
/// # struct Vel { x: f32, y: f32 };
///
/// fn my_system(entities: Res<Entities>, mut pos: CompMut<Pos>, vel: Comp<Vel>) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::time::Duration;
/// # Examples
///
/// ```
/// # use bones_input::prelude::*;
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut stopwatch = Stopwatch::new();
/// assert_eq!(stopwatch.elapsed_secs(), 0.0);
Expand Down Expand Up @@ -33,7 +33,7 @@ impl Stopwatch {
///
/// # Examples
/// ```
/// # use bones_input::prelude::*;
/// # use bones_framework::prelude::*;
/// let stopwatch = Stopwatch::new();
/// assert_eq!(stopwatch.elapsed_secs(), 0.0);
/// assert_eq!(stopwatch.paused(), false);
Expand All @@ -47,7 +47,7 @@ impl Stopwatch {
///
/// # Examples
/// ```
/// # use bones_input::prelude::*;
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut stopwatch = Stopwatch::new();
/// stopwatch.tick(Duration::from_secs(1));
Expand All @@ -68,7 +68,7 @@ impl Stopwatch {
///
/// # Examples
/// ```
/// # use bones_input::prelude::*;
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut stopwatch = Stopwatch::new();
/// stopwatch.tick(Duration::from_secs(1));
Expand Down Expand Up @@ -100,7 +100,7 @@ impl Stopwatch {
///
/// # Examples
/// ```
/// # use bones_input::prelude::*;
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut stopwatch = Stopwatch::new();
/// stopwatch.set_elapsed(Duration::from_secs_f32(1.0));
Expand All @@ -117,7 +117,7 @@ impl Stopwatch {
///
/// # Examples
/// ```
/// # use bones_input::prelude::*;
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut stopwatch = Stopwatch::new();
/// stopwatch.tick(Duration::from_secs_f32(1.5));
Expand All @@ -135,7 +135,7 @@ impl Stopwatch {
///
/// # Examples
/// ```
/// # use bones_input::prelude::*;
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut stopwatch = Stopwatch::new();
/// stopwatch.pause();
Expand All @@ -152,7 +152,7 @@ impl Stopwatch {
///
/// # Examples
/// ```
/// # use bones_input::prelude::*;
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut stopwatch = Stopwatch::new();
/// stopwatch.pause();
Expand All @@ -171,7 +171,7 @@ impl Stopwatch {
///
/// # Examples
/// ```
/// # use bones_input::prelude::*;
/// # use bones_framework::prelude::*;
/// let mut stopwatch = Stopwatch::new();
/// assert!(!stopwatch.paused());
/// stopwatch.pause();
Expand All @@ -188,7 +188,7 @@ impl Stopwatch {
///
/// # Examples
/// ```
/// # use bones_input::prelude::*;
/// # use bones_framework::prelude::*;
/// use std::time::Duration;
/// let mut stopwatch = Stopwatch::new();
/// stopwatch.tick(Duration::from_secs_f32(1.5));
Expand Down
Loading

0 comments on commit b6988d3

Please sign in to comment.