Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephane Leduc committed Nov 4, 2024
2 parents 48a0d8a + 8768699 commit 9206b52
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/remaken-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 1 addition & 1 deletion libs/CLI11
Submodule CLI11 updated 1 files
+1 −1 include/CLI/App.hpp
2 changes: 1 addition & 1 deletion remaken.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TARGET = remaken
VERSION=1.10.0
VERSION=1.10.1

CONFIG += c++1z
CONFIG += console
Expand Down
15 changes: 9 additions & 6 deletions src/CmdOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -144,13 +144,13 @@ 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);
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);
m_config = "release";
m_cliApp.add_option("--config,-c", m_config, "Config: " + getOptionString("--config")); // ,true);
m_cppVersion = "11";
Expand Down Expand Up @@ -537,15 +537,18 @@ 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);
}
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);
// comment all run arguments, as run command doesn't need to maintain options in configuration
boost::replace_all(conf,"run.","#run.");
Expand All @@ -555,7 +558,7 @@ void CmdOptions::writeConfigurationFile() const

void CmdOptions::displayConfigurationSettings() const
{
std::cout<<m_cliApp.config_to_str(m_defaultProfileOptions,true);
std::cout<<m_cliApp.config_to_str(m_defaultProfileOptions,true)<< std::endl;
}

void CmdOptions::printUsage()
Expand Down
2 changes: 1 addition & 1 deletion src/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
10 changes: 5 additions & 5 deletions src/commands/InitCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -188,7 +188,7 @@ int InitCommand::execute()
}

if (m_options.installWizards() || subCommand == "wizards") {
setupWizards(qmakeRootPath);
setupWizards(qmakeRootPath, m_options);
}
return 0;
}
40 changes: 27 additions & 13 deletions src/tools/ConanSystemTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,25 @@ 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<std::string> optionInfos;
boost::split(optionInfos, option, [](char c){return c == ':';});
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 *:" + 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 {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -690,7 +701,12 @@ std::vector<fs::path> 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 *:" + option);
}
else {
optionsArgs.push_back("-o " + option);
}
}
}
std::string profileName = m_options.getConanProfile();
Expand All @@ -717,7 +733,7 @@ std::vector<fs::path> ConanSystemTool::retrievePaths(const Dependency & dependen
}
}
else {
std::string buildMode = "";//dependency.getName() + ":";
std::string buildMode = "";
if (dependency.getMode() == "static") {
buildMode += "shared=False";
}
Expand Down Expand Up @@ -769,11 +785,10 @@ std::vector<fs::path> 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";
}
Expand All @@ -787,7 +802,6 @@ std::vector<fs::path> 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) {
Expand Down
28 changes: 18 additions & 10 deletions src/utils/PathBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <boost/filesystem/detail/utf8_codecvt_facet.hpp>
#include <boost/predef/os.h>
#include "Constants.h"
#include <boost/log/trivial.hpp>

#ifdef WIN32
#include <stdlib.h>
Expand Down Expand Up @@ -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;
Expand All @@ -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 "<<homePathStr;
}
}
}
else {
// try the $HOME environment variable
homePathStr = getenv("HOME");
if (options.getVerbose()) {
BOOST_LOG_TRIVIAL(info)<<"remaken getHomePath "<<homePathStr;
}
homePath = getUTF8PathObserver(homePathStr);
#endif
return homePath;
}

fs::path PathBuilder::getXPCFHomePath()
fs::path PathBuilder::getXPCFHomePath(const CmdOptions & options)
{
fs::path xpcfHomePath = getHomePath();
fs::path xpcfHomePath = getHomePath(options);
xpcfHomePath /= ".xpcf";
return xpcfHomePath;
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/PathBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class PathBuilder
static fs::path replaceRootEnvVars(const std::string & sourcePath, const CmdOptions & options);
static fs::path buildModuleFilePath(const std::string & moduleName,const std::string & filePath, const CmdOptions & options);
static fs::path buildModuleFolderPath(const std::string & filePath, const CmdOptions & options);
static fs::path getHomePath();
static fs::path getXPCFHomePath();
static fs::path getHomePath(const CmdOptions & options);
static fs::path getXPCFHomePath(const CmdOptions & options);
static fs::path appendModuleDecorations(const fs::path & sl);
static fs::path appendModuleDecorations(const char * sl);
static inline bool is_shared_library(const std::string& s) {
Expand Down

0 comments on commit 9206b52

Please sign in to comment.