@@ -61,30 +61,6 @@ func (p *DefaultProjectLoader) Load(projectPath string) (Project, error) {
6161 return Project {}, fmt .Errorf ("failed to load blueprint: %w" , err )
6262 }
6363
64- if ! rbp .Get ("project" ).Exists () {
65- p .logger .Debug ("No project config found in blueprint, assuming root config" )
66- bp , err := validateAndDecode (rbp )
67- if err != nil {
68- p .logger .Error ("Failed loading blueprint" , "error" , err )
69- return Project {}, fmt .Errorf ("failed loading blueprint: %w" , err )
70- }
71-
72- return Project {
73- Blueprint : bp ,
74- Path : projectPath ,
75- RawBlueprint : rbp ,
76- Repo : repo ,
77- RepoRoot : gitRoot ,
78- logger : p .logger ,
79- ctx : p .ctx ,
80- }, nil
81- }
82-
83- var name string
84- if err := rbp .DecodePath ("project.name" , & name ); err != nil {
85- return Project {}, fmt .Errorf ("failed to get project name: %w" , err )
86- }
87-
8864 efPath := filepath .Join (projectPath , "Earthfile" )
8965 exists , err := afero .Exists (p .fs , efPath )
9066 if err != nil {
@@ -109,6 +85,31 @@ func (p *DefaultProjectLoader) Load(projectPath string) (Project, error) {
10985 ef = & efs
11086 }
11187
88+ if ! rbp .Get ("project" ).Exists () {
89+ p .logger .Debug ("No project config found in blueprint, assuming root config" )
90+ bp , err := validateAndDecode (rbp )
91+ if err != nil {
92+ p .logger .Error ("Failed loading blueprint" , "error" , err )
93+ return Project {}, fmt .Errorf ("failed loading blueprint: %w" , err )
94+ }
95+
96+ return Project {
97+ Blueprint : bp ,
98+ Earthfile : ef ,
99+ Path : projectPath ,
100+ RawBlueprint : rbp ,
101+ Repo : repo ,
102+ RepoRoot : gitRoot ,
103+ logger : p .logger ,
104+ ctx : p .ctx ,
105+ }, nil
106+ }
107+
108+ var name string
109+ if err := rbp .DecodePath ("project.name" , & name ); err != nil {
110+ return Project {}, fmt .Errorf ("failed to get project name: %w" , err )
111+ }
112+
112113 p .logger .Info ("Loading tag data" )
113114 var tag * ProjectTag
114115 gitTag , err := git .GetTag (repo )
0 commit comments