Skip to content
Open
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
17 changes: 10 additions & 7 deletions codegen/Cargo.bootstrap.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ version = "0.1.0"
edition = "2024"

[dependencies]

# {{ANALYZED_CRATE}}
bevy_mod_scripting_bindings = { path = "{{BMS_BINDINGS_PATH}}" }
bevy_reflect = { version = "0.17", features = [
"smol_str",
"glam",
"petgraph",
"smallvec",
"uuid",
] }

# bevy_reflect = { version = "0.17", features = [
# "smol_str",
# "glam",
# "petgraph",
# "smallvec",
# "uuid",
# ] }

[workspace]
2 changes: 2 additions & 0 deletions codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ syn = { version = "2", features = ["parsing"], default-features = false }
itertools = "0.12"
chrono = "0.4"
pretty_assertions = "1.3"
regex = "1"

[dependencies]
crate_feature_graph = { workspace = true, features = ["dot_parser", "serde"] }
Expand All @@ -81,6 +82,7 @@ serde = { workspace = true, features = ["std"] }
prettyplease = { workspace = true }
convert_case = { workspace = true }
chrono = { workspace = true }
regex = { workspace = true }

[build-dependencies]
toml = "0.8"
2 changes: 1 addition & 1 deletion codegen/crates/crate_feature_graph/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn main() -> std::io::Result<()> {
let mut graph = WorkspaceGraph::from(workspace);

let root = args.root_package;
log::info!(
log::debug!(
"Calculating features for root: {:?} with features: {:?}, default features: {}",
root,
args.features,
Expand Down
6 changes: 6 additions & 0 deletions codegen/crates/crate_feature_graph/src/feature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ use log::error;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct CrateName(pub(crate) String);

impl AsRef<str> for CrateName {
fn as_ref(&self) -> &str {
&self.0
}
}

impl<'a, T: Borrow<Package>> From<&'a T> for CrateName {
fn from(pkg: &'a T) -> Self {
CrateName(pkg.borrow().name.clone())
Expand Down
10 changes: 5 additions & 5 deletions codegen/crates/crate_feature_graph/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ impl WorkspaceGraph {

// finally filter out nodes we don't want to show but connect edges
if !only_show_crates.is_empty() {
log::info!("Filtering to only show crates: {only_show_crates:?}");
log::debug!("Filtering to only show crates: {only_show_crates:?}");
let only_show_crates: HashSet<_> = only_show_crates
.into_iter()
.map(|s| s.to_string())
Expand All @@ -237,14 +237,14 @@ impl WorkspaceGraph {
.filter(|c| !only_show_crates.contains(&c.to_string()))
.collect();

log::info!(
log::debug!(
"Removing and interconnecting {} nodes, out of {}",
to_remove.len(),
visualiser_graph.node_count()
);

for n in to_remove {
log::info!("Removing node {n}");
log::debug!("Removing node {n}");
let node_index =
match visualiser_graph.find_node_by_opt(|node| node.contains(&n.to_string())) {
Some(n) => n,
Expand Down Expand Up @@ -408,7 +408,7 @@ impl WorkspaceGraph {
}
}

log::info!("Parsed features map: {features_map:?}");
log::debug!("Parsed features map: {features_map:?}");
self.calculate_enabled_features_and_dependencies(features_map, false);
}

Expand Down Expand Up @@ -454,7 +454,7 @@ impl WorkspaceGraph {

open_set.extend(enabled_crates.keys().cloned());

log::info!("Starting feature calculation with open set: {open_set:?}");
log::debug!("Starting feature calculation with open set: {open_set:?}");

while let Some(krate) = open_set.pop_front() {
log::trace!("Processing crate `{krate}`");
Expand Down
1 change: 1 addition & 0 deletions codegen/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ impl WorkspaceMeta {

/// Returns true if the given crate is in the workspace and if the plugin will run on it
pub fn is_workspace_and_included_crate(&self, crate_name: &str) -> bool {
// TODO: temp
self.include_crates
.as_ref()
.map(|include_crates| include_crates.contains(&crate_name.to_owned()))
Expand Down
4 changes: 2 additions & 2 deletions codegen/src/bin/driver.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![feature(rustc_private)]
use bevy_mod_scripting_codegen::{driver::driver_main, *};
use bevy_mod_scripting_codegen::{driver::rustc_driver_main, *};
// use rustc_log::LoggerConfig;

extern crate rustc_log;
Expand All @@ -10,5 +10,5 @@ fn main() {
.parse_filters(&std::env::var("RUST_LOG").unwrap_or_else(|_| "warn".into()))
.init();

driver_main(BevyAnalyzer);
rustc_driver_main(BevyAnalyzer::initialize_from_env());
}
Loading
Loading