Skip to content

Commit bbfda42

Browse files
committed
feat: complete plugin re-write
1 parent c7cd061 commit bbfda42

File tree

301 files changed

+43256
-45692
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

301 files changed

+43256
-45692
lines changed

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[env]
22
TARGET_DIR = { value = "target", relative = true }
3+
4+
[alias]
5+
xtask = "run --package xtask --"

.github/workflows/bevy_api_gen.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ on:
55
paths:
66
- "crates/bevy_api_gen/**"
77
- ".github/workflows/bevy_api_gen.yml"
8+
- ".github/workflows/generate_bindings.yml"
9+
810

911

1012
name: Check and Lint - bevy_api_gen
1113

14+
env:
15+
RUST_TOOLCHAIN: nightly-2024-12-15
16+
1217
jobs:
1318
check:
1419
name: Check - bevy_api_gen
@@ -25,7 +30,7 @@ jobs:
2530
- uses: actions-rs/toolchain@v1
2631
with:
2732
profile: minimal
28-
toolchain: nightly-2024-11-05
33+
toolchain: ${{ env.RUST_TOOLCHAIN }}
2934
override: true
3035
- name: Rust Cache
3136
uses: Swatinem/rust-cache@v2.7.3
@@ -52,7 +57,7 @@ jobs:
5257
with:
5358
profile: minimal
5459
components: rustfmt
55-
toolchain: nightly-2024-11-05
60+
toolchain: ${{ env.RUST_TOOLCHAIN }}
5661
override: true
5762
- name: Rust Cache
5863
uses: Swatinem/rust-cache@v2.7.3
@@ -75,7 +80,7 @@ jobs:
7580
rm -rf crates
7681
- uses: actions-rs/toolchain@v1
7782
with:
78-
toolchain: nightly-2024-11-05
83+
toolchain: ${{ env.RUST_TOOLCHAIN }}
7984
components: clippy
8085
override: true
8186
- name: Rust Cache
@@ -98,7 +103,7 @@ jobs:
98103
rm -rf crates
99104
- uses: actions-rs/toolchain@v1
100105
with:
101-
toolchain: nightly-2024-11-05
106+
toolchain: ${{ env.RUST_TOOLCHAIN }}
102107
override: true
103108
- name: Rust Cache
104109
uses: Swatinem/rust-cache@v2.7.3
@@ -120,7 +125,7 @@ jobs:
120125
rm -rf crates
121126
- uses: actions-rs/toolchain@v1
122127
with:
123-
toolchain: nightly-2024-11-05
128+
toolchain: ${{ env.RUST_TOOLCHAIN }}
124129
override: true
125130
- name: Rust Cache
126131
uses: Swatinem/rust-cache@v2.7.3
@@ -131,3 +136,10 @@ jobs:
131136
with:
132137
command: doc
133138
args: --profile=ephemeral-build
139+
bindings:
140+
permissions:
141+
contents: write
142+
pull-requests: write
143+
name: Generate Bindings - bevy_api_gen
144+
uses: ./.github/workflows/generate_bindings.yml
145+
secrets: inherit

.github/workflows/bevy_mod_scripting.yml

Lines changed: 16 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -21,93 +21,27 @@ concurrency:
2121
cancel-in-progress: true
2222

2323
jobs:
24-
check:
24+
check:
25+
permissions:
26+
pull-requests: write
2527
name: Check - ${{ matrix.run_args.label }}
2628
runs-on: ${{ matrix.run_args.os }}
2729
strategy:
2830
matrix:
2931
run_args: [
30-
{label: Windows - All Features, os: windows-latest, features: "lua54,rhai,teal,lua_script_api,rhai_script_api,rune", cross: x86_64-pc-windows-msvc },
31-
{label: MacOS - All Features, os: macOS-latest, features: "lua54,rhai,teal,lua_script_api,rhai_script_api,rune", cross: x86_64-apple-darwin },
32-
{label: Ubuntu - All Features, os: ubuntu-latest, features: "lua54,lua_script_api,rhai,teal,rhai_script_api,rune", cross: x86_64-unknown-linux-gnu },
33-
{label: Ubuntu Aarch64 - All Features, os: ubuntu-latest, features: "lua54,rhai,teal,lua_script_api,rhai_script_api,rune", cross: aarch64-unknown-linux-gnu },
34-
{label: Ubuntu - Lua51, os: ubuntu-latest, features: "lua51,lua_script_api", cross: x86_64-unknown-linux-gnu },
35-
{label: Ubuntu - Lua52, os: ubuntu-latest, features: "lua52,lua_script_api", cross: x86_64-unknown-linux-gnu },
36-
{label: Ubuntu - Lua53, os: ubuntu-latest, features: "lua53,lua_script_api", cross: x86_64-unknown-linux-gnu },
37-
{label: Ubuntu - Luajit, os: ubuntu-latest, features: "luajit,lua_script_api", cross: x86_64-unknown-linux-gnu },
38-
{label: Ubuntu - Luajit52, os: ubuntu-latest, features: "luajit52,lua_script_api", cross: x86_64-unknown-linux-gnu },
39-
{label: Ubuntu - Luau, os: ubuntu-latest, features: "luau,lua_script_api", cross: x86_64-unknown-linux-gnu }
40-
32+
{label: Windows, os: windows-latest },
33+
{label: MacOS, os: macOS-latest },
34+
{label: Ubuntu, os: ubuntu-latest },
35+
{label: Ubuntu Aarch64, os: ubuntu-latest }
4136
]
4237
steps:
43-
- if: runner.os == 'linux'
44-
name: Install alsa and udev
45-
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
46-
- uses: actions/checkout@v2
47-
- uses: actions-rs/toolchain@v1
48-
with:
49-
profile: minimal
50-
toolchain: stable
51-
override: true
52-
- name: Rust Cache
53-
uses: Swatinem/rust-cache@v2.7.3
54-
- if: runner.os != 'windows'
55-
name: Clear space
56-
run: rm -rf /usr/share/dotnet; rm -rf /opt/ghc; rm -rf "/usr/local/share/boost"; rm -rf "$AGENT_TOOLSDIRECTORY"
57-
- uses: houseabsolute/actions-rust-cross@v0
58-
with:
59-
command: check
60-
target: ${{ matrix.run_args.cross }}
61-
args: --workspace --features=${{ matrix.run_args.features }} --profile=ephemeral-build
62-
63-
fmt:
64-
name: Rustfmt
65-
runs-on: ubuntu-latest
66-
steps:
67-
- name: Install alsa and udev
68-
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
69-
- uses: actions/checkout@v2
70-
- uses: actions-rs/toolchain@v1
71-
with:
72-
profile: minimal
73-
components: rustfmt
74-
toolchain: stable
75-
override: true
76-
- name: Rust Cache
77-
uses: Swatinem/rust-cache@v2.7.3
78-
- uses: actions-rs/cargo@v1
79-
with:
80-
command: fmt
81-
args: --all -- --check
82-
83-
clippy:
84-
name: Clippy
85-
runs-on: ubuntu-latest
86-
steps:
87-
- name: Install alsa and udev
88-
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
89-
- uses: actions/checkout@v2
90-
- uses: actions-rs/toolchain@v1
91-
with:
92-
toolchain: stable
93-
components: clippy
94-
override: true
95-
- name: Rust Cache
96-
uses: Swatinem/rust-cache@v2.7.3
97-
- uses: actions-rs/cargo@v1
98-
with:
99-
command: clippy
100-
args: --features=lua54,rhai,teal,lua_script_api,rhai_script_api,rune --profile=ephemeral-build -- -D warnings
101-
tests:
102-
name: Tests
103-
runs-on: ubuntu-latest
104-
steps:
105-
- name: Clear space
106-
run: sudo rm -rf /usr/share/dotnet; sudo rm -rf /opt/ghc; sudo rm -rf "/usr/local/share/boost"; sudo rm -rf "$AGENT_TOOLSDIRECTORY"
10738
- name: Checkout
10839
uses: actions/checkout@v3
10940
- name: Install alsa and udev
110-
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
41+
if: runner.os == 'linux'
42+
run: |
43+
sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
44+
sudo rm -rf /usr/share/dotnet; sudo rm -rf /opt/ghc; sudo rm -rf "/usr/local/share/boost"; sudo rm -rf "$AGENT_TOOLSDIRECTORY"
11145
- uses: actions-rs/toolchain@v1
11246
with:
11347
toolchain: stable
@@ -116,25 +50,9 @@ jobs:
11650
uses: Swatinem/rust-cache@v2.7.3
11751
- uses: actions-rs/cargo@v1
11852
with:
119-
command: test
120-
args: --workspace --features=lua54,rhai,teal,lua_script_api,rhai_script_api,rune --profile=ephemeral-build
121-
docs:
122-
name: Docs
123-
runs-on: ubuntu-latest
124-
steps:
125-
- name: Install alsa and udev
126-
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
127-
- uses: actions/checkout@v2
128-
- uses: actions-rs/toolchain@v1
129-
with:
130-
toolchain: stable
131-
override: true
132-
- name: Rust Cache
133-
uses: Swatinem/rust-cache@v2.7.3
134-
- name: Find docs.rs features
135-
run: echo "DOCS_FEATURES=$(cargo metadata --no-deps | python -c "import sys,json; [print(','.join(x['metadata']['docs.rs']['features'])) for x in json.load(sys.stdin)['packages'] if x['name'] == 'bevy_mod_scripting']")" >> $GITHUB_OUTPUT
136-
id: features
137-
- uses: actions-rs/cargo@v1
53+
command: xtask
54+
args: ci-check
55+
- uses: romeovs/lcov-reporter-action@v0.2.16
56+
continue-on-error: true
13857
with:
139-
command: doc
140-
args: --workspace --features=${{ steps.features.outputs.DOCS_FEATURES }} --profile=ephemeral-build
58+
lcov-file: ./target/coverage/lcov.info

.github/workflows/doc_gen.yml

Lines changed: 0 additions & 60 deletions
This file was deleted.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Generate Bindings (Bevy, Glam)
2+
3+
on:
4+
workflow_call:
5+
# inputs:
6+
# config-path:
7+
# required: true
8+
# type: string
9+
# secrets:
10+
# token:
11+
# required: true
12+
workflow_dispatch:
13+
14+
env:
15+
RUST_TOOLCHAIN: nightly-2024-12-15
16+
BEVY_API_GEN_PATH: ${{ github.workspace }}/crates/bevy_api_gen
17+
BEVY_PATH: ${{ github.workspace }}/target/codegen/bevy
18+
OUTPUT_PATH: ${{ github.workspace }}/crates/bevy_mod_scripting_functions/src/bevy_bindings/
19+
BEVY_FEATURES: bevy_asset,bevy_animation,bevy_core_pipeline,bevy_ui,bevy_pbr,bevy_render,bevy_text,bevy_sprite,file_watcher,multi_threaded
20+
BRANCH_NAME: __update-bevy-bindings-${{ github.head_ref || github.ref_name }}
21+
GH_TOKEN: ${{ github.token }}
22+
23+
jobs:
24+
generate_bindings:
25+
permissions:
26+
contents: write
27+
pull-requests: write
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
- name: Setup Bot GitHub Credentials
33+
run: |
34+
git config user.name "github-actions[bot]"
35+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
36+
- name: Install Rust Toolchain
37+
uses: actions-rs/toolchain@v1
38+
with:
39+
toolchain: ${{ env.RUST_TOOLCHAIN }}
40+
components: rust-src, rustc-dev, llvm-tools-preview
41+
override: true
42+
- name: Install bevy_api_gen Binaries
43+
run: cargo install --path ${{ env.BEVY_API_GEN_PATH }}
44+
- name: read bevy workspace version
45+
uses: SebRollen/toml-action@v1.2.0
46+
id: read_toml
47+
with:
48+
file: 'Cargo.toml'
49+
field: 'workspace.dependencies.bevy.version'
50+
- name: Prepare Directories
51+
run: |
52+
mkdir -p ${{ env.OUTPUT_PATH }}
53+
mkdir -p ${{ env.BEVY_PATH }}
54+
- name: Clone Bevy
55+
run: |
56+
git clone https://github.com/bevyengine/bevy --branch v${{ steps.read_toml.outputs.value }} --depth 1 ${{ env.BEVY_PATH }}
57+
cd ${{ env.BEVY_PATH }} && git fetch --tags && git checkout v${{ steps.read_toml.outputs.value }}
58+
ls -la ${{ env.BEVY_PATH }}
59+
- name: Generate Bevy Bindings
60+
run: |
61+
cd ${{ env.BEVY_PATH }} && cargo bevy-api-gen generate --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' --features ${{ env.BEVY_FEATURES }} -vv
62+
- name: Collect Bevy Bindings
63+
run: |
64+
ls -la ${{ env.BEVY_PATH }}
65+
cd ${{ env.BEVY_PATH }} && cargo bevy-api-gen collect --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}'
66+
- name: Prune Output
67+
run: |
68+
find ${{ env.OUTPUT_PATH }} -type f ! -name "*.rs" -delete
69+
- name: Check for changes
70+
id: check_changes
71+
run: |
72+
if [[ -n $(git status --porcelain) ]]; then
73+
echo "changes=true" >> "$GITHUB_OUTPUT";
74+
fi
75+
- name: Commit Changes
76+
if: steps.check_changes.outputs.changes
77+
run: |
78+
git checkout -b ${{ env.BRANCH_NAME }} || git checkout ${{ env.BRANCH_NAME }}
79+
git add -A
80+
git commit -m "chore(codegen): update bevy bindings"
81+
git push -u origin ${{ env.BRANCH_NAME }} --force
82+
- uses: jwalton/gh-find-current-pr@master
83+
if: steps.check_changes.outputs.changes
84+
id: findPR
85+
with:
86+
state: all
87+
- name: Create Or Update PR
88+
if: steps.check_changes.outputs.changes && success() && steps.findPR.outputs.number
89+
run: |
90+
gh pr list --base feature/bevy-system-refactor --search "chore(codegen): update bevy bindings" --json number > prs.json
91+
if [ $(jq '. | length' prs.json) -eq 0 ]; then
92+
gh pr create --title "chore(codegen): update bevy bindings" --body "This PR updates the bevy bindings for #${{ steps.findPR.outputs.number }}" --base ${{ github.ref }} --head ${{ env.BRANCH_NAME }} || true
93+
fi

0 commit comments

Comments
 (0)