Skip to content

Commit 42d87a0

Browse files
committed
improvements to codegen + xtask
1 parent d9501a0 commit 42d87a0

File tree

49 files changed

+15932
-11657
lines changed

Some content is hidden

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

49 files changed

+15932
-11657
lines changed

codegen/src/args.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ use serde::{Deserialize, Serialize};
2727
///
2828
/// 5.Generates code using Tera templates given the data gathered from the analysis
2929
pub struct Args {
30+
/// the output and artifact directory
31+
#[arg(global = true, short, long, default_value = compute_default_dir(), value_name = "DIR")]
32+
pub output: Utf8PathBuf,
33+
3034
#[command(subcommand)]
3135
pub cmd: Command,
3236

@@ -198,10 +202,6 @@ pub enum Command {
198202
ListTemplates,
199203
/// Crawls current workspace/crate and generates wrappers for Reflect types using templates
200204
Generate {
201-
/// the output and artifact directory
202-
#[arg(short, long, default_value = compute_default_dir(), value_name = "DIR")]
203-
output: Utf8PathBuf,
204-
205205
/// The directory in which to look for templates, if unspecified will use built-in templates
206206
#[arg(short, long, value_name = "DIR")]
207207
templates: Option<Utf8PathBuf>,

codegen/src/bin/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn main() {
5050
.collect::<Vec<_>>();
5151

5252
info!("Computing active features");
53-
let include_crates = if args.cmd.is_generate() {
53+
let include_crates = if !args.cmd.is_collect() {
5454
let workspace = Workspace::from(&metadata);
5555
let mut graph = WorkspaceGraph::from(workspace);
5656
info!("Using workspace graph: \n{}", graph.to_dot());

codegen/src/callback.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ impl rustc_driver::Callbacks for BevyAnalyzerCallbacks {
3737
let mut meta_dirs = Vec::default();
3838
let mut templates_dir = None;
3939
// add all relevant meta dirs to the context
40+
meta_dirs.push(self.args.output.to_owned());
4041
if let crate::Command::Generate {
41-
output,
4242
meta,
4343
meta_output,
4444
templates,
@@ -49,7 +49,6 @@ impl rustc_driver::Callbacks for BevyAnalyzerCallbacks {
4949
if let Some(meta_output) = meta_output {
5050
meta_dirs.push(meta_output.to_owned())
5151
};
52-
meta_dirs.push(output.to_owned());
5352
meta.iter()
5453
.flatten()
5554
.for_each(|m| meta_dirs.push(m.to_owned()));

0 commit comments

Comments
 (0)