1111 "get_mono" ,
1212 "get_netfx" ,
1313 "get_coreclr" ,
14- "get_coreclr_command_line" ,
1514 "find_dotnet_root" ,
1615 "find_libmono" ,
1716 "find_runtimes" ,
@@ -92,6 +91,7 @@ def get_mono(
9291def get_coreclr (
9392 * ,
9493 runtime_config : Optional [StrOrPath ] = None ,
94+ entry_dll : Optional [StrOrPath ] = None ,
9595 dotnet_root : Optional [StrOrPath ] = None ,
9696 properties : Optional [Dict [str , str ]] = None ,
9797 runtime_spec : Optional [DotnetCoreRuntimeSpec ] = None ,
@@ -104,9 +104,13 @@ def get_coreclr(
104104 the first function object is retrieved.
105105
106106 :param runtime_config:
107- Pass to a ``runtimeconfig.json`` as generated by
107+ Path to a ``runtimeconfig.json`` as generated by
108108 ``dotnet publish``. If this parameter is not given, a temporary runtime
109109 config will be generated.
110+ :param entry_dll:
111+ The path to the entry dll. If this parameter is given, the runtime will
112+ be initialized using the command line hosting API instead of using the
113+ runtime config.
110114 :param dotnet_root:
111115 The root directory of the .NET Core installation. If this is not
112116 specified, we try to discover it using :py:func:`find_dotnet_root`.
@@ -117,6 +121,7 @@ def get_coreclr(
117121 If the ``runtime_config`` is not specified, the concrete runtime to use
118122 can be controlled by passing this parameter. Possible values can be
119123 retrieved using :py:func:`find_runtimes`."""
124+
120125 from .hostfxr import DotnetCoreRuntime
121126
122127 dotnet_root = _maybe_path (dotnet_root )
@@ -125,7 +130,9 @@ def get_coreclr(
125130
126131 temp_dir = None
127132 runtime_config = _maybe_path (runtime_config )
128- if runtime_config is None :
133+ entry_dll = _maybe_path (entry_dll )
134+
135+ if runtime_config is None and entry_dll is None :
129136 if runtime_spec is None :
130137 candidates = [
131138 rt for rt in find_runtimes () if rt .name == "Microsoft.NETCore.App"
@@ -142,7 +149,12 @@ def get_coreclr(
142149 with open (runtime_config , "w" ) as f :
143150 runtime_spec .write_config (f )
144151
145- impl = DotnetCoreRuntime (runtime_config = runtime_config , dotnet_root = dotnet_root )
152+ if entry_dll is not None :
153+ entry_dll = _maybe_path (entry_dll )
154+ impl = DotnetCoreRuntime (entry_dll = entry_dll , dotnet_root = dotnet_root )
155+ else :
156+ impl = DotnetCoreRuntime (runtime_config = runtime_config , dotnet_root = dotnet_root )
157+
146158 if properties :
147159 for key , value in properties .items ():
148160 impl [key ] = value
@@ -153,41 +165,6 @@ def get_coreclr(
153165 return impl
154166
155167
156- def get_coreclr_command_line (
157- * ,
158- entry_dll : StrOrPath ,
159- dotnet_root : Optional [StrOrPath ] = None ,
160- properties : Optional [Dict [str , str ]] = None ,
161- ) -> Runtime :
162- """Get a CoreCLR (.NET Core) runtime instance
163- The returned ``DotnetCoreRuntimeCommandLine`` also acts as a mapping of the config
164- properties. They can be retrieved using the index operator and can be
165- written until the runtime is initialized. The runtime is initialized when
166- the first function object is retrieved.
167- :param entry_dll:
168- The path to the entry dll.
169- :param dotnet_root:
170- The root directory of the .NET Core installation. If this is not
171- specified, we try to discover it using :py:func:`find_dotnet_root`.
172- :param properties:
173- Additional runtime properties. These can also be passed using the
174- ``configProperties`` section in the runtime config."""
175- from .hostfxr import DotnetCoreCommandRuntime
176-
177- dotnet_root = _maybe_path (dotnet_root )
178- if dotnet_root is None :
179- dotnet_root = find_dotnet_root ()
180-
181- impl = DotnetCoreCommandRuntime (
182- entry_dll = _maybe_path (entry_dll ), dotnet_root = dotnet_root
183- )
184- if properties :
185- for key , value in properties .items ():
186- impl [key ] = value
187-
188- return impl
189-
190-
191168def get_netfx (
192169 * , domain : Optional [str ] = None , config_file : Optional [StrOrPath ] = None
193170) -> Runtime :
0 commit comments