TheBevyFlock / bevy_cli

A Bevy CLI tool and linter.
https://thebevyflock.github.io/bevy_cli/
Apache License 2.0
46 stars 7 forks source link

Improve binary package detection for `bevy run` #142

Closed TimJentzsch closed 1 month ago

TimJentzsch commented 1 month ago

bevy run web quickly stopped working for more complex repository setups, because it couldn't figure out which package it had to run.

This PR adds a more sophisticated detection of the binary package detection. We first take a look at the --bin and --package args. If they are not defined, we try to determine the package automatically with the information provided by cargo metadata. We first look for the default_run definition and otherwise check if there is only a single binary package that could be run.

You can test this with the setup in https://github.com/TimJentzsch/bevy_complex_repo. To do that, first install the Bevy CLI on this branch with cargo install --path ., then use bevy run web or bevy run web -p cplx_demo on that repository in the app folder.