Skip to content

Commit

Permalink
Polish.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Oct 10, 2023
1 parent f401986 commit 71bc87b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion nextgen/config/src/project/dep_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ derive_enum!(
#[default]
Production,

// Special case when dependening on the root-level project
// Special case when depending on the root-level project
Root,
}
);
Expand Down
4 changes: 2 additions & 2 deletions nextgen/project-builder/src/project_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Event for DetectLanguageEvent {
pub struct ProjectBuilderContext<'app> {
pub detect_language: &'app Emitter<DetectLanguageEvent>,
pub detect_platform: &'app Emitter<DetectPlatformEvent>,
pub root_id: Option<&'app Id>,
pub root_project_id: Option<&'app Id>,
pub toolchain_config: &'app ToolchainConfig,
pub workspace_root: &'app Path,
}
Expand Down Expand Up @@ -269,7 +269,7 @@ impl<'app> ProjectBuilder<'app> {
dep_id.to_owned(),
DependencyConfig {
id: dep_id.to_owned(),
scope: if self.context.root_id.is_some_and(|r| r == dep_id) {
scope: if self.context.root_project_id.is_some_and(|id| id == dep_id) {
DependencyScope::Root
} else {
DependencyScope::Peer
Expand Down
2 changes: 1 addition & 1 deletion nextgen/project-builder/tests/project_builder_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl Stub {
ProjectBuilderContext {
detect_language: &self.detect_language,
detect_platform: &self.detect_platform,
root_id: None,
root_project_id: None,
toolchain_config: &self.toolchain_config,
workspace_root: &self.workspace_root,
},
Expand Down
9 changes: 5 additions & 4 deletions nextgen/project-graph/src/project_graph_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ pub struct ProjectGraphBuilder<'app> {
nodes: FxHashMap<Id, NodeIndex>,

/// The root project ID.
root_id: Option<Id>,
#[serde(skip)]
root_project_id: Option<Id>,

/// Mapping of project IDs to file system sources,
/// derived from the `workspace.projects` setting.
Expand All @@ -80,7 +81,7 @@ impl<'app> ProjectGraphBuilder<'app> {
aliases: FxHashMap::default(),
graph: DiGraph::new(),
nodes: FxHashMap::default(),
root_id: None,
root_project_id: None,
sources: FxHashMap::default(),
};

Expand Down Expand Up @@ -297,7 +298,7 @@ impl<'app> ProjectGraphBuilder<'app> {
ProjectBuilderContext {
detect_language: &context.detect_language,
detect_platform: &context.detect_platform,
root_id: self.root_id.as_ref(),
root_project_id: self.root_project_id.as_ref(),
toolchain_config: context.toolchain_config,
workspace_root: context.workspace_root,
},
Expand Down Expand Up @@ -465,7 +466,7 @@ impl<'app> ProjectGraphBuilder<'app> {
.await?;

// Find the root project
self.root_id = sources.iter().find_map(|(id, source)| {
self.root_project_id = sources.iter().find_map(|(id, source)| {
if source.as_str().is_empty() || source.as_str() == "." {
Some(id.to_owned())
} else {
Expand Down
7 changes: 4 additions & 3 deletions nextgen/test-utils/src/project_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ impl ProjectGraphContainer {
}

// Use folders as project names
let mut projects = WorkspaceProjectsConfig::default();

projects.globs = vec!["*".into()];
let mut projects = WorkspaceProjectsConfig {
globs: vec!["*".into()],
..WorkspaceProjectsConfig::default()
};

if root.join("moon.yml").exists() {
projects.sources.insert("root".into(), ".".into());
Expand Down

0 comments on commit 71bc87b

Please sign in to comment.