From 00470188232707af1a8320b1a6d5363f76ff0a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Leduc?= Date: Mon, 7 Oct 2024 11:18:13 +0200 Subject: [PATCH 1/9] fix(conan) : fix conan option prefixed by dependency in conan v2 update version t 1.10.1 --- remaken.pro | 2 +- src/tools/ConanSystemTool.cpp | 32 +++++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/remaken.pro b/remaken.pro index 281a549..e848d2e 100755 --- a/remaken.pro +++ b/remaken.pro @@ -1,5 +1,5 @@ TARGET = remaken -VERSION=1.10.0 +VERSION=1.10.1 CONFIG += c++1z CONFIG += console diff --git a/src/tools/ConanSystemTool.cpp b/src/tools/ConanSystemTool.cpp index 1bfcb5c..34b03b0 100755 --- a/src/tools/ConanSystemTool.cpp +++ b/src/tools/ConanSystemTool.cpp @@ -191,7 +191,13 @@ void ConanSystemTool::install(const Dependency & dependency) std::string conanOptionPrefix = optionInfos.front(); optionInfos.erase(optionInfos.begin()); if (optionInfos.empty()) { - optionsArgs.push_back("-o " + option); + if (m_conanVersion >= 2) { + optionsArgs.push_back("-o " + dependency.getName() + "/*:" + option); + } + else + { + optionsArgs.push_back("-o " + option); // conan v1 + } } else { if (conanOptionPrefix.find(separator) != std::string::npos) { optionsArgs.push_back("-o " + conanOptionPrefix + ":" + optionInfos.front()); @@ -226,11 +232,16 @@ void ConanSystemTool::install(const Dependency & dependency) result = bp::system(command.c_str()); } else { - std::string buildMode = "shared=True"; + std::string buildMode = ""; + if (m_conanVersion >= 2) { + buildMode = dependency.getName() + "/*:"; + } if (dependency.getMode() == "static") { - buildMode = "shared=False"; + buildMode += "shared=False"; + } + else { + buildMode += "shared=True"; } - std::string command = m_systemInstallerPath.generic_string(utf8) + " install " + "-o " + buildMode + " " + boost::algorithm::join(settingsArgs, " ") + " -s " + buildType + " -s " + cppStd + " -pr " + profileName + " " + buildForceDep + " " + boost::algorithm::join(optionsArgs, " ") + " " + source; if (m_options.getVerbose()) { std::cout << command.c_str() << std::endl; @@ -690,7 +701,12 @@ std::vector ConanSystemTool::retrievePaths(const Dependency & dependen if (dependency.hasOptions()) { boost::split(options, dependency.getToolOptions(), [](char c){return c == '#';}); for (const auto & option: options) { - optionsArgs.push_back("-o " + option); + if (m_conanVersion >= 2) { + optionsArgs.push_back("-o " + dependency.getName() + "/*:" + option); + } + else { + optionsArgs.push_back("-o " + option); + } } } std::string profileName = m_options.getConanProfile(); @@ -717,7 +733,7 @@ std::vector ConanSystemTool::retrievePaths(const Dependency & dependen } } else { - std::string buildMode = "";//dependency.getName() + ":"; + std::string buildMode = ""; if (dependency.getMode() == "static") { buildMode += "shared=False"; } @@ -769,11 +785,10 @@ std::vector ConanSystemTool::retrievePaths(const Dependency & dependen if (m_options.getVerbose()) { std::cout << command.c_str() << std::endl; } - // SLETODO : issue with : bp::std_out > bp::null => use std::system (ok with it) result = std::system(command.c_str()); } else { - std::string buildMode = "";//dependency.getName() + ":"; + std::string buildMode = dependency.getName() + "/*:"; if (dependency.getMode() == "static") { buildMode += "shared=False"; } @@ -787,7 +802,6 @@ std::vector ConanSystemTool::retrievePaths(const Dependency & dependen if (m_options.getVerbose()) { std::cout << command.c_str() << std::endl; } - // SLETODO : issue with redirect : bp::std_out > bp::null => use std::system (ok with it) result = std::system(command.c_str()); } if (result != 0) { From eff9868d7da2e5914f3b69078b87e9cb000be750 Mon Sep 17 00:00:00 2001 From: Stephane Leduc Date: Mon, 7 Oct 2024 11:36:55 +0200 Subject: [PATCH 2/9] version(CD): update version 1.10.1 --- .github/workflows/remaken-actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/remaken-actions.yml b/.github/workflows/remaken-actions.yml index ac4af0c..27419c6 100644 --- a/.github/workflows/remaken-actions.yml +++ b/.github/workflows/remaken-actions.yml @@ -10,7 +10,7 @@ on: - '[0-9]+\.[0-9]+\.[0-9]+' env: - tag_version: ${{ github.ref_name == 'develop' && '1.10.0' || github.ref_name }} + tag_version: ${{ github.ref_name == 'develop' && '1.10.1' || github.ref_name }} jobs: windows-ci: From 0162a0cec0b5117bcbcc928b451d9c2ad2080ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Leduc?= Date: Tue, 8 Oct 2024 08:55:36 +0200 Subject: [PATCH 3/9] fix: get home path from /home/sleduc in first on linux --- src/CmdOptions.cpp | 6 +++--- src/commands/InitCommand.cpp | 10 +++++----- src/utils/PathBuilder.cpp | 28 ++++++++++++++++++---------- src/utils/PathBuilder.h | 4 ++-- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/CmdOptions.cpp b/src/CmdOptions.cpp index 17d84fc..2b73c54 100755 --- a/src/CmdOptions.cpp +++ b/src/CmdOptions.cpp @@ -121,7 +121,7 @@ std::string CmdOptions::getOptionString(const std::string & optionName) CmdOptions::CmdOptions() { fs::detail::utf8_codecvt_facet utf8; - fs::path remakenRootPath = PathBuilder::getHomePath() / Constants::REMAKEN_FOLDER; + fs::path remakenRootPath = PathBuilder::getHomePath(*this) / Constants::REMAKEN_FOLDER; remakenRootPath /= "packages"; char * rootDirectoryVar = getenv(Constants::REMAKENPKGROOT); if (rootDirectoryVar != nullptr) { @@ -144,7 +144,7 @@ CmdOptions::CmdOptions() remakenRootPath = pkgPath; } - fs::path remakenProfileFolder = PathBuilder::getHomePath() / Constants::REMAKEN_FOLDER / Constants::REMAKEN_PROFILES_FOLDER ; + fs::path remakenProfileFolder = PathBuilder::getHomePath(*this) / Constants::REMAKEN_FOLDER / Constants::REMAKEN_PROFILES_FOLDER ; std::string profileName = "default"; m_cliApp.require_subcommand(1); m_cliApp.fallthrough(true); @@ -537,7 +537,7 @@ CmdOptions::OptionResult CmdOptions::parseArguments(int argc, char** argv) void CmdOptions::writeConfigurationFile() const { fs::detail::utf8_codecvt_facet utf8; - fs::path remakenRootPath = PathBuilder::getHomePath() / Constants::REMAKEN_FOLDER; + fs::path remakenRootPath = PathBuilder::getHomePath(*this) / Constants::REMAKEN_FOLDER; fs::path remakenProfilesPath = remakenRootPath / Constants::REMAKEN_PROFILES_FOLDER; if (!fs::exists(remakenProfilesPath)) { fs::create_directories(remakenProfilesPath); diff --git a/src/commands/InitCommand.cpp b/src/commands/InitCommand.cpp index c8c0aff..5e9916a 100755 --- a/src/commands/InitCommand.cpp +++ b/src/commands/InitCommand.cpp @@ -67,7 +67,7 @@ int setupBrew() int setupArtifactPackager(const CmdOptions & options) { - fs::path remakenRootPath = PathBuilder::getHomePath() / Constants::REMAKEN_FOLDER; + fs::path remakenRootPath = PathBuilder::getHomePath(options) / Constants::REMAKEN_FOLDER; fs::path remakenScriptsPath = remakenRootPath / "scripts"; if (!fs::exists(remakenScriptsPath)) { @@ -99,13 +99,13 @@ int setupArtifactPackager(const CmdOptions & options) return 0; } -int setupWizards(const fs::path & rulesPath) +int setupWizards(const fs::path & rulesPath, const CmdOptions & options) { BOOST_LOG_TRIVIAL(info)<<"Installing qt creator wizards"; #ifdef BOOST_OS_WINDOWS_AVAILABLE fs::path qtWizardsPath = PathBuilder::getUTF8PathObserver(getenv("APPDATA")); #else - fs::path qtWizardsPath = PathBuilder::getHomePath()/".config"; + fs::path qtWizardsPath = PathBuilder::getHomePath(options)/".config"; #endif qtWizardsPath /= "QtProject"; qtWizardsPath /= "qtcreator"; @@ -150,7 +150,7 @@ int InitCommand::execute() } // process init command - fs::path remakenRootPath = PathBuilder::getHomePath() / Constants::REMAKEN_FOLDER; + fs::path remakenRootPath = PathBuilder::getHomePath(m_options) / Constants::REMAKEN_FOLDER; fs::path remakenRulesPath = remakenRootPath / "rules"; fs::path remakenProfilesPath = remakenRootPath / Constants::REMAKEN_PROFILES_FOLDER; fs::path qmakeRootPath = remakenRulesPath / "qmake"; @@ -188,7 +188,7 @@ int InitCommand::execute() } if (m_options.installWizards() || subCommand == "wizards") { - setupWizards(qmakeRootPath); + setupWizards(qmakeRootPath, m_options); } return 0; } diff --git a/src/utils/PathBuilder.cpp b/src/utils/PathBuilder.cpp index 8b8ad4f..631689a 100755 --- a/src/utils/PathBuilder.cpp +++ b/src/utils/PathBuilder.cpp @@ -24,6 +24,7 @@ #include #include #include "Constants.h" +#include #ifdef WIN32 #include @@ -113,7 +114,7 @@ fs::path PathBuilder::buildModuleFilePath(const std::string & moduleName, const return filePath; } -fs::path PathBuilder::getHomePath() +fs::path PathBuilder::getHomePath(const CmdOptions & options) { char * homePathStr; fs::path homePath; @@ -129,23 +130,30 @@ fs::path PathBuilder::getHomePath() else { homePath = getUTF8PathObserver(homePathStr); } -#else - struct passwd* pwd = getpwuid(getuid()); - if (pwd) { - homePathStr = pwd->pw_dir; +#else \ + // try first with the $HOME environment variable + homePathStr = getenv("HOME"); + if (homePathStr == NULL) + { + struct passwd* pwd = getpwuid(getuid()); + if (pwd) { + homePathStr = pwd->pw_dir; + if (options.getVerbose()) { + BOOST_LOG_TRIVIAL(info)<<"remaken getHomePath with getpwuid(getuid()) method "< Date: Thu, 10 Oct 2024 15:02:15 +0200 Subject: [PATCH 4/9] chore(.gitmodules): update CLI11 submodule url (from b-com-software-basis) --- .gitmodules | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index f726986..5bc2981 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,4 +6,5 @@ url = https://github.com/nlohmann/json.git [submodule "libs/CLI11"] path = libs/CLI11 -url=https://github.com/Firefly35/CLI11.git +url=https://github.com/b-com-software-basis/CLI11.git + From cc173e51b48c3ce7c6f7fa6e86370add17304ed7 Mon Sep 17 00:00:00 2001 From: Stephane Leduc Date: Thu, 10 Oct 2024 15:57:56 +0200 Subject: [PATCH 5/9] update CLI11 submodule version (fix of config folder) --- libs/CLI11 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/CLI11 b/libs/CLI11 index cb113f8..d7020d0 160000 --- a/libs/CLI11 +++ b/libs/CLI11 @@ -1 +1 @@ -Subproject commit cb113f8a2cace3fd85fdf7489dffe54701ab7b62 +Subproject commit d7020d0869847a09d877bf793baee6f8033cb4af From c3f13c5c0f5180587c387dc62a2ad4c85cda45f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Leduc?= Date: Mon, 14 Oct 2024 14:33:42 +0200 Subject: [PATCH 6/9] fix: disable log in CmdOptions.cpp --- src/CmdOptions.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/CmdOptions.cpp b/src/CmdOptions.cpp index 2b73c54..c4230a7 100755 --- a/src/CmdOptions.cpp +++ b/src/CmdOptions.cpp @@ -149,7 +149,9 @@ CmdOptions::CmdOptions() m_cliApp.require_subcommand(1); m_cliApp.fallthrough(true); m_cliApp.option_defaults()->always_capture_default(); - m_cliApp.set_config("--profile",profileName,"remaken profile file to read",remakenProfileFolder.generic_string(utf8)); + m_cliApp.set_config("--profile",profileName,"remaken profile file to read",remakenProfileFolder.generic_string(utf8), false); + std::cout << "remakenProfileFolder :"<< remakenProfileFolder.generic_string(utf8) << std::endl << "remaken profile name:" << profileName << std::endl; + m_config = "release"; m_cliApp.add_option("--config,-c", m_config, "Config: " + getOptionString("--config")); // ,true); @@ -539,14 +541,20 @@ void CmdOptions::writeConfigurationFile() const fs::detail::utf8_codecvt_facet utf8; fs::path remakenRootPath = PathBuilder::getHomePath(*this) / Constants::REMAKEN_FOLDER; fs::path remakenProfilesPath = remakenRootPath / Constants::REMAKEN_PROFILES_FOLDER; + std::cout << "write remakenProfilesPath "<< remakenProfilesPath.generic_string(utf8) << std::endl; + if (!fs::exists(remakenProfilesPath)) { + fs::create_directories(remakenProfilesPath); } fs::path remakenProfilePath = remakenProfilesPath/m_profileName; ofstream fos; fos.open(remakenProfilePath.generic_string(utf8),ios::out|ios::trunc); // workaround for CLI11 issue #648 and also waiting for issue #685 + std::string conf = m_cliApp.config_to_str(m_defaultProfileOptions,true); + std::cout<<"write conf file:" << remakenProfilePath.generic_string(utf8) << std::endl ; + std::cout<<"write conf:" << std::endl << conf << std::endl << "-----------------------"<< std::endl ; // comment all run arguments, as run command doesn't need to maintain options in configuration boost::replace_all(conf,"run.","#run."); fos< Date: Mon, 14 Oct 2024 14:34:32 +0200 Subject: [PATCH 7/9] fix(conan): fix conan option with conan v2 --- src/tools/ConanSystemTool.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tools/ConanSystemTool.cpp b/src/tools/ConanSystemTool.cpp index 34b03b0..d46dede 100755 --- a/src/tools/ConanSystemTool.cpp +++ b/src/tools/ConanSystemTool.cpp @@ -180,10 +180,6 @@ void ConanSystemTool::install(const Dependency & dependency) settingsArgs.push_back("arch=" + conanArchTranslationMap.at(m_options.getArchitecture())); } if (dependency.hasOptions()) { - std::string separator = ""; - if (m_conanVersion >= 2) { - separator = "/*"; - } boost::split(options, dependency.getToolOptions(), [](char c){return c == '#';}); for (const auto & option: options) { std::vector optionInfos; @@ -192,13 +188,17 @@ void ConanSystemTool::install(const Dependency & dependency) optionInfos.erase(optionInfos.begin()); if (optionInfos.empty()) { if (m_conanVersion >= 2) { - optionsArgs.push_back("-o " + dependency.getName() + "/*:" + option); + optionsArgs.push_back("-o *:" + option); } else { optionsArgs.push_back("-o " + option); // conan v1 } } else { + std::string separator = ""; + if (m_conanVersion >= 2) { + separator = "/*"; + } if (conanOptionPrefix.find(separator) != std::string::npos) { optionsArgs.push_back("-o " + conanOptionPrefix + ":" + optionInfos.front()); } else { @@ -702,7 +702,7 @@ std::vector ConanSystemTool::retrievePaths(const Dependency & dependen boost::split(options, dependency.getToolOptions(), [](char c){return c == '#';}); for (const auto & option: options) { if (m_conanVersion >= 2) { - optionsArgs.push_back("-o " + dependency.getName() + "/*:" + option); + optionsArgs.push_back("-o *:" + option); } else { optionsArgs.push_back("-o " + option); From 8eb54ff787dfd5ccbd26024037ec5366df6d368d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Leduc?= Date: Mon, 14 Oct 2024 15:38:45 +0200 Subject: [PATCH 8/9] fix: disable log in CmdOptions.cpp --- src/CmdOptions.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/CmdOptions.cpp b/src/CmdOptions.cpp index c4230a7..606da4b 100755 --- a/src/CmdOptions.cpp +++ b/src/CmdOptions.cpp @@ -150,9 +150,7 @@ CmdOptions::CmdOptions() m_cliApp.fallthrough(true); m_cliApp.option_defaults()->always_capture_default(); m_cliApp.set_config("--profile",profileName,"remaken profile file to read",remakenProfileFolder.generic_string(utf8), false); - std::cout << "remakenProfileFolder :"<< remakenProfileFolder.generic_string(utf8) << std::endl << "remaken profile name:" << profileName << std::endl; - - + m_config = "release"; m_cliApp.add_option("--config,-c", m_config, "Config: " + getOptionString("--config")); // ,true); m_cppVersion = "11"; @@ -541,8 +539,7 @@ void CmdOptions::writeConfigurationFile() const fs::detail::utf8_codecvt_facet utf8; fs::path remakenRootPath = PathBuilder::getHomePath(*this) / Constants::REMAKEN_FOLDER; fs::path remakenProfilesPath = remakenRootPath / Constants::REMAKEN_PROFILES_FOLDER; - std::cout << "write remakenProfilesPath "<< remakenProfilesPath.generic_string(utf8) << std::endl; - + if (!fs::exists(remakenProfilesPath)) { fs::create_directories(remakenProfilesPath); @@ -553,8 +550,6 @@ void CmdOptions::writeConfigurationFile() const // workaround for CLI11 issue #648 and also waiting for issue #685 std::string conf = m_cliApp.config_to_str(m_defaultProfileOptions,true); - std::cout<<"write conf file:" << remakenProfilePath.generic_string(utf8) << std::endl ; - std::cout<<"write conf:" << std::endl << conf << std::endl << "-----------------------"<< std::endl ; // comment all run arguments, as run command doesn't need to maintain options in configuration boost::replace_all(conf,"run.","#run."); fos< Date: Mon, 4 Nov 2024 14:31:45 +0100 Subject: [PATCH 9/9] set default qmake tag to 4.12.0 for init command --- src/Constants.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Constants.h b/src/Constants.h index 966dd46..a0aa084 100755 --- a/src/Constants.h +++ b/src/Constants.h @@ -36,7 +36,7 @@ class Constants { static constexpr const char * REMAKEN_PROFILES_FOLDER = "profiles"; static constexpr const char * REMAKEN_CACHE_FILE = ".remaken-cache"; static constexpr const char * ARTIFACTORY_API_KEY = "artifactoryApiKey"; - static constexpr const char * QMAKE_RULES_DEFAULT_TAG = "4.10.0"; + static constexpr const char * QMAKE_RULES_DEFAULT_TAG = "4.12.0"; static constexpr const char * PKGINFO_FOLDER = ".pkginfo"; static constexpr const char * VCPKG_REPOURL = "https://github.com/microsoft/vcpkg"; static constexpr const char * EXTRA_DEPS = "extra-packages.txt";