Skip to content

v0.8.0 - Bevy 0.15 Support #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/bevy_api_gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2024-05-20
toolchain: nightly-2024-11-05
override: true
- name: Rust Cache
uses: Swatinem/rust-cache@v2.7.3
Expand All @@ -52,7 +52,7 @@ jobs:
with:
profile: minimal
components: rustfmt
toolchain: nightly-2024-05-20
toolchain: nightly-2024-11-05
override: true
- name: Rust Cache
uses: Swatinem/rust-cache@v2.7.3
Expand All @@ -75,7 +75,7 @@ jobs:
rm -rf crates
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2024-05-20
toolchain: nightly-2024-11-05
components: clippy
override: true
- name: Rust Cache
Expand All @@ -98,7 +98,7 @@ jobs:
rm -rf crates
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2024-05-20
toolchain: nightly-2024-11-05
override: true
- name: Rust Cache
uses: Swatinem/rust-cache@v2.7.3
Expand All @@ -120,7 +120,7 @@ jobs:
rm -rf crates
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2024-05-20
toolchain: nightly-2024-11-05
override: true
- name: Rust Cache
uses: Swatinem/rust-cache@v2.7.3
Expand Down
32 changes: 21 additions & 11 deletions .github/workflows/bevy_mod_scripting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,36 @@ on:
- '.github/workflows/release-plz.yml'
- '.github/workflows/bevy_api_gen.yml'
- '.github/workflows/macro_tests.yml'
- 'docs/**'


name: Check and Lint - bevy_mod_scripting

concurrency:
# Use github.run_id on main branch
# Use github.event.pull_request.number on pull requests, so it's unique per pull request
# Use github.ref on other branches, so it's unique per branch
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
check:
name: Check
name: Check - ${{ matrix.run_args.label }}
runs-on: ${{ matrix.run_args.os }}
strategy:
matrix:
run_args: [
{os: windows-latest, lua: lua54, cross: x86_64-pc-windows-msvc},
{os: macOS-latest, lua: lua54, cross: x86_64-apple-darwin},
{os: ubuntu-latest, lua: lua54, cross: aarch64-unknown-linux-gnu},
{os: ubuntu-latest, lua: lua51, cross: x86_64-unknown-linux-gnu},
{os: ubuntu-latest, lua: lua52, cross: x86_64-unknown-linux-gnu},
{os: ubuntu-latest, lua: lua53, cross: x86_64-unknown-linux-gnu},
{os: ubuntu-latest, lua: lua54, cross: x86_64-unknown-linux-gnu},
{os: ubuntu-latest, lua: luajit, cross: x86_64-unknown-linux-gnu},
{os: ubuntu-latest, lua: luajit52, cross: x86_64-unknown-linux-gnu}
{label: Windows - All Features, os: windows-latest, features: "lua54,rhai,teal,lua_script_api,rhai_script_api,rune", cross: x86_64-pc-windows-msvc },
{label: MacOS - All Features, os: macOS-latest, features: "lua54,rhai,teal,lua_script_api,rhai_script_api,rune", cross: x86_64-apple-darwin },
{label: Ubuntu - All Features, os: ubuntu-latest, features: "lua54,lua_script_api,rhai,teal,rhai_script_api,rune", cross: x86_64-unknown-linux-gnu },
{label: Ubuntu Aarch64 - All Features, os: ubuntu-latest, features: "lua54,rhai,teal,lua_script_api,rhai_script_api,rune", cross: aarch64-unknown-linux-gnu },
{label: Ubuntu - Lua51, os: ubuntu-latest, features: "lua51,lua_script_api", cross: x86_64-unknown-linux-gnu },
{label: Ubuntu - Lua52, os: ubuntu-latest, features: "lua52,lua_script_api", cross: x86_64-unknown-linux-gnu },
{label: Ubuntu - Lua53, os: ubuntu-latest, features: "lua53,lua_script_api", cross: x86_64-unknown-linux-gnu },
{label: Ubuntu - Luajit, os: ubuntu-latest, features: "luajit,lua_script_api", cross: x86_64-unknown-linux-gnu },
{label: Ubuntu - Luajit52, os: ubuntu-latest, features: "luajit52,lua_script_api", cross: x86_64-unknown-linux-gnu },
{label: Ubuntu - Luau, os: ubuntu-latest, features: "luau,lua_script_api", cross: x86_64-unknown-linux-gnu }

]
steps:
- if: runner.os == 'linux'
Expand All @@ -48,7 +58,7 @@ jobs:
with:
command: check
target: ${{ matrix.run_args.cross }}
args: --workspace --features=${{ matrix.run_args.lua }},rhai,teal,lua_script_api,rhai_script_api,rune --profile=ephemeral-build
args: --workspace --features=${{ matrix.run_args.features }} --profile=ephemeral-build

fmt:
name: Rustfmt
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/mdbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy mdBook to GitHub Pages

on:
push:
branches:
- "**"
paths:
- 'docs/**'
- '.github/workflows/mdbook.yml'

jobs:

build:
name: Build Book - mdbook
runs-on: ubuntu-latest
steps:

- name: Checkout repository
uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Rust Cache
uses: Swatinem/rust-cache@v2.7.3
- name: Install mdBook
run: cargo install mdbook

- name: Build the book
run: cd docs && mdbook build

- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/book
26 changes: 26 additions & 0 deletions .github/workflows/pr-titles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Lint PR"

on:
pull_request_target:
types:
- opened
- edited
- synchronize
- reopened

permissions:
pull-requests: read

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
fix
feat
chore
3 changes: 2 additions & 1 deletion .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ permissions:
on:
push:
branches:
- [main, staging]
- main
- staging

jobs:

Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## [0.8.0-alpha.2](https://github.com/makspll/bevy_mod_scripting/compare/v0.8.0-alpha.1...v0.8.0-alpha.2) - 2024-12-03

### Fixed

- bug when compiling without `teal` feature ([#148](https://github.com/makspll/bevy_mod_scripting/pull/148))

### Other

- Small fixes ([#155](https://github.com/makspll/bevy_mod_scripting/pull/155))
- Luau support attempt ([#154](https://github.com/makspll/bevy_mod_scripting/pull/154))
- Bump bevy & bevy console ([#153](https://github.com/makspll/bevy_mod_scripting/pull/153))
- Fix failing doctest ([#146](https://github.com/makspll/bevy_mod_scripting/pull/146))
- update Cargo.toml dependencies

## [0.8.0-alpha.1](https://github.com/makspll/bevy_mod_scripting/compare/v0.8.0-alpha.0...v0.8.0-alpha.1) - 2024-11-10

### Other

- Bump Bevy release candidate ([#143](https://github.com/makspll/bevy_mod_scripting/pull/143))
- update Cargo.toml dependencies

## [0.7.1](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting-v0.7.0...bevy_mod_scripting-v0.7.1) - 2024-11-03

### Other
Expand Down
19 changes: 10 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_mod_scripting"
version = "0.7.1"
version = "0.8.0-alpha.2"
authors = ["Maksymilian Mozolewski <makspl17@gmail.com>"]
edition = "2021"
license = "MIT OR Apache-2.0"
Expand Down Expand Up @@ -44,6 +44,7 @@ lua53 = ["bevy_mod_scripting_lua/lua53", "lua"]
lua54 = ["bevy_mod_scripting_lua/lua54", "lua"]
luajit = ["bevy_mod_scripting_lua/luajit", "lua"]
luajit52 = ["bevy_mod_scripting_lua/luajit52", "lua"]
luau = ["bevy_mod_scripting_lua/luau", "lua"]

# optional
lua_script_api = ["bevy_script_api/lua"]
Expand All @@ -63,22 +64,22 @@ rune = ["bevy_mod_scripting_rune"]
[dependencies]
bevy = { workspace = true }
bevy_mod_scripting_core = { workspace = true }
bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.7.1", optional = true }
bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.7.1", optional = true }
bevy_mod_scripting_rune = { path = "crates/languages/bevy_mod_scripting_rune", version = "0.7.1", optional = true }
bevy_script_api = { path = "crates/bevy_script_api", version = "0.7.1", optional = true }
bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.8.0-alpha.2", optional = true }
bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.8.0-alpha.2", optional = true }
bevy_mod_scripting_rune = { path = "crates/languages/bevy_mod_scripting_rune", version = "0.8.0-alpha.2", optional = true }
bevy_script_api = { path = "crates/bevy_script_api", version = "0.8.0-alpha.2", optional = true }


[workspace.dependencies]
bevy = { version = "0.14.2", default-features = false }
bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.7.1" }
bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.7.1" }
bevy = { version = "0.15.0", default-features = false }
bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.8.0-alpha.2" }
bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.8.0-alpha.2" }

[dev-dependencies]
bevy = { workspace = true, default-features = true }
clap = { version = "4.1", features = ["derive"] }
rand = "0.8.5"
bevy_console = "0.12"
bevy_console = "0.13"
rhai-rand = "0.1"

[workspace]
Expand Down
2 changes: 1 addition & 1 deletion check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CURRENT_DIR=$(basename "$PWD")


if [[ "$CURRENT_DIR" == "bevy_api_gen" ]]; then
cargo +nightly-2024-05-20 clippy --all-targets --message-format=json
cargo +nightly-2024-11-05 clippy --all-targets --message-format=json
else
cargo clippy --workspace --all-targets --message-format=json --features="lua54 lua_script_api rhai rhai_script_api teal rune bevy/file_watcher bevy/multi_threaded"
fi
5 changes: 2 additions & 3 deletions crates/bevy_api_gen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,16 @@ source = "discover"
rustc_private = true

[rust-analyzer.check]
overrideCommand = ["cargo", "+nightly-2024-05-20", "a", "--message-format=json"]
overrideCommand = ["cargo", "+nightly-2024-11-05", "a", "--message-format=json"]


[dependencies]
log = "0.4"
env_logger = "0.11"
rustc_plugin = "=0.10.0-nightly-2024-05-20"
rustc_plugin = { git = "https://github.com/makspll/rustc_plugin", branch = "feature/rust-1.82.0" }
indexmap = "2"
tempdir = "0.3"
cargo_metadata = "0.18"
rustc_data_structures = "0.0.1"
serde_json = "1"
serde = "1"
clap = { version = "4", features = ["derive", "string"] }
Expand Down
14 changes: 7 additions & 7 deletions crates/bevy_api_gen/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ bevy_api_gen is a Cargo plugin that generates reflection-powered wrappers for Be
To install bevy_api_gen, use the following command:

```bash
cargo +nightly-2024-05-20 install bevy_api_gen
cargo +nightly-2024-11-05 install bevy_api_gen
```

# Usage
Expand All @@ -18,39 +18,39 @@ cargo +nightly-2024-05-20 install bevy_api_gen
To run the main codegen process, use the following command:

```bash
cargo +nightly-2024-05-20 bevy-api-gen generate
cargo +nightly-2024-11-05 bevy-api-gen generate
```

This will perform all parts of the process and generate meta as well as .rs files for each crate in your workspace in your `/target/plugin-nightly-2024-05-20/bevy_api_gen` directory
This will perform all parts of the process and generate meta as well as .rs files for each crate in your workspace in your `/target/plugin-nightly-2024-11-05/bevy_api_gen` directory

## Collect

After generating all the files, you can 'collect' them in a mod.rs file like so:

```bash
cargo +nightly-2024-05-20 bevy-api-gen collect
cargo +nightly-2024-11-05 bevy-api-gen collect
```

## List Types

To see a list of all `Reflect` implementing types in your workspace run:

```bash
cargo +nightly-2024-05-20 bevy-api-gen list-types > all_types.txt
cargo +nightly-2024-11-05 bevy-api-gen list-types > all_types.txt
```

## List Templates

To see the list of all templates which you can override use:

```bash
cargo +nightly-2024-05-20 bevy-api-gen list-templates
cargo +nightly-2024-11-05 bevy-api-gen list-templates
```

## Print Template

You can also print any of the templates to stdout:

```bash
cargo +nightly-2024-05-20 bevy-api-gen print item.tera
cargo +nightly-2024-11-05 bevy-api-gen print item.tera
```
2 changes: 1 addition & 1 deletion crates/bevy_api_gen/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
components = ["clippy", "rust-src", "rustc-dev", "llvm-tools"]
channel = "nightly-2024-05-20"
channel = "nightly-2024-11-05"
1 change: 1 addition & 0 deletions crates/bevy_api_gen/src/bin/driver.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![feature(rustc_private)]
use bevy_api_gen::*;

fn main() {
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_api_gen/src/bin/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![feature(rustc_private)]
use std::{
collections::HashMap,
env,
Expand Down
14 changes: 7 additions & 7 deletions crates/bevy_api_gen/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ impl CachedTraits {
.all(|t| self.std_source_traits.contains_key(*t))
}

pub(crate) fn missing_std_source_traits(&self) -> Vec<String> {
STD_SOURCE_TRAITS
.iter()
.filter(|t| !self.std_source_traits.contains_key(**t))
.map(|s| (*s).to_owned())
.collect()
}
// pub(crate) fn missing_std_source_traits(&self) -> Vec<String> {
// STD_SOURCE_TRAITS
// .iter()
// .filter(|t| !self.std_source_traits.contains_key(**t))
// .map(|s| (*s).to_owned())
// .collect()
// }
}

#[derive(Clone, Debug)]
Expand Down
4 changes: 1 addition & 3 deletions crates/bevy_api_gen/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#![feature(rustc_private, let_chains)]
#![deny(rustc::internal)]

extern crate rustc_ast;
extern crate rustc_driver;
extern crate rustc_errors;
extern crate rustc_hir;
extern crate rustc_hir_analysis;
extern crate rustc_infer;
extern crate rustc_interface;
extern crate rustc_lint;
extern crate rustc_middle;
extern crate rustc_session;
extern crate rustc_span;
extern crate rustc_trait_selection;

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_api_gen/src/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl MetaLoader {
let cache = self.cache.borrow();
if cache.contains_key(crate_name) {
trace!("Loading meta from cache for: {}", crate_name);
return cache.get(crate_name).cloned();
cache.get(crate_name).cloned()
} else {
trace!("Loading meta from filesystem for: {}", crate_name);
drop(cache);
Expand Down
Loading
Loading