@@ -48,30 +48,60 @@ public static int Main(string[] args)
48
48
return 1 ;
49
49
}
50
50
51
+ //If this is set it will scope the generation to only a single profile, eg only OpenGL or only WebGPU
52
+ string profile = null ;
53
+
51
54
var sw = Stopwatch . StartNew ( ) ;
52
55
var extraCtrls = new List < string > ( ) ;
53
56
var failedJobs = 0 ;
54
57
Console . SetOut ( ConsoleWriter . GetOrCreate ( Console . Out ) ) ;
58
+
59
+ //do one pass over the arguments, picking out the things that start with `--` (eg. control descriptors)
55
60
foreach ( var arg in args )
56
61
{
62
+ if ( ! arg . StartsWith ( "--" ) )
63
+ {
64
+ continue ;
65
+ }
66
+
67
+ if ( arg . StartsWith ( "--profile=" ) )
68
+ {
69
+ profile = arg . Substring ( "--profile=" . Length ) ;
70
+ continue ;
71
+ }
72
+
57
73
if ( string . Equals ( arg , "--no-parallel" , StringComparison . OrdinalIgnoreCase ) )
58
74
{
59
75
// picked up in Generator.cs
60
76
continue ;
61
77
}
62
78
79
+ Console . WriteLine ( $ "Control descriptor \" { arg } \" will be applied to every job herein.") ;
80
+ extraCtrls . Add ( arg [ 2 ..] ) ;
81
+ }
82
+
83
+ //do a second pass over the arguments, picking out the things that dont start with `--` (eg. files)
84
+ foreach ( var arg in args )
85
+ {
63
86
if ( arg . StartsWith ( "--" ) )
64
87
{
65
- Console . WriteLine ( $ "Control descriptor \" { arg } \" will be applied to every job herein.") ;
66
- extraCtrls . Add ( arg [ 2 ..] ) ;
67
88
continue ;
68
89
}
69
90
70
91
var jobSw = Stopwatch . StartNew ( ) ;
71
92
var abs = Path . GetFullPath ( arg ) ;
72
93
Environment . CurrentDirectory = Path . GetDirectoryName
73
94
( abs ) ?? throw new NullReferenceException ( "Dir path null." ) ;
74
- Generator . Run ( AddDescriptors ( JsonConvert . DeserializeObject < Config > ( File . ReadAllText ( abs ) ) , extraCtrls ) ) ;
95
+
96
+ var config = JsonConvert . DeserializeObject < Config > ( File . ReadAllText ( abs ) ) ;
97
+
98
+ //if the profile scope is set, set the tasks to generate to *only* the task that matches the name
99
+ if ( profile != null )
100
+ {
101
+ config . Tasks = config . Tasks . Where ( x => x . Name . Equals ( profile , StringComparison . InvariantCultureIgnoreCase ) ) . ToArray ( ) ;
102
+ }
103
+
104
+ Generator . Run ( AddDescriptors ( config , extraCtrls ) ) ;
75
105
76
106
jobSw . Stop ( ) ;
77
107
Thread . Sleep ( 3000 ) ; // cooldown to ensure all the threads have reported their results.
0 commit comments