diff --git a/tools/jnimarshalmethod-gen/App.cs b/tools/jnimarshalmethod-gen/App.cs index 23d488c7c..56d10fc02 100644 --- a/tools/jnimarshalmethod-gen/App.cs +++ b/tools/jnimarshalmethod-gen/App.cs @@ -93,6 +93,11 @@ List ProcessArguments (string [] args) { "h|help|?", "Show this message and exit", v => help = v != null }, + { "types=", + "Generate marshaling methods only for types whose names match regex patterns listed {FILE}.\n" + + "One regex pattern per line.\n" + + "Empty lines and lines starting with '#' character are ignored as comments.", + v => LoadTypes (v) }, { "t|type=", "Generate marshaling methods only for types whose names match {TYPE-REGEX}.", v => typeNameRegexes.Add (new Regex (v)) }, @@ -116,6 +121,24 @@ List ProcessArguments (string [] args) return assemblies; } + void LoadTypes (string typesPath) + { + try { + foreach (var line in File.ReadLines (typesPath)) { + if (string.IsNullOrWhiteSpace (line)) + continue; + + if (line [0] == '#') + continue; + + typeNameRegexes.Add (new Regex (line)); + } + } catch (Exception e) { + Error ($"Unable to read profile '{typesPath}'.{Environment.NewLine}{e}"); + Environment.Exit (4); + } + } + void ProcessAssemblies (List assemblies) { CreateJavaVM (jvmDllPath); @@ -153,7 +176,7 @@ void ProcessAssemblies (List assemblies) try { CreateMarshalMethodAssembly (assembly); } catch (Exception e) { - Error ($"Unable to process assembly '{assembly}'\n{e.Message}\n{e}"); + Error ($"Unable to process assembly '{assembly}'{Environment.NewLine}{e.Message}{Environment.NewLine}{e}"); Environment.Exit (1); } } @@ -168,7 +191,7 @@ void CreateJavaVM (string jvmDllPath) try { builder.CreateJreVM (); } catch (Exception e) { - Error ($"Unable to create Java VM\n{e}"); + Error ($"Unable to create Java VM{Environment.NewLine}{e}"); Environment.Exit (3); } }