diff --git a/src/Uno.Wasm.Packager/packager.cs b/src/Uno.Wasm.Packager/packager.cs index d6e74055f..a025a2720 100644 --- a/src/Uno.Wasm.Packager/packager.cs +++ b/src/Uno.Wasm.Packager/packager.cs @@ -1418,7 +1418,9 @@ int Run (string[] args) { linker_args.Add(extra_linkerflags); linker_args.AddRange(linkerSearchPaths); - ninja.WriteLine ($" command = {tools_shell_prefix} {linkerBin} \'@{linkerResponse}\' {exitCommand}; {tunerCommand} --gen-empty-assemblies $out"); + ninja.WriteLine ($" command = {tools_shell_prefix} {linkerBin} \'@{linkerResponse}\' {exitCommand}; {tunerCommand} --gen-empty-assemblies \'@$builddir/tuner.rsp\'"); + ninja.WriteLine (" rspfile = $builddir/tuner.rsp"); + ninja.WriteLine (" rspfile_content = $out"); ninja.WriteLine (" description = [IL-LINK]"); ninja.WriteLine ("rule aot-instances-dll"); @@ -1436,7 +1438,9 @@ int Run (string[] args) { ninja.WriteLine ("rule gen-icall-table"); ninja.WriteLine ($" command = {tools_shell_prefix} {tunerCommand} --gen-icall-table $out $runtime_table $in"); ninja.WriteLine ("rule gen-pinvoke-table"); - ninja.WriteLine ($" command = {tools_shell_prefix} {tunerCommand} --gen-pinvoke-table $out $pinvoke_libs $in"); + ninja.WriteLine ($" command = {tools_shell_prefix} {tunerCommand} --gen-pinvoke-table \'@$builddir/gen-pinvoke.rsp\'"); + ninja.WriteLine ($" rspfile = $builddir/gen-pinvoke.rsp"); + ninja.WriteLine ($" rspfile_content = $out $pinvoke_libs $in"); ninja.WriteLine ("rule ilstrip"); ninja.WriteLine ($" command = {commandPrefix} {cpCommand} $in $out; mono $tools_dir/mono-cil-strip.exe -q $out"); ninja.WriteLine (" description = [IL-STRIP]"); diff --git a/src/Uno.Wasm.Tuner/tuner.cs b/src/Uno.Wasm.Tuner/tuner.cs index dd7332532..a78747701 100644 --- a/src/Uno.Wasm.Tuner/tuner.cs +++ b/src/Uno.Wasm.Tuner/tuner.cs @@ -42,7 +42,7 @@ int Run (String[] args) } else if (cmd == "--gen-pinvoke-table") { return GenPinvokeTable (args); } else if (cmd == "--gen-empty-assemblies") { - return GenEmptyAssemblies (args); + return GenEmptyAssemblies2 (args); } else { Usage (); return 1; @@ -64,15 +64,29 @@ public static string MapType (TypeReference t) { return "int"; } - int GenPinvokeTable (String[] args) { + int GenPinvokeTable (string[] args) + { + if (args[1].StartsWith("@")) + { + var rawContent = File.ReadAllText(args[1].Substring(1)); + + var content = rawContent.Split(" "); + + args = new[] { args[0] } + .Concat(content) + .ToArray(); + } + var outputFile = args[1]; var icallTable = args[3]; var modules = new Dictionary (); foreach (var module in args [2].Split (',')) + { modules [module] = module; + } - var files = args.Skip (4).ToArray (); + var files = args.Skip(4).ToArray(); var generator = new PInvokeTableGenerator(); @@ -118,8 +132,28 @@ int GenIcallTable(string[] args) { } // Generate empty assemblies for the filenames in ARGS if they don't exist - int GenEmptyAssemblies (string[] args) { - foreach (var fname in args.Skip(1)) { + int GenEmptyAssemblies2 (IEnumerable args) + { + args = args.SelectMany(arg => + { + // Expand a response file + + if (arg.StartsWith("@")) + { + var rawContent = File.ReadAllText(arg.Substring(1)); + var content = rawContent.Split(" "); + +#if DEBUG + Console.WriteLine($"Tuner Response content: {rawContent}"); +#endif + + return content; + } + return new[] { arg }; + }); + + foreach (var fname in args.Skip(1)) + { if (File.Exists (fname) || !Path.GetExtension(fname).Equals(".dll", StringComparison.OrdinalIgnoreCase)) { continue;