diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e84f0214..d4270a33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,12 @@ jobs: command: check args: --all-targets --features atlas + - name: Run cargo check headless + uses: actions-rs/cargo@v1 + with: + command: check + args: --all-targets --no-default-features + # test: # name: Tests # strategy: diff --git a/examples/basic.rs b/examples/basic.rs index 7955d1de..9ce731e1 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -6,7 +6,9 @@ mod helpers; fn startup( mut commands: Commands, asset_server: Res, - #[cfg(not(feature = "atlas"))] array_texture_loader: Res, + #[cfg(all(not(feature = "atlas"), feature = "render"))] array_texture_loader: Res< + ArrayTextureLoader, + >, ) { commands.spawn(Camera2dBundle::default()); @@ -60,7 +62,7 @@ fn startup( // Add atlas to array texture loader so it's preprocessed before we need to use it. // Only used when the atlas feature is off and we are using array textures. - #[cfg(not(feature = "atlas"))] + #[cfg(all(not(feature = "atlas"), feature = "render"))] { array_texture_loader.add(TilemapArrayTexture { texture: TilemapTexture::Single(asset_server.load("tiles.png")), diff --git a/src/array_texture_preload.rs b/src/array_texture_preload.rs index fd24a14e..909546f3 100644 --- a/src/array_texture_preload.rs +++ b/src/array_texture_preload.rs @@ -1,4 +1,3 @@ -#[cfg(feature = "render")] use crate::render::{DefaultSampler, TextureArrayCache}; use crate::{ prelude::{TilemapSpacing, TilemapTileSize}, @@ -8,7 +7,6 @@ use bevy::render::{ render_resource::{FilterMode, TextureFormat}, texture::BevyDefault, }; -#[cfg(feature = "render")] use bevy::{ prelude::{Assets, Image, Res, ResMut, Resource}, render::Extract, @@ -60,7 +58,6 @@ impl ArrayTextureLoader { } } -#[cfg(feature = "render")] pub(crate) fn extract( images: Extract>>, array_texture_loader: Extract>, diff --git a/src/lib.rs b/src/lib.rs index df20a1fa..d7952ce2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,7 +32,7 @@ use tiles::{ use bevy::render::{RenderApp, RenderStage}; /// A module that allows pre-loading of atlases into array textures. -#[cfg(not(feature = "atlas"))] +#[cfg(all(not(feature = "atlas"), feature = "render"))] mod array_texture_preload; /// A module which provides helper functions. pub mod helpers; @@ -114,7 +114,7 @@ pub struct TilemapBundle { /// A module which exports commonly used dependencies. pub mod prelude { - #[cfg(not(feature = "atlas"))] + #[cfg(all(not(feature = "atlas"), feature = "render"))] pub use crate::array_texture_preload::*; pub use crate::helpers::filling::*; pub use crate::helpers::geometry::*;