@@ -5,19 +5,36 @@ namespace EventHorizon.Blazor.TypeScript.Interop.Generator.ConsoleApp
55 using System . IO ;
66 using EventHorizon . Blazor . TypeScript . Interop . Generator . Formatter ;
77 using EventHorizon . Blazor . TypeScript . Interop . Generator . Logging ;
8- using EventHorizon . Blazor . TypeScript . Interop . Generator . Writers . Project ;
8+
9+ using ServerGenerator = Blazor . Interop . Generator . GenerateInteropSource ;
10+ using ServerProjectWriter = Blazor . Interop . Generator . Writers . Project . ServerProjectWriter ;
11+ using WasmGenerator = GenerateSource ;
12+ using WasmProjectWriter = Writers . Project . ProjectWriter ;
913
1014 public class Program
1115 {
1216 static void Main ( string [ ] args )
1317 {
14- //Run(AstParser.Model.ASTParserType.NodeJS); // 75084ms/71877ms to generate.
15- Run ( AstParser . Model . ASTParserType . Sdcb ) ; // 22027ms/19835ms/18236ms to generate.
18+ //Run(AstParser.Model.ASTParserType.NodeJS, true); // 75084ms/71877ms to generate.
19+ Run (
20+ AstParser . Model . ASTParserType . Sdcb ,
21+ true ,
22+ "EventHorizon.Blazor.BabylonJS.WASM"
23+ ) ; // 22027ms/19835ms/18236ms to generate.
24+ //Run(
25+ // AstParser.Model.ASTParserType.Sdcb,
26+ // false,
27+ // "EventHorizon.Blazor.BabylonJS.Server"
28+ //);
1629 }
17- static void Run ( AstParser . Model . ASTParserType type )
30+ static void Run (
31+ AstParser . Model . ASTParserType type ,
32+ bool useWasm ,
33+ string projectAssembly
34+ )
1835 {
1936 var stopwatch = Stopwatch . StartNew ( ) ;
20- var projectAssembly = "EventHorizon.Blazor.BabylonJS.WASM" ;
37+ // var projectAssembly = "EventHorizon.Blazor.BabylonJS.WASM";
2138 var projectGenerationLocation = Path . Combine (
2239 ".." ,
2340 "_generated"
@@ -28,10 +45,6 @@ static void Run(AstParser.Model.ASTParserType type)
2845 "SourceFiles"
2946 ) ;
3047 var textFormatter = new NoFormattingTextFormatter ( ) ;
31- var writer = new ProjectWriter (
32- projectGenerationLocation ,
33- projectAssembly
34- ) ;
3548 var sourceFiles = new List < string >
3649 {
3750 //"testing.d.ts",
@@ -86,19 +99,48 @@ static void Run(AstParser.Model.ASTParserType type)
8699 }
87100 GlobalLogger . Info ( "Removed Generation Directory" ) ;
88101
89- new GenerateSource ( ) . Run (
90- projectAssembly ,
91- sourceDirectory ,
92- sourceFiles ,
93- generationList ,
94- writer ,
95- textFormatter ,
96- new Dictionary < string , string >
97- {
98- { "BABYLON.PointerInfoBase | type" , "int" }
99- } ,
100- type
101- ) ;
102+ if ( useWasm )
103+ {
104+ GlobalLogger . Info ( "Running Wasm Generator" ) ;
105+ var writer = new WasmProjectWriter (
106+ projectGenerationLocation ,
107+ projectAssembly
108+ ) ;
109+ new WasmGenerator ( ) . Run (
110+ projectAssembly ,
111+ sourceDirectory ,
112+ sourceFiles ,
113+ generationList ,
114+ writer ,
115+ textFormatter ,
116+ new Dictionary < string , string >
117+ {
118+ { "BABYLON.PointerInfoBase | type" , "int" }
119+ } ,
120+ type
121+ ) ;
122+ }
123+ else
124+ {
125+ GlobalLogger . Info ( "Running Server Generator" ) ;
126+ var writer = new ServerProjectWriter (
127+ projectGenerationLocation ,
128+ projectAssembly
129+ ) ;
130+ new ServerGenerator ( ) . Run (
131+ projectAssembly ,
132+ sourceDirectory ,
133+ sourceFiles ,
134+ generationList ,
135+ writer ,
136+ textFormatter ,
137+ new Dictionary < string , string >
138+ {
139+ { "BABYLON.PointerInfoBase | type" , "int" }
140+ } ,
141+ type
142+ ) ;
143+ }
102144 stopwatch . Stop ( ) ;
103145 GlobalLogger . Info ( "Removed Generation Directory" ) ;
104146 GlobalLogger . Info ( $ "Took { stopwatch . ElapsedMilliseconds } ms to generate.") ;
0 commit comments