diff options
author | Zoltan Varga <vargaz@gmail.com> | 2020-02-18 10:33:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-18 10:33:45 +0300 |
commit | 7038b1a4261f86dac2fda4f3894f397bddf88f2c (patch) | |
tree | 9e79849c2932c4b269b209ff46b3f546dfa4fad7 /mcs | |
parent | 15d61562ca6fac9b96987b2f23471efd4e17ba7e (diff) |
[wasm] Implement generation of empty assemblies in wasm-tuner. (#18880)
The linker can completely link away some assemblies, but the rest of the ninja
build still requires them. Previously they were generated by running csc, but
thats too slow, so generate them using Cecil from wasm-tuner.
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/tools/wasm-tuner/tuner.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mcs/tools/wasm-tuner/tuner.cs b/mcs/tools/wasm-tuner/tuner.cs index b908bfb2d7e..6e36ffd8c2b 100644 --- a/mcs/tools/wasm-tuner/tuner.cs +++ b/mcs/tools/wasm-tuner/tuner.cs @@ -97,6 +97,7 @@ public class WasmTuner Console.WriteLine ("Arguments:"); Console.WriteLine ("--gen-icall-table icall-table.json <assemblies>."); Console.WriteLine ("--gen-pinvoke-table <list of native library names separated by commas> <assemblies>."); + Console.WriteLine ("--gen-empty-assemblies <filenames>."); } int Run (String[] args) { @@ -113,6 +114,8 @@ public class WasmTuner return GenIcallTable (args); } else if (cmd == "--gen-pinvoke-table") { return GenPinvokeTable (args); + } else if (cmd == "--gen-empty-assemblies") { + return GenEmptyAssemblies (args); } else { Usage (); return 1; @@ -411,4 +414,16 @@ public class WasmTuner icalls.Add (icall); } } + + // Generate empty assemblies for the filenames in ARGS if they don't exist + int GenEmptyAssemblies (String[] args) { + foreach (var fname in args) { + if (File.Exists (fname)) + continue; + var basename = Path.GetFileName (fname).Replace (".exe", "").Replace (".dll", ""); + var assembly = AssemblyDefinition.CreateAssembly (new AssemblyNameDefinition (basename, new Version (0, 0, 0, 0)), basename, ModuleKind.Dll); + assembly.Write (fname); + } + return 0; + } }
\ No newline at end of file |