Merge pull request #2360 from schellap/rollfwd
Roll forward for FX and additional paths
This commit is contained in:
commit
95bcf436fa
4 changed files with 35 additions and 26 deletions
|
@ -55,34 +55,34 @@ struct probe_config_t
|
|||
assert(!match_hash || probe_deps_json == nullptr);
|
||||
}
|
||||
|
||||
static probe_config_t svc_ni(const pal::string_t dir, bool patch_roll_fwd, bool prerelease_roll_fwd)
|
||||
static probe_config_t svc_ni(const pal::string_t& dir, bool patch_roll_fwd, bool prerelease_roll_fwd)
|
||||
{
|
||||
return probe_config_t(dir, false, patch_roll_fwd, prerelease_roll_fwd, nullptr, true, true);
|
||||
}
|
||||
|
||||
static probe_config_t svc(const pal::string_t dir, bool patch_roll_fwd, bool prerelease_roll_fwd)
|
||||
static probe_config_t svc(const pal::string_t& dir, bool patch_roll_fwd, bool prerelease_roll_fwd)
|
||||
{
|
||||
return probe_config_t(dir, false, patch_roll_fwd, prerelease_roll_fwd, nullptr, true, false);
|
||||
}
|
||||
|
||||
static probe_config_t cache_ni(const pal::string_t dir)
|
||||
static probe_config_t cache_ni(const pal::string_t& dir)
|
||||
{
|
||||
return probe_config_t(dir, true, false, false, nullptr, false, true);
|
||||
}
|
||||
|
||||
static probe_config_t cache(const pal::string_t dir)
|
||||
static probe_config_t cache(const pal::string_t& dir)
|
||||
{
|
||||
return probe_config_t(dir, true, false, false, nullptr, false, false);
|
||||
}
|
||||
|
||||
static probe_config_t fx(const pal::string_t dir, const deps_json_t* deps)
|
||||
static probe_config_t fx(const pal::string_t& dir, const deps_json_t* deps)
|
||||
{
|
||||
return probe_config_t(dir, false, false, false, deps, false, false);
|
||||
}
|
||||
|
||||
static probe_config_t additional(const pal::string_t dir, bool patch_roll_fwd, bool prerelease_roll_fwd)
|
||||
static probe_config_t additional(const pal::string_t& dir)
|
||||
{
|
||||
return probe_config_t(dir, false, patch_roll_fwd, prerelease_roll_fwd, nullptr, false, false);
|
||||
return probe_config_t(dir, false, false, false, nullptr, false, false);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -225,9 +225,7 @@ void deps_resolver_t::setup_probe_config(
|
|||
for (const auto& probe : m_additional_probes)
|
||||
{
|
||||
// Additional paths
|
||||
bool patch_roll_fwd = config.get_patch_roll_fwd();
|
||||
bool prerelease_roll_fwd = config.get_prerelease_roll_fwd();
|
||||
m_probes.push_back(probe_config_t::additional(probe, patch_roll_fwd, prerelease_roll_fwd));
|
||||
m_probes.push_back(probe_config_t::additional(probe));
|
||||
}
|
||||
|
||||
if (trace::is_enabled())
|
||||
|
|
|
@ -32,9 +32,21 @@ pal::string_t fx_muxer_t::resolve_fx_dir(const pal::string_t& muxer_dir, runtime
|
|||
append_path(&fx_dir, _X("shared"));
|
||||
append_path(&fx_dir, fx_name.c_str());
|
||||
|
||||
// If production and no roll forward use given version.
|
||||
// For prerelease, we will always roll forward.
|
||||
if (!specified.is_prerelease() && !patch_roll_fwd)
|
||||
bool do_roll_forward = false;
|
||||
if (!specified.is_prerelease())
|
||||
{
|
||||
// If production and no roll forward use given version.
|
||||
do_roll_forward = patch_roll_fwd;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Prerelease, but roll forward only if version doesn't exist.
|
||||
pal::string_t ver_dir = fx_dir;
|
||||
append_path(&ver_dir, fx_ver.c_str());
|
||||
do_roll_forward = !pal::directory_exists(ver_dir);
|
||||
}
|
||||
|
||||
if (!do_roll_forward)
|
||||
{
|
||||
trace::verbose(_X("Did not roll forward because patch_roll_fwd=%d, chose [%s]"), patch_roll_fwd, fx_ver.c_str());
|
||||
append_path(&fx_dir, fx_ver.c_str());
|
||||
|
@ -45,28 +57,30 @@ pal::string_t fx_muxer_t::resolve_fx_dir(const pal::string_t& muxer_dir, runtime
|
|||
|
||||
std::vector<pal::string_t> list;
|
||||
pal::readdir(fx_dir, &list);
|
||||
fx_ver_t max_specified = specified;
|
||||
fx_ver_t most_compatible = specified;
|
||||
for (const auto& version : list)
|
||||
{
|
||||
trace::verbose(_X("Inspecting version... [%s]"), version.c_str());
|
||||
fx_ver_t ver(-1, -1, -1);
|
||||
if (!specified.is_prerelease() && fx_ver_t::parse(version, &ver, true) && // true -- only prod. prevents roll forward to prerelease.
|
||||
ver.get_major() == max_specified.get_major() &&
|
||||
ver.get_minor() == max_specified.get_minor())
|
||||
ver.get_major() == specified.get_major() &&
|
||||
ver.get_minor() == specified.get_minor())
|
||||
{
|
||||
max_specified = std::max(ver, max_specified);
|
||||
// Pick the greatest production that differs only in patch.
|
||||
most_compatible = std::max(ver, most_compatible);
|
||||
}
|
||||
if (specified.is_prerelease() && fx_ver_t::parse(version, &ver, false) && // false -- implies both production and prerelease.
|
||||
ver.is_prerelease() && // prevent roll forward to production.
|
||||
ver.get_major() == max_specified.get_major() &&
|
||||
ver.get_minor() == max_specified.get_minor() &&
|
||||
ver.get_patch() == max_specified.get_patch())
|
||||
ver.get_major() == specified.get_major() &&
|
||||
ver.get_minor() == specified.get_minor() &&
|
||||
ver > specified)
|
||||
{
|
||||
max_specified = std::max(ver, max_specified);
|
||||
// Pick the smallest prerelease that is greater than specified.
|
||||
most_compatible = (most_compatible == specified) ? ver : std::min(ver, most_compatible);
|
||||
}
|
||||
}
|
||||
pal::string_t max_specified_str = max_specified.as_str();
|
||||
append_path(&fx_dir, max_specified_str.c_str());
|
||||
pal::string_t most_compatible_str = most_compatible.as_str();
|
||||
append_path(&fx_dir, most_compatible_str.c_str());
|
||||
}
|
||||
|
||||
trace::verbose(_X("Chose FX version [%s]"), fx_dir.c_str());
|
||||
|
|
|
@ -96,9 +96,6 @@ bool runtime_config_t::ensure_dev_config_parsed()
|
|||
return true;
|
||||
}
|
||||
|
||||
// Set dev mode default values, if the file exists.
|
||||
m_patch_roll_fwd = false;
|
||||
|
||||
pal::ifstream_t file(m_dev_path);
|
||||
if (!file.good())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue