@@ -27,6 +27,38 @@ public class AsmResolverDummyDllOutputFormat : Cpp2IlOutputFormat
27
27
private AssemblyDefinition ? MostRecentCorLib { get ; set ; }
28
28
29
29
public override void DoOutput ( ApplicationAnalysisContext context , string outputRoot )
30
+ {
31
+ var ret = BuildAssemblies ( context ) ;
32
+
33
+ var start = DateTime . Now ;
34
+ Logger . Verbose ( "Generating PE images..." , "DummyDllOutput" ) ;
35
+
36
+ if ( ! Directory . Exists ( outputRoot ) )
37
+ Directory . CreateDirectory ( outputRoot ) ;
38
+
39
+ //Convert assembly definitions to PE files
40
+ var peImagesToWrite = ret
41
+ . AsParallel ( )
42
+ . Select ( a => ( image : a . ManifestModule ! . ToPEImage ( new ManagedPEImageBuilder ( ) ) , name : a . ManifestModule . Name ! ) )
43
+ . ToList ( ) ;
44
+
45
+ Logger . VerboseNewline ( $ "{ ( DateTime . Now - start ) . TotalMilliseconds : F1} ms", "DummyDllOutput" ) ;
46
+
47
+ start = DateTime . Now ;
48
+ Logger . Verbose ( "Building and writing managed PE files to disk..." , "DummyDllOutput" ) ;
49
+
50
+ //Save them
51
+ var fileBuilder = new ManagedPEFileBuilder ( ) ;
52
+ foreach ( var ( image , name ) in peImagesToWrite )
53
+ {
54
+ var dllPath = Path . Combine ( outputRoot , name ) ;
55
+ fileBuilder . CreateFile ( image ) . Write ( dllPath ) ;
56
+ }
57
+
58
+ Logger . VerboseNewline ( $ "{ ( DateTime . Now - start ) . TotalMilliseconds : F1} ms", "DummyDllOutput" ) ;
59
+ }
60
+
61
+ public List < AssemblyDefinition > BuildAssemblies ( ApplicationAnalysisContext context )
30
62
{
31
63
#if VERBOSE_LOGGING
32
64
var asmCount = context . Assemblies . Count ;
@@ -44,7 +76,7 @@ public override void DoOutput(ApplicationAnalysisContext context, string outputR
44
76
#else
45
77
Logger . Verbose ( $ "Building stub assemblies...", "DummyDllOutput" ) ;
46
78
#endif
47
- var ret = BuildStubAssemblies ( context ) ;
79
+ List < AssemblyDefinition > ret = BuildStubAssemblies ( context ) ;
48
80
Logger . VerboseNewline ( $ "{ ( DateTime . Now - start ) . TotalMilliseconds : F1} ms", "DummyDllOutput" ) ;
49
81
50
82
TypeDefinitionsAsmResolver . CacheNeededTypeDefinitions ( ) ;
@@ -78,32 +110,7 @@ public override void DoOutput(ApplicationAnalysisContext context, string outputR
78
110
79
111
TypeDefinitionsAsmResolver . Reset ( ) ;
80
112
81
- start = DateTime . Now ;
82
- Logger . Verbose ( "Generating PE images..." , "DummyDllOutput" ) ;
83
-
84
- if ( ! Directory . Exists ( outputRoot ) )
85
- Directory . CreateDirectory ( outputRoot ) ;
86
-
87
- //Convert assembly definitions to PE files
88
- var peImagesToWrite = ret
89
- . AsParallel ( )
90
- . Select ( a => ( image : a . ManifestModule ! . ToPEImage ( new ManagedPEImageBuilder ( ) ) , name : a . ManifestModule . Name ! ) )
91
- . ToList ( ) ;
92
-
93
- Logger . VerboseNewline ( $ "{ ( DateTime . Now - start ) . TotalMilliseconds : F1} ms", "DummyDllOutput" ) ;
94
-
95
- start = DateTime . Now ;
96
- Logger . Verbose ( "Building and writing managed PE files to disk..." , "DummyDllOutput" ) ;
97
-
98
- //Save them
99
- var fileBuilder = new ManagedPEFileBuilder ( ) ;
100
- foreach ( var ( image , name ) in peImagesToWrite )
101
- {
102
- var dllPath = Path . Combine ( outputRoot , name ) ;
103
- fileBuilder . CreateFile ( image ) . Write ( dllPath ) ;
104
- }
105
-
106
- Logger . VerboseNewline ( $ "{ ( DateTime . Now - start ) . TotalMilliseconds : F1} ms", "DummyDllOutput" ) ;
113
+ return ret ;
107
114
}
108
115
109
116
private List < AssemblyDefinition > BuildStubAssemblies ( ApplicationAnalysisContext context )
0 commit comments