Merge pull request #2409 from schellap/rcfg

Add runtimeconfig to corehost as well
This commit is contained in:
Senthil 2016-04-11 15:21:04 -07:00
commit 49db7b246b
3 changed files with 15 additions and 6 deletions

View file

@ -19,7 +19,7 @@ arguments_t::arguments_t() :
}
bool parse_arguments(const pal::string_t& deps_path, const std::vector<pal::string_t>& probe_paths, host_mode_t mode,
const int argc, const pal::char_t* argv[], arguments_t* arg_out)
const int argc, const pal::char_t* argv[], pal::string_t* runtime_config, arguments_t* arg_out)
{
arguments_t& args = *arg_out;
// Get the full name of the application
@ -68,7 +68,7 @@ bool parse_arguments(const pal::string_t& deps_path, const std::vector<pal::stri
}
std::unordered_map<pal::string_t, std::vector<pal::string_t>> opts;
std::vector<pal::string_t> known_opts = { _X("--depsfile"), _X("--additionalprobingpath") };
std::vector<pal::string_t> known_opts = { _X("--depsfile"), _X("--additionalprobingpath"), _X("--runtimeconfig") };
int num_args = 0;
if (!parse_known_args(args.app_argc, args.app_argv, known_opts, &opts, &num_args))
{
@ -79,7 +79,9 @@ bool parse_arguments(const pal::string_t& deps_path, const std::vector<pal::stri
args.app_argv += num_args;
pal::string_t opts_deps_file = _X("--depsfile");
pal::string_t opts_probe_path = _X("--additionalprobingpath");
pal::string_t opts_runtime_config = _X("--runtimeconfig");
pal::string_t deps_file = get_last_known_arg(opts, opts_deps_file, deps_path);
*runtime_config = get_last_known_arg(opts, opts_runtime_config, _X(""));
if (opts.count(opts_probe_path))
{
for (const auto& str : opts[opts_probe_path])

View file

@ -115,6 +115,6 @@ struct arguments_t
}
};
bool parse_arguments(const pal::string_t& deps_path, const std::vector<pal::string_t>& probe_paths, host_mode_t mode, const int argc, const pal::char_t* argv[], arguments_t* args);
bool parse_arguments(const pal::string_t& deps_path, const std::vector<pal::string_t>& probe_paths, host_mode_t mode, const int argc, const pal::char_t* argv[], pal::string_t* runtime_config, arguments_t* args);
#endif // ARGS_H

View file

@ -231,7 +231,8 @@ SHARED_API int corehost_main(const int argc, const pal::char_t* argv[])
// Take care of arguments
arguments_t args;
if (!parse_arguments(g_init->deps_file(), g_init->probe_paths(), g_init->host_mode(), argc, argv, &args))
pal::string_t runtime_config;
if (!parse_arguments(g_init->deps_file(), g_init->probe_paths(), g_init->host_mode(), argc, argv, &runtime_config, &args))
{
return StatusCode::LibHostInvalidArgs;
}
@ -247,8 +248,14 @@ SHARED_API int corehost_main(const int argc, const pal::char_t* argv[])
else
{
pal::string_t config_file, dev_config_file;
get_runtime_config_paths_from_app(args.managed_application, &config_file, &dev_config_file);
if (runtime_config.empty())
{
get_runtime_config_paths_from_app(args.managed_application, &config_file, &dev_config_file);
}
else
{
get_runtime_config_paths_from_arg(runtime_config, &config_file, &dev_config_file);
}
runtime_config_t config(config_file, dev_config_file);
if (!config.is_valid())