From 72000ac691fa61e63029b3c100e2fe5adad334ab Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Sat, 21 Nov 2020 00:39:41 -0500 Subject: [PATCH] renamed conf::paths() to conf::path() conf_version --- src/cmd/build.cpp | 2 +- src/cmd/release.cpp | 12 ++-- src/core/conf.cpp | 118 ++++++++++++++++++------------------- src/core/conf.h | 27 +++++---- src/core/context.cpp | 2 +- src/core/op.cpp | 6 +- src/tasks/boost.cpp | 10 ++-- src/tasks/boost_di.cpp | 2 +- src/tasks/bzip2.cpp | 4 +- src/tasks/explorerpp.cpp | 6 +- src/tasks/fmt.cpp | 4 +- src/tasks/gtest.cpp | 4 +- src/tasks/installer.cpp | 2 +- src/tasks/libbsarch.cpp | 6 +- src/tasks/libffi.cpp | 2 +- src/tasks/libloot.cpp | 10 ++-- src/tasks/licenses.cpp | 4 +- src/tasks/lz4.cpp | 12 ++-- src/tasks/modorganizer.cpp | 6 +- src/tasks/ncc.cpp | 4 +- src/tasks/nmm.cpp | 4 +- src/tasks/openssl.cpp | 8 +-- src/tasks/pyqt.cpp | 16 ++--- src/tasks/python.cpp | 16 ++--- src/tasks/sevenz.cpp | 6 +- src/tasks/sip.cpp | 8 +-- src/tasks/spdlog.cpp | 4 +- src/tasks/stylesheets.cpp | 16 ++--- src/tasks/translations.cpp | 6 +- src/tasks/usvfs.cpp | 24 ++++---- src/tasks/zlib.cpp | 4 +- src/tools/downloader.cpp | 2 +- src/tools/git.cpp | 2 +- src/tools/patcher.cpp | 2 +- src/tools/tools.cpp | 20 +++---- 35 files changed, 193 insertions(+), 188 deletions(-) diff --git a/src/cmd/build.cpp b/src/cmd/build.cpp index 2d2e25e..bcda3f1 100644 --- a/src/cmd/build.cpp +++ b/src/cmd/build.cpp @@ -175,7 +175,7 @@ int build_command::do_run() void build_command::create_prefix_ini() { - const auto prefix = conf().paths().prefix(); + const auto prefix = conf().path().prefix(); // creating prefix if (!exists(prefix)) diff --git a/src/cmd/release.cpp b/src/cmd/release.cpp index b7f7b6d..b3903c3 100644 --- a/src/cmd/release.cpp +++ b/src/cmd/release.cpp @@ -32,7 +32,7 @@ void release_command::make_bin() u8cout << "making binary archive " << path_to_utf8(out) << "\n"; op::archive_from_glob(gcx(), - conf().paths().install_bin() / "*", out, {"__pycache__"}); + conf().path().install_bin() / "*", out, {"__pycache__"}); } void release_command::make_pdbs() @@ -41,7 +41,7 @@ void release_command::make_pdbs() u8cout << "making pdbs archive " << path_to_utf8(out) << "\n"; op::archive_from_glob(gcx(), - conf().paths().install_pdbs() / "*", out, {"__pycache__"}); + conf().path().install_pdbs() / "*", out, {"__pycache__"}); } void release_command::make_src() @@ -101,7 +101,7 @@ void release_command::make_src() void release_command::make_installer() { const auto file = "Mod.Organizer-" + version_ + ".exe"; - const auto src = conf().paths().install_installer() / file; + const auto src = conf().path().install_installer() / file; const auto dest = out_; u8cout << "copying installer " << file << "\n"; @@ -354,7 +354,7 @@ void release_command::check_repos_for_branch() bool release_command::check_clean_prefix() { - const auto prefix = conf().paths().prefix(); + const auto prefix = conf().path().prefix(); if (!fs::exists(prefix)) return true; @@ -399,7 +399,7 @@ void release_command::prepare() } // finding output path - const auto prefix = conf().paths().prefix(); + const auto prefix = conf().path().prefix(); out_ = fs::path(utf8_to_utf16(utf8out_)); if (out_.empty()) @@ -436,7 +436,7 @@ std::string release_command::do_doc() std::string release_command::version_from_exe() const { - const auto exe = conf().paths().install_bin() / "ModOrganizer.exe"; + const auto exe = conf().path().install_bin() / "ModOrganizer.exe"; // getting version info size DWORD dummy = 0; diff --git a/src/core/conf.cpp b/src/core/conf.cpp index 5b9ebf7..09c659c 100644 --- a/src/core/conf.cpp +++ b/src/core/conf.cpp @@ -28,27 +28,6 @@ bool bool_from_string(std::string_view s) } -conf_global::conf_global() - : conf_section("global") -{ -} - -conf_transifex::conf_transifex() - : conf_section("transifex") -{ -} - -conf_prebuilt::conf_prebuilt() - : conf_section("prebuilt") -{ -} - -conf_paths::conf_paths() - : conf_section("paths") -{ -} - - conf_global conf::global() { return {}; @@ -64,7 +43,12 @@ conf_prebuilt conf::prebuilt() return {}; } -conf_paths conf::paths() +conf_versions conf::version() +{ + return {}; +} + +conf_paths conf::path() { return {}; } @@ -208,16 +192,6 @@ void conf::set_for_task( map_[std::string(task_name)][std::string(section)][std::string(key)] = value; } -fs::path conf::path_by_name(std::string_view name) -{ - return get_global("paths", name); -} - -std::string conf::version_by_name(std::string_view name) -{ - return get_global("versions", name); -} - fs::path conf::tool_by_name(std::string_view name) { return get_global("tools", name); @@ -495,7 +469,7 @@ bool try_qt_location(fs::path& check) fs::path find_qt() { - fs::path p = conf().paths().qt_install(); + fs::path p = conf().path().qt_install(); if (!p.empty()) { @@ -510,7 +484,7 @@ fs::path find_qt() std::vector locations = { - conf().paths().pf_x64(), + conf().path().pf_x64(), "C:\\", "D:\\" }; @@ -872,7 +846,7 @@ void make_canonical_path( std::string_view key, const fs::path& default_parent, std::string_view default_dir) { - fs::path p = conf().paths().get(key); + fs::path p = conf().path().get(key); if (p.empty()) { @@ -1065,7 +1039,7 @@ fs::path find_iscc() { const fs::path inno = fmt::format("inno setup {}", v); - for (fs::path pf : {conf().paths().pf_x86(), conf().paths().pf_x64()}) + for (fs::path pf : {conf().path().pf_x86(), conf().path().pf_x64()}) { p = pf / inno / iscc; if (fs::exists(p)) @@ -1087,10 +1061,10 @@ void init_options( for (auto&& ini : inis) { // Check if the prefix is set by this ini file: - fs::path cprefix = add ? fs::path{} : conf().paths().prefix(); + fs::path cprefix = add ? fs::path{} : conf().path().prefix(); parse_ini(ini, add); - if (conf().paths().prefix() != cprefix) + if (conf().path().prefix() != cprefix) ini_prefix = ini; add = false; @@ -1141,7 +1115,7 @@ void init_options( auto log_file = conf().global().log_file(); if (log_file.is_relative()) - log_file = conf().paths().prefix() / log_file; + log_file = conf().path().prefix() / log_file; context::set_log_file(log_file); @@ -1154,7 +1128,7 @@ void init_options( gcx().debug(context::conf, " . {}", ini); set_path_if_empty("third_party", find_third_party_directory); - this_env::prepend_to_path(conf().paths().third_party() / "bin"); + this_env::prepend_to_path(conf().path().third_party() / "bin"); set_path_if_empty("pf_x86", find_program_files_x86); set_path_if_empty("pf_x64", find_program_files_x64); @@ -1168,41 +1142,41 @@ void init_options( find_vcvars(); validate_qt(); - this_env::append_to_path(conf().paths().get("qt_bin")); + this_env::append_to_path(conf().path().get("qt_bin")); - if (!conf().paths().prefix().empty()) + if (!conf().path().prefix().empty()) make_canonical_path("prefix", ini_prefix.empty() ? fs::current_path() : ini_prefix.parent_path(), ""); - make_canonical_path("cache", conf().paths().prefix(), "downloads"); - make_canonical_path("build", conf().paths().prefix(), "build"); - make_canonical_path("install", conf().paths().prefix(), "install"); - make_canonical_path("install_installer", conf().paths().install(), "installer"); - make_canonical_path("install_bin", conf().paths().install(), "bin"); - make_canonical_path("install_libs", conf().paths().install(), "libs"); - make_canonical_path("install_pdbs", conf().paths().install(), "pdb"); - make_canonical_path("install_dlls", conf().paths().install_bin(), "dlls"); - make_canonical_path("install_loot", conf().paths().install_bin(), "loot"); - make_canonical_path("install_plugins", conf().paths().install_bin(), "plugins"); - make_canonical_path("install_licenses", conf().paths().install_bin(), "licenses"); + make_canonical_path("cache", conf().path().prefix(), "downloads"); + make_canonical_path("build", conf().path().prefix(), "build"); + make_canonical_path("install", conf().path().prefix(), "install"); + make_canonical_path("install_installer", conf().path().install(), "installer"); + make_canonical_path("install_bin", conf().path().install(), "bin"); + make_canonical_path("install_libs", conf().path().install(), "libs"); + make_canonical_path("install_pdbs", conf().path().install(), "pdb"); + make_canonical_path("install_dlls", conf().path().install_bin(), "dlls"); + make_canonical_path("install_loot", conf().path().install_bin(), "loot"); + make_canonical_path("install_plugins", conf().path().install_bin(), "plugins"); + make_canonical_path("install_licenses", conf().path().install_bin(), "licenses"); make_canonical_path( "install_pythoncore", - conf().paths().install_dlls(), "pythoncore"); + conf().path().install_dlls(), "pythoncore"); make_canonical_path( "install_stylesheets", - conf().paths().install_bin(), "stylesheets"); + conf().path().install_bin(), "stylesheets"); make_canonical_path( "install_translations", - conf().paths().install_bin(), "resources/translations"); + conf().path().install_bin(), "resources/translations"); conf::set_global("tools", "iscc", path_to_utf8(find_iscc())); } bool verify_options() { - if (conf().paths().prefix().empty()) + if (conf().path().prefix().empty()) { u8cerr << "missing prefix; either specify it the [paths] section of " @@ -1212,9 +1186,9 @@ bool verify_options() } // will be created later if it doesn't exist - if (fs::exists(conf().paths().prefix())) + if (fs::exists(conf().path().prefix())) { - if (fs::equivalent(conf().paths().prefix(), mob_exe_path().parent_path())) + if (fs::equivalent(conf().path().prefix(), mob_exe_path().parent_path())) { u8cerr << "the prefix cannot be where mob.exe is, there's already a " @@ -1242,7 +1216,7 @@ void dump_available_options() fs::path make_temp_file() { - static fs::path dir = conf().paths().temp_dir(); + static fs::path dir = conf().path().temp_dir(); wchar_t name[MAX_PATH + 1] = {}; if (GetTempFileNameW(dir.native().c_str(), L"mob", 0, name) == 0) @@ -1257,6 +1231,10 @@ fs::path make_temp_file() } +conf_global::conf_global() + : conf_section("global") +{ +} void conf_global::set_output_log_level(const std::string& s) { @@ -1312,4 +1290,24 @@ void conf_global::set_dry(std::string_view s) g_dry = bool_from_string(s); } +conf_transifex::conf_transifex() + : conf_section("transifex") +{ +} + +conf_versions::conf_versions() + : conf_section("versions") +{ +} + +conf_prebuilt::conf_prebuilt() + : conf_section("prebuilt") +{ +} + +conf_paths::conf_paths() + : conf_section("paths") +{ +} + } // namespace diff --git a/src/core/conf.h b/src/core/conf.h index 1638c84..a33f30c 100644 --- a/src/core/conf.h +++ b/src/core/conf.h @@ -7,6 +7,7 @@ class conf_section; class conf_global; class conf_prebuilt; class conf_transifex; +class conf_versions; class conf_paths; class conf @@ -16,13 +17,15 @@ class conf friend class conf_global; friend class conf_prebuilt; friend class conf_transifex; + friend class conf_versions; friend class conf_paths; public: conf_global global(); conf_transifex transifex(); conf_prebuilt prebuilt(); - conf_paths paths(); + conf_versions version(); + conf_paths path(); // this just forwards to conf_global, but it's used everywhere // @@ -34,15 +37,8 @@ public: static bool bool_task_option_by_name( const std::vector& task_names, std::string_view name); - static std::string version_by_name(std::string_view name); static fs::path tool_by_name(std::string_view name); - static bool ignore_uncommitted() - { - return bool_global_by_name("ignore_uncommitted"); - } - - static std::vector format_options(); // only in conf.cpp static std::string get_global( @@ -66,6 +62,8 @@ public: std::string_view task_name, std::string_view section, std::string_view key, std::string_view value); + static std::vector format_options(); + private: using key_value_map = std::map>; @@ -80,8 +78,6 @@ private: // temp - static fs::path path_by_name(std::string_view name); - static std::string get_for_task( const std::vector& task_names, std::string_view section, std::string_view key); @@ -171,6 +167,11 @@ public: bool clean() const { return get("clean_task"); } bool fetch() const { return get("fetch_task"); } bool build() const { return get("build_task"); } + + bool ignore_uncommitted() const + { + return get("ignore_uncommitted"); + } }; class conf_transifex : public conf_section @@ -179,6 +180,12 @@ public: conf_transifex(); }; +class conf_versions : public conf_section +{ +public: + conf_versions(); +}; + class conf_prebuilt : public conf_section { public: diff --git a/src/core/context.cpp b/src/core/context.cpp index 0a756f3..888984d 100644 --- a/src/core/context.cpp +++ b/src/core/context.cpp @@ -231,7 +231,7 @@ void context::set_log_file(const fs::path& p) { // creating directory if (!exists(p.parent_path())) - op::create_directories(gcx(), mob::conf().paths().prefix()); + op::create_directories(gcx(), mob::conf().path().prefix()); HANDLE h = CreateFileW( p.native().c_str(), GENERIC_WRITE, FILE_SHARE_READ, diff --git a/src/core/op.cpp b/src/core/op.cpp index b76bc4a..6f6da9d 100644 --- a/src/core/op.cpp +++ b/src/core/op.cpp @@ -685,13 +685,13 @@ void check(const context& cx, const fs::path& p, flags f) return true; }; - if (is_inside(p, conf().paths().prefix())) + if (is_inside(p, conf().path().prefix())) return; - if (is_inside(p, conf().paths().temp_dir())) + if (is_inside(p, conf().path().temp_dir())) return; - if (is_inside(p, conf().paths().licenses())) + if (is_inside(p, conf().path().licenses())) return; cx.bail_out(context::fs, "path {} is outside prefix", p); diff --git a/src/tasks/boost.cpp b/src/tasks/boost.cpp index 361d1ae..4b6140a 100644 --- a/src/tasks/boost.cpp +++ b/src/tasks/boost.cpp @@ -12,12 +12,12 @@ boost::boost() std::string boost::version() { - return conf::version_by_name("boost"); + return conf().version().get("boost"); } std::string boost::version_vs() { - return conf::version_by_name("boost_vs"); + return conf().version().get("boost_vs"); } bool boost::prebuilt() @@ -28,7 +28,7 @@ bool boost::prebuilt() fs::path boost::source_path() { return - conf().paths().build() / + conf().path().build() / ("boost_" + boost_version_no_tags_underscores()); } @@ -127,7 +127,7 @@ void boost::build_and_install_prebuilt() { op::copy_file_to_dir_if_better(cx(), lib_path(arch::x64) / python_dll(), - conf().paths().install_dlls()); + conf().path().install_dlls()); }); } @@ -196,7 +196,7 @@ void boost::build_and_install_from_source() { op::copy_file_to_dir_if_better(cx(), lib_path(arch::x64) / python_dll(), - conf().paths().install_dlls()); + conf().path().install_dlls()); }); } diff --git a/src/tasks/boost_di.cpp b/src/tasks/boost_di.cpp index 41b6888..104ee39 100644 --- a/src/tasks/boost_di.cpp +++ b/src/tasks/boost_di.cpp @@ -21,7 +21,7 @@ bool boost_di::prebuilt() fs::path boost_di::source_path() { - return conf().paths().build() / "di"; + return conf().path().build() / "di"; } void boost_di::do_clean(clean c) diff --git a/src/tasks/bzip2.cpp b/src/tasks/bzip2.cpp index c11f3ae..ed4a314 100644 --- a/src/tasks/bzip2.cpp +++ b/src/tasks/bzip2.cpp @@ -11,7 +11,7 @@ bzip2::bzip2() std::string bzip2::version() { - return conf::version_by_name("bzip2"); + return conf().version().get("bzip2"); } bool bzip2::prebuilt() @@ -21,7 +21,7 @@ bool bzip2::prebuilt() fs::path bzip2::source_path() { - return conf().paths().build() / ("bzip2-" + version()); + return conf().path().build() / ("bzip2-" + version()); } void bzip2::do_clean(clean c) diff --git a/src/tasks/explorerpp.cpp b/src/tasks/explorerpp.cpp index 3bc69d1..37999e5 100644 --- a/src/tasks/explorerpp.cpp +++ b/src/tasks/explorerpp.cpp @@ -11,7 +11,7 @@ explorerpp::explorerpp() std::string explorerpp::version() { - return conf::version_by_name("explorerpp"); + return conf().version().get("explorerpp"); } bool explorerpp::prebuilt() @@ -21,7 +21,7 @@ bool explorerpp::prebuilt() fs::path explorerpp::source_path() { - return conf().paths().build() / "explorer++"; + return conf().path().build() / "explorer++"; } void explorerpp::do_clean(clean c) @@ -58,7 +58,7 @@ void explorerpp::do_fetch() { op::copy_glob_to_dir_if_better(cx(), source_path() / "*", - conf().paths().install_bin() / "explorer++", + conf().path().install_bin() / "explorer++", op::copy_files); }); } diff --git a/src/tasks/fmt.cpp b/src/tasks/fmt.cpp index 03ef074..55697b0 100644 --- a/src/tasks/fmt.cpp +++ b/src/tasks/fmt.cpp @@ -11,7 +11,7 @@ fmt::fmt() std::string fmt::version() { - return conf::version_by_name("fmt"); + return conf().version().get("fmt"); } bool fmt::prebuilt() @@ -21,7 +21,7 @@ bool fmt::prebuilt() fs::path fmt::source_path() { - return conf().paths().build() / ("fmt-" + version()); + return conf().path().build() / ("fmt-" + version()); } fs::path fmt::solution_path() diff --git a/src/tasks/gtest.cpp b/src/tasks/gtest.cpp index 67de196..86a1566 100644 --- a/src/tasks/gtest.cpp +++ b/src/tasks/gtest.cpp @@ -11,7 +11,7 @@ gtest::gtest() std::string gtest::version() { - return conf::version_by_name("gtest"); + return conf().version().get("gtest"); } bool gtest::prebuilt() @@ -21,7 +21,7 @@ bool gtest::prebuilt() fs::path gtest::source_path() { - return conf().paths().build() / "googletest"; + return conf().path().build() / "googletest"; } void gtest::do_clean(clean c) diff --git a/src/tasks/installer.cpp b/src/tasks/installer.cpp index f9e42d5..53b0aea 100644 --- a/src/tasks/installer.cpp +++ b/src/tasks/installer.cpp @@ -32,7 +32,7 @@ void installer::do_clean(clean c) git::delete_directory(cx(), source_path()); if (is_set(c, clean::rebuild)) - op::delete_directory(cx(), conf().paths().install_installer()); + op::delete_directory(cx(), conf().path().install_installer()); }); } diff --git a/src/tasks/libbsarch.cpp b/src/tasks/libbsarch.cpp index e78ad83..b93a8ae 100644 --- a/src/tasks/libbsarch.cpp +++ b/src/tasks/libbsarch.cpp @@ -11,7 +11,7 @@ libbsarch::libbsarch() std::string libbsarch::version() { - return conf::version_by_name("libbsarch"); + return conf().version().get("libbsarch"); } bool libbsarch::prebuilt() @@ -21,7 +21,7 @@ bool libbsarch::prebuilt() fs::path libbsarch::source_path() { - return conf().paths().build() / dir_name(); + return conf().path().build() / dir_name(); } void libbsarch::do_clean(clean c) @@ -61,7 +61,7 @@ void libbsarch::do_build_and_install() { op::copy_file_to_dir_if_better(cx(), source_path() / "libbsarch.dll", - conf().paths().install_dlls()); + conf().path().install_dlls()); }); } diff --git a/src/tasks/libffi.cpp b/src/tasks/libffi.cpp index cc1aa07..526d9aa 100644 --- a/src/tasks/libffi.cpp +++ b/src/tasks/libffi.cpp @@ -21,7 +21,7 @@ bool libffi::prebuilt() fs::path libffi::source_path() { - return conf().paths().build() / "libffi"; + return conf().path().build() / "libffi"; } void libffi::do_clean(clean c) diff --git a/src/tasks/libloot.cpp b/src/tasks/libloot.cpp index e2f5819..08bac91 100644 --- a/src/tasks/libloot.cpp +++ b/src/tasks/libloot.cpp @@ -11,17 +11,17 @@ libloot::libloot() std::string libloot::version() { - return conf::version_by_name("libloot"); + return conf().version().get("libloot"); } std::string libloot::hash() { - return conf::version_by_name("libloot_hash"); + return conf().version().get("libloot_hash"); } std::string libloot::branch() { - return conf::version_by_name("libloot_branch"); + return conf().version().get("libloot_branch"); } bool libloot::prebuilt() @@ -31,7 +31,7 @@ bool libloot::prebuilt() fs::path libloot::source_path() { - return conf().paths().build() / release_name(); + return conf().path().build() / release_name(); } void libloot::do_clean(clean c) @@ -71,7 +71,7 @@ void libloot::do_build_and_install() { op::copy_file_to_dir_if_better(cx(), source_path() / "loot.dll", - conf().paths().install_loot()); + conf().path().install_loot()); }); } diff --git a/src/tasks/licenses.cpp b/src/tasks/licenses.cpp index 58c328d..b3d3fcd 100644 --- a/src/tasks/licenses.cpp +++ b/src/tasks/licenses.cpp @@ -29,8 +29,8 @@ void licenses::do_build_and_install() instrument([&] { op::copy_glob_to_dir_if_better(cx(), - conf().paths().licenses() / "*", - conf().paths().install_licenses(), + conf().path().licenses() / "*", + conf().path().install_licenses(), op::copy_files|op::copy_dirs); }); } diff --git a/src/tasks/lz4.cpp b/src/tasks/lz4.cpp index 6a46d1e..f2293ee 100644 --- a/src/tasks/lz4.cpp +++ b/src/tasks/lz4.cpp @@ -11,7 +11,7 @@ lz4::lz4() std::string lz4::version() { - return conf::version_by_name("lz4"); + return conf().version().get("lz4"); } bool lz4::prebuilt() @@ -21,7 +21,7 @@ bool lz4::prebuilt() fs::path lz4::source_path() { - return conf().paths().build() / ("lz4-" + version()); + return conf().path().build() / ("lz4-" + version()); } void lz4::do_clean(clean c) @@ -93,11 +93,11 @@ void lz4::build_and_install_prebuilt() { op::copy_file_to_dir_if_better(cx(), source_path() / "bin" / "liblz4.pdb", - conf().paths().install_pdbs()); + conf().path().install_pdbs()); op::copy_file_to_dir_if_better(cx(), source_path() / "bin" / "liblz4.dll", - conf().paths().install_dlls()); + conf().path().install_dlls()); }); } @@ -131,11 +131,11 @@ void lz4::build_and_install_from_source() op::copy_file_to_dir_if_better(cx(), out_dir() / "liblz4.dll", - conf().paths().install_dlls()); + conf().path().install_dlls()); op::copy_file_to_dir_if_better(cx(), out_dir() / "liblz4.pdb", - conf().paths().install_pdbs()); + conf().path().install_pdbs()); }); } diff --git a/src/tasks/modorganizer.cpp b/src/tasks/modorganizer.cpp index 71f6cbe..7b02466 100644 --- a/src/tasks/modorganizer.cpp +++ b/src/tasks/modorganizer.cpp @@ -77,7 +77,7 @@ fs::path modorganizer::this_solution_path() const fs::path modorganizer::super_path() { - return conf().paths().build() / "modorganizer_super"; + return conf().path().build() / "modorganizer_super"; } url modorganizer::git_url() const @@ -175,8 +175,8 @@ cmake modorganizer::create_cmake_tool(const fs::path& root, cmake::ops o) { return std::move(cmake(o) .generator(cmake::vs) - .def("CMAKE_INSTALL_PREFIX:PATH", conf().paths().install()) - .def("DEPENDENCIES_DIR", conf().paths().build()) + .def("CMAKE_INSTALL_PREFIX:PATH", conf().path().install()) + .def("DEPENDENCIES_DIR", conf().path().build()) .def("BOOST_ROOT", boost::source_path()) .def("BOOST_LIBRARYDIR", boost::lib_path(arch::x64)) .def("FMT_ROOT", fmt::source_path()) diff --git a/src/tasks/ncc.cpp b/src/tasks/ncc.cpp index 6ca48e1..1cde98f 100644 --- a/src/tasks/ncc.cpp +++ b/src/tasks/ncc.cpp @@ -22,7 +22,7 @@ bool ncc::prebuilt() fs::path ncc::source_path() { - return conf().paths().build() / "NexusClientCli"; + return conf().path().build() / "NexusClientCli"; } void ncc::do_clean(clean c) @@ -68,7 +68,7 @@ void ncc::do_build_and_install() run_tool(process_runner(process() .binary(publish) .stderr_level(context::level::trace) - .arg(conf().paths().install_bin()))); + .arg(conf().path().install_bin()))); }); } diff --git a/src/tasks/nmm.cpp b/src/tasks/nmm.cpp index 0320b37..cde80f6 100644 --- a/src/tasks/nmm.cpp +++ b/src/tasks/nmm.cpp @@ -11,7 +11,7 @@ nmm::nmm() std::string nmm::version() { - return conf::version_by_name("nmm"); + return conf().version().get("nmm"); } bool nmm::prebuilt() @@ -21,7 +21,7 @@ bool nmm::prebuilt() fs::path nmm::source_path() { - return conf().paths().build() / "Nexus-Mod-Manager"; + return conf().path().build() / "Nexus-Mod-Manager"; } void nmm::do_clean(clean c) diff --git a/src/tasks/openssl.cpp b/src/tasks/openssl.cpp index bab7c4a..bc30505 100644 --- a/src/tasks/openssl.cpp +++ b/src/tasks/openssl.cpp @@ -12,7 +12,7 @@ openssl::openssl() std::string openssl::version() { - return conf::version_by_name("openssl"); + return conf().version().get("openssl"); } bool openssl::prebuilt() @@ -22,7 +22,7 @@ bool openssl::prebuilt() fs::path openssl::source_path() { - return conf().paths().build() / ("openssl-" + version()); + return conf().path().build() / ("openssl-" + version()); } fs::path openssl::build_path() @@ -187,8 +187,8 @@ void openssl::install_engines() void openssl::copy_files() { - copy_dlls_to(conf().paths().install_bin()); - copy_pdbs_to(conf().paths().install_pdbs()); + copy_dlls_to(conf().path().install_bin()); + copy_pdbs_to(conf().path().install_pdbs()); } void openssl::copy_dlls_to(const fs::path& dir) diff --git a/src/tasks/pyqt.cpp b/src/tasks/pyqt.cpp index 55e8a90..b5383b1 100644 --- a/src/tasks/pyqt.cpp +++ b/src/tasks/pyqt.cpp @@ -12,12 +12,12 @@ pyqt::pyqt() std::string pyqt::version() { - return conf::version_by_name("pyqt"); + return conf().version().get("pyqt"); } std::string pyqt::builder_version() { - return conf::version_by_name("pyqt_builder"); + return conf().version().get("pyqt_builder"); } bool pyqt::prebuilt() @@ -27,7 +27,7 @@ bool pyqt::prebuilt() fs::path pyqt::source_path() { - return conf().paths().build() / ("PyQt5-" + version()); + return conf().path().build() / ("PyQt5-" + version()); } fs::path pyqt::build_path() @@ -62,7 +62,7 @@ void pyqt::do_clean(clean c) if (is_set(c, clean::rebuild)) { op::delete_file(cx(), - conf().paths().cache() / sip_install_file(), + conf().path().cache() / sip_install_file(), op::optional); } } @@ -160,7 +160,7 @@ void pyqt::sip_build() python::source_path(), python::scripts_path()}) .set("CL", " /MP") - .set("LIB", ";" + path_to_utf8(conf().paths().install_libs()), env::append) + .set("LIB", ";" + path_to_utf8(conf().path().install_libs()), env::append) .set("PYTHONHOME", path_to_utf8(python::source_path())); @@ -197,7 +197,7 @@ void pyqt::sip_build() .binary(sip::sip_module_exe()) .arg("--sdist") .arg("PyQt5.sip") - .cwd(conf().paths().cache()) + .cwd(conf().path().cache()) .env(pyqt_env))); } @@ -212,7 +212,7 @@ void pyqt::install_sip_file() else { run_tool(pip(pip::install) - .file(conf().paths().cache() / sip_install_file())); + .file(conf().path().cache() / sip_install_file())); installed_bypass.create(); } @@ -221,7 +221,7 @@ void pyqt::install_sip_file() void pyqt::copy_files() { const fs::path site_packages_pyqt = python::site_packages_path() / "PyQt5"; - const fs::path pyqt_plugin = conf().paths().install_plugins() / "data" / "PyQt5"; + const fs::path pyqt_plugin = conf().path().install_plugins() / "data" / "PyQt5"; op::copy_file_to_dir_if_better(cx(), site_packages_pyqt / "__init__.py", diff --git a/src/tasks/python.cpp b/src/tasks/python.cpp index 31290a6..1f4fc50 100644 --- a/src/tasks/python.cpp +++ b/src/tasks/python.cpp @@ -12,7 +12,7 @@ python::python() std::string python::version() { - return conf::version_by_name("python"); + return conf().version().get("python"); } bool python::prebuilt() @@ -55,7 +55,7 @@ std::string python::version_without_v() fs::path python::source_path() { - return conf().paths().build() / ("python-" + version_without_v()); + return conf().path().build() / ("python-" + version_without_v()); } fs::path python::build_path() @@ -205,30 +205,30 @@ void python::copy_files() { op::copy_glob_to_dir_if_better(cx(), build_path() / "*.lib", - conf().paths().install_libs(), + conf().path().install_libs(), op::copy_files); op::copy_glob_to_dir_if_better(cx(), build_path() / "libffi*.dll", - conf().paths().install_dlls(), + conf().path().install_dlls(), op::copy_files); op::copy_file_to_dir_if_better(cx(), build_path() / ("python" + version_for_dll() + ".dll"), - conf().paths().install_dlls()); + conf().path().install_dlls()); op::copy_file_to_dir_if_better(cx(), build_path() / ("python" + version_for_dll() + ".pdb"), - conf().paths().install_pdbs()); + conf().path().install_pdbs()); op::copy_glob_to_dir_if_better(cx(), build_path() / "pythoncore/*.pyd", - conf().paths().install_pythoncore(), + conf().path().install_pythoncore(), op::copy_files); op::copy_file_to_file_if_better(cx(), build_path() / "pythoncore" / ("python" + version_for_dll() + ".zip"), - conf().paths().install_dlls() / "pythoncore.zip", + conf().path().install_dlls() / "pythoncore.zip", op::copy_files); } diff --git a/src/tasks/sevenz.cpp b/src/tasks/sevenz.cpp index 38e5acd..83503ff 100644 --- a/src/tasks/sevenz.cpp +++ b/src/tasks/sevenz.cpp @@ -11,7 +11,7 @@ sevenz::sevenz() std::string sevenz::version() { - return conf::version_by_name("sevenz"); + return conf().version().get("sevenz"); } bool sevenz::prebuilt() @@ -21,7 +21,7 @@ bool sevenz::prebuilt() fs::path sevenz::source_path() { - return conf().paths().build() / ("7zip-" + version()); + return conf().path().build() / ("7zip-" + version()); } void sevenz::do_clean(clean c) @@ -72,7 +72,7 @@ void sevenz::do_build_and_install() { op::copy_file_to_dir_if_better(cx(), module_to_build() / "x64/7z.dll", - conf().paths().install_dlls()); + conf().path().install_dlls()); }); } diff --git a/src/tasks/sip.cpp b/src/tasks/sip.cpp index 28c0a5d..1520d33 100644 --- a/src/tasks/sip.cpp +++ b/src/tasks/sip.cpp @@ -12,12 +12,12 @@ sip::sip() std::string sip::version() { - return conf::version_by_name("sip"); + return conf().version().get("sip"); } std::string sip::version_for_pyqt() { - return conf::version_by_name("pyqt_sip"); + return conf().version().get("pyqt_sip"); } bool sip::prebuilt() @@ -27,7 +27,7 @@ bool sip::prebuilt() fs::path sip::source_path() { - return conf().paths().build() / ("sip-" + version()); + return conf().path().build() / ("sip-" + version()); } fs::path sip::sip_module_exe() @@ -173,7 +173,7 @@ void sip::generate() fs::path sip::download_file() { - return conf().paths().cache() / ("sip-" + version() + ".tar.gz"); + return conf().path().cache() / ("sip-" + version() + ".tar.gz"); } } // namespace diff --git a/src/tasks/spdlog.cpp b/src/tasks/spdlog.cpp index 50b2054..cc6a51e 100644 --- a/src/tasks/spdlog.cpp +++ b/src/tasks/spdlog.cpp @@ -11,7 +11,7 @@ spdlog::spdlog() std::string spdlog::version() { - return conf::version_by_name("spdlog"); + return conf().version().get("spdlog"); } bool spdlog::prebuilt() @@ -21,7 +21,7 @@ bool spdlog::prebuilt() fs::path spdlog::source_path() { - return conf().paths().build() / ("spdlog-" + version()); + return conf().path().build() / ("spdlog-" + version()); } void spdlog::do_clean(clean c) diff --git a/src/tasks/stylesheets.cpp b/src/tasks/stylesheets.cpp index a784c11..8dd071f 100644 --- a/src/tasks/stylesheets.cpp +++ b/src/tasks/stylesheets.cpp @@ -16,22 +16,22 @@ std::string stylesheets::version() std::string stylesheets::paper_lad_6788_version() { - return conf::version_by_name("ss_paper_lad_6788"); + return conf().version().get("ss_paper_lad_6788"); } std::string stylesheets::paper_automata_6788_version() { - return conf::version_by_name("ss_paper_automata_6788"); + return conf().version().get("ss_paper_automata_6788"); } std::string stylesheets::paper_mono_6788_version() { - return conf::version_by_name("ss_paper_mono_6788"); + return conf().version().get("ss_paper_mono_6788"); } std::string stylesheets::dark_mode_1809_6788_version() { - return conf::version_by_name("ss_dark_mode_1809_6788"); + return conf().version().get("ss_dark_mode_1809_6788"); } @@ -87,7 +87,7 @@ void stylesheets::do_fetch() fs::path stylesheets::release_build_path(const release& r) const { - return conf().paths().build() / (r.name + "-v" + r.version); + return conf().path().build() / (r.name + "-v" + r.version); } downloader stylesheets::make_downloader_tool( @@ -101,7 +101,7 @@ downloader stylesheets::make_downloader_tool( return std::move(downloader(o) .url(u) - .file(conf().paths().cache() / (r.name + ".7z"))); + .file(conf().path().cache() / (r.name + ".7z"))); } void stylesheets::do_build_and_install() @@ -111,11 +111,11 @@ void stylesheets::do_build_and_install() for (auto&& r : releases()) { const fs::path src = - conf().paths().build() / (r.name + "-v" + r.version); + conf().path().build() / (r.name + "-v" + r.version); op::copy_glob_to_dir_if_better(cx(), src / "*", - conf().paths().install_stylesheets(), + conf().path().install_stylesheets(), op::copy_files|op::copy_dirs); } }); diff --git a/src/tasks/translations.cpp b/src/tasks/translations.cpp index b92adb1..ef1499e 100644 --- a/src/tasks/translations.cpp +++ b/src/tasks/translations.cpp @@ -159,7 +159,7 @@ std::string translations::version() fs::path translations::source_path() { - return conf().paths().build() / "transifex-translations"; + return conf().path().build() / "transifex-translations"; } void translations::do_clean(clean c) @@ -173,7 +173,7 @@ void translations::do_clean(clean c) { op::delete_file_glob( cx(), - conf().paths().install_translations() / "*.qm", + conf().path().install_translations() / "*.qm", op::optional); } }); @@ -235,7 +235,7 @@ void translations::do_build_and_install() instrument([&] { const auto root = source_path() / "translations"; - const auto dest = conf().paths().install_translations(); + const auto dest = conf().path().install_translations(); const projects ps(root); op::create_directories(cx(), dest); diff --git a/src/tasks/usvfs.cpp b/src/tasks/usvfs.cpp index 4015154..f9b0650 100644 --- a/src/tasks/usvfs.cpp +++ b/src/tasks/usvfs.cpp @@ -11,7 +11,7 @@ usvfs::usvfs() std::string usvfs::version() { - return conf::version_by_name("usvfs"); + return conf().version().get("usvfs"); } bool usvfs::prebuilt() @@ -21,7 +21,7 @@ bool usvfs::prebuilt() fs::path usvfs::source_path() { - return conf().paths().build() / "usvfs"; + return conf().path().build() / "usvfs"; } void usvfs::do_clean(clean c) @@ -140,26 +140,26 @@ void usvfs::download_from_appveyor(arch a) void usvfs::copy_prebuilt(arch a) { const std::string dir = prebuilt_directory_name(a); - const auto paths = conf().paths(); + const auto path = conf().path(); op::copy_glob_to_dir_if_better(cx(), - paths.build() / dir / "*.pdb", - paths.install_pdbs(), + path.build() / dir / "*.pdb", + path.install_pdbs(), op::copy_files); op::copy_glob_to_dir_if_better(cx(), - paths.build() / dir / "*.lib", - paths.install_libs(), + path.build() / dir / "*.lib", + path.install_libs(), op::copy_files); op::copy_glob_to_dir_if_better(cx(), - paths.build() / dir / "*.dll", - paths.install_bin(), + path.build() / dir / "*.dll", + path.install_bin(), op::copy_files); op::copy_glob_to_dir_if_better(cx(), - paths.build() / dir / "*.exe", - paths.install_bin(), + path.build() / dir / "*.exe", + path.install_bin(), op::copy_files); } @@ -209,7 +209,7 @@ usvfs::create_appveyor_downloaders(arch a, downloader::ops o) const auto dl = std::make_shared(o); dl->url(u); - dl->file(conf().paths().build() / dir / u.filename()); + dl->file(conf().path().build() / dir / u.filename()); return dl; }; diff --git a/src/tasks/zlib.cpp b/src/tasks/zlib.cpp index cb136c3..8ccba27 100644 --- a/src/tasks/zlib.cpp +++ b/src/tasks/zlib.cpp @@ -11,7 +11,7 @@ zlib::zlib() std::string zlib::version() { - return conf::version_by_name("zlib"); + return conf().version().get("zlib"); } bool zlib::prebuilt() @@ -21,7 +21,7 @@ bool zlib::prebuilt() fs::path zlib::source_path() { - return conf().paths().build() / ("zlib-" + version()); + return conf().path().build() / ("zlib-" + version()); } void zlib::do_clean(clean c) diff --git a/src/tools/downloader.cpp b/src/tools/downloader.cpp index 2bced39..51666ac 100644 --- a/src/tools/downloader.cpp +++ b/src/tools/downloader.cpp @@ -183,7 +183,7 @@ fs::path downloader::path_for_url(const mob::url& u) const filename = u.filename(); } - return conf().paths().cache() / filename; + return conf().path().cache() / filename; } } // namespace diff --git a/src/tools/git.cpp b/src/tools/git.cpp index 6189510..2201b5f 100644 --- a/src/tools/git.cpp +++ b/src/tools/git.cpp @@ -21,7 +21,7 @@ void git::delete_directory(const context& cx, const fs::path& p) git g(no_op); g.root(p); - if (!conf::ignore_uncommitted()) + if (!conf().global().ignore_uncommitted()) { if (g.has_uncommitted_changes()) { diff --git a/src/tools/patcher.cpp b/src/tools/patcher.cpp index ba638f5..dffbff8 100644 --- a/src/tools/patcher.cpp +++ b/src/tools/patcher.cpp @@ -37,7 +37,7 @@ patcher& patcher::root(const fs::path& dir) void patcher::do_run() { - const fs::path patches_root = conf().paths().patches() / task_; + const fs::path patches_root = conf().path().patches() / task_; if (!fs::exists(patches_root)) { diff --git a/src/tools/tools.cpp b/src/tools/tools.cpp index ae1dfd9..51910db 100644 --- a/src/tools/tools.cpp +++ b/src/tools/tools.cpp @@ -83,22 +83,22 @@ fs::path nasm::binary() fs::path qt::installation_path() { - return conf().paths().qt_install(); + return conf().path().qt_install(); } fs::path qt::bin_path() { - return conf().paths().get("qt_bin"); + return conf().path().get("qt_bin"); } std::string qt::version() { - return conf::version_by_name("qt"); + return conf().version().get("qt"); } std::string qt::vs_version() { - return conf::version_by_name("qt_vs"); + return conf().version().get("qt_vs"); } @@ -114,7 +114,7 @@ fs::path vs::devenv_binary() fs::path vs::installation_path() { - return conf().paths().get("vs"); + return conf().path().get("vs"); } fs::path vs::vswhere() @@ -129,22 +129,22 @@ fs::path vs::vcvars() std::string vs::version() { - return conf::version_by_name("vs"); + return conf().version().get("vs"); } std::string vs::year() { - return conf::version_by_name("vs_year"); + return conf().version().get("vs_year"); } std::string vs::toolset() { - return conf::version_by_name("vs_toolset"); + return conf().version().get("vs_toolset"); } std::string vs::sdk() { - return conf::version_by_name("sdk"); + return conf().version().get("sdk"); } vs& vs::solution(const fs::path& sln) @@ -404,7 +404,7 @@ void pip::do_download() .arg("download") .arg("--no-binary=:all:") .arg("--no-deps") - .arg("-d", conf().paths().cache()) + .arg("-d", conf().path().cache()) .arg(package_ + "==" + version_) .env(this_env::get() .set("PYTHONUTF8", "1")));