change ordering of the args when invoking dotnet exec for xunit. Fix a bug in the host logic
This commit is contained in:
parent
e2e535d510
commit
0eb527a7c1
5 changed files with 70 additions and 25 deletions
|
@ -107,29 +107,46 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
}
|
||||
|
||||
arguments.Add("exec");
|
||||
|
||||
if (runtimeConfigPath != null)
|
||||
{
|
||||
arguments.Add("--runtimeconfig");
|
||||
arguments.Add(runtimeConfigPath);
|
||||
}
|
||||
|
||||
if (depsFilePath != null)
|
||||
{
|
||||
arguments.Add("--depsfile");
|
||||
arguments.Add(depsFilePath);
|
||||
}
|
||||
|
||||
arguments.Add("--additionalprobingpath");
|
||||
arguments.Add(nugetPackagesRoot);
|
||||
|
||||
arguments.Add(commandPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
host = CoreHost.HostExePath;
|
||||
|
||||
arguments.Add(commandPath);
|
||||
|
||||
if (runtimeConfigPath != null)
|
||||
{
|
||||
arguments.Add("--runtimeconfig");
|
||||
arguments.Add(runtimeConfigPath);
|
||||
}
|
||||
|
||||
if (depsFilePath != null)
|
||||
{
|
||||
arguments.Add("--depsfile");
|
||||
arguments.Add(depsFilePath);
|
||||
}
|
||||
|
||||
arguments.Add("--additionalprobingpath");
|
||||
arguments.Add(nugetPackagesRoot);
|
||||
}
|
||||
|
||||
arguments.Add(commandPath);
|
||||
|
||||
if (runtimeConfigPath != null)
|
||||
{
|
||||
arguments.Add("--runtimeconfig");
|
||||
arguments.Add(runtimeConfigPath);
|
||||
}
|
||||
|
||||
if (depsFilePath != null)
|
||||
{
|
||||
arguments.Add("--depsfile");
|
||||
arguments.Add(depsFilePath);
|
||||
}
|
||||
|
||||
arguments.Add("--additionalprobingpath");
|
||||
arguments.Add(nugetPackagesRoot);
|
||||
|
||||
arguments.AddRange(commandArguments);
|
||||
|
||||
return CreateCommandSpec(host, arguments, commandResolutionStrategy);
|
||||
|
|
|
@ -314,11 +314,18 @@ int fx_muxer_t::parse_args_and_execute(const pal::string_t& own_dir, int argoff,
|
|||
trace::verbose(_X("Current argv is %s"), app_candidate.c_str());
|
||||
|
||||
pal::string_t app_or_deps = deps_file.empty() ? app_candidate : deps_file;
|
||||
pal::string_t app_or_runtime_config = runtime_config.empty() ? app_candidate : runtime_config;
|
||||
pal::string_t config_file, dev_config_file;
|
||||
|
||||
trace::error(_X("Finding runtimeconfig.json from [%s]"), app_or_runtime_config.c_str());
|
||||
get_runtime_config_paths_from_file(app_or_runtime_config, &config_file, &dev_config_file);
|
||||
if(runtime_config.empty())
|
||||
{
|
||||
trace::verbose(_X("Finding runtimeconfig.json from [%s]"), app_candidate.c_str());
|
||||
get_runtime_config_paths_from_app(app_candidate, &config_file, &dev_config_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
trace::verbose(_X("Finding runtimeconfig.json from [%s]"), runtime_config.c_str());
|
||||
get_runtime_config_paths_from_arg(runtime_config, &config_file, &dev_config_file);
|
||||
}
|
||||
|
||||
runtime_config_t config(config_file, dev_config_file);
|
||||
for (const auto& path : config.get_probe_paths())
|
||||
|
|
|
@ -248,7 +248,7 @@ SHARED_API int corehost_main(const int argc, const pal::char_t* argv[])
|
|||
{
|
||||
pal::string_t config_file, dev_config_file;
|
||||
|
||||
get_runtime_config_paths_from_file(args.managed_application, &config_file, &dev_config_file);
|
||||
get_runtime_config_paths_from_app(args.managed_application, &config_file, &dev_config_file);
|
||||
runtime_config_t config(config_file, dev_config_file);
|
||||
|
||||
if (!config.is_valid())
|
||||
|
|
|
@ -6,14 +6,33 @@
|
|||
#include "trace.h"
|
||||
#include "libhost.h"
|
||||
|
||||
void get_runtime_config_paths_from_file(const pal::string_t& file, pal::string_t* cfg, pal::string_t* dev_cfg)
|
||||
void get_runtime_config_paths_from_app(const pal::string_t& app, pal::string_t* cfg, pal::string_t* dev_cfg)
|
||||
{
|
||||
auto name = get_filename_without_ext(file);
|
||||
auto name = get_filename_without_ext(app);
|
||||
|
||||
auto json_name = name + _X(".runtimeconfig.json");
|
||||
auto dev_json_name = name + _X(".runtimeconfig.dev.json");
|
||||
|
||||
auto json_path = get_directory(file);
|
||||
auto json_path = get_directory(app);
|
||||
auto dev_json_path = json_path;
|
||||
|
||||
append_path(&json_path, json_name.c_str());
|
||||
append_path(&dev_json_path, dev_json_name.c_str());
|
||||
|
||||
trace::verbose(_X("Runtime config is cfg=%s dev=%s"), json_path.c_str(), dev_json_path.c_str());
|
||||
|
||||
dev_cfg->assign(dev_json_path);
|
||||
cfg -> assign(json_path);
|
||||
}
|
||||
|
||||
void get_runtime_config_paths_from_arg(const pal::string_t& arg, pal::string_t* cfg, pal::string_t* dev_cfg)
|
||||
{
|
||||
auto name = get_filename_without_ext(arg);
|
||||
|
||||
auto json_name = name + _X(".json");
|
||||
auto dev_json_name = name + _X(".dev.json");
|
||||
|
||||
auto json_path = get_directory(arg);
|
||||
auto dev_json_path = json_path;
|
||||
|
||||
append_path(&json_path, json_name.c_str());
|
||||
|
|
|
@ -80,7 +80,9 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
void get_runtime_config_paths_from_file(const pal::string_t& file, pal::string_t* config_file, pal::string_t* dev_config_file);
|
||||
void get_runtime_config_paths_from_app(const pal::string_t& file, pal::string_t* config_file, pal::string_t* dev_config_file);
|
||||
void get_runtime_config_paths_from_arg(const pal::string_t& file, pal::string_t* config_file, pal::string_t* dev_config_file);
|
||||
|
||||
host_mode_t detect_operating_mode(const int argc, const pal::char_t* argv[], pal::string_t* own_dir = nullptr);
|
||||
|
||||
void try_patch_roll_forward_in_dir(const pal::string_t& cur_dir, const fx_ver_t& start_ver, pal::string_t* max_str);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue