Skip to content

Commit

Permalink
Standardize toml format with taplo (bevyengine#10594)
Browse files Browse the repository at this point in the history
# Objective

- Standardize fmt for toml files

## Solution

- Add [taplo](https://taplo.tamasfe.dev/) to CI (check for fmt and diff
for toml files), for context taplo is used by the most popular extension
in VScode [Even Better
TOML](https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml
- Add contribution section to explain toml fmt with taplo.
 
Now to pass CI you need to run `taplo fmt --option indent_string=" "` or
if you use vscode have the `Even Better TOML` extension with 4 spaces
for indent

---------

Co-authored-by: Alice Cecile <[email protected]>
  • Loading branch information
2 people authored and Ray Redondo committed Jan 9, 2024
1 parent 1bc12d9 commit 7d68f48
Show file tree
Hide file tree
Showing 29 changed files with 227 additions and 126 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,26 @@ jobs:
VALIDATE_MARKDOWN: true
DEFAULT_BRANCH: main

toml:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install taplo
run: |
curl -fsSL https://github.com/tamasfe/taplo/releases/latest/download/taplo-full-linux-x86_64.gz \
| gzip -d - \
| install -m 755 /dev/stdin /usr/local/bin/taplo
- name: Run Taplo
id: taplo
run: taplo fmt --check --diff
- name: Taplo info
if: failure()
run: |
echo 'To fix toml fmt, please run `taplo fmt`'
echo 'Or if you use VSCode, use the Even Better Toml extension'
run-examples-on-windows-dx12:
runs-on: windows-latest
timeout-minutes: 60
Expand Down
11 changes: 8 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,14 @@ If you're new to Bevy, here's the workflow we use:
To locally lint your files using the same workflow as our CI:
1. Install [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli).
2. Run `markdownlint -f -c .github/linters/.markdown-lint.yml .` in the root directory of the Bevy project.
5. Push your changes to your fork on Github and open a Pull Request.
6. Respond to any CI failures or review feedback. While CI failures must be fixed before we can merge your PR, you do not need to *agree* with all feedback from your reviews, merely acknowledge that it was given. If you cannot come to an agreement, leave the thread open and defer to a Maintainer or Project Lead's final judgement.
7. When your PR is ready to merge, a Maintainer or Project Lead will review it and suggest final changes. If those changes are minimal they may even apply them directly to speed up merging.

5. When working with Toml (`.toml`) files, Bevy's CI will check toml files using [taplo](https://taplo.tamasfe.dev/): `taplo fmt --check --diff`
1. If you use VSCode, install [Even better toml](https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml) and format your files.
2. If you want to use the cli tool, install [taplo-cli](https://taplo.tamasfe.dev/cli/installation/cargo.html) and run `taplo fmt --check --diff` to check for the formatting. Fix any issues by running `taplo fmt` in the root directory of the Bevy project.

6. Push your changes to your fork on Github and open a Pull Request.
7. Respond to any CI failures or review feedback. While CI failures must be fixed before we can merge your PR, you do not need to *agree* with all feedback from your reviews, merely acknowledge that it was given. If you cannot come to an agreement, leave the thread open and defer to a Maintainer or Project Lead's final judgement.
8. When your PR is ready to merge, a Maintainer or Project Lead will review it and suggest final changes. If those changes are minimal they may even apply them directly to speed up merging.

If you end up adding a new official Bevy crate to the `bevy` repo:

Expand Down
4 changes: 3 additions & 1 deletion crates/bevy_animation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ bevy_app = { path = "../bevy_app", version = "0.12.0" }
bevy_asset = { path = "../bevy_asset", version = "0.12.0" }
bevy_core = { path = "../bevy_core", version = "0.12.0" }
bevy_math = { path = "../bevy_math", version = "0.12.0" }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = ["bevy"] }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = [
"bevy",
] }
bevy_render = { path = "../bevy_render", version = "0.12.0" }
bevy_time = { path = "../bevy_time", version = "0.12.0" }
bevy_utils = { path = "../bevy_utils", version = "0.12.0" }
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ downcast-rs = "1.2.0"

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = { version = "0.2" }
web-sys = { version = "0.3", features = [ "Window" ] }
web-sys = { version = "0.3", features = ["Window"] }

[lints]
workspace = true
8 changes: 6 additions & 2 deletions crates/bevy_audio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ bevy_app = { path = "../bevy_app", version = "0.12.0" }
bevy_asset = { path = "../bevy_asset", version = "0.12.0" }
bevy_ecs = { path = "../bevy_ecs", version = "0.12.0" }
bevy_math = { path = "../bevy_math", version = "0.12.0" }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = ["bevy"] }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = [
"bevy",
] }
bevy_transform = { path = "../bevy_transform", version = "0.12.0" }
bevy_derive = { path = "../bevy_derive", version = "0.12.0" }
bevy_utils = { path = "../bevy_utils", version = "0.12.0" }
Expand All @@ -26,7 +28,9 @@ rodio = { version = "0.17", default-features = false }
oboe = { version = "0.5", optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
rodio = { version = "0.17", default-features = false, features = ["wasm-bindgen"] }
rodio = { version = "0.17", default-features = false, features = [
"wasm-bindgen",
] }

[features]
mp3 = ["rodio/mp3"]
Expand Down
12 changes: 9 additions & 3 deletions crates/bevy_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ keywords = ["bevy"]

[dependencies]
# bevy
bevy_app = { path = "../bevy_app", version = "0.12.0", features = ["bevy_reflect"] }
bevy_ecs = { path = "../bevy_ecs", version = "0.12.0", features = ["bevy_reflect"] }
bevy_app = { path = "../bevy_app", version = "0.12.0", features = [
"bevy_reflect",
] }
bevy_ecs = { path = "../bevy_ecs", version = "0.12.0", features = [
"bevy_reflect",
] }
bevy_math = { path = "../bevy_math", version = "0.12.0" }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = ["bevy"] }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = [
"bevy",
] }
bevy_tasks = { path = "../bevy_tasks", version = "0.12.0" }
bevy_utils = { path = "../bevy_utils", version = "0.12.0" }

Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_core_pipeline/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name = "bevy_core_pipeline"
version = "0.12.0"
edition = "2021"
authors = [
"Bevy Contributors <[email protected]>",
"Carter Anderson <[email protected]>",
"Bevy Contributors <[email protected]>",
"Carter Anderson <[email protected]>",
]
description = "Provides a core render pipeline for Bevy Engine."
homepage = "https://bevyengine.org"
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_diagnostic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ bevy_utils = { path = "../bevy_utils", version = "0.12.0" }
[target.'cfg(all(target_os="macos"))'.dependencies]
# Some features of sysinfo are not supported by apple. This will disable those features on apple devices
sysinfo = { version = "0.29.0", default-features = false, features = [
"apple-app-store",
"apple-app-store",
] }

# Only include when not bevy_dynamic_plugin and on linux/windows/android
Expand Down
26 changes: 15 additions & 11 deletions crates/bevy_gltf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,28 @@ bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.12.0" }
bevy_log = { path = "../bevy_log", version = "0.12.0" }
bevy_math = { path = "../bevy_math", version = "0.12.0" }
bevy_pbr = { path = "../bevy_pbr", version = "0.12.0" }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = ["bevy"] }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = [
"bevy",
] }
bevy_render = { path = "../bevy_render", version = "0.12.0" }
bevy_scene = { path = "../bevy_scene", version = "0.12.0", features = ["bevy_render"] }
bevy_scene = { path = "../bevy_scene", version = "0.12.0", features = [
"bevy_render",
] }
bevy_transform = { path = "../bevy_transform", version = "0.12.0" }
bevy_tasks = { path = "../bevy_tasks", version = "0.12.0" }
bevy_utils = { path = "../bevy_utils", version = "0.12.0" }

# other
gltf = { version = "1.3.0", default-features = false, features = [
"KHR_lights_punctual",
"KHR_materials_transmission",
"KHR_materials_ior",
"KHR_materials_volume",
"KHR_materials_unlit",
"KHR_materials_emissive_strength",
"extras",
"names",
"utils",
"KHR_lights_punctual",
"KHR_materials_transmission",
"KHR_materials_ior",
"KHR_materials_volume",
"KHR_materials_unlit",
"KHR_materials_emissive_strength",
"extras",
"names",
"utils",
] }
thiserror = "1.0"
base64 = "0.13.0"
Expand Down
8 changes: 6 additions & 2 deletions crates/bevy_hierarchy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ trace = []
# bevy
bevy_app = { path = "../bevy_app", version = "0.12.0" }
bevy_core = { path = "../bevy_core", version = "0.12.0" }
bevy_ecs = { path = "../bevy_ecs", version = "0.12.0", features = ["bevy_reflect"] }
bevy_ecs = { path = "../bevy_ecs", version = "0.12.0", features = [
"bevy_reflect",
] }
bevy_log = { path = "../bevy_log", version = "0.12.0" }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = ["bevy"] }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = [
"bevy",
] }
bevy_utils = { path = "../bevy_utils", version = "0.12.0" }

# other
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_input/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ bevy_ecs = { path = "../bevy_ecs", version = "0.12.0" }
bevy_math = { path = "../bevy_math", version = "0.12.0" }
bevy_utils = { path = "../bevy_utils", version = "0.12.0" }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = [
"glam",
"glam",
] }

# other
Expand Down
58 changes: 43 additions & 15 deletions crates/bevy_internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ categories = ["game-engines", "graphics", "gui", "rendering"]

[features]
trace = [
"bevy_app/trace",
"bevy_core_pipeline?/trace",
"bevy_ecs/trace",
"bevy_log/trace",
"bevy_render?/trace",
"bevy_hierarchy/trace",
"bevy_winit?/trace"
"bevy_app/trace",
"bevy_core_pipeline?/trace",
"bevy_ecs/trace",
"bevy_log/trace",
"bevy_render?/trace",
"bevy_hierarchy/trace",
"bevy_winit?/trace",
]
trace_chrome = [ "bevy_log/tracing-chrome" ]
trace_tracy = ["bevy_render?/tracing-tracy", "bevy_log/tracing-tracy" ]
trace_chrome = ["bevy_log/tracing-chrome"]
trace_tracy = ["bevy_render?/tracing-tracy", "bevy_log/tracing-tracy"]
trace_tracy_memory = ["bevy_log/trace_tracy_memory"]
wgpu_trace = ["bevy_render/wgpu_trace"]
detailed_trace = ["bevy_utils/detailed_trace"]
Expand Down Expand Up @@ -61,8 +61,20 @@ symphonia-wav = ["bevy_audio/symphonia-wav"]
shader_format_glsl = ["bevy_render/shader_format_glsl"]
shader_format_spirv = ["bevy_render/shader_format_spirv"]

serialize = ["bevy_core/serialize", "bevy_input/serialize", "bevy_time/serialize", "bevy_window/serialize", "bevy_transform/serialize", "bevy_math/serialize", "bevy_scene?/serialize"]
multi-threaded = ["bevy_asset/multi-threaded", "bevy_ecs/multi-threaded", "bevy_tasks/multi-threaded"]
serialize = [
"bevy_core/serialize",
"bevy_input/serialize",
"bevy_time/serialize",
"bevy_window/serialize",
"bevy_transform/serialize",
"bevy_math/serialize",
"bevy_scene?/serialize",
]
multi-threaded = [
"bevy_asset/multi-threaded",
"bevy_ecs/multi-threaded",
"bevy_tasks/multi-threaded",
]
async-io = ["bevy_tasks/async-io"]

# Display server protocol support (X11 is enabled by default)
Expand All @@ -73,13 +85,27 @@ x11 = ["bevy_winit/x11"]
subpixel_glyph_atlas = ["bevy_text/subpixel_glyph_atlas"]

# Transmission textures in `StandardMaterial`:
pbr_transmission_textures = ["bevy_pbr?/pbr_transmission_textures", "bevy_gltf?/pbr_transmission_textures"]
pbr_transmission_textures = [
"bevy_pbr?/pbr_transmission_textures",
"bevy_gltf?/pbr_transmission_textures",
]

# Optimise for WebGL2
webgl = ["bevy_core_pipeline?/webgl", "bevy_pbr?/webgl", "bevy_render?/webgl", "bevy_gizmos?/webgl", "bevy_sprite?/webgl"]
webgl = [
"bevy_core_pipeline?/webgl",
"bevy_pbr?/webgl",
"bevy_render?/webgl",
"bevy_gizmos?/webgl",
"bevy_sprite?/webgl",
]

# enable systems that allow for automated testing on CI
bevy_ci_testing = ["bevy_app/bevy_ci_testing", "bevy_time/bevy_ci_testing", "bevy_render?/bevy_ci_testing", "bevy_render?/ci_limits"]
bevy_ci_testing = [
"bevy_app/bevy_ci_testing",
"bevy_time/bevy_ci_testing",
"bevy_render?/bevy_ci_testing",
"bevy_render?/ci_limits",
]

# Enable animation support, and glTF animation loading
animation = ["bevy_animation", "bevy_gltf?/bevy_animation"]
Expand Down Expand Up @@ -131,7 +157,9 @@ bevy_input = { path = "../bevy_input", version = "0.12.0" }
bevy_log = { path = "../bevy_log", version = "0.12.0" }
bevy_math = { path = "../bevy_math", version = "0.12.0" }
bevy_ptr = { path = "../bevy_ptr", version = "0.12.0" }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = ["bevy"] }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = [
"bevy",
] }
bevy_time = { path = "../bevy_time", version = "0.12.0" }
bevy_transform = { path = "../bevy_transform", version = "0.12.0" }
bevy_utils = { path = "../bevy_utils", version = "0.12.0" }
Expand Down
7 changes: 5 additions & 2 deletions crates/bevy_log/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ license = "MIT OR Apache-2.0"
keywords = ["bevy"]

[features]
trace = [ "tracing-error" ]
trace = ["tracing-error"]
trace_tracy_memory = ["dep:tracy-client"]

[dependencies]
bevy_app = { path = "../bevy_app", version = "0.12.0" }
bevy_utils = { path = "../bevy_utils", version = "0.12.0" }
bevy_ecs = { path = "../bevy_ecs", version = "0.12.0" }

tracing-subscriber = {version = "0.3.1", features = ["registry", "env-filter"]}
tracing-subscriber = { version = "0.3.1", features = [
"registry",
"env-filter",
] }
tracing-chrome = { version = "0.7.0", optional = true }
tracing-tracy = { version = "0.10.0", optional = true }
tracing-log = "0.1.2"
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_macros_compile_fail_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ publish = false

[dependencies]
bevy_derive = { path = "../bevy_derive" }
trybuild = "1.0.71"
trybuild = "1.0.71"
6 changes: 5 additions & 1 deletion crates/bevy_mikktspace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
name = "bevy_mikktspace"
version = "0.12.0"
edition = "2021"
authors = ["Benjamin Wasty <[email protected]>", "David Harvey-Macaulay <[email protected]>", "Layl Bongers <[email protected]>"]
authors = [
"Benjamin Wasty <[email protected]>",
"David Harvey-Macaulay <[email protected]>",
"Layl Bongers <[email protected]>",
]
description = "Mikkelsen tangent space algorithm"
documentation = "https://docs.rs/bevy"
homepage = "https://bevyengine.org"
Expand Down
4 changes: 3 additions & 1 deletion crates/bevy_pbr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ bevy_asset = { path = "../bevy_asset", version = "0.12.0" }
bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.12.0" }
bevy_ecs = { path = "../bevy_ecs", version = "0.12.0" }
bevy_math = { path = "../bevy_math", version = "0.12.0" }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = ["bevy"] }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0", features = [
"bevy",
] }
bevy_render = { path = "../bevy_render", version = "0.12.0" }
bevy_transform = { path = "../bevy_transform", version = "0.12.0" }
bevy_utils = { path = "../bevy_utils", version = "0.12.0" }
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_reflect/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ documentation = ["bevy_reflect_derive/documentation"]
[dependencies]
# bevy
bevy_math = { path = "../bevy_math", version = "0.12.0", features = [
"serialize",
"serialize",
], optional = true }
bevy_reflect_derive = { path = "bevy_reflect_derive", version = "0.12.0" }
bevy_utils = { path = "../bevy_utils", version = "0.12.0" }
Expand All @@ -31,9 +31,9 @@ downcast-rs = "1.2"
thiserror = "1.0"
serde = "1"
smallvec = { version = "1.6", features = [
"serde",
"union",
"const_generics",
"serde",
"union",
"const_generics",
], optional = true }
glam = { version = "0.24.1", features = ["serde"], optional = true }
smol_str = { version = "0.2.0", optional = true }
Expand Down
Loading

0 comments on commit 7d68f48

Please sign in to comment.