diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a135c6e4e662..6e9e82dc2bfc1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -333,3 +333,25 @@ jobs: with: name: msrv path: msrv/ + + check-bevy-internal-imports: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v3 + - name: Check for bevy_internal imports + shell: bash + run: | + errors="" + for file in $(find examples tests -name '*.rs'); do + if grep -q "use bevy_internal" "$file"; then + errors+="ERROR: Detected 'use bevy_internal' in $file\n" + fi + done + if [ -n "$errors" ]; then + echo -e "$errors" + echo " Avoid importing bevy_internal, it should not be used directly" + echo " Fix the issue by replacing 'bevy_internal' with 'bevy'" + echo " Example: 'use bevy::sprite::MaterialMesh2dBundle;' instead of 'bevy_internal::sprite::MaterialMesh2dBundle;'" + exit 1 + fi \ No newline at end of file diff --git a/examples/animation/animated_fox.rs b/examples/animation/animated_fox.rs index 808d04adf13f7..87fe9dd0989a7 100644 --- a/examples/animation/animated_fox.rs +++ b/examples/animation/animated_fox.rs @@ -3,9 +3,7 @@ use std::f32::consts::PI; use std::time::Duration; -use bevy::pbr::CascadeShadowConfigBuilder; -use bevy::prelude::*; -use bevy_internal::animation::RepeatAnimation; +use bevy::{animation::RepeatAnimation, pbr::CascadeShadowConfigBuilder, prelude::*}; fn main() { App::new()