41 var command = (
ImportCommand)context.ParseResult.CommandResult.Command;
45 if (context.ParseResult.GetValueForArgument(command.InputsArgument) is FileInfo[] _inputs)
46 options.Inputs = AppendArray(options.Inputs, _inputs);
48 if (context.ParseResult.GetValueForOption(command.RecurseOption) is
string[] _recurse)
49 options.Recurse = AppendArray(options.Recurse, _recurse);
51 if (context.ParseResult.GetValueForOption(command.AssemblyAttributesOption) is FileInfo[] _assemblyAttributes)
52 options.AssemblyAttributes = AppendArray(options.AssemblyAttributes, _assemblyAttributes);
54 if (GetParsedDictionaryValueForOption<string, FileInfo>(context, command.ResourceOption,
null) is IReadOnlyDictionary<string, FileInfo> _resources)
55 options.Resources = AppendDictionaries(options.Resources, _resources);
57 if (GetParsedDictionaryValueForOption<string, FileInfo>(context, command.ExternalResourceOption,
null) is IReadOnlyDictionary<string, FileInfo> _externalresources)
58 options.ExternalResources = AppendDictionaries(options.ExternalResources, _externalresources);
60 if (context.ParseResult.GetValueForOption(command.OutputOption) is FileInfo _output)
61 options.Output = _output;
63 if (context.ParseResult.GetValueForOption(command.AssemblyNameOption) is
string _assemblyName)
64 options.AssemblyName = _assemblyName;
67 options.Target = _target;
70 options.Platform = _platform;
73 options.Apartment = _apartment;
75 if (context.ParseResult.GetValueForOption(command.NoGlobbingOption) is
true)
76 options.NoGlobbing =
true;
78 if (GetParsedValueForOption<
string[]?>(context, command.EnableAssertionsOption,
null) is
string[] _ea)
79 options.EnableAssertions = _ea;
81 if (GetParsedValueForOption<
string[]?>(context, command.DisableAssertionsOption,
null) is
string[] _da)
82 options.DisableAssertions = _da;
84 if (GetParsedDictionaryValueForOption<string, string>(context, command.PropertiesOption,
"") is IReadOnlyDictionary<string, string> _properties)
85 options.Properties = AppendDictionaries(options.Properties, _properties);
87 if (context.ParseResult.GetValueForOption(command.RemoveAssertionsOption) is
true)
88 options.RemoveAssertions =
true;
90 if (context.ParseResult.GetValueForOption(command.MainClassOption) is
string _main)
93 if (context.ParseResult.GetValueForOption(command.ReferenceOption) is
string[] _references)
94 options.References = AppendArray(options.References, _references);
96 if (context.ParseResult.GetValueForOption(command.NoJNIOption) is
true)
99 if (context.ParseResult.GetValueForOption(command.ExcludeOption) is FileInfo _exclude)
100 options.Exclude = _exclude;
102 if (GetParsedValueForOption<Version?>(context, command.VersionOption,
null) is Version _version)
103 options.Version = _version;
105 if (GetParsedValueForOption<Version?>(context, command.FileVersionOption,
null) is Version _fileversion)
106 options.FileVersion = _fileversion;
108 if (context.ParseResult.GetValueForOption(command.Win32IconOption) is FileInfo _win32icon)
109 options.Win32Icon = _win32icon;
111 if (context.ParseResult.GetValueForOption(command.Win32ManifestOption) is FileInfo _win32manifest)
112 options.Win32Manifest = _win32manifest;
114 if (context.ParseResult.GetValueForOption(command.KeyFileOption) is FileInfo _keyfile)
115 options.KeyFile = _keyfile;
117 if (context.ParseResult.GetValueForOption(command.KeyOption) is
string _keyoption)
118 options.Key = _keyoption;
120 if (context.ParseResult.GetValueForOption(command.DelaySignOption) is
true)
121 options.DelaySign =
true;
124 options.Debug = _debug;
126 if (context.ParseResult.GetValueForOption(command.DeterministicOption) is
false)
127 options.Deterministic =
false;
129 if (context.ParseResult.GetValueForOption(command.OptimizeOption) is
true)
130 options.Optimize =
true;
132 if (context.ParseResult.GetValueForOption(command.SourcePathOption) is DirectoryInfo _sourcePath)
133 options.SourcePath = _sourcePath;
135 if (context.ParseResult.GetValueForOption(command.RemapOption) is FileInfo _remap)
136 options.Remap = _remap;
138 if (context.ParseResult.GetValueForOption(command.NoStackTraceInfoOption) is
true)
139 options.NoStackTraceInfo =
true;
141 if (context.ParseResult.GetValueForOption(command.RemoveUnusedPrivateFieldsOption) is
true)
142 options.RemoveUnusedPrivateFields =
true;
144 if (context.ParseResult.GetValueForOption(command.CompressResourcesOption) is
true)
145 options.CompressResources =
true;
147 if (context.ParseResult.GetValueForOption(command.StrictFinalFieldSemanticsOption) is
true)
148 options.StrictFinalFieldSemantics =
true;
150 if (context.ParseResult.GetValueForOption(command.PrivatePackageOption) is
string[] _privatepackages)
151 options.PrivatePackages = AppendArray(options.PrivatePackages, _privatepackages);
153 if (context.ParseResult.GetValueForOption(command.PublicPackageOption) is
string[] _publicpackages)
154 options.PublicPackages = AppendArray(options.PublicPackages, _publicpackages);
156 if (context.ParseResult.GetValueForOption(command.NoWarnOption) is
Diagnostic[] _nowarn)
157 options.NoWarn = options.NoWarn !=
null ? AppendArray(options.NoWarn, _nowarn) : _nowarn;
159 if (context.ParseResult.GetValueForOption(command.WarnAsErrorOption) is
Diagnostic[] _warnaserror)
160 options.WarnAsError = options.WarnAsError !=
null ? AppendArray(options.WarnAsError, _warnaserror) : _warnaserror;
162 if (command.RuntimeOption !=
null)
163 if (context.ParseResult.GetValueForOption(command.RuntimeOption) is FileInfo _runtime)
164 options.Runtime = _runtime;
166 if (context.ParseResult.GetValueForOption(command.ClassLoaderOption) is
string _classloader)
167 options.ClassLoader = _classloader;
169 if (command.SharedClassLoaderOption !=
null)
170 if (context.ParseResult.GetValueForOption(command.SharedClassLoaderOption) is
true)
171 options.SharedClassLoader =
true;
173 if (context.ParseResult.GetValueForOption(command.BaseAddressOption) is
string _baseaddress)
174 options.BaseAddress = _baseaddress;
176 if (context.ParseResult.GetValueForOption(command.FileAlignOption) is
string _filealign)
177 options.FileAlign = _filealign;
179 if (context.ParseResult.GetValueForOption(command.NoPeerCrossReferenceOption) is
true)
180 options.NoPeerCrossReference =
true;
182 if (context.ParseResult.GetValueForOption(command.NoStdLibOption) is
true)
183 options.NoStdLib =
true;
185 if (context.ParseResult.GetValueForOption(command.LibraryOption) is DirectoryInfo[] _libs)
186 options.Libraries = AppendArray(options.Libraries, _libs);
188 if (context.ParseResult.GetValueForOption(command.NoAutoSerializationOption) is
true)
189 options.NoAutoSerialization =
true;
191 if (context.ParseResult.GetValueForOption(command.HighEntropyVAOption) is
true)
192 options.HighEntropyVA =
true;
194 if (context.ParseResult.GetValueForOption(command.ProxyOption) is
string[] _proxies)
195 options.Proxies = _proxies;
197 if (context.ParseResult.GetValueForOption(command.AllowNonVirtualCallsOption) is
true)
198 options.AllowNonVirtualCalls =
true;
200 if (context.ParseResult.GetValueForOption(command.StaticOption) is
true)
201 options.Static =
true;
203 if (context.ParseResult.GetValueForOption(command.NoJarStubsOption) is
true)
204 options.NoJarStubs =
true;
206 if (context.ParseResult.GetValueForOption(command.WarningLevel4Option) is
true)
207 options.WarningLevel4Option =
true;
209 if (context.ParseResult.GetValueForOption(command.NoParameterReflectionOption) is
true)
210 options.NoParameterReflection =
true;
212 if (command.BootstrapOption !=
null)
213 if (context.ParseResult.GetValueForOption(command.BootstrapOption) is
true)
214 options.Bootstrap =
true;
216 if (command.LogOption !=
null)
217 if (context.ParseResult.GetValueForOption(command.LogOption) is
string _log)
221 foreach (var level
in _levels)
224 var nestedOptions =
new List<ImportOptions>(level.Args.Count);
225 nestedCommand.SetHandler(nestedOptions.Add,
new ImportOptionsBinding(level.Nested.ToArray(), options));
226 new CommandLineBuilder(nestedCommand).Build().Invoke(level.Args.ToArray());
227 options.Nested = nestedOptions.ToArray();