Skip to content
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

Proxy derive macros, rustc plugin codegen, safety improvements #67

Merged
merged 104 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
5683caf
WIP
makspll Jan 12, 2023
5dddc30
WIP
makspll Jan 12, 2023
3db868c
Merge branch 'main' into feature/derive_macros
makspll May 8, 2023
52b589b
WIP
makspll May 14, 2023
aca39ea
WIP
makspll May 27, 2023
8157155
WIP
makspll May 27, 2023
b208579
WIP
makspll May 27, 2023
da66355
WIP
makspll May 28, 2023
f81c4cf
fix spans
makspll May 28, 2023
2f07cff
Clean up proxy/proxied name abstraction
makspll May 29, 2023
7a4c7ac
add custom bodies with automatic unwrapping
makspll Jun 3, 2023
a29c7c5
Implement support for custom bodies in wrapper only functions
makspll Jun 5, 2023
a754b6f
some refactoring + Option support
makspll Jun 15, 2023
0f1f82d
Add support for outer results in macro
makspll Jun 17, 2023
dcb6fd9
Added UI tests as well as wider type support in macro
makspll Jun 27, 2023
b2bb9e5
refactor + add trycompile tests + more parameter support
makspll Jul 1, 2023
b2a9a8d
update wrappers.rs example
makspll Jul 14, 2023
0497658
correct example
makspll Jul 15, 2023
fabecc5
add more to wrappers.rs
makspll Jul 15, 2023
6c3db02
rename wrappers.rs
makspll Aug 24, 2023
9a85007
Merge remote-tracking branch 'origin/main' into feature/derive_macros
makspll Aug 24, 2023
780276c
fix merge issues
makspll Aug 24, 2023
e5bc2ba
fix issues with bevy 0.11 migration + minor changes
makspll Aug 24, 2023
6a2cf63
fix test errors
makspll Aug 25, 2023
09796b4
silence deprecated macro warnings
makspll Aug 25, 2023
f5a067a
WIP fields
makspll Aug 31, 2023
67cc8a9
WIP
makspll Oct 9, 2023
48eeaaf
WIP dump, sailfish integration, new codegen
makspll Nov 6, 2023
a7a33b1
add missing fromLuaProxy impl
makspll Nov 6, 2023
e04dc2b
refactoring
makspll Nov 9, 2023
0072891
fix remaining issues due to refactoring and clean up
makspll Nov 12, 2023
f6550d8
make fields work most of the way
makspll Nov 17, 2023
0196f1f
Make ReflectedValue work in the macro
makspll Nov 17, 2023
c8c1221
clean up
makspll Nov 19, 2023
6d81a2a
add generated marker
makspll Nov 19, 2023
8f18878
add more attrs
makspll Nov 19, 2023
d7045e2
change attrs
makspll Nov 19, 2023
90833cb
change attributes
makspll Nov 19, 2023
01d99bd
Merge branch 'main' into feature/derive_macros
makspll Nov 19, 2023
1caf965
Merge branch 'main' into feature/derive_macros
makspll Nov 19, 2023
bbde17a
Implement composite functions, now just code gen for operators
makspll Nov 19, 2023
6a839d5
Merge branch 'feature/derive_macros' of https://github.com/makspll/be…
makspll Nov 19, 2023
de48f5b
Merge branch 'main' into feature/derive_macros
makspll Nov 19, 2023
a91b069
clean up codegen crate
makspll Nov 20, 2023
eee57e5
Merge branch 'feature/derive_macros' of https://github.com/makspll/be…
makspll Nov 20, 2023
8db22b7
finish codegen & functionality
makspll Nov 21, 2023
e672eb1
better naming and remove commented out shit
makspll Nov 23, 2023
966b81a
expand range of operators available by adding primitives on lhs
makspll Nov 23, 2023
d09ae47
reduce unsafe usage, remove potential UB, and make all wrappers clone…
makspll Nov 24, 2023
fd44c58
Completely automate type crawling
makspll Dec 1, 2023
59011ef
fix generics and private fields passing through
makspll Dec 1, 2023
b235a25
WIP
makspll Dec 18, 2023
83731f4
begin work on compiler plugin
makspll Mar 13, 2024
fc1ae8a
add bootstrapping and inference steps
makspll Mar 17, 2024
025d900
much progress
makspll Mar 23, 2024
0984d99
Re-organise && force RA to work
makspll Mar 24, 2024
bb8aa48
Add readme and clean up
makspll Mar 24, 2024
833e7f4
big brain moves
makspll Mar 24, 2024
96e466f
begin transition to new generated API format
makspll Mar 24, 2024
33c856b
Merge remote-tracking branch 'origin/main' into feature/derive_macros
makspll Mar 24, 2024
a2f31a9
merge
makspll Mar 24, 2024
b0ec587
WIP
makspll Mar 25, 2024
c8c0593
calm the errors down
makspll Mar 26, 2024
c272e0e
formatting
makspll Mar 26, 2024
a3be41a
formatting
makspll Mar 26, 2024
118a4f8
unset format_generated_files
makspll Mar 26, 2024
e8bc118
fix compilation issue
makspll Mar 26, 2024
d8e1979
cache bootstrap deps
makspll Mar 26, 2024
c184f69
Fix some issues with references and templates
makspll Mar 26, 2024
6f5429b
more fixes
makspll Mar 26, 2024
7b30861
More fixes
makspll Mar 27, 2024
fcca8e3
manual fixes
makspll Mar 28, 2024
2997bbb
fix unstable functions being picked up
makspll Mar 28, 2024
8346ec3
add filter for os string temporarily
makspll Mar 28, 2024
0442b7d
add vec index methods
makspll Apr 1, 2024
9961a9e
Ordering and some fixes
makspll Apr 1, 2024
3ff539d
Fix issue with impl selection
makspll Apr 3, 2024
cf1931d
format generated files and fix missing fields
makspll Apr 3, 2024
9d5fa19
change .gitattributes and remove useless import
makspll Apr 3, 2024
cee9dd0
reduce compilation RAM consumption for dev builds, Allow capturing cl…
makspll Apr 3, 2024
ededb8a
add meta version to format, add ToString implementations
makspll Apr 3, 2024
075dca8
skip rustfmt for generated files
makspll Apr 3, 2024
35d6443
formatting and clippy
makspll Apr 3, 2024
9093027
clippy
makspll Apr 3, 2024
f18f100
remove unused methods
makspll Apr 3, 2024
ed04e78
trim readme
makspll Apr 4, 2024
f0132f0
fix console_integration.rs
makspll Apr 4, 2024
c9951a7
remove verbose logs from makefile api gen
makspll Apr 4, 2024
c42091e
fix custom check command from not testing examples
makspll Apr 4, 2024
975115b
fix doc gen example
makspll Apr 4, 2024
b3f89ac
fix more examples
makspll Apr 4, 2024
b3f144f
fix wrappers example
makspll Apr 4, 2024
d6a12f5
remove unnecessary crate and feature gate providers
makspll Apr 4, 2024
d06fd02
remove doctests for now
makspll Apr 4, 2024
357537c
fmt
makspll Apr 4, 2024
36d4040
clippy
makspll Apr 4, 2024
dd904de
Merge branch 'main' into feature/derive_macros
makspll Apr 4, 2024
7830c78
remove faulty ci temporarily, update readme
makspll Apr 4, 2024
a7605ad
Merge branch 'feature/derive_macros' of https://github.com/makspll/be…
makspll Apr 4, 2024
b3dbc78
add architecture.md
makspll Apr 4, 2024
3975b7a
make sure other examples are working
makspll Apr 4, 2024
b2315ae
renamings and make sure docs get generated correct
makspll Apr 4, 2024
2997127
stage back some tests
makspll Apr 4, 2024
6514f86
fix trycompile tests and add missing mut to proxy
makspll Apr 4, 2024
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
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[env]
TARGET_DIR={ value = "target", relative = true }
TARGET_DIR = { value = "target", relative = true }
7 changes: 2 additions & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
bevy_script_api/src/generated.rs linguist-generated
bevy_script_api/src/generated.rs -diff -merge

**/*generated*.rs linguist-generated
**/*generated*.rs -diff -merge
crates/bevy_script_api/providers/*.rs linguist-generated
crates/bevy_script_api/providers/*.rs -diff -merge
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
run_args: [
{os: windows-latest, lua: lua54, cross: null},
{os: macOS-latest, lua: lua54, cross: null},
{os: ubuntu-latest, lua: lua54, cross: aarch64-unknown-linux-gnu},
# {os: ubuntu-latest, lua: lua54, cross: aarch64-unknown-linux-gnu}, see https://github.com/houseabsolute/actions-rust-cross/issues/15
{os: ubuntu-latest, lua: lua51, cross: null},
{os: ubuntu-latest, lua: lua52, cross: null},
{os: ubuntu-latest, lua: lua53, cross: null},
Expand Down
3 changes: 3 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# max_width = 60
# use_small_heuristics = "Max"
# format_generated_files = false
27 changes: 9 additions & 18 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug unit tests in library 'bevy_mod_scripting'",
"cargo": {
"args": [
"test",
"--no-run",
"--lib",
"--package=bevy_mod_scripting"
],
"filter": {
"name": "bevy_mod_scripting",
"kind": "lib"
}
},
"args": [],
"name": "Debug specific unit test",
"preLaunchTask": "Build specific package's unit tests",
"program": "${workspaceFolder}/target/debug/test_binary",
"env": {
"CARGO_MANIFEST_DIR": "${workspaceFolder}/bevy_mod_scripting"
"CARGO_MANIFEST_DIR": "${workspaceFolder}/bevy_mod_scripting",
"LD_LIBRARY_PATH": "${workspaceFolder}/target/debug/deps:${env:HOME}/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib"
},
"cwd": "${workspaceFolder}"
"cwd": "${workspaceFolder}",
},
{
"name": "Debug example 'game_of_life_lua'",
Expand All @@ -45,7 +35,8 @@
"args": [],
"cwd": "${workspaceFolder}",
"env": {
"CARGO_MANIFEST_DIR": "${workspaceFolder}"
"CARGO_MANIFEST_DIR": "${workspaceFolder}",
"LD_LIBRARY_PATH": "${workspaceFolder}/target/debug/deps:${env:HOME}/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib"
}
},
{
Expand Down
26 changes: 16 additions & 10 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@
"lldb.showDisassembly": "never",
"lldb.dereferencePointers": true,
"lldb.consoleMode": "commands",
"rust-analyzer.cargo.features": [
"lua54",
"lua_script_api",
"rhai",
"rhai_script_api",
"teal",
"rune"
"[rust]": {
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"editor.defaultFormatter": "rust-lang.rust-analyzer"
},
"rust-analyzer.rustc.source": "discover",
"rust-analyzer.linkedProjects": [
"./crates/bevy_api_gen/Cargo.toml",
"Cargo.toml",
],
"rust-analyzer.server.extraEnv": {
"RUSTUP_TOOLCHAIN": "stable"
}
"rust-analyzer.check.invocationStrategy": "per_workspace",
"rust-analyzer.check.invocationLocation": "workspace",
"rust-analyzer.check.overrideCommand": [
"/home/makspll/git/bevy_mod_scripting/check.sh"
],
"rust-analyzer.showUnlinkedFileNotification": false,
// "rust-analyzer.semanticHighlighting.operator.enable": false
}
29 changes: 29 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"version": "2.0.0",
"inputs": [
{
"id": "test_name",
"type": "promptString",
"description": "Run only tests including this string in their name",
"default": ""
},
{
"id": "package",
"type": "promptString",
"description": "The crate location of this unit test",
"default": "bevy_mod_scripting"
}
],
"tasks": [
{
"label": "Build specific package's unit tests",
"type": "process",
"command": "make",
"args": [
"build_test_in_package",
"PACKAGE=${input:package}",
"TEST_NAME=${input:test_name}"
]
}
]
}
78 changes: 49 additions & 29 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,41 +61,47 @@ rhai_script_api = ["bevy_script_api/rhai"]
rune = ["bevy_mod_scripting_rune"]

[dependencies]
bevy = { version = "0.13", default-features = false }
bevy_mod_scripting_core = { path = "bevy_mod_scripting_core", version = "0.5.0" }
bevy_mod_scripting_lua = { path = "languages/bevy_mod_scripting_lua", version = "0.5.0", optional = true }
bevy_mod_scripting_rhai = { path = "languages/bevy_mod_scripting_rhai", version = "0.5.0", optional = true }
bevy_mod_scripting_rune = { path = "languages/bevy_mod_scripting_rune", version = "0.5.0", optional = true }
bevy_script_api = { path = "bevy_script_api", version = "0.5.0", optional = true }
bevy = { workspace = true }
bevy_mod_scripting_core = { workspace = true }
bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.5.0", optional = true }
bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.5.0", optional = true }
bevy_mod_scripting_rune = { path = "crates/languages/bevy_mod_scripting_rune", version = "0.5.0", optional = true }
bevy_script_api = { path = "crates/bevy_script_api", version = "0.5.0", optional = true }


[workspace.dependencies]
bevy = { version = "=0.13.1", default-features = false }
bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.5.0" }
bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.5.0" }

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

[workspace]
resolver = "2"
members = [
"bevy_mod_scripting_core",
"bevy_event_priority",
"bevy_mod_scripting_derive",
"bevy_api_gen",
"bevy_script_api",
"languages/bevy_mod_scripting_lua",
"languages/bevy_mod_scripting_lua_derive",
"languages/bevy_mod_scripting_rhai",
"languages/bevy_mod_scripting_rhai_derive",
"languages/bevy_mod_scripting_rune",
"bevy_mod_scripting_common",
"crates/bevy_mod_scripting_core",
"crates/bevy_event_priority",
"crates/bevy_script_api",
"crates/languages/bevy_mod_scripting_lua",
"crates/languages/bevy_mod_scripting_lua_derive",
"crates/languages/bevy_mod_scripting_rhai",
"crates/languages/bevy_mod_scripting_rhai_derive",
"crates/languages/bevy_mod_scripting_rune",
"crates/bevy_mod_scripting_common",
]
resolver = "2"
exclude = ["bevy_api_gen"]

[profile.dev]
debug = 1
opt-level = 1

[profile.dev.package."*"]
debug = 0
opt-level = 3

[profile.ephemeral-build]
Expand All @@ -105,16 +111,25 @@ codegen-units = 8
incremental = false
debug = false


[[example]]
name = "console_integration_lua"
path = "examples/lua/console_integration.rs"
required-features = ["lua54", "lua_script_api", "bevy/file_watcher"]
required-features = [
"lua54",
"lua_script_api",
"bevy/file_watcher",
"bevy/multi-threaded",
]

[[example]]
name = "console_integration_rhai"
path = "examples/rhai/console_integration.rs"
required-features = ["rhai", "rhai_script_api", "bevy/file_watcher"]
required-features = [
"rhai",
"rhai_script_api",
"bevy/file_watcher",
"bevy/multi-threaded",
]

[[example]]
name = "complex_game_loop_lua"
Expand All @@ -124,12 +139,22 @@ required-features = ["lua54"]
[[example]]
name = "game_of_life_lua"
path = "examples/lua/game_of_life.rs"
required-features = ["lua54", "teal", "lua_script_api", "bevy/file_watcher"]
required-features = [
"lua54",
"lua_script_api",
"bevy/file_watcher",
"bevy/multi-threaded",
]

[[example]]
name = "game_of_life_rhai"
path = "examples/rhai/game_of_life.rs"
required-features = ["rhai", "rhai_script_api", "bevy/file_watcher"]
required-features = [
"rhai",
"rhai_script_api",
"bevy/file_watcher",
"bevy/multi-threaded",
]

[[example]]
name = "event_recipients_lua"
Expand All @@ -156,11 +181,6 @@ name = "bevy_api_rhai"
path = "examples/rhai/bevy_api.rs"
required-features = ["rhai", "rhai_script_api"]

[[example]]
name = "multiple_events_rhai"
path = "examples/rhai/multiple_events_rhai.rs"
required-features = ["rhai", "rhai_script_api"]

[[example]]
name = "wrappers"
path = "examples/wrappers.rs"
Expand Down
Loading
Loading