File tree Expand file tree Collapse file tree 2 files changed +6
-11
lines changed
Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ mod test;
2929use anyhow:: { bail, Context , Result } ;
3030use schemars:: JsonSchema ;
3131use serde:: Deserialize ;
32- use source:: { workspace, Source } ;
32+ use source:: { workspace:: WorkspaceConfig , Source } ;
3333use std:: path:: { Path , PathBuf } ;
3434use tracing:: log;
3535
@@ -120,7 +120,7 @@ pub async fn load_workspace_config(
120120) -> Result < Option < PathBuf > > {
121121 let cargo_toml = current_path. join ( "Cargo.toml" ) ;
122122 if cargo_toml. exists ( ) {
123- if let Ok ( workspace) = workspace :: workspace_from_manifest ( & cargo_toml) . await {
123+ if let Ok ( workspace) = WorkspaceConfig :: new ( & cargo_toml) . await {
124124 match workspace_name {
125125 Some ( name) => {
126126 if let Some ( workspace) = workspace. get_workspace_by_name ( & name) {
Original file line number Diff line number Diff line change 11use anyhow:: { Context , Result } ;
22use cargo_metadata:: { Metadata , MetadataCommand } ;
3+ use serde:: { Deserialize , Serialize } ;
34use std:: path:: Path ;
45use std:: path:: PathBuf ;
56use tokio:: task:: spawn_blocking;
67
7- #[ derive( Debug , Clone , serde :: Serialize , serde :: Deserialize ) ]
8+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
89pub struct WorkspaceConfig {
910 pub metadata : Metadata ,
1011}
@@ -21,12 +22,12 @@ impl WorkspaceConfig {
2122 }
2223
2324 pub fn get_default_workspace ( self ) -> Option < PathBuf > {
24- if let Some ( default_members ) = self . metadata . workspace_default_members . first ( ) {
25+ if let Some ( default_member ) = self . metadata . workspace_default_members . first ( ) {
2526 if let Some ( found) = self
2627 . metadata
2728 . packages
2829 . into_iter ( )
29- . find ( |p| p. id == * default_members )
30+ . find ( |p| p. id == * default_member )
3031 {
3132 return Some ( found. manifest_path . clone ( ) . into ( ) ) ;
3233 }
@@ -51,9 +52,3 @@ impl WorkspaceConfig {
5152 None
5253 }
5354}
54-
55- /// Load the trunk configuration from the cargo manifest
56- pub async fn workspace_from_manifest ( file : impl AsRef < Path > ) -> anyhow:: Result < WorkspaceConfig > {
57- let workspace_config = WorkspaceConfig :: new ( file. as_ref ( ) ) . await ?;
58- Ok ( workspace_config)
59- }
You can’t perform that action at this time.
0 commit comments