1111 "get_mono" ,
1212 "get_netfx" ,
1313 "get_coreclr" ,
14- "get_coreclr_command_line" ,
1514 "find_dotnet_root" ,
1615 "find_libmono" ,
1716 "find_runtimes" ,
@@ -94,6 +93,7 @@ def get_mono(
9493def get_coreclr (
9594 * ,
9695 runtime_config : Optional [StrOrPath ] = None ,
96+ entry_dll : Optional [StrOrPath ] = None ,
9797 dotnet_root : Optional [StrOrPath ] = None ,
9898 properties : Optional [Dict [str , str ]] = None ,
9999 runtime_spec : Optional [DotnetCoreRuntimeSpec ] = None ,
@@ -106,9 +106,13 @@ def get_coreclr(
106106 the first function object is retrieved.
107107
108108 :param runtime_config:
109- Pass to a ``runtimeconfig.json`` as generated by
109+ Path to a ``runtimeconfig.json`` as generated by
110110 ``dotnet publish``. If this parameter is not given, a temporary runtime
111111 config will be generated.
112+ :param entry_dll:
113+ The path to the entry dll. If this parameter is given, the runtime will
114+ be initialized using the command line hosting API instead of using the
115+ runtime config.
112116 :param dotnet_root:
113117 The root directory of the .NET Core installation. If this is not
114118 specified, we try to discover it using :py:func:`find_dotnet_root`.
@@ -119,6 +123,7 @@ def get_coreclr(
119123 If the ``runtime_config`` is not specified, the concrete runtime to use
120124 can be controlled by passing this parameter. Possible values can be
121125 retrieved using :py:func:`find_runtimes`."""
126+
122127 from .hostfxr import DotnetCoreRuntime
123128
124129 dotnet_root = _maybe_path (dotnet_root )
@@ -127,7 +132,9 @@ def get_coreclr(
127132
128133 temp_dir = None
129134 runtime_config = _maybe_path (runtime_config )
130- if runtime_config is None :
135+ entry_dll = _maybe_path (entry_dll )
136+
137+ if runtime_config is None and entry_dll is None :
131138 if runtime_spec is None :
132139 candidates = [
133140 rt for rt in find_runtimes () if rt .name == "Microsoft.NETCore.App"
@@ -144,7 +151,12 @@ def get_coreclr(
144151 with open (runtime_config , "w" ) as f :
145152 runtime_spec .write_config (f )
146153
147- impl = DotnetCoreRuntime (runtime_config = runtime_config , dotnet_root = dotnet_root )
154+ if entry_dll is not None :
155+ entry_dll = _maybe_path (entry_dll )
156+ impl = DotnetCoreRuntime (entry_dll = entry_dll , dotnet_root = dotnet_root )
157+ else :
158+ impl = DotnetCoreRuntime (runtime_config = runtime_config , dotnet_root = dotnet_root )
159+
148160 if properties :
149161 for key , value in properties .items ():
150162 impl [key ] = value
@@ -155,41 +167,6 @@ def get_coreclr(
155167 return impl
156168
157169
158- def get_coreclr_command_line (
159- * ,
160- entry_dll : StrOrPath ,
161- dotnet_root : Optional [StrOrPath ] = None ,
162- properties : Optional [Dict [str , str ]] = None ,
163- ) -> Runtime :
164- """Get a CoreCLR (.NET Core) runtime instance
165- The returned ``DotnetCoreRuntimeCommandLine`` also acts as a mapping of the config
166- properties. They can be retrieved using the index operator and can be
167- written until the runtime is initialized. The runtime is initialized when
168- the first function object is retrieved.
169- :param entry_dll:
170- The path to the entry dll.
171- :param dotnet_root:
172- The root directory of the .NET Core installation. If this is not
173- specified, we try to discover it using :py:func:`find_dotnet_root`.
174- :param properties:
175- Additional runtime properties. These can also be passed using the
176- ``configProperties`` section in the runtime config."""
177- from .hostfxr import DotnetCoreCommandRuntime
178-
179- dotnet_root = _maybe_path (dotnet_root )
180- if dotnet_root is None :
181- dotnet_root = find_dotnet_root ()
182-
183- impl = DotnetCoreCommandRuntime (
184- entry_dll = _maybe_path (entry_dll ), dotnet_root = dotnet_root
185- )
186- if properties :
187- for key , value in properties .items ():
188- impl [key ] = value
189-
190- return impl
191-
192-
193170def get_netfx (
194171 * , domain : Optional [str ] = None , config_file : Optional [StrOrPath ] = None
195172) -> Runtime :
0 commit comments