From 33ac57fb6a452d027d3036e79e633bbb869c6ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Fri, 12 Jul 2024 12:55:26 +0200 Subject: [PATCH] Remove gamebryo and nuget specific stuff. --- src/main.cpp | 26 ++-------------- src/tasks/modorganizer.cpp | 29 ++++-------------- src/tasks/tasks.h | 35 +++------------------ src/tasks/translations.cpp | 63 ++------------------------------------ 4 files changed, 15 insertions(+), 138 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ce35867..75d7b9e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -73,29 +73,9 @@ namespace mob { .add_task("modorganizer-nxmhandler") .add_task("modorganizer-helper") .add_task("githubpp") - .add_task("modorganizer-game_gamebryo") .add_task({"modorganizer-bsapacker", "bsa_packer"}) - .add_task("modorganizer-preview_bsa"); - - // the gamebryo flag must be set for all game plugins that inherit from - // the gamebryo classes; this will merge the .ts file from gamebryo with - // the one from the specific plugin - add_task() - .add_task("modorganizer-game_oblivion", mo::gamebryo) - .add_task("modorganizer-game_nehrim", mo::gamebryo) - .add_task("modorganizer-game_fallout3", mo::gamebryo) - .add_task("modorganizer-game_fallout4", mo::gamebryo) - .add_task("modorganizer-game_fallout4vr", mo::gamebryo) - .add_task("modorganizer-game_fallout76", mo::gamebryo) - .add_task("modorganizer-game_falloutnv", mo::gamebryo) - .add_task("modorganizer-game_morrowind", mo::gamebryo) - .add_task("modorganizer-game_skyrim", mo::gamebryo) - .add_task("modorganizer-game_skyrimse", mo::gamebryo) - .add_task("modorganizer-game_skyrimvr", mo::gamebryo) - .add_task("modorganizer-game_starfield", mo::gamebryo) - .add_task("modorganizer-game_ttw", mo::gamebryo) - .add_task("modorganizer-game_enderal", mo::gamebryo) - .add_task("modorganizer-game_enderalse", mo::gamebryo); + .add_task("modorganizer-preview_bsa") + .add_task("modorganizer-game_bethesda"); add_task() .add_task({"modorganizer-tool_inieditor", "inieditor"}) @@ -109,7 +89,7 @@ namespace mob { .add_task("modorganizer-installer_quick") .add_task("modorganizer-installer_fomod") .add_task("modorganizer-installer_fomod_csharp") - .add_task("modorganizer-installer_omod", mo::nuget) + .add_task("modorganizer-installer_omod") .add_task("modorganizer-installer_wizard") .add_task("modorganizer-bsa_extractor") .add_task("modorganizer-plugin_python"); diff --git a/src/tasks/modorganizer.cpp b/src/tasks/modorganizer.cpp index 90f2189..6569b34 100644 --- a/src/tasks/modorganizer.cpp +++ b/src/tasks/modorganizer.cpp @@ -59,18 +59,18 @@ namespace mob::tasks { g.init_repo(); } - modorganizer::modorganizer(std::string long_name, flags f) - : modorganizer(std::vector{long_name}, f) + modorganizer::modorganizer(std::string long_name) + : modorganizer(std::vector{long_name}) { } - modorganizer::modorganizer(std::vector names, flags f) - : modorganizer(std::vector(names.begin(), names.end()), f) + modorganizer::modorganizer(std::vector names) + : modorganizer(std::vector(names.begin(), names.end())) { } - modorganizer::modorganizer(std::vector names, flags f) - : task(make_names(names)), repo_(names[0]), flags_(f) + modorganizer::modorganizer(std::vector names) + : task(make_names(names)), repo_(names[0]) { if (names.size() > 1) { project_ = names[1]; @@ -80,16 +80,6 @@ namespace mob::tasks { } } - bool modorganizer::is_gamebryo_plugin() const - { - return is_set(flags_, gamebryo); - } - - bool modorganizer::is_nuget_plugin() const - { - return is_set(flags_, nuget); - } - fs::path modorganizer::source_path() const { // something like build/modorganizer_super/uibase @@ -187,13 +177,6 @@ namespace mob::tasks { // run cmake run_tool(create_cmake_tool()); - // run restore for nuget - // - // until https://gitlab.kitware.com/cmake/cmake/-/issues/20646 is resolved, - // we need a manual way of running the msbuild -t:restore - if (is_nuget_plugin()) - run_tool(create_msbuild_tool().targets({"restore"})); - // run msbuild run_tool(create_msbuild_tool()); } diff --git a/src/tasks/tasks.h b/src/tasks/tasks.h index 55df177..5aae2ea 100644 --- a/src/tasks/tasks.h +++ b/src/tasks/tasks.h @@ -216,34 +216,13 @@ namespace mob::tasks { cmake::ops o = cmake::generate, config config = config::relwithdebinfo); - // flags for some MO projects - enum flags { - noflags = 0x00, - - // gamebryo project, used by the translations task because these - // projects have multiple .ts files that have to be merged - gamebryo = 0x01, - - // project that uses nuget, cmake doesn't support those right now, so - // `msbuild -t:restore` has to be run manually - nuget = 0x02, - }; - // some mo tasks have more than one name, mostly because the transifex slugs // are different than the names on github; the std::string and const char* // overloads are because they're constructed from initializer lists and it's // more convenient that way - modorganizer(std::string name, flags f = noflags); - modorganizer(std::vector names, flags f = noflags); - modorganizer(std::vector names, flags f = noflags); - - // whether this project has the gamebryo flag on - // - bool is_gamebryo_plugin() const; - - // whether this project has the nuget flag on - // - bool is_nuget_plugin() const; + modorganizer(std::string name); + modorganizer(std::vector names); + modorganizer(std::vector names); // url to the git repo // @@ -271,7 +250,6 @@ namespace mob::tasks { private: std::string repo_; std::string project_; - flags flags_; // creates the cmake tool for this MO project // @@ -623,11 +601,6 @@ namespace mob::tasks { // duplicate warnings std::set warned_; - // whether the given project name is a gamebryo task, `dir` is just for - // logging - // - bool is_gamebryo_plugin(const std::string& dir, const std::string& project); - // parses the directory name, walks all the .ts files, returns a project // object for them // @@ -636,7 +609,7 @@ namespace mob::tasks { // returns a lang object that contains at least the given main_ts_file, // but might contain more if it's a gamebryo plugin // - lang create_lang(bool gamebryo, const std::string& project_name, + lang create_lang(const std::string& project_name, const fs::path& main_ts_file); }; diff --git a/src/tasks/translations.cpp b/src/tasks/translations.cpp index bc29c50..6910b19 100644 --- a/src/tasks/translations.cpp +++ b/src/tasks/translations.cpp @@ -125,9 +125,6 @@ namespace mob::tasks { // walks all the .ts files in the project, creates a `lang` object for // each // - // each project directory is named "mod-organizer-2.project_name", so this - // splits on the dot to get the project name, checks if it's a gamebryo - // plugin, and adds the gamebryo .ts file as well if necessary // splitting const auto dir_name = path_to_utf8(dir.filename()); @@ -150,7 +147,6 @@ namespace mob::tasks { // project project p(project_name); - const bool gamebryo = is_gamebryo_plugin(dir_name, project_name); // for each file for (auto f : fs::directory_iterator(dir)) { @@ -168,14 +164,14 @@ namespace mob::tasks { } // add a new `lang` object for it - p.langs.push_back(create_lang(gamebryo, project_name, f.path())); + p.langs.push_back(create_lang(project_name, f.path())); } return p; } translations::projects::lang - translations::projects::create_lang(bool gamebryo, const std::string& project_name, + translations::projects::create_lang(const std::string& project_name, const fs::path& main_ts_file) { lang lg(path_to_utf8(main_ts_file.stem())); @@ -183,64 +179,9 @@ namespace mob::tasks { // every lang has the .ts file from the project, gamebryo plugins have more lg.ts_files.push_back(main_ts_file); - if (gamebryo) { - // this is a gamebryo plugin, so it needs the gamebryo .ts file as well, - // find it - - // the .ts files for gamebryo are in mod-organizer-2.game_gamebryo/ - const fs::path gamebryo_dir = - conf().transifex().get("project") + "." + "game_gamebryo"; - - // the .ts file has the same name, it's just "lang.ts" - const auto gamebryo_ts = root_ / gamebryo_dir / main_ts_file.filename(); - - if (fs::exists(gamebryo_ts)) { - // found, add it - lg.ts_files.push_back(gamebryo_ts); - } - else { - // not found, that means the plugin was translated into a language, - // but the gamebryo project wasn't; warn once - if (!warned_.contains(gamebryo_ts)) { - warned_.insert(gamebryo_ts); - - warnings_.push_back(::std::format( - "{} is a gamebryo plugin but there is no '{}'; the " - ".qm file will be missing some translations (will " - "only warn once)", - project_name, path_to_utf8(gamebryo_ts))); - } - } - } - return lg; } - bool translations::projects::is_gamebryo_plugin(const std::string& dir, - const std::string& project) - { - const auto* t = task_manager::instance().find_one(project); - - if (!t) { - warnings_.push_back( - ::std::format("directory '{}' was parsed as project '{}', but there's " - "no task with this name", - dir, project)); - - return false; - } - - // gamebryo plugins are all `modorganizer` tasks - const auto* mo_task = static_cast(t); - if (!mo_task) { - // not an mo task, can't be a gamebryo plugin - return false; - } - - // check the flag - return mo_task->is_gamebryo_plugin(); - } - translations::translations() : task("translations") {} fs::path translations::source_path()