@@ -20,16 +20,14 @@ public void GetModulesOrder(string moduleName, string configuration, out List<De
20
20
{
21
21
log . Debug ( "Building configurations graph" ) ;
22
22
ConsoleWriter . WriteProgress ( "Building configurations graph" ) ;
23
-
24
23
var configsGraph = BuildConfigsGraph ( moduleName , configuration ) ;
25
24
configsGraph = EraseExtraChildren ( configsGraph ) ;
26
25
topSortedVertices = GetTopologicallySortedGraph ( configsGraph , moduleName , configuration ) ;
27
-
26
+
28
27
log . Debug ( "Getting current commit hashes" ) ;
29
28
ConsoleWriter . WriteProgress ( "Getting current commit hashes" ) ;
30
29
currentCommitHashes = GetCurrentCommitHashes ( configsGraph ) ;
31
30
updatedModules = BuiltInfoStorage . Deserialize ( ) . GetUpdatedModules ( topSortedVertices , currentCommitHashes ) ;
32
-
33
31
ConsoleWriter . ResetProgress ( ) ;
34
32
}
35
33
@@ -149,22 +147,33 @@ public static Dictionary<Dep, List<Dep>> BuildConfigsGraph(string moduleName, st
149
147
return graph ;
150
148
}
151
149
152
- private static void Dfs ( Dep dep , Dictionary < Dep , List < Dep > > graph , HashSet < Dep > visitedConfigurations )
150
+ private static readonly Dictionary < string , bool > DepConfigurationExistsCache = new Dictionary < string , bool > ( ) ;
151
+ private static void CheckAndUpdateDepConfiguration ( Dep dep )
153
152
{
154
153
dep . UpdateConfigurationIfNull ( ) ;
155
-
156
- if ( Yaml . Exists ( dep . Name ) && ! Yaml . ConfigurationParser ( dep . Name ) . ConfigurationExists ( dep . Configuration ) )
154
+ var key = dep . ToString ( ) ;
155
+ if ( ! DepConfigurationExistsCache . ContainsKey ( key ) )
156
+ {
157
+ if ( ! Directory . Exists ( Path . Combine ( Helper . CurrentWorkspace , dep . Name ) ) )
158
+ {
159
+ throw new CementBuildException ( "Failed to find module '" + dep . Name + "'" ) ;
160
+ }
161
+ DepConfigurationExistsCache [ key ] = ! Yaml . Exists ( dep . Name ) ||
162
+ Yaml . ConfigurationParser ( dep . Name ) . ConfigurationExists ( dep . Configuration ) ;
163
+ }
164
+ if ( ! DepConfigurationExistsCache [ key ] )
157
165
{
158
- ConsoleWriter . WriteWarning ( $ "Configuration '{ dep . Configuration } ' was not found in { dep . Name } . Will take full-build config") ;
166
+ ConsoleWriter . WriteWarning (
167
+ $ "Configuration '{ dep . Configuration } ' was not found in { dep . Name } . Will take full-build config") ;
159
168
dep . Configuration = "full-build" ;
160
169
}
170
+ }
161
171
172
+ private static void Dfs ( Dep dep , Dictionary < Dep , List < Dep > > graph , HashSet < Dep > visitedConfigurations )
173
+ {
174
+ CheckAndUpdateDepConfiguration ( dep ) ;
162
175
visitedConfigurations . Add ( dep ) ;
163
176
graph [ dep ] = new List < Dep > ( ) ;
164
- if ( ! Directory . Exists ( Path . Combine ( Helper . CurrentWorkspace , dep . Name ) ) )
165
- {
166
- throw new CementBuildException ( "Failed to find module '" + dep . Name + "'" ) ;
167
- }
168
177
var currentDeps = new DepsParser ( Path . Combine ( Helper . CurrentWorkspace , dep . Name ) ) . Get ( dep . Configuration ) . Deps ?? new List < Dep > ( ) ;
169
178
currentDeps = currentDeps . Select ( d => new Dep ( d . Name , null , d . Configuration ) ) . ToList ( ) ;
170
179
foreach ( var d in currentDeps )
0 commit comments